diff options
| -rw-r--r-- | #CMakeLists.txt# | 20 | ||||
| l--------- | .#CMakeLists.txt | 1 | ||||
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | CMakeLists.txt | 20 | ||||
| -rw-r--r-- | src/constants.h | 7 | ||||
| -rw-r--r-- | src/entity.h | 25 | ||||
| -rw-r--r-- | src/main.c | 18 | ||||
| -rw-r--r-- | src/settings.c | 7 | ||||
| -rw-r--r-- | src/settings.h | 13 |
9 files changed, 112 insertions, 0 deletions
diff --git a/#CMakeLists.txt# b/#CMakeLists.txt# new file mode 100644 index 0000000..43a12ef --- /dev/null +++ b/#CMakeLists.txt# @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.15) +project(Simple-Platformer VERSION 1.0.0) + +find_package(raylib REQUIRED) + +add_executable(game +#===========HEADERS=============== + "src/constants.h" + "src/settings.h" + "src/entity.h" +#===========SOURCES=============== + "src/settings.c" + "src/main.c" +) + +target_link_libraries(game PRIVATE raylib) + +if (UNIX) + target_link_libraries(game PRIVATE m) +endif() diff --git a/.#CMakeLists.txt b/.#CMakeLists.txt new file mode 120000 index 0000000..c3cc091 --- /dev/null +++ b/.#CMakeLists.txt @@ -0,0 +1 @@ +ubuntu@ubuntubox.3994:1773392748
\ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c795b05 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build
\ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..a442bb1 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.15) +project(Simple-Platformer VERSION 1.0.0) + +find_package(raylib REQUIRED) + +add_executable(game +#===========HEADERS=============== + "src/constants.h" + "src/settings.h" +#===========SOURCES=============== + "src/entity.h" + "src/settings.c" + "src/main.c" +) + +target_link_libraries(game PRIVATE raylib) + +if (UNIX) + target_link_libraries(game PRIVATE m) +endif() diff --git a/src/constants.h b/src/constants.h new file mode 100644 index 0000000..5d76d42 --- /dev/null +++ b/src/constants.h @@ -0,0 +1,7 @@ +#ifndef CONSTANTS_H_ +#define CONSTANTS_H_ + +#define WINDOW_WIDTH 800 +#define WINDOW_HEIGHT 600 + +#endif diff --git a/src/entity.h b/src/entity.h new file mode 100644 index 0000000..cbde27a --- /dev/null +++ b/src/entity.h @@ -0,0 +1,25 @@ +#ifndef ENTITY_H_ +#define ENTITY_H_ + +#include <raylib.h> +#define <stdint.h> + +enum entity_type { + Player_Entity +}; + +#define ENTITY_ACTIVE 1 +#define ENTITY_PHYSICS_ENABLED (1 << 1) + +struct entity { + enum entity_type type; + uint32_t entity_flags flags + + Vector2 position; //The position of the entity(roughly the center) + Rectangle body; +}; + +void update_entity(struct entity* entity, float dt); +void draw_entity(const struct entity* entity); + +#endif diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..e4ab80a --- /dev/null +++ b/src/main.c @@ -0,0 +1,18 @@ +#include <stdlib.h> +#include <raylib.h> +#include "settings.h" + +struct settings settings; + +int main() { + load_or_init_settings(&settings, NULL); + InitWindow(settings.window_width, settings.window_height, "Platformer"); + + while (!WindowShouldClose()) { + BeginDrawing(); + ClearBackground(RAYWHITE); + EndDrawing(); + } + + return 0; +} diff --git a/src/settings.c b/src/settings.c new file mode 100644 index 0000000..f7b2338 --- /dev/null +++ b/src/settings.c @@ -0,0 +1,7 @@ +#include "settings.h" +#include "constants.h" + +void load_or_init_settings(struct settings* settings, const char* filename) { + settings->window_width = WINDOW_WIDTH; + settings->window_height = WINDOW_HEIGHT; +} diff --git a/src/settings.h b/src/settings.h new file mode 100644 index 0000000..15574be --- /dev/null +++ b/src/settings.h @@ -0,0 +1,13 @@ +#ifndef SETTINGS_H_ +#define SETTINGS_H_ + +#include <raylib.h> + +struct settings { + int window_width; + int window_height; +}; + +void load_or_init_settings(struct settings* settings, const char* filename); + +#endif |
