Jump to content
  • Advertisement
Sign in to follow this  
Al Gorithm

strange bug

This topic is 4527 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I decided to create a map editor for my Breakout clone, but I'm currently stuck. I have it set to place the center of the current object where the cursor is when the left mouse button is pressed. However, this is not working properly. I've translated the object placement to world coordinates fine, but no matter what world coordinates the screen is centered on,the screen coordinates registered by the program are wrong. They are fine in the upper left hand of the screen, but as you move the cursor right, there is a space between the objects that grows as the x value increases. Same with the Y axis. The further from the upper left the further from the cursor the block is placed. I have no idea what could be causing this and I was wondering if someone could tell me or help me find what I am missing. Here is the code from my message loop where I set the X and Y positions
case WM_MOUSEMOVE:  bluepaddle.color = BLUE;
bluepaddle.height = PADDLEHEIGHT;
bluepaddle.width = PADDLEWIDTH;
bluepaddle.color = BLUE;
bluepaddle.height = PADDLEHEIGHT;
bluepaddle.width = PADDLEWIDTH;
bluepaddle.x = xpos-(resWidth/2)+(int)LOWORD(lParam); 
bluepaddle.y = ypos-(resHeight/2)+(int)HIWORD(lParam);
return 0;
I'm doing my drawing with opengl. Here are the relevant edited drawing routines.
void render(){
gluOrtho2D(xpos-(.5*resWidth), xpos+(.5*resWidth) , ypos+(.5*resHeight) , ypos-(.5*resHeight));
I will post the program later tonight so you can see what I'm talking about. Any help here would be appreciated. [Edited by - Al Gorithm on June 24, 2006 11:16:34 PM]

Share this post

Link to post
Share on other sites
Your code in the switch statement is indented 11 levels. This discourages me from trying to help you for two reasons:

1) Because [code][/code] tags preformat text and don't allow breaking spaces, your code posting causes the page to scroll to a truly ridiculous horizontal width.

2) If you're writing code that indents that deep, it's *no wonder* you're having problems. Learn to write stuff more cleanly first.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!