Start rendering in the dod version and extract common header
This commit is contained in:
65
no_dod.c
65
no_dod.c
@@ -1,28 +1,10 @@
|
||||
#include "wapp.h"
|
||||
#include "common.h"
|
||||
#include "raylib.h"
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define WIDTH 1280
|
||||
#define HEIGHT 720
|
||||
#define HALF_WIDTH (WIDTH * 0.5f)
|
||||
#define HALF_HEIGHT (HEIGHT * 0.5f)
|
||||
#define MAX_WANDERER_DIM 8
|
||||
#define MIN_WANDERER_DIM 3
|
||||
#define MIN_ZONE_DIM 30
|
||||
#define BG_COLOR (Color){.r = 0xea, .g = 0xf2, .b = 0xe3, .a = 0xff}
|
||||
#define FG_COLOR (Color){.r = 0x42, .g = 0x4C, .b = 0x55, .a = 0xff}
|
||||
#define ZONE_COLOR (Color){.r = 0xb4, .g = 0x65, .b = 0x4a, .a = 0xff}
|
||||
#define WANDERER_COUNT 500000
|
||||
#define ZONE_COUNT 5
|
||||
#define WANDERER_SLOWDOWN_FACTOR 0.5f
|
||||
#define WANDERER_SPEEDUP_FACTOR 2.0f
|
||||
#define MSG_BUF_LEN 4096
|
||||
#define abs(A) (A < 0 ? A * -1 : A)
|
||||
#define min(A, B) (A < B ? A : B)
|
||||
#define max(A, B) (A > B ? A : B)
|
||||
|
||||
#define OBJECT_COMMON struct {Position position; Scale scale;}
|
||||
|
||||
typedef struct Position Position;
|
||||
@@ -89,31 +71,32 @@ int main(void) {
|
||||
init_slow_zone(&(zones[i]),&state);
|
||||
}
|
||||
|
||||
// while (!WindowShouldClose()) {
|
||||
// for (u64 i = 0; i < WANDERER_COUNT; ++i) {
|
||||
// move_wanderer(&(wanderers[i]), zones);
|
||||
// }
|
||||
//
|
||||
// BeginDrawing();
|
||||
//
|
||||
// ClearBackground(BG_COLOR);
|
||||
//
|
||||
// #ifndef NDEBUG
|
||||
// for (u64 i = 0; i < ZONE_COUNT; ++i) {
|
||||
// render_slow_zone(&(zones[i]));
|
||||
// }
|
||||
// #endif
|
||||
//
|
||||
// for (u64 i = 0; i < WANDERER_COUNT; ++i) {
|
||||
// render_wanderer(&(wanderers[i]));
|
||||
// }
|
||||
//
|
||||
// EndDrawing();
|
||||
// }
|
||||
|
||||
while (!WindowShouldClose()) {
|
||||
f64 time = GetTime();
|
||||
if (time >= 20.0) {
|
||||
break;
|
||||
}
|
||||
|
||||
for (u64 i = 0; i < WANDERER_COUNT; ++i) {
|
||||
move_wanderer(&(wanderers[i]), zones);
|
||||
}
|
||||
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(BG_COLOR);
|
||||
|
||||
#ifndef NDEBUG
|
||||
for (u64 i = 0; i < ZONE_COUNT; ++i) {
|
||||
render_slow_zone(&(zones[i]));
|
||||
}
|
||||
#endif
|
||||
|
||||
for (u64 i = 0; i < WANDERER_COUNT; ++i) {
|
||||
render_wanderer(&(wanderers[i]));
|
||||
}
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
EndDrawing();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user