|
|
|
@ -1,6 +1,11 @@
|
|
|
|
|
#include <SDL.h>
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
|
|
SDL_Window* window;
|
|
|
|
|
SDL_Renderer* renderer;
|
|
|
|
|
SDL_Surface* surface;
|
|
|
|
|
SDL_Texture* texture;
|
|
|
|
|
SDL_Event event;
|
|
|
|
|
const int screenWidth = 800;
|
|
|
|
|
const int screenHeight = 600;
|
|
|
|
|
|
|
|
|
@ -14,33 +19,33 @@ int throw_sdl_err(const char* fmt)
|
|
|
|
|
return 3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main(int argc, char** argv) {
|
|
|
|
|
|
|
|
|
|
SDL_Window* window;
|
|
|
|
|
SDL_Renderer* renderer;
|
|
|
|
|
SDL_Surface* surface;
|
|
|
|
|
SDL_Texture* texture;
|
|
|
|
|
SDL_Event event;
|
|
|
|
|
|
|
|
|
|
int initWindow(void){
|
|
|
|
|
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
|
|
|
|
return throw_sdl_err("Could not init the SDL: %s");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (SDL_CreateWindowAndRenderer(screenWidth, screenHeight, SDL_WINDOW_OPENGL, &window, &renderer)) {
|
|
|
|
|
return throw_sdl_err("Could not create new window and renderer: %s");
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int loadLogo(void){
|
|
|
|
|
surface = SDL_LoadBMP("imgs/bocm.bmp");
|
|
|
|
|
if (!surface) {
|
|
|
|
|
return throw_sdl_err("Could not load BMP image: %s");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
texture = SDL_CreateTextureFromSurface(renderer, surface);
|
|
|
|
|
if (!texture) {
|
|
|
|
|
return throw_sdl_err("Could not create new texture from surface: %s");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SDL_FreeSurface(surface); // free a RGB surface
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main(int argc, char** argv) {
|
|
|
|
|
|
|
|
|
|
initWindow();
|
|
|
|
|
loadLogo();
|
|
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
|
SDL_PollEvent(&event);
|
|
|
|
|