Jump to content
  • Advertisement
Sign in to follow this  
ash150

Basic Movement Input

This topic is 3610 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

Hi, Say I have a box on the screen which uses keyboard input to allow the user to move the object left,right, up, down. What i want to know it, once the user takes the box out of the window frame, how do i get it to reappear? eg, user moves the box to the left, off the screen and so re-appears on the right hand side, etc. also, whats the easiest way to apply a background image to your window instead of just a plain colour? Thanks! OpenGl/C++

Share this post


Link to post
Share on other sites
Advertisement
I don't know if I fully understood what your problem is.

To make the box reappear on the window, you could save its coordinates somewhere and then check if the box is still in the window before drawing ( by comparing its coordinates with the window frame ). If it is, draw it at its coordinates. If it isn't, do something like resetting its position so that it is on the right hand side ( assuming that it exited the window on the left ).

The easiest way to apply a background image that comes to my mind ist loading a bitmap image into memory ( from a file ) or using a image already stored in memory as pixel data and draw that image to the screen with glDrawPixels(). Draw the background image before drawing anything else. To undestand the usage of glDrawPixels() you should have a look in the OpenGL Redbook ( if you don't already know it ).

I hope that helped you a little.

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!