Experimento con emscripten y SDL
#include "engine.h"12void background_render_handler(actor *a)3{4background_actor *bg = (background_actor *)a;56sprite_render(&(bg->background_sprite));7SDL_Rect dest = {.x = 0, .y = 0, .w = eng.grid_width * TILE_DIMENSION, .h = STATUS_BAR_HEIGHT * TILE_DIMENSION};8SDL_RenderCopy (eng.renderer, bg->status_bar, NULL, &dest);910SDL_QueryTexture(bg->status_text,11NULL, NULL, &dest.w, &dest.h);12dest.x = 80;13dest.y = 20;14SDL_RenderCopy (eng.renderer, bg->status_text, NULL, &dest);15}1617background_actor *background_actor_init(background_actor *bg)18{19actor_init(&bg->a, background_render_handler, NULL);20sprite_init(21&bg->background_sprite,22eng.grid_width * TILE_DIMENSION,23eng.grid_height * TILE_DIMENSION,24&eng.sand_decal);25bg->background_sprite.r[0] = 0;26bg->background_sprite.r[1] = STATUS_BAR_HEIGHT * TILE_DIMENSION;2728bg->status_bar = eng.textures[STATUS_BAR_TEXTURE]; // SDL_CreateTextureFromSurface(eng.renderer, status_surface);2930bg->font = TTF_OpenFont(STATUS_TEXT_FONT, STATUS_TEXT_SIZE);31background_actor_update_scoreboard(bg);3233return bg;34}3536background_actor *background_actor_update_scoreboard(background_actor *bg)37{38SDL_Color fg={93,93,93,255};39char msg[201];40sprintf(msg, "score: %02u", eng.score);41SDL_Surface *status_text_surface = TTF_RenderText_Blended(bg->font, msg, fg);42bg->status_text = SDL_CreateTextureFromSurface(eng.renderer, status_text_surface);43SDL_FreeSurface(status_text_surface);4445return bg;46}474849