aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gameplay.cpp23
-rw-r--r--src/gameplay.hpp27
-rw-r--r--src/main.cpp58
-rw-r--r--src/window.cpp11
-rw-r--r--src/window.hpp15
5 files changed, 134 insertions, 0 deletions
diff --git a/src/gameplay.cpp b/src/gameplay.cpp
new file mode 100644
index 0000000..4368954
--- /dev/null
+++ b/src/gameplay.cpp
@@ -0,0 +1,23 @@
+#include "gameplay.hpp"
+
+Enemy::Enemy(void)
+{
+ posX = GetRandomValue(0, SCREENWIDTH);
+ posY = GetRandomValue(0, SCREENHEIGHT);
+ direction = (Vector2){posX, posY};
+}
+
+Enemy::~Enemy() {}
+Game::~Game() {}
+
+Game::Game(void)
+{
+ nEnemies = GetRandomValue(0, 15);
+
+ enemies = new Enemy[15];
+}
+
+void Game::start() const
+{
+
+}
diff --git a/src/gameplay.hpp b/src/gameplay.hpp
new file mode 100644
index 0000000..3b611fe
--- /dev/null
+++ b/src/gameplay.hpp
@@ -0,0 +1,27 @@
+#ifndef GAMEPLAY_H_
+#define GAMEPLAY_H_
+
+#include "window.hpp"
+
+class Enemy {
+ float posX;
+ float posY;
+ Vector2 direction;
+ public:
+ Enemy();
+ ~Enemy();
+};
+
+class Game {
+ int nEnemies;
+
+ Enemy * enemies;
+
+ public:
+ Game();
+ ~Game();
+
+ void start() const ;
+};
+
+#endif // GAMEPLAY_H_
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..f5a27af
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,58 @@
+#include "window.hpp"
+#include "gameplay.hpp"
+#include <iostream>
+
+gameState gs = TITLE;
+
+Game* game = new Game;
+
+int main(void) {
+ initWindow();
+
+ // Main game loop
+ while (!WindowShouldClose()) /* Detect window close button or ESC key */
+ {
+ switch (gs) {
+ case (TITLE):
+ {
+ if (IsKeyPressed(KEY_ENTER))
+ {
+ gs = GAMEPLAY;
+ }
+ break ;
+ }
+ case (GAMEPLAY):
+ {
+ break ;
+ }
+ case (ENDING):
+ {
+ break ;
+ }
+ }
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ switch (gs) {
+ case (TITLE):
+ {
+ DrawText("LOGO SCREEN", 20, 20, 40, LIGHTGRAY);
+ break ;
+ }
+ case (GAMEPLAY):
+ {
+ game->start();
+ break ;
+ }
+ case (ENDING):
+ {
+ DrawText("GOOD BYE SCREEN", 20, 20, 40, LIGHTGRAY);
+ break ;
+ }
+ }
+ EndDrawing();
+ }
+ CloseWindow();
+ return 0;
+}
diff --git a/src/window.cpp b/src/window.cpp
new file mode 100644
index 0000000..17731c0
--- /dev/null
+++ b/src/window.cpp
@@ -0,0 +1,11 @@
+#include "window.hpp"
+
+int
+initWindow(void) {
+ // Initialization
+ InitWindow(SCREENWIDTH, SCREENHEIGHT, "WIP -- coolspace");
+ InitAudioDevice();
+ SetTargetFPS(60);
+
+ return (0);
+}
diff --git a/src/window.hpp b/src/window.hpp
new file mode 100644
index 0000000..82abd2a
--- /dev/null
+++ b/src/window.hpp
@@ -0,0 +1,15 @@
+#ifndef WINDOW_H_
+#define WINDOW_H_
+
+#include "raylib.h"
+
+int initWindow(void);
+
+#define SCREENWIDTH 800
+#define SCREENHEIGHT 450
+
+typedef enum gameState {
+TITLE = 0, GAMEPLAY, ENDING
+} gameState ;
+
+#endif // WINDOW_H_