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 / Getting angles to line up?

Author
Message
Fluorescent
FPSC Reloaded TGC Backer
19
Years of Service
User Offline
Joined: 1st Aug 2005
Location: Stockholm, Sweden
Posted: 15th Aug 2015 20:13
I have a space ship type that has a Angle property on it. And when I handle the input from the player this is the value that I change first. And it's also the one that I use for moving the sprite around using Cos and Sin.

I then set the angle of the sprite using SetSpriteAngle. I also use it to set the angle of the laser that the player can shoot.

But things doesn't seem to line up, or it's my eyes that are playing a trick on me.



The pink and white line is me drawing the way the ship is pointing for debugging purposes. But it looks like it's slightly of centre compared to the sprite. The laser-beam follows the line very nice when moving, but the sprite seems to be angled wrongly. And you can see at the top that all the angles are in fact the same.

What am I doing wrong?
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 15th Aug 2015 22:01
for me it looks the laser have the same angle as the ship.
means the ship is not in line.

AGK (Steam) V2 Beta .. : Windows 10 Pro, 8.1 Pro 64 Bit : AMD (15.7.1) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 15th Aug 2015 22:51
I think I agree with Markus, the line doesn't look properly angled from the ship.


"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Fluorescent
FPSC Reloaded TGC Backer
19
Years of Service
User Offline
Joined: 1st Aug 2005
Location: Stockholm, Sweden
Posted: 16th Aug 2015 10:32
But since the laser is following the line, it looks weird.

Could it be because I use percent-system that the aspect ratio throws things of centre a bit? And how could I compensate for that?

This is the code I use for moving the laser.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 16th Aug 2015 10:44
The line you have drawn is 123.7 degrees, if your screenshot is an exact match to your screen.

The laser appears to be the right angle, the spacecraft is too difficult to measure because of its size and shape.

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: 16th Aug 2015 12:23
without SetVirtualResolution i get unwanted results.

example:


AGK (Steam) V2 Beta .. : Windows 10 Pro, 8.1 Pro 64 Bit : AMD (15.7.1) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
Fluorescent
FPSC Reloaded TGC Backer
19
Years of Service
User Offline
Joined: 1st Aug 2005
Location: Stockholm, Sweden
Posted: 17th Aug 2015 17:51
So, your conclusion is that if using percentage system, something gets a bit out of line and things don't really line up correctly?
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 17th Aug 2015 20:20
no, it seems if not using this command SetVirtualResolution
it looks odd.

AGK (Steam) V2 Beta .. : Windows 10 Pro, 8.1 Pro 64 Bit : AMD (15.7.1) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 17th Aug 2015 23:00
You probably need to factor in the device dimensions as use them as some kind of multiplier.
But this is where I fail terribly, I can't offer any specifics as my threads on Render Images will attest to!

Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 17th Aug 2015 23:32
I love the percentage system! I'll never use Virtual Resolutions ever again!

This is an easy peasy fix! All you have to do is multiply your y# variable by the display aspect ratio and make sure all your variables are floats.

Quick example:



Good luck!

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 18th Aug 2015 02:50 Edited at: 18th Aug 2015 02:57
100x100 is also a virtual resolution.

it make no sense using a 1:1 aspect ratio on a 16:9 device and then scale the x or y values.
then u can use better direct a vr with 160x90 or something.
or 4:3 40:30 80:60 160:120 , 4:3 fit in a 16:9 screen too.
+ SetScissor( 0,0,0,0 )

or a other trick is using the minimum width/height as 100,
means a square fit in every screen. the rest is oversize.
we have commands (GetScreenBounds...) to find the borders.

AGK (Steam) V2 Beta .. : Windows 10 Pro, 8.1 Pro 64 Bit : AMD (15.7.1) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 18th Aug 2015 03:46
I 100% disagree!

I think the percentage system makes everything 100x easier and makes more sense than setting a virtual resolution. It's easier, faster and there's no fiddling to get your game to look uniform across multiple platforms.

It honestly just makes more sense to use the percentage system than setting a virtual one.

Quote: "it make no sense using a 1:1 aspect ratio on a 16:9 device and then scale the x or y values.
then u can use better direct a vr with 160x90 or something.
or 4:3 40:30 80:60 160:120 , 4:3 fit in a 16:9 screen too.
+ SetScissor( 0,0,0,0 )
"


