Tag Info

New answers tagged

2

boost::ptr_vector is, underneath the hood, a std::vector<void *>. Not only is it not possible to use the ptr_vector to directly supply an input to glBufferData (et cetera), but it is a phenomenally bad way to store vertex data in general because of the extremely poor cache locality of the data If you were to use std::vector<vertex> vertices; ...


2

SDL2 is very capable of doing exactly what you ask. SDL2 is also more efficient and has much more utility. I highly recommend upgrading to SDL2 by following the instructions provided in the Migration Guide on SDL Wiki. EDIT: It took me a few days to migrate my project from SDL 1.2 to 2.0.3; most of the migration process was changing from SDL_Surface to ...


2

We can find out which corner the player is in by checking whether their position is above or below the two diagonals through the square. Let's assume for a moment that the center of your square was at the coordinate position (0,0), and let's start with the diagonal that goes from the lower left to the upper right. When would a point be exactly on this line? ...


0

Do you know for sure that the player's position is actually inside the square? If so, the following might work for you. If you translate the player position (p_x, p_y) so that the center of the square (c_x, c_y) would end up in your coordinate system's origin, and then rotate it by 45 degrees around the origin, you can simply check the four corner by ...


1

You can start with your gradient texture and render your texture to a surface where you want your button to be. You can manually apply the gradient by only copying over the pixels from the gradient map onto the destination where the destination pixels have alpha (or multiply the two). Note, when using GL/DX, you can use the stencil buffer ...



Top 50 recent answers are included