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.

AppGameKit Classic Chat / Add text and change background color on SetRenderToImage

Author
Message
CodeTrasher
12
Years of Service
User Offline
Joined: 18th Jul 2012
Location: Tampere, Finland
Posted: 16th Jul 2016 21:22
As the subject says, I want to create an image with text and different background color. I understand the basic idea of rendering to image instead of the screen but I'm a bit confused what drawing commands I can or I'm allowed to use. Do I need to manually call Swap(), Update() or Render() commands or can I even create text with SetRenderToImage command? If some one else has more experience on this regard, I'd be very happy if you shared your knowledge with me. Thank you.
Mah machine: Intel Xeon E3-1231v3 4x3.40GHz | CM Hyper 212 Evo | ASRock H97 Pro4 | 240GB SanDisk SSD | Sapphire Radeon R9 270X Dual-X 2048MB | Seagate HDD 1000GB |
8GB Crucial Ballistix Sport DDR3-1600
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 17th Jul 2016 08:49
With SetRenderToImage, you can draw anything you would normally do rendering to the screen.
Call it before you draw anything.
Then ClearScreen()
You can now drawSprite() etc.
When you have finished drawing, SetRenderToScreen()

You don't need to Swap(), Update() or Render()
For your text, you probably need to save it to a sprite so you can DrawSprite(). I haven't tried text on a Render Image, there may be a better way.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 17th Jul 2016 09:13
everything what not paint direct in this "buffer" will be painted with the call of Render() command. Render using lists orderd by depth value, like Sprites,GUI

Update() updates the input cycle or physics.

Swap() exchange the back/front buffer pointer and clears the "backbuffer" for next painting.

AGK (Steam) V2.0.20 : Windows 10 Pro 64 Bit : AMD (16.3.2) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
CodeTrasher
12
Years of Service
User Offline
Joined: 18th Jul 2012
Location: Tampere, Finland
Posted: 18th Jul 2016 21:32
Alright, thank you both for your help. I'll have to try and see further what approach suits my needs best.
Mah machine: Intel Xeon E3-1231v3 4x3.40GHz | CM Hyper 212 Evo | ASRock H97 Pro4 | 240GB SanDisk SSD | Sapphire Radeon R9 270X Dual-X 2048MB | Seagate HDD 1000GB |
8GB Crucial Ballistix Sport DDR3-1600
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 19th Jul 2016 08:21
Markus' approach is better
I have never used it this way, but in the future I will.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt

Login to post a reply

Server time is: 2024-09-29 17:26:43
Your offset time is: 2024-09-29 17:26:43