I believe you're looking at this all wrong. It makes perfect sense to me, idk lol.

Fluorescent
FPSC Reloaded TGC Backer
19
Years of Service
User Offline
Joined: 1st Aug 2005
Location: Stockholm, Sweden
Posted: 18th Aug 2015 09:18
I'm gonna agree with jlmoondog that percentage systems makes more sense when dealing with different screens. How ever as I think we just found out there appears to be a hickup in managing the aspect ratio.

Am I correct when I think about it that using 100 by 100 on a rectangular screen essentially makes agk's pixels to become rectangular and that is the reason angles seems a bit off?
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 18th Aug 2015 11:46 Edited at: 18th Aug 2015 11:47
I don't think percentages will help either. Your taking a completely 2D coordinate system, condensing it into a rectangle, and with that you will never get the results you need. It looks like the angle is calculating based on a portrait orientated rectangular screen, so they Y coordinates might be for a 0-1024 range while the X coordinates might be for a 0-600 range, the Y coordinate is then condensed down to the square while the X coordinate is left alone, meaning Y is squished - AppGameKit thinks your using a rectangular screen, not a square one... probably due to it detecting the actual hardware screen and making its own mind up about scaling. Percentages and virtual resolutions are scaled to hardware, so a point at 100%,100% is the corner of your screen no matter what shape it is.

Set the virtual resolution to something like 1024x600, and stick to that - then the angles will behave. Using percentages would be fine if you had a perfectly square screen.

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 18th Aug 2015 13:49
if we using 100x100% or just 100x100units everything is stretched on a normal device screen because most are 16:9 or 4:3 ...
if u want see a normal sprite we can use -1 at x or y size but this will do a anti stretched.

AGK (Steam) V2 Beta .. : Windows 10 Pro, 8.1 Pro 64 Bit : AMD (15.7.1) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
Fluorescent
FPSC Reloaded TGC Backer
19
Years of Service
User Offline
Joined: 1st Aug 2005
Location: Stockholm, Sweden
Posted: 18th Aug 2015 18:54
I've implemented JLMoondog's suggestion with the multiplication of aspect ratio and it looks much more convincing. Particularly when the ship is in motion it looks quite natural.

Thank you everyone!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 18th Aug 2015 20:29
This challenge highlights the major flaw in percentage based resolution. If you want to display a specific angle, you can't.

In this case you don't care that it is exactly 135 degrees. But what if you did? What if you were displaying a time on an analogue clock for example? You need to retrieve the device height and width. And if you are doing that, then there is no point at all in using the percentage based system in the first place.

Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 18th Aug 2015 20:36
The angle never changes. I'm not sure what you mean by it being a flaw. Can you explain it a little more, show an example of what you mean Mr. Bat?

trietias
9
Years of Service
User Offline
Joined: 20th Jul 2015
Location:
Posted: 18th Aug 2015 22:56 Edited at: 18th Aug 2015 22:57
I think BatVink means something like this:

Below is a picture of a 45 deg angle in a box 100x100 pixels

When resize that to fit a 16:9 screen ratio, we get this


So if it creates the angles based on the percentage system assuming things are perfect squares, and resizes the images the same way photoshop would, I can see how the angle of the image could cause issues.

Now I'm not sure why they aren't lining up, but I could see this causing a problem for me if I was working with showing angles.
JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 19th Aug 2015 04:45
I still don't see the problem. The percentage system does not affect how an angle is displayed onscreen. People are getting confused...the percentage system is not the equivalent to a virtual resolution of 100x100. It's not 100 grids by 100 grid units...it's 100% of x resolution by 100% y resolution.

A 45 degree angle will look exactly the same when rendered in the percentage system vs vr.

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 19th Aug 2015 10:40
i am sure percentage system is 100x100 virtual resolution.
example
1920 real 100% width 100 virtual
1080 real 100% height 100 virtual

640 real 100% width 100 virtual
480 real 100% height 100 virtual

AGK (Steam) V2 Beta .. : Windows 10 Pro, 8.1 Pro 64 Bit : AMD (15.7.1) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 19th Aug 2015 12:55
The issue I see is that 0.5,0.5 on a percentage system is the middle of the screen, but it's not the middle of a square, it's being used to move a sprite and project a bullet path.

If you are positioned at 0.5,0.5, and your ship is at 45 degrees, 0.1 units from the ship is 0.6,0.6 yes?

