Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Text Positioning??

Author
Message
Lee Stevens
19
Years of Service
User Offline
Joined: 19th Apr 2007
Location: Deep in code...
Posted: 30th Sep 2010 19:08
Hey guys, I'm messing around with code trying to get something to work, ( I don't have code to show).
I have my Variables, Health, Level, XP and how many enemy's you've killed.

I want 'Level' in the top left corner, just below it we have 'XP' and below that we have 'Health'.
In the bottom right hand corner I want '[ammount of enems killed here] Enemys Killed'.
I want it using the screed width, and screen height commands? I've tried using them and i'm not sure if im doing it right, Any help would be muchly appreciated.

If There Is A Problem, Find The Question.
Lee Stevens 1st September 2007
Devonps
16
Years of Service
User Offline
Joined: 5th Nov 2009
Location: Nottingham
Posted: 30th Sep 2010 19:20
Is this on a 2d or 3d screen?

Do you want to use TEXT or SPRITEs?

Marriage is a circle of rings....
Engagement ring, Wedding ring, Suffering!
Neco
18
Years of Service
User Offline
Joined: 13th Jul 2008
Location: Waterloo, Wisconsin USA
Posted: 30th Sep 2010 19:45 Edited at: 30th Sep 2010 19:53
If its 2D, look up the Text command in the help file.

Real quick snippet



Would give you a display that says " Health: 100 " in the top left corner.

Lee Stevens
19
Years of Service
User Offline
Joined: 19th Apr 2007
Location: Deep in code...
Posted: 30th Sep 2010 20:39
its a HUD, Level, XP and Enemys killed are TEXT,
Health is a sprite

If There Is A Problem, Find The Question.
Lee Stevens 1st September 2007
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 30th Sep 2010 23:51
You really only need for SCREEN WIDTH() and SCREEN HEIGHT() to center a sprite, image, or text on the screen or if you want to grab the entire screen.

Now if you want to have multiple resolutions that the user can change at will then yes, use those commands to calculate where everything goes on the screen. But again if you have only one resolution there's no need to use SCREEN WIDTH() and SCREEN HEIGHT() at all because once you know the x and y coordinates where you want everything there's no need for calculations.



When you run the above code snip change the resolution to anything you want and it'll always show the boxes in each corner and in the center.

Neco
18
Years of Service
User Offline
Joined: 13th Jul 2008
Location: Waterloo, Wisconsin USA
Posted: 1st Oct 2010 03:12
That's a nice bit of code Grog. I've been wondering how I would tackle any kind of User Interface that could adapt to different resolutions.

Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 1st Oct 2010 04:38
Quote: "That's a nice bit of code Grog."


Thank you. Hey, hows your Text RPG coming?

Neco
18
Years of Service
User Offline
Joined: 13th Jul 2008
Location: Waterloo, Wisconsin USA
Posted: 1st Oct 2010 16:23
Kind of stuck in a rut with that

I'm about to start rebuilding my room printing function to account for colors I want to add, and also to see if I can remove some of the overhead with ideas discussed in my thread. Haven't quite decided how I want to do the colors yet also.

Also been side tracked with the Room object itself, and how I want to handle "special" exits and how I want to store that data(How to include multiple Door exits if I want, and stuff like that).. Still agonizing over the storage method and way I want to address the rooms.. But shouldn't clutter this thread up with that stuff

Although temporarily I used IanM's array saving/loading tool and that was rather easy.

Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 1st Oct 2010 18:22
Quote: "Kind of stuck in a rut with that"


As you know help is just one message away. But don't feel bad. I started mine a week ago and I'm still working on the engine. I haven't even thought about the actual adventure or even have any room or item data. Maybe in a few days I'll have some rooms to play with.

Login to post a reply

Server time is: 2026-07-23 09:51:33
Your offset time is: 2026-07-23 09:51:33