Jump to content

View more

Image of the Day

#ld38 #screenshotsaturday Mimosa Fizz action gif #2 https://t.co/TUzdppvfUL
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

WT* ?

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
7 replies to this topic

#1 eltharynd   Members   

123
Like
1Likes
Like

Posted 27 September 2013 - 04:04 PM

i was coding something while i stopped 1 hours on some simple math problem...

at first i thought i was doing something wrong but after a while i realized this

	float x = eng->mWidth;
	float y = eng->mHeight;

returned 0 in x... i had to resolve this way

	float xx = eng->mWidth;
	float yy = eng->mHeight;
	float x = (800 / xx);
	float y = (200 / yy);

and everything worked...

can someone explain to me while i cannot include a member of another class in an equation?? did i do something wrong??? please help me understand...



#2 Cornstalks   Members   

7030
Like
16Likes
Like

Posted 27 September 2013 - 04:07 PM

*
POPULAR

Huh? The two things you have posted there aren't the same. Anyway, my guess is integer division issues. Does this fix your problem?

float x = 800.0f / eng->mWidth; // (feel free to cast eng->mWidth to float; I didn't because promotion rules will make it at least a float anyway)
float y = 200.0f / eng->mHeight;

[ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]

#3 eltharynd   Members   

123
Like
0Likes
Like

Posted 27 September 2013 - 04:09 PM

thanks :) that solved


Edited by eltharynd, 27 September 2013 - 04:13 PM.


#4 Álvaro   Members   

20937
Like
7Likes
Like

Posted 27 September 2013 - 04:37 PM

*
POPULAR

Wow, Cornstalks. That was impressive. You managed to figure out what the code actually said (`800 / eng->mWidth'), even though the OP posted something else.

To eltharynd: Please copy and paste code in the future so we don't have to rely on Cornstalks's crystal ball.

Edited by Álvaro, 27 September 2013 - 09:08 PM.


#5 Muzzy A   Members   

737
Like
5Likes
Like

Posted 28 September 2013 - 06:37 PM

*
POPULAR

LOL this topic brightened my day.



#6 Khatharr   Members   

8648
Like
6Likes
Like

Posted 28 September 2013 - 09:42 PM

*
POPULAR

Wow, Cornstalks. That was impressive. You managed to figure out what the code actually said (`800 / eng->mWidth'), even though the OP posted something else.

To eltharynd: Please copy and paste code in the future so we don't have to rely on Cornstalks's crystal ball.

 

Once again I'm impressed by Cornstalks' balls.


void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

#7 QuinnDexter   Members   

153
Like
0Likes
Like

Posted 04 October 2013 - 09:42 AM

There are posts on Gamedev that are boring and some that are interesting but this one made my Friday biggrin.png



#8 Malabyte   Members   

610
Like
0Likes
Like

Posted 13 October 2013 - 12:00 PM

(Comment removed for redundancy.)


Edited by Malabyte, 13 October 2013 - 12:16 PM.

- Awl you're base are belong me! -

- I don't know, I'm just a noob -





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.