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 Studio Chat / [SOLVED] How to render an image to the screen?

Author
Message
Pfaber1
5
Years of Service
User Offline
Joined: 7th Jan 2018
Location: England
Posted: 17th Apr 2023 14:24
I want to put an image on my screen to render to using the command "SetRenderToimage" but need some input . Please tell me where I'm going wrong .

loadimage(150,"resscreen.png")
setrendertoimage(150,-1)

Thanks for reading

The author of this post has marked a post as an answer.

Go to answer

hendron
7
Years of Service
Recently Online
Joined: 20th Dec 2015
Location:
Posted: 17th Apr 2023 16:12
You have to use a Render Image instead of a standard one. See CreateRenderImage().
Pfaber1
5
Years of Service
User Offline
Joined: 7th Jan 2018
Location: England
Posted: 17th Apr 2023 17:37
Thanks that is really cool . I've been playing with this for hours . Gonna try it now and thanks again.
Pfaber1
5
Years of Service
User Offline
Joined: 7th Jan 2018
Location: England
Posted: 17th Apr 2023 20:01
This is my code to render my image to the to the screen so I can effectively change the screen resolution. It does not work right now and I need some help.
If you have the answer please let me know. Here is the code as it is .
hendron
7
Years of Service
Recently Online
Joined: 20th Dec 2015
Location:
Posted: 17th Apr 2023 21:08 Edited at: 23rd Apr 2023 17:50
This post has been marked by the post author as the answer.
It just so happens that I have an include for that. Feel free to use it if you like. Change the GAME_WIDTH and GAME_HEIGHT constants to your desired resolution. Note that it includes functionality for saving and loading display settings. If it doesn't find a display_settings file in your App directory (NOT your source directory), it will create one.




Save it as display.agc in your project. Here's an example of how to use it. Note that you don't need to call Sync() in your main loop.



EDIT: This reminded me that there were some things I hadn't implemented yet. Updated.
Pfaber1
5
Years of Service
User Offline
Joined: 7th Jan 2018
Location: England
Posted: 17th Apr 2023 23:00
Hi Hendron thanks very much it works great. It's a shame that setscreenresolution has been deprecated I guess they had there reasons. Your code which is way better than I can do does the job very well.
The reason I wanted to do this was to increase my FPS . Excellent work . Thanks again.
hendron
7
Years of Service
Recently Online
Joined: 20th Dec 2015
Location:
Posted: 17th Apr 2023 23:14
No problem. As far as I know, SetScreenResolution never did what you would expect anyway. It only worked on Mobile devices. On desktop it would force the window size to change. Anyway, this method is especially useful for doing lower resolution stuff like pixel art and retro 3D games. Whether or not it'll give you an FPS boost, I'm not sure. That generally depends on a ton of factors. My advice would be to not worry too much about FPS until it starts dropping below a reasonable target (60 - 240hz), then look at areas you can optimize.
Pfaber1
5
Years of Service
User Offline
Joined: 7th Jan 2018
Location: England
Posted: 18th Apr 2023 06:46
Yes indeed Hendron thanks for your very good help.
hendron
7
Years of Service
Recently Online
Joined: 20th Dec 2015
Location:
Posted: 23rd Apr 2023 17:52
Caught this mistake today while working on a project -- line 58 should be DeleteSprite instead of DeleteImage. I've updated the code snippet.

Login to post a reply

Server time is: 2023-06-06 13:29:56
Your offset time is: 2023-06-06 13:29:56