From b2bd9bccd8fffaae76c7f2f8373e641a6dd029d2 Mon Sep 17 00:00:00 2001 From: 0scar Date: Tue, 6 Feb 2024 14:33:37 +0100 Subject: Initial commit --- .gitignore | 4 ++++ CMakeLists.txt | 34 ++++++++++++++++++++++++++++++ resources/shader.fragmentshader | 10 +++++++++ resources/shader.vertexshader | 17 +++++++++++++++ src/main.c | 17 +++++++++++++++ state_mainstate/include/states/mainstate.h | 13 ++++++++++++ state_mainstate/src/mainstate.c | 16 ++++++++++++++ 7 files changed, 111 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 resources/shader.fragmentshader create mode 100644 resources/shader.vertexshader create mode 100644 src/main.c create mode 100644 state_mainstate/include/states/mainstate.h create mode 100644 state_mainstate/src/mainstate.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e27d710 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +rogue +obj +compile_commands.json +build diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..32843ad --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.24) +project(rogue VERSION 0.0.1 LANGUAGES C) + +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(CMAKE_C_STANDARD_REQUIRED ON) + +set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE) + +find_package(Git REQUIRED) + +include(FetchContent) + +set(CMAKE_DISABLE_IN_SOURCE_BUILD ON CACHE BOOL "Prevents cmake -S. -B.") +set(CMAKE_DISABLE_SOURCE_CHANGES ON CACHE BOOL "Prevent writing files to CMAKE_SOURCE_DIR under configure") + +FetchContent_Declare(daw + GIT_REPOSITORY https://codeberg.org/onelin/daw.git + GIT_TAG glfw +) + +add_compile_options(-Og -ggdb3 -fno-omit-frame-pointer) +add_link_options(-Og -ggdb3 -fno-omit-frame-pointer) + +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + add_compile_options(-D_DEBUG) +endif() + +FetchContent_MakeAvailable(daw) + +daw_add_state(mainstate) + +add_executable(${PROJECT_NAME} src/main.c) +target_link_libraries(${PROJECT_NAME} PUBLIC daw) +target_include_directories(${PROJECT_NAME} PUBLIC include) diff --git a/resources/shader.fragmentshader b/resources/shader.fragmentshader new file mode 100644 index 0000000..a244f24 --- /dev/null +++ b/resources/shader.fragmentshader @@ -0,0 +1,10 @@ +#version 330 core + +// Ouput data +in vec3 fragmentcolor; +out vec3 color; + +void main() { + color = fragmentcolor; + +} diff --git a/resources/shader.vertexshader b/resources/shader.vertexshader new file mode 100644 index 0000000..657053e --- /dev/null +++ b/resources/shader.vertexshader @@ -0,0 +1,17 @@ +#version 330 core + +// Input vertex data, different for all executions of this shader. +layout(location = 0) in vec3 vertexPosition_modelspace; +layout(location = 1) in vec3 vertexColor; + +uniform mat4 MVP; + +out vec3 fragmentcolor; + +void main() { + + gl_Position = MVP * vec4(vertexPosition_modelspace, 1); + // gl_Position.w = 1.0; + + fragmentcolor = vertexColor; +} diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..b72d678 --- /dev/null +++ b/src/main.c @@ -0,0 +1,17 @@ +#include +#include + +#define MEMORY_SIZE 65536 + +int main(void) { + + Platform *p = engine_init("rogue", + 0,0, + 1.f, 0, + MEMORY_SIZE, + NULL, + NULL); + + engine_run(p, STATE_titlescreen); + engine_stop(p); +} diff --git a/state_mainstate/include/states/mainstate.h b/state_mainstate/include/states/mainstate.h new file mode 100644 index 0000000..1abfa67 --- /dev/null +++ b/state_mainstate/include/states/mainstate.h @@ -0,0 +1,13 @@ +#ifndef STATE_TITLESCREEN_H +#define STATE_TITLESCREEN_H + +#include +//#include +//#include +//#include +//#include + +typedef struct mainstate_state { +} mainstate_state; + +#endif diff --git a/state_mainstate/src/mainstate.c b/state_mainstate/src/mainstate.c new file mode 100644 index 0000000..e9d6dec --- /dev/null +++ b/state_mainstate/src/mainstate.c @@ -0,0 +1,16 @@ +//#include +//#include +#include + +void mainstate_init(mainstate_state *state) { + INFO("Starting mainstate"); +} + +void mainstate_free(mainstate_state *state) { +} + +StateType mainstate_update(mainstate_state *state) { + StateType next_state = STATE_null; + + return next_state; +} -- cgit v1.3