start to lay down code
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
project(natsukashii CXX)
|
project(natsukashii CXX)
|
||||||
set(CXX_VERSION 17)
|
|
||||||
set(CXX_VERSION_REQUIRED TRUE)
|
set(CMAKE_CXX_VERSION 17)
|
||||||
set(FRONTEND "qt" CACHE INTERNAL "")
|
set(CMAKE_CXX_VERSION_REQUIRED TRUE)
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
add_executable(natsukashii src/main.cpp)
|
add_executable(natsukashii src/main.cpp)
|
||||||
target_link_libraries(natsukashii cores frontend)
|
target_link_libraries(natsukashii cores frontend)
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
add_subdirectory(core)
|
add_subdirectory(core)
|
||||||
|
|
||||||
|
set(FRONTEND "qt" CACHE INTERNAL "")
|
||||||
|
|
||||||
if(${FRONTEND} MATCHES "qt")
|
if(${FRONTEND} MATCHES "qt")
|
||||||
add_subdirectory(frontend/qt)
|
add_subdirectory(frontend/qt)
|
||||||
elseif(${FRONTEND} MATCHES "sdl")
|
elseif(${FRONTEND} MATCHES "sdl")
|
||||||
|
|||||||
@@ -1,2 +1,8 @@
|
|||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
project(frontend)
|
project(frontend)
|
||||||
|
|
||||||
|
find_package(SDL2 REQUIRED)
|
||||||
|
|
||||||
|
add_library(frontend Frontend.cpp Frontend.hpp)
|
||||||
|
target_include_directories(frontend PUBLIC .)
|
||||||
|
target_link_libraries(frontend PUBLIC SDL2)
|
||||||
15
src/frontend/sdl/Frontend.cpp
Normal file
15
src/frontend/sdl/Frontend.cpp
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#include <Frontend.hpp>
|
||||||
|
|
||||||
|
namespace natsukashii::frontend {
|
||||||
|
App::~App() {
|
||||||
|
SDL_DestroyRenderer(renderer);
|
||||||
|
SDL_DestroyWindow(window);
|
||||||
|
SDL_Quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
App::App() {
|
||||||
|
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO);
|
||||||
|
window = SDL_CreateWindow("natukashii", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 800, 600, SDL_WINDOW_SHOWN);
|
||||||
|
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
|
||||||
|
}
|
||||||
|
}
|
||||||
12
src/frontend/sdl/Frontend.hpp
Normal file
12
src/frontend/sdl/Frontend.hpp
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <SDL2/SDL.h>
|
||||||
|
|
||||||
|
namespace natsukashii::frontend {
|
||||||
|
struct App {
|
||||||
|
~App();
|
||||||
|
App();
|
||||||
|
private:
|
||||||
|
SDL_Window *window = nullptr;
|
||||||
|
SDL_Renderer *renderer = nullptr;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,3 +1,8 @@
|
|||||||
#include <BaseCore.hpp>
|
#include <Frontend.hpp>
|
||||||
|
|
||||||
int main() {}
|
using namespace natsukashii::frontend;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
App app;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user