Tag Info

New answers tagged

0

You need to move all the SDL functions out of the compound for loop. for{for{pixels[y*width+x] = argb;}} //Update all pixel values at once //Then... SDL_UpdateTexture(texture, NULL, pixels, width * 4); //Copy entire array only once SDL_RenderClear(renderer); SDL_RenderCopy(renderer, texture, NULL, NULL); SDL_RenderPresent(renderer);


0

You will have to check (where the text is, Inside or outside the screen) before you render, and correct it. Example: if( rec.x < 0 ) { // Here you will set something to render the other par of the text in x=0; }


0

There is a problem using SDL_Renderer with OpenGL. You can save the text to a Surface, and then use this example: http://www.sdltutorials.com/sdl-tip-sdl-surface-to-opengl-texture


0

SDL can build in many Platform. If you are ussing C++, all STL library work on g++ and windows compilers. fopen, and others is the same. EDIT: You can see this: https://wiki.libsdl.org/CategoryIO and others SDL Functions.


3

SDL is a cross-platform library, so as long as your code is cross-platform(i.e. no OS specific calls, use '/' in directories instead of '\', etc.), yes you should be able to copy and paste without too many issues. If you end up using a different compiler, it might be more or less lenient about certain things, but they are probably minor.


3

You can't reliably control the FPS with functions like SDL_Delay, they call the operating sleep function, which tells the operating system "Please don't give me any CPU time for at least N miliseconds", the operating system is then free to decide: At what granularity (i.e., as you said you specify 1ms and it waits for 15ms, it has a granularity of 15ms) ...


0

Your velocity is 0 when the ball stops, so the velocity must be 0 at the point where it would "overshoot" (when there's a direction change required in the paddle). You can set your velocity to 0 and change paddle direction when your paddle has reached the y coordinate of the ball.



Top 50 recent answers are included