Updated TODO and CMake to hopefully compile on windows and linux and link SDL_image
This commit is contained in:
32
.vscode/tasks.json
vendored
Normal file
32
.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Cmake and build",
|
||||
"type": "shell",
|
||||
"command": "cmake .; make"
|
||||
},
|
||||
{
|
||||
"label": "build",
|
||||
"type": "shell",
|
||||
"command": "make"
|
||||
},
|
||||
{
|
||||
"label": "build and run",
|
||||
"type": "shell",
|
||||
"command": "make; cd bin; ./crumpet-engine; cd .."
|
||||
},
|
||||
{
|
||||
"label": "Cmake, build and run",
|
||||
"type": "shell",
|
||||
"command": "cmake .; make; cd bin; ./crumpet-engine; cd .."
|
||||
},
|
||||
{
|
||||
"label": "run",
|
||||
"type": "shell",
|
||||
"command": "cd bin; ./crumpet-engine; cd .."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
# version
|
||||
cmake_minimum_required(VERSION 2.4)
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
project(crumpet-engine)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} CMakeFiles/)
|
||||
cmake_policy(SET CMP0037 OLD)
|
||||
|
||||
set(EXEName crumpet-engine)
|
||||
set(BuildDIR bin)
|
||||
set(SrcDIR src)
|
||||
@@ -13,7 +16,7 @@ if (WIN32)
|
||||
set(SDL2_INCLUDE_DIR E:/Games/Librarys/SDL2-2.0.8/include)
|
||||
set(SDL2_LIBRARY E:/Games/Librarys/SDL2-2.0.8/lib/x64)
|
||||
set(SDL2_IMAGE_INCLUDE_DIR E:/Games/Librarys/SDL2_image-2.0.4/VisualC/external/include)
|
||||
set(SDL2_IMAGE_LIBRARIES E:/Games/Librarys/SDL2_image-2.0.4/VisualC/external/lib/x64)
|
||||
set(SDL2_IMAGE_LIBRARY E:/Games/Librarys/SDL2_image-2.0.4/VisualC/external/lib/x64)
|
||||
endif (WIN32)
|
||||
|
||||
if (UNIX)
|
||||
@@ -21,12 +24,9 @@ if (UNIX)
|
||||
find_package(SDL2_image REQUIRED)
|
||||
endif (UNIX)
|
||||
|
||||
include_directories(
|
||||
${SDL2_INCLUDE_DIR}
|
||||
${SDL2_IMAGE_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
include_directories(${IncludeDIR})
|
||||
include_directories(${BuildDIR}/ ${SDL2_INCLUDE_DIR})
|
||||
include_directories(${BuildDIR}/ ${SDL2_IMAGE_INCLUDE_DIR})
|
||||
include_directories(${BuildDIR}/ ${IncludeDIR})
|
||||
|
||||
file(GLOB_RECURSE SourceFiles
|
||||
${SrcDIR}/*
|
||||
@@ -36,7 +36,5 @@ file(GLOB_RECURSE SourceFiles
|
||||
)
|
||||
|
||||
add_executable(${BuildDIR}/${EXEName} ${SourceFiles})
|
||||
target_link_libraries(${BuildDIR}/${EXEName}
|
||||
${SDL2_LIBRARY}
|
||||
${SDL2_IMAGE_LIBRARIES}
|
||||
)
|
||||
target_link_libraries(${BuildDIR}/${EXEName} ${SDL2_LIBRARIES})
|
||||
target_link_libraries(${BuildDIR}/${EXEName} ${SDL2_IMAGE_LIBRARY})
|
||||
|
||||
36
TODO.txt
36
TODO.txt
@@ -5,41 +5,7 @@ x -> complete
|
||||
? -> in development
|
||||
|
||||
***URGENT FIX NEEDED***
|
||||
[ ] Memory leak in rendering pipeline
|
||||
[ ]
|
||||
|
||||
**TODO**
|
||||
[ ] Comment the code
|
||||
[ ] Fix entity / sprite resizing
|
||||
[x] Add sprite methods to entity
|
||||
[x] Remove member initialization lists from Sprite and Entity, use Vec2* instead
|
||||
[ ] Logger class
|
||||
[ ] Maybe use preprocessor statements
|
||||
[ ] Time and other useful logging methods
|
||||
[ ] Empty constructor, instance method
|
||||
[x] Rect class to extend SDL_Rect and add conversion capabilitys, colision and intersection to it
|
||||
[x] Camera class to use Rect* instead of SLD_Rect*
|
||||
[x] Add and subtract (+ -) operators to add rectangles and subtract them together
|
||||
[x] Equal and not equal (!= ==) operators to return true / flase if the rectangles match
|
||||
[x] ToString function for easy logging
|
||||
[x] Setposition and translate methods
|
||||
[x] Intersects, contains methods
|
||||
[x] x,y,w,h properties
|
||||
[x] Switch other classes to use this instead of SDL_Rect* and make sure to update the render pipeline
|
||||
[x] Center point
|
||||
[-] Maybe a point class - used Vec2*
|
||||
[x] Game camera class and redo rendering pipeline
|
||||
[?] Add rotation and flipping for entities and sprites
|
||||
[x] Camera class
|
||||
[x] Make the camera class control the rendering of the active scene
|
||||
[x] Game coordinate system
|
||||
[x] Render to GameWorld coordinates instead of screen coordinates
|
||||
[-] Each entity and sprite should store a reference to Camera
|
||||
[ ] Fix zoom in the camera
|
||||
[ ] Objects that are off the screen, do not get rendered
|
||||
[ ] GameWorld class with coordinate system
|
||||
[?] Switch between camera modes on GameWorld
|
||||
[ ] Multiple scenes stored as levels
|
||||
[ ] UI and HUD (maybe later tho)
|
||||
[ ] Framerate
|
||||
[ ] Cap framerate
|
||||
[ ] Calculate framerate
|
||||
|
||||
Binary file not shown.
@@ -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