start to lay down code

This commit is contained in:
CocoSimone
2022-05-02 23:57:42 +02:00
parent e3681fb608
commit c73e15971a
6 changed files with 46 additions and 5 deletions

View File

@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.20)
add_subdirectory(core)
set(FRONTEND "qt" CACHE INTERNAL "")
if(${FRONTEND} MATCHES "qt")
add_subdirectory(frontend/qt)
elseif(${FRONTEND} MATCHES "sdl")

View File

@@ -1,2 +1,8 @@
cmake_minimum_required(VERSION 3.20)
project(frontend)
find_package(SDL2 REQUIRED)
add_library(frontend Frontend.cpp Frontend.hpp)
target_include_directories(frontend PUBLIC .)
target_link_libraries(frontend PUBLIC SDL2)

View 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);
}
}

View 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;
};
}

View File

@@ -1,3 +1,8 @@
#include <BaseCore.hpp>
#include <Frontend.hpp>
int main() {}
using namespace natsukashii::frontend;
int main() {
App app;
return 0;
}