summaryrefslogtreecommitdiff
path: root/platformer/src/world.h
blob: 9553938b08cec73df8c4fd9142a4ecceacc9809d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
 * ============================================================
 * FILE:        world.h
 *
 * PURPOSE:     Public interface for "the level". Today the level is a blank,
 *              flat square of ground, and this API is how other modules ask
 *              questions about it.
 *
 * FITS IN:     physics.c asks for the ground height and bounds. main.c asks
 *              for the spawn point. render.c asks for the extent so it knows
 *              how big a grid to draw.
 *
 * INTERFACE:   Use these exact signatures:
 *
 *   void  world_init(void);
 *   float world_ground_height(float x, float z);
 *             Height of the ground at (x, z). Returns 0.0f for now. This is
 *             the one hook where terrain/platforms will plug in later.
 *   Vec3  world_clamp_to_bounds(Vec3 p);
 *             Returns p with x and z clamped to [-WORLD_HALF_EXTENT,
 *             +WORLD_HALF_EXTENT]. y is untouched.
 *   Vec3  world_spawn_point(void);
 *             Where the player starts / resets to: (0, 0, 0) for now.
 *   float world_half_extent(void);
 *             Returns WORLD_HALF_EXTENT (so render.c doesn't need config
 *             knowledge of the world's shape).
 *
 *   Include "math3d.h".
 *
 * CONVENTIONS: Include guard: WORLD_H.
 *
 * NOT IN SCOPE: Level files, platforms, walls, slopes, objects.
 *
 * DONE WHEN:   physics.c and render.c can be written using only this header.
 * ============================================================
 */
#ifndef WORLD_H
#define WORLD_H

#endif /* WORLD_H */