sprite gui render
This commit is contained in:
parent
f5899b4e60
commit
aa08815e7c
5
Makefile
5
Makefile
|
@ -52,15 +52,10 @@ endef
|
||||||
edirs != find source -type d -name include
|
edirs != find source -type d -name include
|
||||||
subengs = sound 3d
|
subengs = sound 3d
|
||||||
|
|
||||||
ifeq ($(ED), 1)
|
|
||||||
subengs += editor
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(DBG), 1)
|
ifeq ($(DBG), 1)
|
||||||
subengs += debug
|
subengs += debug
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
edirs += source/engine $(addprefix source/engine/, $(subengs)) source/engine/thirdparty/Nuklear
|
edirs += source/engine $(addprefix source/engine/, $(subengs)) source/engine/thirdparty/Nuklear
|
||||||
ehead != find source/engine source/engine/sound source/engine/debug source/engine/editor -maxdepth 1 -type f -name *.h
|
ehead != find source/engine source/engine/sound source/engine/debug source/engine/editor -maxdepth 1 -type f -name *.h
|
||||||
eobjects != find source/engine -type f -name '*.c' | sed -r 's|^(.*)\.c|$(objprefix)/\1.o|' # Gets all .c files and makes .o refs
|
eobjects != find source/engine -type f -name '*.c' | sed -r 's|^(.*)\.c|$(objprefix)/\1.o|' # Gets all .c files and makes .o refs
|
||||||
|
|
|
@ -210,11 +210,10 @@ void sprite_setanim(struct sprite *sprite, struct TexAnim *anim, int frame) {
|
||||||
sprite->frame = anim->st_frames[frame];
|
sprite->frame = anim->st_frames[frame];
|
||||||
}
|
}
|
||||||
|
|
||||||
void gui_draw_img(const char *img, float x, float y) {
|
void gui_draw_img(const char *img, HMM_Vec2 pos, float scale, float angle) {
|
||||||
sg_apply_pipeline(pip_sprite);
|
sg_apply_pipeline(pip_sprite);
|
||||||
struct Texture *tex = texture_loadfromfile(img);
|
struct Texture *tex = texture_loadfromfile(img);
|
||||||
HMM_Vec2 pos = {x, y};
|
HMM_Vec2 size = {scale, scale};
|
||||||
HMM_Vec2 size = {1.f, 1.f};
|
|
||||||
HMM_Vec2 offset = {0.f, 0.f};
|
HMM_Vec2 offset = {0.f, 0.f};
|
||||||
tex_draw(tex, pos, 0.f, size, offset, tex_get_rect(tex), color_white);
|
tex_draw(tex, pos, 0.f, size, offset, tex_get_rect(tex), color_white);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ void sprite_draw_all();
|
||||||
unsigned int incrementAnimFrame(unsigned int interval, struct sprite *sprite);
|
unsigned int incrementAnimFrame(unsigned int interval, struct sprite *sprite);
|
||||||
void sprite_flush();
|
void sprite_flush();
|
||||||
|
|
||||||
void gui_draw_img(const char *img, float x, float y);
|
void gui_draw_img(const char *img, HMM_Vec2 pos);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
layout (location = 0) in vec4 vertex;
|
layout (location = 0) in vec4 vertex;
|
||||||
out vec2 texcoords;
|
out vec2 texcoords;
|
||||||
|
|
||||||
|
uniform mat4 proj;
|
||||||
uniform mat4 mpv;
|
uniform mat4 mpv;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
|
|
Loading…
Reference in a new issue