GoldFish Engine
Quite simple and lightweight game engine
Loading...
Searching...
No Matches
gf_texture.c
1
#define GF_EXPOSE_TEXTURE
2
#define GF_EXPOSE_DRAW_DRIVER
3
4
#include <
gf_pre.h
>
5
6
/* External library */
7
8
/* Interface */
9
#include <
gf_texture.h
>
10
11
/* Engine */
12
#include <
gf_draw_driver.h
>
13
14
/* Standard */
15
#include <stdlib.h>
16
17
gf_texture_t
* gf_texture_create(
gf_draw_t
* draw,
int
width,
int
height,
unsigned
char
* data) {
18
gf_texture_t
* texture = malloc(
sizeof
(*texture));
19
gf_draw_driver_texture_t
* ddtexture;
20
texture->
internal_width
= width;
21
texture->
internal_height
= height;
22
ddtexture = gf_draw_driver_register_texture(draw, width, height, &texture->
internal_width
, &texture->
internal_height
, data);
23
if
(ddtexture == NULL) {
24
free(texture);
25
return
NULL;
26
}
27
texture->
width
= width;
28
texture->
height
= height;
29
texture->
draw_driver_texture
= ddtexture;
30
return
texture;
31
}
32
33
void
gf_texture_destroy(
gf_texture_t
* texture) {
34
gf_draw_driver_destroy_texture(texture->
draw_driver_texture
);
35
free(texture);
36
}
gf_draw_driver.h
Drawing driver.
gf_pre.h
Required headers before anything.
gf_texture.h
Texture.
gf_draw_driver_texture_t
Driver-dependent texture.
Definition
draw_driver.h:58
gf_draw_t
Drawing interface.
Definition
draw.h:108
gf_texture_t
Texture.
Definition
texture.h:49
gf_texture_t::internal_width
int internal_width
Internal width of texture.
Definition
texture.h:49
gf_texture_t::internal_height
int internal_height
Internal height of texture.
Definition
texture.h:49
gf_texture_t::draw_driver_texture
gf_draw_driver_texture_t * draw_driver_texture
Driver-dependent texture.
Definition
texture.h:49
gf_texture_t::height
int height
Height of texture.
Definition
texture.h:49
gf_texture_t::width
int width
Width of texture.
Definition
texture.h:49
gf_texture.c
Generated by
1.9.8