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.

Newcomers AppGameKit Corner / How To Print Variable( like "ScreenFPS()" ) Onto Screen At Some Location?

Author
Message
JeZxLee
7
Years of Service
User Offline
Joined: 15th Mar 2017
Location: Long Island, New York, United States, Earth
Posted: 22nd Apr 2017 20:42
Hi,

Just started playing around with my licensed AppGameKit.
I can't figure out how to print a variable onto the screen at a specific location?
I would like to print "ScreenFPS()" on the bottom-left of the screen.
(screen size is 1024x768)

Also how would I outline(with a specific color) the above text?
Thanks!

Jesse
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 23rd Apr 2017 07:49
If you want todo anything more complex than simple printing, look at the text commands - you can set the font, size, colour, position and many other things.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
JeZxLee
7
Years of Service
User Offline
Joined: 15th Mar 2017
Location: Long Island, New York, United States, Earth
Posted: 23rd Apr 2017 12:01
Hi,

OK, but how do I assign a variable like "ScreenFPS()" to " CreateText ( 1, "?" ) " ?
Thanks!

Jesse
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 23rd Apr 2017 17:52
You would need to constantly update it each cycle...

SetTextString(1, str(ScreenFPS()))
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
programming is ace
User Banned
Posted: 23rd Apr 2017 18:14
JeZxLee
7
Years of Service
User Offline
Joined: 15th Mar 2017
Location: Long Island, New York, United States, Earth
Posted: 23rd Apr 2017 18:55
Hi,

I have the following source code which builds & runs OK, but all I get is the white background and no FPS text?
How would I fix it to see black FPS text above white background?
Thanks in advance!

Jesse

programming is ace
User Banned
Posted: 23rd Apr 2017 19:26
For any drawing commands, we need to move them to the front

So Use this command render2dfront() just before sync()

i.e

do
...
...
Render2DFront()
sync()
loop

Ranietz
AGK Gold Backer
20
Years of Service
User Offline
Joined: 2nd Sep 2004
Location: Norway
Posted: 23rd Apr 2017 20:15
If you want a white background you could use SetClearColor(255,255,255) before the main loop instead of using DrawBox() commands.
Like this:

programming is ace
User Banned
Posted: 23rd Apr 2017 20:23
That will only fix one problem,

Render2DFtront will fix all drawing problems

Sorreee.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 23rd Apr 2017 22:09
Quote: "That will only fix one problem,
Render2DFtront will fix all drawing problems
Sorreee."


Render order is not an issue in this case. Text will render in front of 3D by default. Test below:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
programming is ace
User Banned
Posted: 23rd Apr 2017 22:13
Try the

Drawbox
DrawEllipse
DrawLine

functions in the main loop before the sync
programming is ace
User Banned
Posted: 23rd Apr 2017 22:13
Only effected by draw commands
programming is ace
User Banned
Posted: 23rd Apr 2017 22:15
I get the feeling your trying to prove me wrong..


Well try it
programming is ace
User Banned
Posted: 23rd Apr 2017 22:30
Just put Render2dfront() before sync() then your laughing

Hey - if you want to create stuff with draw commands inside your main loop - it will work effortlessly too.

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 24th Apr 2017 08:25 Edited at: 24th Apr 2017 08:25
Quote: "I get the feeling your trying to prove me wrong.."


The original post asked about printing is any place on the screen.
The answer was the Text functions.
The Text functions don't need Render2DFront() as shown is the example I posted.

I'm not trying to prove anybody wrong, I am giving the correct advice to a question.

Quote: "Well try it"


We don't tolerate threats and abuse towards other members here.
And no, you haven't got away with registering under a new name. We know who you are and have given you the opportunity to redeem yourself.
Don't ruin it
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
MikeHart
AGK Bronze Backer
21
Years of Service
User Offline
Joined: 9th Jun 2003
Location:
Posted: 25th Apr 2017 10:50
prgramming is ace = DamonTheGreat
Running Windows 7 Home, 64 bit, 8 GB ram, Athlon II X2 255, ATI Radeon HD 4200. Using AGK2 Tier 1.

Login to post a reply

Server time is: 2024-11-22 15:16:11
Your offset time is: 2024-11-22 15:16:11