summaryrefslogtreecommitdiff
path: root/platformer/src/render.h
blob: fd95f3b83c3039a4a14fcd9c20ff498d86183d2c (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
41
42
43
/*
 * ============================================================
 * FILE:        render.h
 *
 * PURPOSE:     Public interface for drawing a frame. Rendering only READS game
 *              state; it never changes the player, the camera or the world.
 *
 * FITS IN:     main.c calls render_init() after window_init(), render_frame()
 *              once per display frame, and render_shutdown() before
 *              window_shutdown().
 *
 * INTERFACE:   Use these exact signatures:
 *
 *   bool render_init(void);          compiles shaders, builds meshes. Returns
 *                                    false (after printing why) on failure.
 *   void render_frame(const Camera *cam, const Player *player, float aspect,
 *                     int fps);      fps is shown in the top-right corner;
 *                                    pass 0 until it has been measured
 *   void render_shutdown(void);      frees GL objects
 *
 *   Include <stdbool.h>, "camera.h", "player.h".
 *
 * CONVENTIONS: Include guard: RENDER_H.
 *
 * NOT IN SCOPE: A general renderer / scene graph, materials, textures, general
 *              text (only the FPS counter).
 *
 * DONE WHEN:   main.c can draw everything with these three calls.
 * ============================================================
 */
#ifndef RENDER_H
#define RENDER_H

#include <stdbool.h>

#include "camera.h"
#include "player.h"

bool render_init(void);
void render_frame(const Camera *cam, const Player *player, float aspect, int fps);
void render_shutdown(void);

#endif /* RENDER_H */