sdl-2

Why CPU-side version SDL_FillRect up to 7 times faster in compare GPU-side version SDL_RenderFillRect?

一个人想着一个人 提交于 2021-01-05 06:38:59
问题 Here I have asked what is the difference between SDL_FillRect and SDL_RenderFillRect Here is code of my benchmark: my $window = SDL2::Video::SDL_CreateWindow( 'Hello', 100, 100, 800, 600, 0x00000004 ); my $surface = SDL2::Video::SDL_GetWindowSurface( $window ); my $render = SDL2::Render::SDL_GetRenderer( $window ); SDL2::Render::SDL_SetRenderDrawColor( $render, 0, 0, 255, 255 ); use Benchmark ':all'; my $rect1 = SDL2::Rect->new({ x => 10, y => 10, h => 50, w => 50 }); timethese( 1000000, {

Why CPU-side version SDL_FillRect up to 7 times faster in compare GPU-side version SDL_RenderFillRect?

安稳与你 提交于 2021-01-05 06:37:49
问题 Here I have asked what is the difference between SDL_FillRect and SDL_RenderFillRect Here is code of my benchmark: my $window = SDL2::Video::SDL_CreateWindow( 'Hello', 100, 100, 800, 600, 0x00000004 ); my $surface = SDL2::Video::SDL_GetWindowSurface( $window ); my $render = SDL2::Render::SDL_GetRenderer( $window ); SDL2::Render::SDL_SetRenderDrawColor( $render, 0, 0, 255, 255 ); use Benchmark ':all'; my $rect1 = SDL2::Rect->new({ x => 10, y => 10, h => 50, w => 50 }); timethese( 1000000, {

SDL2 - Vsync not working

别来无恙 提交于 2021-01-03 03:29:41
问题 I use vsync in my program, and it works fine until I minimize the window. I did this when I created the renderer: renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); And here is the game loop: while (running) { checkEvent(); handleKeyboard(timer.getDelta()); render(); } It gives me a stable 60 frames per second, but I get more than 100000 frames per second when I minimize the window. Why is that happening? 回答1: Probably just a bug in SDL. If you

SDL2 Smooth texture(sprite) animation between points in time function

江枫思渺然 提交于 2020-12-04 03:50:34
问题 currently im trying to develop smooth animation effect via hardware accelerated technique (DirectX or OpenGL), my current goal is very simple, i would like to move texture from point A to point B in given duration, this is classic way to animate objects, i read a lot about Robert Penner interpolations, and for this purpose i would like to animate my texture in simpliest linear interpolation as described here: http://upshots.org/actionscript/jsas-understanding-easing Everything works, except

SDL2 Smooth texture(sprite) animation between points in time function

守給你的承諾、 提交于 2020-12-04 03:50:07
问题 currently im trying to develop smooth animation effect via hardware accelerated technique (DirectX or OpenGL), my current goal is very simple, i would like to move texture from point A to point B in given duration, this is classic way to animate objects, i read a lot about Robert Penner interpolations, and for this purpose i would like to animate my texture in simpliest linear interpolation as described here: http://upshots.org/actionscript/jsas-understanding-easing Everything works, except

LNK2019 - unresolved external symbol - C++ - SDL2 Library [duplicate]

筅森魡賤 提交于 2020-11-29 09:49:31
问题 This question already has answers here : What is an undefined reference/unresolved external symbol error and how do I fix it? (34 answers) Closed 2 years ago . I am trying to initialize my game window and can't get past this error. I have tried: double and triple checking all my code for syntax errors checking that the SDL2 library is properly included in my project Please see below code for your reference: Header file: #ifndef Game_hpp #define Game_hpp #include "SDL.h" #include <iostream>

How to correctly handle control-key combinations in SDL2

99封情书 提交于 2020-08-07 06:07:50
问题 In my SDL 2.0 based application, I would like to handle both Control + and Control = . I understand that I could handle the SDL_KEYDOWN event and look for the SDLK_EQUALS keycode in combination with KEYMODE_CTRL . And even check for KEYMOD_SHIFT' to distinguish between + and =`. However, this is not portable and breaks on keyboards where those symbols are mapped to different keys. Another thing I have tried is to enable SDL_StartTextInput() and then listen to SDL_TEXTINPUT events. However

C++ SDL2 - Incomprehensible link error

谁说胖子不能爱 提交于 2020-06-29 08:00:26
问题 I setup SDL2 under C++ CDT Eclipse. I added the include path "........SDL2-2.0.3\i686-w64-mingw32\include", the library path "........SDL2-2.0.3\i686-w64-mingw32\lib" and added the libraries 1."mingw32" 2."SDL2main" 3."SDL2". So now, if I add a main.cpp with this content: #include <SDL.h> int main(int argc, char* args[]) { return 0; } I can build the project fine, but if I use this: #include <SDL.h> int main() { return 0; } The project can't build and I get this error: Info: Internal Builder