Updated TODO and CMake to hopefully compile on windows and linux and link SDL_image
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL2/SDL_image.h>
|
||||
|
||||
#include "game.h"
|
||||
|
||||
#undef main
|
||||
|
||||
12
src/main.cpp
12
src/main.cpp
@@ -4,9 +4,21 @@ int main(int argc, char** argv) {
|
||||
Game game;
|
||||
game.renderer.createWindow("Crumpet Engine", 600, 400, SCREEN_MODE_VSYNC);
|
||||
|
||||
SDL_Texture* texture;
|
||||
SDL_Surface* loadSurface = IMG_Load("./resources/mario.png");
|
||||
if (loadSurface == NULL) {
|
||||
std::cout << "ERROR LOADING SURFACE " << SDL_GetError() << std::endl;
|
||||
}
|
||||
texture = SDL_CreateTextureFromSurface(game.renderer.SDLRenderer, loadSurface);
|
||||
if (texture == NULL) {
|
||||
std::cout << "ERROR LOADING TEXTURE " << SDL_GetError() << std::endl;
|
||||
}
|
||||
SDL_FreeSurface(loadSurface);
|
||||
|
||||
while (!game.renderer.isWindowClosed()) {
|
||||
game.renderer.clear();
|
||||
game.input.poll();
|
||||
SDL_RenderCopy(game.renderer.SDLRenderer, texture, NULL, NULL);
|
||||
game.renderer.update();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user