| Line |
Branch |
Exec |
Source |
| 1 |
|
|
/* |
| 2 |
|
|
* Filename: system_reset_game_clock.c |
| 3 |
|
|
* Path: sources/System |
| 4 |
|
|
* Created Date: Saturday, September 16th 2023, 4:09:34 am |
| 5 |
|
|
* Author: osvegn |
| 6 |
|
|
* |
| 7 |
|
|
* Copyright (c) 2023 our_rpg |
| 8 |
|
|
*/ |
| 9 |
|
|
|
| 10 |
|
|
#include "systems.h" |
| 11 |
|
|
#include "raylib.h" |
| 12 |
|
|
#include "vector.h" |
| 13 |
|
|
#include "world.h" |
| 14 |
|
|
#include "world_entity.h" |
| 15 |
|
|
#include "world_resource.h" |
| 16 |
|
|
#include "components.h" |
| 17 |
|
|
#ifdef __linux__ |
| 18 |
|
|
#include <sys/time.h> |
| 19 |
|
|
#endif |
| 20 |
|
|
#include "resources.h" |
| 21 |
|
|
|
| 22 |
|
✗ |
int system_reset_game_clock_constructor(system_t *system) |
| 23 |
|
|
{ |
| 24 |
|
✗ |
system->type = S_RESET_GAME_CLOCK; |
| 25 |
|
✗ |
system->run = &system_reset_game_clock; |
| 26 |
|
✗ |
system->active = true; |
| 27 |
|
✗ |
return 0; |
| 28 |
|
|
} |
| 29 |
|
|
|
| 30 |
|
✗ |
int system_reset_game_clock(void *world) |
| 31 |
|
|
{ |
| 32 |
|
|
#ifdef __linux__ |
| 33 |
|
|
struct timeval new; |
| 34 |
|
✗ |
resource_t *game_clock = world_get_resource_by_type(world, R_GAME_CLOCK); |
| 35 |
|
|
|
| 36 |
|
✗ |
gettimeofday(&new, NULL); |
| 37 |
|
✗ |
resource_game_clock_set(game_clock, &new); |
| 38 |
|
|
#endif |
| 39 |
|
✗ |
return 0; |
| 40 |
|
|
} |
| 41 |
|
|
|