So the problem is that the angle between 0.5,0.5 and 0.6,0.6 is not 45 degrees, it's more like 53 degrees or something, visually I mean. No matter if it's virtual or percentage based, your screen really needs to conform to the aspect ratio of the device otherwise you get problems like the one exhibited here. The sprites are fine, because AppGameKit allows for the virtual resolution and knows to scale the sprites appropriately, but mix that with SIN/COS angle movement and it goes to hell because that won't allow for aspect ratio, the virtual resolution will always disagree with the device resolution and end up squashing the Y axis.

The percentage system definitely does affect how an angle is represented. If the angle is represented in a sprite, then it'll look fine, if it's represented by a line that relies on a 1:1 aspect ration, it'll be wrong. The percentage system is effectively just a virtual resolution of 1x1.

I think trietias has shown a great example of the problem... move at a 45 degree angle on a percentage based coordinate system on a non 1:1 aspect screen and it won't be 45 degrees, no matter which way you slice it, the percentage system is not good for most game projects.

SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 19th Aug 2015 13:06
Quote: "1920 real 100% width 100 virtual
1080 real 100% height 100 virtual

640 real 100% width 100 virtual
480 real 100% height 100 virtual"


Can't say I have used the % system yet but feel it will be much better to fill the screen on all systems as I don't like how you get borders on different devices.

I thought the % way of doing things though was e.g.:

x = 1920 in real you would use 0 to 1920 and in % it would work out for you a % of 1920 so that it would look the same on screen and that it uses 0 to 1 using fractions too for more accuracy and not 0 to 100.

So the screen size would not be 100 x 100 it would be 100% x 100% (% 1920 x % 1080 )

So you might get a slight distortion on the screen but the angles etc should still be accurate and relate correctly to sprites on the screen still.

Also you can then use resizing etc so that sprites don't look incorrect.


Thats how I thought it would work but correct me if I am wrong.



Eg, trietias example pictures would be correct but then again sprites would be positioned on the screen correctly too so would line up in the proper place for the line drawn.

There seem to be a lot of people using % system with no problems and I am going to have a go at it myself next time even though it seems a strange way of doing things compared to the usual way of positioning.

The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 19th Aug 2015 13:27
Could it be something do with everything using floats apart from the ship when trying to convert to %?

Everything says 135.000000 apart from ship which is 135.

I know 135 and 135.000000 is the same but it might not be when going to %

The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 19th Aug 2015 13:32
Quote: "I don't like how you get borders on different devices"

You can resolve this problem with the scissor commands.

VanB's explanation is the best illustration. Work with Sprite commands and all is well. But anything mathematical is either incompatible or involves working in exactly the same way as a virtual resolution to resolve the problem, making the percentage system redundant.

Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 19th Aug 2015 13:58
Quote: "So the problem is that the angle between 0.5,0.5 and 0.6,0.6 is not 45 degrees, it's more like 53 degrees or something, visually I mean"


This doesn't all quite make sense to me to be honest, you all seem to be looking at this as if it is a square which it isn't. a 640 x 480 screen size is not 100 x 100 anyway and a 45 degree angle would not go corner to corner no matter what you do on any system.

The 45 degree angle would be from the start point created on the screen to a point at 45 degrees from it.

So on a % system 0.5,0.5 would not draw an angle to 0.6,0.6 it might be something like 0.6,0.546 or something like it on any system unless you actually set the screen size as a square in the first place but who has a square screen phone.

I think I would go with what JLMoondog is saying.

Quote: "You can resolve this problem with the scissor commands."


Not sure how this would get rid of borders on devices as you are setting the screen size to be a specific size on the virtual system no matter what device you are using so you always get some border unless the device is exactly the same ratio as your screen size.
If you draw a picture in photoshop at 640 x 400 and display this on a screen with virtual size of 640 x 400, then use a phone with screen size of 640 x 480, how would set scissor change the border without resizing the image and distorting anyway.

Surely this would be similar to % system but using your own sort of % method?

The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 19th Aug 2015 14:32
Quote: "So on a % system 0.5,0.5 would not draw an angle to 0.6,0.6 it might be something like 0.6,0.546 or something like it on any system unless you actually set the screen size as a square in the first place but who has a square screen phone."


