GoldFish Engine
Quite simple and lightweight game engine
Loading...
Searching...
No Matches
gf_client.c
1#define GF_EXPOSE_CLIENT
2
3#include <gf_pre.h>
4
5/* External library */
6
7/* Interface */
8#include <gf_client.h>
9
10/* Engine */
11#include <gf_draw.h>
12#include <gf_log.h>
13
14/* Standard */
15#include <stdlib.h>
16#include <string.h>
17
18void gf_client_begin(void) { gf_draw_begin(); }
19
20void gf_client_end(void) { gf_draw_end(); }
21
22gf_client_t* gf_client_create(gf_engine_t* engine, const char* title) {
23 gf_client_t* client = malloc(sizeof(*client));
24 memset(client, 0, sizeof(*client));
25 client->engine = engine;
26 client->draw = gf_draw_create(engine, title);
27 if(client->draw == NULL) {
28 gf_log_function(engine, "Failed to create drawing interface", "");
29 gf_client_destroy(client);
30 return NULL;
31 }
32 return client;
33}
34
35void gf_client_destroy(gf_client_t* client) {
36 if(client->draw != NULL) gf_draw_destroy(client->draw);
37 gf_log_function(client->engine, "Destroyed client interface", "");
38 free(client);
39}
40
41int gf_client_step(gf_client_t* client) {
42 int s = gf_draw_step(client->draw);
43 return s;
44}
Client interface.
Drawing interface.
Logger.
#define gf_log_function(engine, fmt,...)
Output log with line number and function name.
Definition gf_log.h:26
Required headers before anything.
Client interface.
Definition client.h:36
gf_draw_t * draw
Drawing interface.
Definition client.h:36
gf_engine_t * engine
Engine instance.
Definition client.h:36
Engine instance.
Definition core.h:44