Tag Info

New answers tagged


Store the keys from the last frame and compare in the current frame. if(!old_keys[key] && keys[key]) { /* pressed since last frame */ } if(old_keys[key] && !keys[key]) { /* released since last frame */ } if(old_keys[key] && keys[key]) { /* held since last frame */ }


glOrtho( 0.f, viewWidth, viewHeight, 0.f, 0.f, 1.f ); Assuming that you're starting from an identity matrix, this glOrtho() call will give you a traditional window coordinate system with 0,0 at the top left corner, such that one unit in OpenGL space corresponds exactly to one pixel in the view which contains the OpenGL-rendered image. Man page for glOrtho. ...


To let your footsoldiers share a tile you should simply position them correctly after the pathfinding found the tile. If you are smoothing your path then each step should lead to the correct position for that unit within the tile. You can also have a look at flocking. It basically finds a single path for a group of units and moves them as a group. ...


If you're using SDL 2 you should just be able to port to mobile quite easily. SDL 2 has support out of the box for mobile. It won't be a 2-click port but it will be very possible to do. Check out the download page: http://www.libsdl.org/download-2.0.php#source There are versions of SDL 2 for iOS and Android that you can build from source. SDL is very well ...

Top 50 recent answers are included