When you're dealing with mathematic movement, you are moving within the percentage system - so a line between 0.5,0.5 to 0.6,0.6 mathematically is exactly 45 degrees, but when converted to screen coordinates it isn't. What use is the percentage system when moving at 45 degrees does not give identical X and Y movement increments? (answer: no use at all)
The percentage system won't automatically adjust 2D maths in code to suit the screen aspect - it'll just multiply to the actual screen size. A screen of 1920x1080 is so 'not-square' that it'll show significant distortion when using 2D maths to set the position of a sprite. Moving 0.1 units right and 0.1 units up won't necessarily leave a sprite at 45 degrees from it's starting position on a full screen virtual or percentage based resolution. I mean, that 0.1 would be 192px horizontally, and 108px vertically, that's no good for a game that relies on 2D math movement. Not sure how else I can state this... 2D movement is 2D movement, AppGameKit sprite screen scaling is a different thing entirely and it needs to be kept under control.

I think the best way would be to set a virtual resolution and aspect ratio based on a variable X width. Like keep the height at 100, but make the width variable, like 168, 192, etc etc to suit the actual screen shape. Borders can be a pain, but they are a fraction of the pain involved in actually coding your game to not have them. If you opt for a general standard size of tablet or phone screen, then the borders are minimal, and maybe that's something we just have to live with. Really the percentage coordinates are there for apps that need to rotate and fit any old sized screen, but apps, not games - the code needed to support that method is really a bigger burden than most of us want to deal with (variable text and sprite positions, gui elements, and the joys of image scaling). At least by keeping to the aspect ratio, moving based on SIN+COS will be predictable and compatible with the AppGameKit screen scaling.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 19th Aug 2015 14:49
Quote: "I think everybody is right.. except me so just forget I said anything."


Seriously though I think if a sock fits wear it. I started out using only the percentage system, now I use a virtual resolution and have no problems with angles or uniformity on either system.

Bonus points for getting the quote reference...

Using AppGameKit V2 Tier 1
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 19th Aug 2015 14:54
Hmmm ..... well my head is well and truly battered lol

I get what everyone is saying and it makes sense to a certain point what everyone is saying too but when you look at apps in general on Android and iPhone they all use the full screen and I think mine with a border is then probably odd in comparison to others or to the normal users viewpoint so full screen is desirable.

For example the regular person downloads 2 apps both the same type of game say, one has borders and the other doesn't and uses the full screen.
Most people would keep the full screen one and get rid of the one with borders thinking it is not as good.

Well I think my next app will have to use % to see, I have done the virtual route and this is more natural to my way of thinking, % seems a bit alien but JLMoondog seems to rate it highly and his latest game seems to work very well.
As you say, maybe it depends on the game mechanics but until I try it I can't really make my mind up lol.

Maybe Paul could provide some sort of input here and his views on it and maybe if there is a right and wrong way of doing it

In the end, nobody said coding was easy and that's all part of the fun and frustration we like I suppose in trying to solve something

The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 19th Aug 2015 14:59
Quote: ""I think everybody is right.. except me so just forget I said anything.""


lol not sure who said this but I think it all the time on here haha

The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 19th Aug 2015 16:54
Quote: " think trietias has shown a great example of the problem... move at a 45 degree angle on a percentage based coordinate system on a non 1:1 aspect screen and it won't be 45 degrees, no matter which way you slice it, the percentage system is not good for most game projects."


This is completely and utterly incorrect! Every single one of my apps I've published use the percentage system. The reason is because it makes it 100x easier! Your complaint about angle's doesn't make sense! A 45 degree angle will look exactly the same on a percentage system vs a virtual.

My Super Torpedo Command Game uses angles and trig to calculate the path and XxY velocity of projectiles, with absolutely no issues.

Here's an example of using math commands to calculate position and angles using the percentage system:



Perfect circles.

I still don't see what everyone is complaining about. The percentage system is an awesome system to create any type of game with. I think we're about to have a mexican code stand off.

Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 19th Aug 2015 17:13 Edited at: 19th Aug 2015 17:50
Quote: "Am I correct when I think about it that using 100 by 100 on a rectangular screen essentially makes agk's pixels to become rectangular and that is the reason angles seems a bit off? "

Sounds right to me.

I don't like to use the percentage system myself. (I prefer the exact positioning by pixels)
I use virtual resolution, unless it is a simple snippet for testing an idea.

I have to agree with Moondog though, that it makes no difference for the angles.
It is a matter of preference for the person writing their code.
I agree with him that the percentage system is easy, and is the best way to ensure desired output on multiple devices.
However, I feel that the virtual resolution offers me more control and better precision.

