sprite gui render

This commit is contained in:
John Alanbrook 2023-05-31 17:09:02 +00:00
parent f5899b4e60
commit aa08815e7c
4 changed files with 4 additions and 9 deletions

View file

@ -52,15 +52,10 @@ endef
edirs != find source -type d -name include
subengs = sound 3d
ifeq ($(ED), 1)
subengs += editor
endif
ifeq ($(DBG), 1)
subengs += debug
endif
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
eobjects != find source/engine -type f -name '*.c' | sed -r 's|^(.*)\.c|$(objprefix)/\1.o|' # Gets all .c files and makes .o refs

View file

@ -210,11 +210,10 @@ void sprite_setanim(struct sprite *sprite, struct TexAnim *anim, int 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);
struct Texture *tex = texture_loadfromfile(img);
HMM_Vec2 pos = {x, y};
HMM_Vec2 size = {1.f, 1.f};
HMM_Vec2 size = {scale, scale};
HMM_Vec2 offset = {0.f, 0.f};
tex_draw(tex, pos, 0.f, size, offset, tex_get_rect(tex), color_white);
}

View file

@ -41,7 +41,7 @@ void sprite_draw_all();
unsigned int incrementAnimFrame(unsigned int interval, struct sprite *sprite);
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

View file

@ -2,6 +2,7 @@
layout (location = 0) in vec4 vertex;
out vec2 texcoords;
uniform mat4 proj;
uniform mat4 mpv;
void main()