0
How do you use the sdl2 library installed in the CXXDROID app
2 ответов
+ 3
FWIW, that's a 17 part series which seems like a decent starter.
+ 2
Google, YouTube. There are many examples of using it.
I tried this example that creates a black window for 5 sec:
https://dev.to/noah11012/using-sdl2-opening-a-window-79c
#include <SDL2/SDL.h>
#include <iostream>
int main()
{
if(SDL_Init(SDL_INIT_VIDEO) < 0)
{
std::cout << "Failed to initialize the SDL2 library\n";
return -1;
}
SDL_Window *window = SDL_CreateWindow("SDL2 Window",
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
680, 480,
0);
if(!window)
{
std::cout << "Failed to create window\n";
return -1;
}
SDL_Surface *window_surface = SDL_GetWindowSurface(window);
if(!window_surface)
{
std::cout << "Failed to get the surface from the window\n";
return -1;
}
SDL_UpdateWindowSurface(window);
SDL_Delay(5000);
}
Worked fine for me.