Ejemplo n.º 1
0
void rh_init(struct resources *r)
{
  /* TODO:  add check for malloc and createFromFile */
  r->textures = malloc(sizeof(sfTexture*) * TEXTURE_COUNT);
  for (size_t i = 0; i < TEXTURE_COUNT; ++i) {
    r->textures[i] = sfTexture_createFromFile(textures[i], NULL);
  }

  r->fonts = malloc(sizeof(sfFont*) * FONT_COUNT);
  for (size_t i = 0; i < FONT_COUNT; ++i) {
    r->fonts[i] = sfFont_createFromFile(fonts[i]);
  }
}
Ejemplo n.º 2
0
sfText *game_ui_text_builder(char *string, sfVector2f position, sfColor color,sfTextStyle style,float size)
{
  sfText *temp = sfText_create();
  if(game_ui_font == NULL)
  {
    game_ui_font = sfFont_createFromFile(FONTPATH);
    if(game_ui_font == NULL) { JNX_LOG(NULL,"Critical error loading game font, exiting!\n"); exit(1); };
  }
  sfText_setFont(temp,game_ui_font);
  sfText_setString(temp,string);
  sfText_setColor(temp,color);
  sfText_setPosition(temp,position);
  sfText_setStyle(temp,style);
  sfText_setCharacterSize(temp,size);
  return temp;
}