void physics_init() { /* init pools, maps */ pool = entitypool_new(PhysicsInfo); debug_draw_map = entitymap_new(false); /* init cpSpace */ space = cpSpaceNew(); cpSpaceSetGravity(space, cpv(0, -9.8)); /* init draw stuff */ program = gfx_create_program(data_path("phypoly.vert"), NULL, data_path("phypoly.frag")); glUseProgram(program); glGenVertexArrays(1, &vao); glBindVertexArray(vao); glGenBuffers(1, &vbo); glBindBuffer(GL_ARRAY_BUFFER, vbo); gfx_bind_vertex_attrib(program, GL_FLOAT, 2, "position", Vec2, x); }
void world_init(struct World *self) { self->components = componentStore_new(); self->entities = entitypool_new(); self->tilemap = tilemap_new(1024, 1024); }