Skip to content

Commit

Permalink
Get rid of video_render_sprite.
Browse files Browse the repository at this point in the history
  • Loading branch information
katajakasa committed Jun 1, 2023
1 parent 7190aad commit ca7ed00
Show file tree
Hide file tree
Showing 17 changed files with 22 additions and 46 deletions.
2 changes: 1 addition & 1 deletion src/console/console.c
Expand Up @@ -313,7 +313,7 @@ void console_render() {
con->input[0] = '\0';
con->histpos_changed = 0;
}
video_render_sprite(&con->background, -1, con->ypos - 101, BLEND_ALPHA, 0);
video_draw(&con->background, -1, con->ypos - 101);
int t = con->ticks / 2;
// input line
font_render(&font_small, con->input, 0, con->ypos - 7, color_create(121, 121, 121, 255));
Expand Down
2 changes: 1 addition & 1 deletion src/game/gui/dialog.c
Expand Up @@ -76,7 +76,7 @@ void dialog_render(dialog *dlg) {
if(!dlg->visible) {
return;
}
video_render_sprite(&dlg->background, dlg->x, dlg->y, BLEND_ALPHA, 0);
video_draw(&dlg->background, dlg->x, dlg->y);
if(dlg->yes) {
component_render(dlg->yes);
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/gui/menu.c
Expand Up @@ -90,7 +90,7 @@ static void menu_render(component *c) {
// Otherwise handle this component
iterator it;
component **tmp;
video_render_sprite(m->bg, c->x, c->y, BLEND_ALPHA, 0);
video_draw(m->bg, c->x, c->y);
vector_iter_begin(&s->objs, &it);
while((tmp = iter_next(&it)) != NULL) {
component_render(*tmp);
Expand Down
2 changes: 1 addition & 1 deletion src/game/gui/pilotpic.c
Expand Up @@ -19,7 +19,7 @@ typedef struct {
static void pilotpic_render(component *c) {
pilotpic *g = widget_get_obj(c);
if(g->img != NULL) {
video_render_sprite(g->img->data, c->x, c->y, BLEND_ALPHA, 0);
video_draw(g->img->data, c->x, c->y);
}
}

Expand Down
9 changes: 4 additions & 5 deletions src/game/gui/progressbar.c
Expand Up @@ -103,17 +103,16 @@ static void progressbar_render(component *c) {
}
}

// Render backgrond (flashing or not)
// Render background (flashing or not)
if(bar->state) {
video_render_sprite(bar->background_alt, c->x, c->y, BLEND_ALPHA, 0);
video_draw(bar->background_alt, c->x, c->y);
} else {
video_render_sprite(bar->background, c->x, c->y, BLEND_ALPHA, 0);
video_draw(bar->background, c->x, c->y);
}

// Render block
if(bar->block != NULL) {
video_render_sprite(bar->block, c->x + (bar->orientation == PROGRESSBAR_LEFT ? 0 : c->w - bar->block->w + 1),
c->y, BLEND_ALPHA, 0);
video_draw(bar->block, c->x + (bar->orientation == PROGRESSBAR_LEFT ? 0 : c->w - bar->block->w + 1), c->y);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/game/gui/spritebutton.c
Expand Up @@ -31,7 +31,7 @@ static void spritebutton_render(component *c) {
video_render_sprite_flip_scale_opacity_tint(sb->img, c->x, c->y, BLEND_ALPHA, 0, 0, 1.0, 1.0, opacity,
color_create(128, 128, 128, 255));
} else if(sb->active > 0) {
video_render_sprite(sb->img, c->x, c->y, BLEND_ALPHA, 0);
video_draw(sb->img, c->x, c->y);
}
if(sb->text) {
sb->tconf.opacity = opacity;
Expand Down
2 changes: 1 addition & 1 deletion src/game/gui/spriteimage.c
Expand Up @@ -12,7 +12,7 @@ typedef struct {

static void spriteimage_render(component *c) {
spriteimage *sb = widget_get_obj(c);
video_render_sprite(sb->img, c->x, c->y, BLEND_ALPHA, 0);
video_draw(sb->img, c->x, c->y);
}

static void spriteimage_free(component *c) {
Expand Down
2 changes: 1 addition & 1 deletion src/game/gui/textbutton.c
Expand Up @@ -69,7 +69,7 @@ static void textbutton_render(component *c) {

// Border
if(tb->border_enabled) {
video_render_sprite(&tb->border, c->x - 2, c->y - 2, BLEND_ALPHA, 0);
video_draw(&tb->border, c->x - 2, c->y - 2);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/game/gui/textinput.c
Expand Up @@ -29,7 +29,7 @@ static void textinput_render(component *c) {
int chars = strlen(tb->buf);

if(tb->bg_enabled) {
video_render_sprite(&tb->sur, c->x + (c->w - tb->sur.w) / 2, c->y - 2, BLEND_ALPHA, 0);
video_draw(&tb->sur, c->x + (c->w - tb->sur.w) / 2, c->y - 2);
}

if(component_is_selected(c)) {
Expand Down
2 changes: 1 addition & 1 deletion src/game/gui/trnselect.c
Expand Up @@ -25,7 +25,7 @@ typedef struct {
static void trnselect_render(component *c) {
trnselect *g = widget_get_obj(c);

video_render_sprite(g->img->data, c->x + g->img->pos.x, c->y + g->img->pos.y, BLEND_ALPHA, 0);
video_draw(g->img->data, c->x + g->img->pos.x, c->y + g->img->pos.y);
if(g->label) {
component_render(g->label);
}
Expand Down
4 changes: 2 additions & 2 deletions src/game/objects/har.c
Expand Up @@ -926,7 +926,7 @@ void har_debug(object *obj) {
uint8_t red = 0xCF;
uint8_t blank = 0;

// video_render_sprite(&h->cd_debug, 0, 0, 0, 0);
// video_draw(&h->cd_debug, 0, 0);

if(obj->cur_sprite == NULL) {
return;
Expand Down Expand Up @@ -977,7 +977,7 @@ void har_debug(object *obj) {
image_set_pixel(&img, pos_a.x, pos_a.y, red);

surface_force_refresh(&h->cd_debug); // Force refresh for the texture
video_render_sprite(&h->cd_debug, 0, 0, 0, 0);
video_draw(&h->cd_debug, 0, 0);
}
#endif // DEBUGMODE

Expand Down
2 changes: 1 addition & 1 deletion src/game/scenes/arena.c
Expand Up @@ -1137,7 +1137,7 @@ void arena_render_overlay(scene *scene) {
// Render menu (if visible)
if(local->menu_visible) {
guiframe_render(local->game_menu);
video_render_sprite(&local->sur, 10, 150, BLEND_ALPHA, 0);
video_draw(&local->sur, 10, 150);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/game/scenes/melee.c
Expand Up @@ -437,8 +437,8 @@ void melee_render(scene *scene) {
int current_b = 5 * local->row_b + local->column_b;

if(local->selection == 0) {
video_render_sprite(&local->feh, 70, 0, BLEND_ALPHA, 0);
video_render_sprite(&local->bleh, 0, 62, BLEND_ALPHA, 0);
video_draw(&local->feh, 70, 0);
video_draw(&local->bleh, 0, 62);

// player bio
font_render_wrapped_shadowed(&font_small, lang_get(135 + current_a), 4, 66, 152, COLOR_GREEN,
Expand All @@ -455,8 +455,8 @@ void melee_render(scene *scene) {
component_render(local->bar_endurance[0]);

if(player2->selectable) {
video_render_sprite(&local->feh, 320 - 70 - local->feh.w, 0, BLEND_ALPHA, 0);
video_render_sprite(&local->bleh, 320 - local->bleh.w, 62, BLEND_ALPHA, 0);
video_draw(&local->feh, 320 - 70 - local->feh.w, 0);
video_draw(&local->bleh, 320 - local->bleh.w, 62);
// player bio
font_render_wrapped_shadowed(&font_small, lang_get(135 + current_b), 320 - local->bleh.w + 4, 66, 152,
COLOR_GREEN, TEXT_SHADOW_RIGHT | TEXT_SHADOW_BOTTOM);
Expand Down
2 changes: 1 addition & 1 deletion src/game/scenes/newsroom.c
Expand Up @@ -138,7 +138,7 @@ void newsroom_overlay_render(scene *scene) {

// Render text
if(str_size(&local->news_str) > 0) {
video_render_sprite(&local->news_bg, 20, 140, BLEND_ALPHA, 0);
video_draw(&local->news_bg, 20, 140);
font_render_wrapped(&font_small, str_c(&local->news_str), 30, 150, 250, COLOR_YELLOW);
}

Expand Down
2 changes: 1 addition & 1 deletion src/game/scenes/vs.c
Expand Up @@ -265,7 +265,7 @@ void vs_render(scene *scene) {

if(player2->selectable) {
// arena selection
video_render_sprite(&local->arena_select_bg, 55, 150, BLEND_ALPHA, 0);
video_draw(&local->arena_select_bg, 55, 150);

object_render(&local->arena_select);

Expand Down
12 changes: 0 additions & 12 deletions src/video/video.c
Expand Up @@ -304,18 +304,6 @@ void video_render_sprite_tint(surface *sur, int sx, int sy, color c, int pal_off
video_render_sprite_flip_scale_opacity_tint(sur, sx, sy, BLEND_ALPHA, pal_offset, FLIP_NONE, 1.0f, 1.0f, 255, c);
}

// Wrapper
void video_render_sprite(surface *sur, int sx, int sy, VIDEO_BLEND_MODE blend_mode, int pal_offset) {
video_render_sprite_flip_scale_opacity(sur, sx, sy, blend_mode, pal_offset, FLIP_NONE, 1.0f, 1.0f, 255);
}

void video_render_sprite_flip_scale_opacity(surface *sur, int sx, int sy, VIDEO_BLEND_MODE blend_mode, int pal_offset,
unsigned int flip_mode, float x_percent, float y_percent, uint8_t opacity) {

video_render_sprite_flip_scale_opacity_tint(sur, sx, sy, blend_mode, pal_offset, flip_mode, x_percent, y_percent,
opacity, color_create(0xFF, 0xFF, 0xFF, 0xFF));
}

void video_render_sprite_size(surface *sur, int sx, int sy, int sw, int sh) {
SDL_Rect dst;
dst.w = sw;
Expand Down
11 changes: 0 additions & 11 deletions src/video/video.h
Expand Up @@ -19,11 +19,6 @@ void video_reinit_renderer();
void video_get_state(int *w, int *h, int *fs, int *vsync);
void video_move_target(int x, int y);

/**
* @deprecated
*/
void video_render_sprite(surface *sur, int x, int y, VIDEO_BLEND_MODE blend_mode, int pal_offset);

/**
* @deprecated
*/
Expand All @@ -34,12 +29,6 @@ void video_render_sprite_size(surface *sur, int sx, int sy, int sw, int sh);
*/
void video_render_sprite_tint(surface *sur, int x, int y, color c, int pal_offset);

/**
* @deprecated
*/
void video_render_sprite_flip_scale_opacity(surface *sur, int x, int y, VIDEO_BLEND_MODE blend_mode, int pal_offset,
unsigned int flip_mode, float x_percent, float y_percent, uint8_t opacity);

/**
* @deprecated
*/
Expand Down

0 comments on commit ca7ed00

Please sign in to comment.