diff options
| -rw-r--r-- | src/constants.h | 1 | ||||
| -rw-r--r-- | src/main.c | 17 | ||||
| -rw-r--r-- | src/star.h | 8 |
3 files changed, 26 insertions, 0 deletions
diff --git a/src/constants.h b/src/constants.h new file mode 100644 index 0000000..ecd5b1f --- /dev/null +++ b/src/constants.h @@ -0,0 +1 @@ +#define STAR_AMOUNT 1000 @@ -1,6 +1,15 @@ +#include "constants.h" #include "raylib.h" +#include "star.h" int main(int argc, char *argv[]) { + Star *stars[STAR_AMOUNT] = {}; + + for (int i = 0; i < STAR_AMOUNT; i++) { + Star star = {{0, 0, 0}, {20, 20}, 1.0, BLACK}; + stars[i] = ☆ + } + InitWindow(800, 600, "hyperspace (demo)"); SetTargetFPS(60); @@ -10,6 +19,14 @@ int main(int argc, char *argv[]) { ClearBackground(WHITE); DrawText("hi world!", GetScreenWidth() / 2.0 - 16 * 4, GetScreenHeight() / 2.0 - 16, 32, BLACK); + + for (int i = 0; i < sizeof(stars) / sizeof(stars[0]); i++) { + Star *star = stars[i]; + + DrawRectangle(star->position.x, star->position.y, star->size.x, + star->size.y, star->color); + } + EndDrawing(); } diff --git a/src/star.h b/src/star.h new file mode 100644 index 0000000..bc215ee --- /dev/null +++ b/src/star.h @@ -0,0 +1,8 @@ +#include "raylib.h" + +typedef struct Star { + Vector3 position; + Vector2 size; + float velocity; + Color color; +} Star; |
