Category : sdl-2

I’m trying SDL2 for ios. I followed this instructions to build libsdl2.a and libsdlmain.a. Have used the built in ios template xcode project. But gives me error while Initialization. SDL Error: Application didn’t initialize properly, did you include SDL_main.h in the file containing your main() function? could anyone help me? #include "SDL.h" int main(int argc, ..

Read more

the code in question: #include <SDL2/SDL.h> #include <math.h> const int WINDOW_WIDTH = 1000; const int WINDOW_HEIGHT = 750; int main(int argc, char *args[]) { if (SDL_Init(SDL_INIT_VIDEO) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error: %s", SDL_GetError()); } SDL_Window *window; SDL_Renderer *renderer; SDL_Event e; bool running = true; if (SDL_CreateWindowAndRenderer(WINDOW_WIDTH, WINDOW_HEIGHT, 0, &window, &renderer)) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error: %s", SDL_GetError()); ..

Read more

I am trying to use SDL and SDL_image as a subprojects in my project. Folder structure: testRepos ├── build //build files inside ├── src │ ├── main.cpp │ ├── texture.png │ └── CMakeLists.txt ├── third_party │ ├── SDL //SDL repo inside │ ├── SDL_image //SDL_image repo inside │ └── CMakeLists.txt └── CMakeLists.txt main.cpp #include <SDL.h> ..

Read more

So my header file reads: #include <iostream> #include <cmath> #include <map> #include <SDL2/SDL.h> #include <SDL2/SDL_ttf.h> #include <SDL2/SDL_image.h> using namespace std; class Screen { public: const static int WIDTH = 800, HEIGHT = 600; private: SDL_Window *window; SDL_Renderer *renderer; map<string, SDL_Texture*> textures SDL_Rect background; public: Screen(): window(nullptr), renderer(nullptr) { background.w = WIDTH, background.h = HEIGHT; background.x ..

Read more

I’m currently using the SDL library and I need direct access to the framebuffer in the ARGB pixel format. An SDL_Surface has a "pixels" element that makes this possible but apparently it is in the ABGR format. How can I change it to ARGB? Neither SDL_ConvertSurface() nor SDL_ConvertSurfaceFormat() have worked. A solution for either SDL ..

Read more