From 30e2f2436fb1bdc688101e97f65ec1cf49ddb35d Mon Sep 17 00:00:00 2001
From: salaaad2 <arthurdurant263@gmail.com>
Date: Sun, 2 Jan 2022 20:29:46 +0100
Subject: initial commit

---
 src/gameplay.cpp | 23 ++++++++++++++++++++++
 src/gameplay.hpp | 27 ++++++++++++++++++++++++++
 src/main.cpp     | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/window.cpp   | 11 +++++++++++
 src/window.hpp   | 15 +++++++++++++++
 5 files changed, 134 insertions(+)
 create mode 100644 src/gameplay.cpp
 create mode 100644 src/gameplay.hpp
 create mode 100644 src/main.cpp
 create mode 100644 src/window.cpp
 create mode 100644 src/window.hpp

(limited to 'src')

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_
-- 
cgit v1.2.3