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 / Resolution fault in text commands

Author
Message
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 17th Apr 2016 18:07
I noticed this a while ago, but had bigger fish to fry with different resolutions in use.

However, this is the issue:- NOTE: this is in full screen mode and not windowed.

Regular sprites will resize proportionally as expected if you change the computer resolution.
However, any text output using the text commands do not resize according to the resolution - i.e. are not proportionally reduced like the rest of the virtual screen.

Say I have a 1024x768 virtual screen and I am developing on a 2560x1440 res screen. I create a text object of a certain size e.g. so it is the same size /alignment as a sprite which e.g. 200px wide.

Change the PC resolution to some other random resolution, such as 1600x900 and the 200px sprite (which is still 200 "virtual" pixels wide on my 1024x768 virtual screen has resized as expected on the "real screen" but the text items have not (bigger than expected).

I have gotten around this in some cases by not using the text commands, but I don't fancy rewriting the whole lot.

Screenshots attached to demonstrate issue:

Screenshot1 when PC at 2560x1440
Screenshot2 when PC at 1600x1024

You will see the height is proportionally adjusted, but not the width.

Attachments

Login to view attachments
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 17th Apr 2016 20:01
I tried it and I do not get the problem. This is my code below. I went from 1920 x 1080 down to 800 x 600 by changing the Windows PC resolution.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 18th Apr 2016 07:34
nz0
I have no problems with text scaling and I have used screens with different resolutions. You should post a small code snippet that shows your problem. The problem could be in your own code.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 18th Apr 2016 11:41
I think I should have added that this appears to be related to aspect ratio. It doesn't happen on all resolution drops. Try 1600x900 for instance.

Batvink, try starting off with a virtual res of 1024x768 which is 4:3 and resolution down to a 16:9 like the one above. Also - full screen mode - not windowed.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 18th Apr 2016 12:22
I have just tried it again with 1024x768, to 1600x900.
All my tests have been full screen.

Just to clarify - I start the app, then I use Windows display settings to change the resolution.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 18th Apr 2016 18:21
I'll have to do a little test app.

You won't see anything if you aren't using a custom font either.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 19th Apr 2016 01:18
Actually, I'm doing something that's a little non-standard, although it's fine for everything except text commands; I'm mixing SetDisplayAspect() with SetVirtualResolution().

So, I set a virtual resolution of e.g. 1024x768, but will always want the full screen to be fully occupied on every PC resolution, hence I will also use SetDisplayAspect(-1)

This works fine for me, as long as I load all my images and sprites etc. BEFORE I use SetDisplayAspect(-1)

The help suggests that SetDisplayAspect(-1) is only of use if you are using the percentage system (which I am not, nor ever will be). However, using the following methods have not caused me any issues previously in AGK1:

SetDisplayAspect(16.0/9.0) or whatever
Load_All_myImages()
SetDisplayAspect(-1)

This will give me the correct relative size for my loaded images - apart from text objects.

Later, when meddling with text objects, I find that if I did something like:

SetDisplayAspect(16.0/9.0)
.. do something with a text object... such as change the text value or generate a new object
SetDisplayAspect(-1)

then this solves the problem.

I suppose then, that a question exists which either everyone is oblivious to or assumes that everyone is going to run their fullscreen game in the same resolution that the developer wrote the game in:

How can you guarantee that, using a virtual resolution of an arbitrary size:
The game will run in full screen (4:3, 16:9, 16:10 and whatever..) without distortions.

I expect to draw to a e.g. 1024x768 virtual screen and have that stretched accordingly to [the native resolution] without disproportionate, independent behavior from certain commands?

My method above works fine apart from text objects. I've probably talked myself into having to make my own text handler, haven't I?
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 19th Apr 2016 11:15
I use SetVirtualResolution() together with SetScissor( 0, 0, 0, 0 ). You should make sure to have a full understanding of the display commands before staring on any serious project.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 19th Apr 2016 17:31
What gives you the impression I don't understand the display commands?

The point of my post is to show that the in-built text commands don't stretch according to the same rules as single sprites. What does setScissor(0,0,0,0) do? According to the documentation on the command, it makes no sense.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 19th Apr 2016 21:35
If you have black borders due to the device not matching the games aspect ratio, it allows you to make the game draw into those black areas.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 20th Apr 2016 01:38
This isn't a documented feature. I take it this is mutually exclusive to SetAspectRatio(-1) then?
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 20th Apr 2016 08:41
It is something I haven't used, but I imagine would be very useful. If I understand it correctly, sprites that would normally be "off-stage" are still visible.
So you should design your game to be played in the dimensions you specify, but ensure that sprites that may or may not be hidden are still presented correctly to the player.
For example, if you have a background sprite it should be taller and wider.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 20th Apr 2016 10:22
What Batvink said..

It just extends the screen to allow you to use the black borders. I use it to ensure that the screen always fills the display. (But, I set aspect ration to the device width / device height (or whatever way is correct) anyway so shouldn't have this issue.)
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 20th Apr 2016 13:41 Edited at: 20th Apr 2016 13:47
Quote: "What gives you the impression I don't understand the display commands?."


No need to get defensive. But this:

Quote: "What does setScissor(0,0,0,0) do? According to the documentation on the command, it makes no sense"


SetScissor() is one of many commands listed in the display section of the documentation.

Apparently this part is undocumented. I've been using it since it was added so I've never looked at the documentation for the command. It does the desired effect without using SetDisplayAspect(-1). Which should not be used since it (according to the description) "fills the whole screen without black borders, but will look different on every device". It's only there to be used for simple projects and testing.


If you make a code snippet that shows the bug, it is much easier for others to confirm if it is a bug or something you might have missed. Usually when users post about bugs, it's their own code.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 21st Apr 2016 22:40
Quote: "Quote: "What gives you the impression I don't understand the display commands?."
No need to get defensive. But this:"


Well, there is because you clearly called me out for not "understanding" undocumented functions.

Anyway - that aside, SetAspectRatio(-1) works as a totally valid and usable stretching function for everything except from the built in text commands. That is what I am trying to say.

It's not there for "simple projects and testing" - what would be the point, plus does the documentation indicate that? No.
I am aware SetAspectRatio(-1) would be different under varied resolutions, hence why I test it under all resolutions. I put this issue to one side a long time ago by writing my own text functions (which work 100% with SetAspectRatio(-1) but now I thought it was worth raising the question).

Batvink: none of this relates to sprites. It's about the text functions.


Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 21st Apr 2016 22:53
Use the scissor command, it's more predictable.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 22nd Apr 2016 07:53
Quote: "Batvink: none of this relates to sprites. It's about the text functions."


I was only explaining the scissor function
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 22nd Apr 2016 13:20
Quote: "Well, there is because you clearly called me out for not "understanding" undocumented functions."


I have no understanding of the 3D commands, because I've never used them. It's not about calling you out. If you are going to get mad about something like that you will only make obstacles for yourself. Being overly defensive will only hurt your own progress by not listening to advice. And you still haven't posted an example that shows the bug that you have found. This problem could have been solved days ago instead of making a discussion about it.

Login to post a reply

Server time is: 2024-11-25 07:46:53
Your offset time is: 2024-11-25 07:46:53