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 / [SOLVED] Sprite scaling problems.

Author
Message
Bloodwire
8
Years of Service
User Offline
Joined: 26th Dec 2015
Location:
Posted: 21st Apr 2019 11:09
I think the problem with AppGameKit is that they've made it so easy, that it becomes hard. Example, I want to create a sprite, and I want to create an app/program that works both on my computer and my android devices. All of the devices have of course different screen formats, but AppGameKit scales automatically, so everything should be fine?

My problem is that the appearance changes depending on which device I am using. I have written a piece of code to illustrate this (below) - the program creates a display, 1280x720 and then it creates a sprite and scales it down so that it covers 1/4 of the screen (square, top corner) I then draw a cross, for references. On my PC this shows up as I intended, the square is withit the cross, but when I broadcast the same app to my phone the square is shrinked and drawn inside the 1/4 part of the cross.

How do you guys deal with this? I am constantly running into this problem with sprites, they are scaled differently depending on which device you are working on. It's a mess. One of the prime reasons I need to get this to work is that I want to draw (DrawLine) on the screen and there is no way to draw in the background, you are basically forced to use sprites to draw background images, which is kind of backward, in my opinion. Sprites used to be used small hardware accelerated objects which you could move around the screen quickly and independently (Commodore 64 came up with this.)

So, how do you guys deal with this?



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

Go to answer

Golelorn
8
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 21st Apr 2019 18:11 Edited at: 21st Apr 2019 18:59
This post has been marked by the post author as the answer.
I find it best to use the percentage system.

Instead of using SetVirtualResolution() you would use SetDisplayAspect().

This makes everything to scale using a base 100X100 area(the backbuffer area).

Keep in mind that drawing to the backbuffer is going to be a different resolution than the rendered resolution, so we have to adjust for that.

Example:

Bloodwire
8
Years of Service
User Offline
Joined: 26th Dec 2015
Location:
Posted: 21st Apr 2019 21:50
Thanks, this helps a lot. I think the commands I have been looking for are the GetScreenBounds commands. I haven't seen them before.

Login to post a reply

Server time is: 2024-11-22 21:34:29
Your offset time is: 2024-11-22 21:34:29