int main(int argc, char** argv)
{
- playtime.room_count = 4;
-
/* TODO: Clean this up and integrate into platform system. */
+
#ifdef ENABLE_BARROWGEN
+ playtime.room_count = 4;
barrow.max_iterations *= 1;
+
IVec2 grid_size = {.x = GRID_X*2.0, .y = GRID_Y * 2.0};
GeneratorArgs gargs =
{
{
bool response = false;
-
+ resource_state = RENDER_RESOURCE_WAIT;
return response;
}
// One last synchronization so boss thread doesn't die early
pthread_barrier_wait(&barrier);
- playtime.should_quit = 1;
+ playtime.generation_finished = 1;
return _arg;
}
for (int t = 0; t < warg.worker_count; t++)
{
pthread_join(threads[t], NULL);
+ printf("Joined worker %d\n", t);
}
/* TODO: Actually this probably shouldn't be freeing resources allocated outside of the unit. */
void control_resource_wait_mode()
{
+ if (playtime.generation_finished && playtime.resources_ready)
+ {
+ resource_state++;
+ }
}
SetWindowState(FLAG_VSYNC_HINT | FLAG_WINDOW_RESIZABLE);
}
+/* Resource generation is done, but still have work to do before
+ gameplay proper can start.
+*/
void control_resource_ready_mode()
{
- if(resource_state == 1)
- {
- wait_initialize_resources();
- initialize_renderer();
- resource_state = 2;
- }
+ wait_initialize_resources();
+ initialize_renderer();
+ resource_state++;
}
/* Values that are required to initialize Raylib. */
typedef struct
{
- uint32_t should_quit;
+ bool should_quit;
+ bool generation_finished;
+ bool resources_ready;
uint32_t room_count;
Vector3 room_positions[16];
initialize(garg->worker_count, garg->rd_opts);
start(garg->worker_count, garg->rd_opts);
- while(!playtime.should_quit) {}
+ while(!playtime.generation_finished){}
//printf("Opts: {\nIterations: %d\nTime delta: %f\nDiffA: %f\nDiffB: %f\nFeed: %f\nKill: %f\n\n}\n", active_opt.max_iterations, active_opt.delta_t, active_opt.diff_a, active_opt.diff_b, active_opt.feed, active_opt.kill);
stbi_write_png(floor_albedo_name, grid_size.x*img_export_scale.x, grid_size.y*img_export_scale.y, 4, large_albedo_buffer, grid_size.x * sizeof(uint32_t)*img_export_scale.x);
cleanup();
- resource_state = 1;
+ playtime.resources_ready = 1;
return 0;
}