Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Vanilla

Reply
 
Thread Tools Display Modes
Old December 17, 2013, 21:21   #191
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 9,022
Derakon is on a distinguished road
Hunh, I wouldn't have expected that to be efficient. Interesting. Thanks for describing your approach, anyway. It's possible the Qt front-end for Pyrel would want to steal it.
Derakon is offline   Reply With Quote
Old December 28, 2013, 04:44   #192
nppangband
NPPAngband Maintainer
 
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
nppangband is on a distinguished road
Quote:
Originally Posted by AnonymousHero View Post
The great thing is that it's a really dumb implementation which seems to be performing quite well. The standard QGraphicsScene is (apparently) easily capable of handling thousands of little "items" (as they call them) in a scene(*), so I just create MxN QGraphicsSimpleTextItem-derived instances and (at the window-open event) position them appropriately for the MxN grid. That's all setup, so when I want to write something I just look up the "character" (QGraphicsSimpleTextItem) at the appropriate place and change its "text" and foreground color. After a whole line is "written"/cleared/whatever I just call "invalidate" on the QGraphicsScene on the portion I updated and it takes care of the rest!

Now, there is a caveat which I haven't mentioned and that is that I haven't yet tried the torture-test which is "center on player" and then go running around (mainly due to lack of arrow key handling ), but given that the current implementation is so unbelievably dumb, I'm not expecting much trouble there.

(*) Using all manner of interesting stuff like BSPs for optimizing exactly which items get redrawn on invalidation/re-paint.
Hi Anonymoushero,

I was looking through the QT examples, and I found this:

http://harmattan-dev.nokia.com/docs/...ine-rogue.html

It appears to be just moving around an "@" with direction keys, in a roguelike settings. This code will probably be pretty useful to me soon.

I should post my start to a QT port soon. I am focusing on developing a menubar and toolbars for the game. I haven't actually incorporated any angband code yet. My next step will be to get the port to load the edit files, and close them up on exit.
__________________
NPPAngband current home page: http://nppangband.bitshepherd.net/
Source code repository:
https://github.com/nppangband/NPPAngband_QT
Downloads:
https://app.box.com/s/1x7k65ghsmc31usmj329pb8415n1ux57

Last edited by nppangband; December 28, 2013 at 04:49.
nppangband is offline   Reply With Quote
Old December 28, 2013, 04:53   #193
nppangband
NPPAngband Maintainer
 
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
nppangband is on a distinguished road
Quote:
Originally Posted by Derakon View Post
Hunh, I wouldn't have expected that to be efficient. Interesting. Thanks for describing your approach, anyway. It's possible the Qt front-end for Pyrel would want to steal it.
I am finding QT to be quite well documented. I faced a little learning curve the first couple days, but now that I am getting used to it things are moving along nicely. Plus there are countless examples out there to learn from.

It is amazing that can be done with just a couple lines of code in QT that takes hundreds or thousands of lines in the Angband "game engine".
__________________
NPPAngband current home page: http://nppangband.bitshepherd.net/
Source code repository:
https://github.com/nppangband/NPPAngband_QT
Downloads:
https://app.box.com/s/1x7k65ghsmc31usmj329pb8415n1ux57
nppangband is offline   Reply With Quote
Old December 28, 2013, 05:08   #194
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 9,022
Derakon is on a distinguished road
If you need them, Pyrel has fairly optimized drawing routines that aren't specific to any given front-end library here. This handles issues like:

* Deciding which subset of the map to display (centering on @ but taking map boundaries into account)
* Drawing text, including pairs of left/right-aligned items (e.g. for inventory display: item name on one side, weight on the other)
* Mapping from pixel space to the map grid

The qtPyrel subclass of that class has Qt-specific code for performing drawing operations. Note that window setup is handled by other files.
Derakon is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tales of Maj'Eyal 1.0.0RC1 aka "The Mathematics of Tears" DarkGod ToME 17 December 20, 2012 22:31


All times are GMT +1. The time now is 11:00.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.