summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--CMakeLists.txt34
-rw-r--r--resources/shader.fragmentshader10
-rw-r--r--resources/shader.vertexshader17
-rw-r--r--src/main.c17
-rw-r--r--state_mainstate/include/states/mainstate.h13
-rw-r--r--state_mainstate/src/mainstate.c16
7 files changed, 111 insertions, 0 deletions
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 <engine/engine.h>
+#include <rogue/resources.h>
+
+#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 <stdbool.h>
+//#include <engine/state.h>
+//#include <engine/engine.h>
+//#include <engine/ui.h>
+//#include <engine/input.h>
+
+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 <engine/logging.h>
+//#include <engine/input.h>
+#include <states/mainstate.h>
+
+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;
+}