Skip to content

Commit 425c824

Browse files
authored
Merge pull request #4 from yellowcake-org/feature/first-frame-updates
Feature/first frame updates
2 parents d083eff + af4de19 commit 425c824

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

include/methods/methods.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#ifndef LIBYCENV_INCLUDE_METHODS_H
22
#define LIBYCENV_INCLUDE_METHODS_H
33

4-
yc_env_world_status_t yc_env_world_init(yc_res_map_t *source, yc_env_world_t **result);
4+
yc_env_world_status_t yc_env_world_initialize(yc_env_world_t *result, yc_res_map_t *map);
5+
yc_env_world_status_t yc_env_world_invalidate(yc_env_world_t *world);
6+
57
yc_env_world_status_t yc_env_world_tick(yc_env_world_t *world);
68

79
#endif //LIBYCENV_INCLUDE_METHODS_H

source/world.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
#include <libycenv.h>
22
#include <libycres.h>
33

4-
#include <stdlib.h>
4+
yc_env_world_status_t yc_env_world_initialize(yc_env_world_t *world, yc_res_map_t *map) {
5+
if (NULL == map) { return YC_ENV_STATUS_INPUT; }
6+
if (NULL == world) { return YC_ENV_STATUS_INPUT; }
57

6-
yc_env_world_status_t yc_env_world_init(yc_res_map_t *source, yc_env_world_t **result) {
7-
if (NULL == source) { return YC_ENV_STATUS_INPUT; }
8-
if (NULL == result) { return YC_ENV_STATUS_INPUT; }
8+
world->map = map;
99

10-
yc_env_world_t *world = malloc(sizeof(yc_env_world_t));
11-
if (NULL == world) { return YC_ENV_STATUS_MEM; }
10+
return YC_ENV_STATUS_OK;
11+
}
12+
13+
yc_env_world_status_t yc_env_world_invalidate(yc_env_world_t *world) {
14+
if (NULL == world) { return YC_ENV_STATUS_INPUT; }
1215

13-
world->map = source;
14-
*result = world;
16+
yc_res_map_invalidate(world->map);
1517

1618
return YC_ENV_STATUS_OK;
1719
}

0 commit comments

Comments
 (0)