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.

Dark GDK / Problems with dbScaleSprite

Author
Message
Wizz
14
Years of Service
User Offline
Joined: 27th Apr 2009
Location:
Posted: 4th Dec 2011 21:23
I'm totaly losing my mind here. I can not understand why this basic operation doesn't work...
I'm making a 2D game with sprites and I'm trying to make it so that the sprite's sizes adjust to the screen resolution. So first I get the screen resolution and put it in a variable. My sprites are 800x600 pixels big. So first I want to size the sprite to be the same in height as the screen resolution, and then I size the width accrodingly. (so scaling is the obvious choice)


//global
int disp_width = GetSystemMetrics(0);
int disp_height = GetSystemMetrics(1);
height_adj=disp_height/600;

//in a function
dbSprite(302,0,0,5);
float scale=100*height_adj;
dbScaleSprite(302,100*height_adj);


Nothing happens! The sprite doesn't scale. in my case my screen height is 900 so the number is 1.5 so if I put in scale=100*1.5 it works fine. Since when can't you save a value into a variable with multiplying? what the christ?!

Jonas
18
Years of Service
User Offline
Joined: 10th Aug 2005
Location: What day is it?
Posted: 4th Dec 2011 21:31
I don't do a lot of 2D so I'm not sure if the function works or not. But as for a workaround for now, you might try dbStretchSprite. That will give you independent x and y control anyway (If you deem it necessary).
Wizz
14
Years of Service
User Offline
Joined: 27th Apr 2009
Location:
Posted: 5th Dec 2011 10:40
Doesn't work either.

Login to post a reply

Server time is: 2024-03-29 08:47:49
Your offset time is: 2024-03-29 08:47:49