The example above is not two 45 degree angles.
Going from corner to corner is not 45 degrees unless the image is square.
These angles are based on rotation, and as Moondog says the 45 degrees is 45 degrees either way, because a circle is a circle, not an oval.
So, angles range to 360 degrees. (a circle)
The percentage system should be working as he suggests, making the scaling adjustments fine.

I think your problem lies in either the calculations being done or the order in which they are being done.
It is hard to tell without seeing all the code that pertains to your function rather than just a snippet of one part.

Quote: "
I then set the angle of the sprite using SetSpriteAngle. I also use it to set the angle of the laser that the player can shoot."

If they share the same angle, then they should appear in line with each other, unless you are syncing them separately.
If you adjust both then sync() together, then you should be okay.
If one is being sync() before the other, then the second one is trailing.

The laser and ship do look like the same angle to me, just not on the same line.
The pink and white line is definitely off angle from the ship and laser.


Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 19th Aug 2015 17:40
Well, JLMoondog's example looks like a perfect circle to me and my next app will be using %age system to try it.
I think this is the way to go myself.

The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 19th Aug 2015 17:52 Edited at: 19th Aug 2015 18:06
Quote: "I think this is the way to go myself. "

Sure if you want to use floats all the time, but trying to place something at a fraction of a pixel doesn't seem right to me.
As I said before...
I agree with him that the percentage system is easy, and is the best way to ensure desired output on multiple devices.
However, I feel that the virtual resolution offers me more control and better precision.
... so for me, using whole numbers (integers) for placing things at pixels locations is the way to go.

Maybe I am wrong here, but it at least makes me feel like I have better control of my results.
Again, it really makes little difference in the long run, it is just a matter of preference.

Dangit, now I want to play around with ships and lasers using both methods, but I have to work on something else first.
I'll be playing with this later though, so maybe we can share snippets at some point for examples of this?

Quote: "Here's an example of using math commands to calculate position and angles using the percentage system:"

That is a very nice Star Castle indeed.


Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 19th Aug 2015 19:31
Quote: "My Super Torpedo Command Game uses angles and trig to calculate the path and XxY velocity of projectiles, with absolutely no issues."


Yes, but does 10 pixels left and 10 pixels up give you a 45 degree angle in your trig? Or do you use a factor in your trig to realign it? That is the crux of the issue.

Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 19th Aug 2015 21:04 Edited at: 19th Aug 2015 21:05
There seems to be a lot of discussion about code but very little code to back it up. So here's some:



Run that and uncomment one of these lines:


That will run the code in one of four display styles:
1. Square aspect, virtual resolution
2. non-square aspect, virtual resolution
3. Square aspect, percentage based resolution
4. non-square aspect, percentage based resolution

The code draws a circle using sprites and trig and you will get a perfect circle with each style except #4. if you use non-square aspect, percentage based resolution then you need additional maths to "fix the squish".

The display function is a little bulkier than it needs to be for this demo but I just copied it from my standard set up.

AGK V2 user - Tier 1 (mostly)
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 20th Aug 2015 00:02
lol well this is getting too heavy now but all I want to know is who said this:

Quote: "I think everybody is right.. except me so just forget I said anything"



Quote: "Yes, but does 10 pixels left and 10 pixels up give you a 45 degree angle "


What about 10% left and 10% up

The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 20th Aug 2015 00:10
Quote: "What about 10% left and 10% up"


Bad news...it won't necessarily give you 45 degrees

At 800x600, that would be 80 pixels left and 60 pixels up - 33.75 degrees

Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
SpecTre
Developer
21
Years of Service
User Offline
Joined: 24th Feb 2003
Location: UK
Posted: 20th Aug 2015 00:31
Quote: "Bad news...it won't necessarily give you 45 degrees "


haha

Well the other quote says:

Quote: "I think everybody is right.. except me so just forget I said anything"


The Amiga and Amos were great!
My website LEAP - Download Paint Pot here!
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 20th Aug 2015 00:51
My bad - I really made too many assumptions about the way AppGameKit handles virtual resolutions. Seems that it enforces the render area rather than just scaling it... still no idea how it works really, using percentages with full screen is giving me a headache just thinking about it.

Login to post a reply

Server time is: 2024-11-25 19:23:08
Your offset time is: 2024-11-25 19:23:08