naev 0.12.5
gatherable.h
1/*
2 * See Licensing and Copyright notice in naev.h
3 */
4#pragma once
5
6#include "commodity.h"
7#include "vec2.h"
8
14typedef struct Gatherable_ {
15 const Commodity *type;
18 double timer;
19 double lifeleng;
21 int sx;
22 int sy;
25
26/*
27 * Init/cleanup.
28 */
29int gatherable_load( void );
30void gatherable_cleanup( void );
31
32/*
33 * Gatherable objects
34 */
35int gatherable_init( const Commodity *com, const vec2 *pos, const vec2 *vel,
36 double lifeleng, int qtt, unsigned int player_only );
37void gatherable_render( void );
38int gatherable_getClosest( const vec2 *pos, double rad );
39int gatherable_getPos( vec2 *pos, vec2 *vel, int id );
40void gatherable_free( void );
41void gatherable_update( double dt );
int gatherable_getPos(vec2 *pos, vec2 *vel, int id)
Returns the position and velocity of a gatherable.
Definition gatherable.c:197
void gatherable_free(void)
Frees all the gatherables.
Definition gatherable.c:147
int gatherable_init(const Commodity *com, const vec2 *pos, const vec2 *vel, double lifeleng, int qtt, unsigned int player_only)
Initializes a gatherable object.
Definition gatherable.c:68
int gatherable_getClosest(const vec2 *pos, double rad)
Gets the closest gatherable from a given position, within a given radius.
Definition gatherable.c:173
int gatherable_load(void)
Loads the gatherable system.
Definition gatherable.c:40
void gatherable_cleanup(void)
Cleans up after the gatherable system.
Definition gatherable.c:50
void gatherable_update(double dt)
Updates all gatherable objects.
Definition gatherable.c:95
void gatherable_render(void)
Renders all the gatherables.
Definition gatherable.c:156
Represents a commodity.
Definition commodity.h:57
Represents stuff that can be gathered.
Definition gatherable.h:14
int player_only
Definition gatherable.h:23
double lifeleng
Definition gatherable.h:19
double timer
Definition gatherable.h:18
const Commodity * type
Definition gatherable.h:15
Represents a 2d vector.
Definition vec2.h:45