Text Practice Mode
Programming : starset game engine piece of code [C / SFML]
created Sep 15th 2020, 10:04 by Fosowl
2
67 words
7 completed
5
Rating visible after 3 or more votes
00:00
void starset_entities_render_single(entities_t *copy, sfRenderWindow *window)
{
float rotation = 0.0f;
int height = (int)copy->aspect->sheet->rect.height / 2;
int width = (int)copy->aspect->sheet->rect.width / 2;
copy->size.x = width;
copy->size.y = height;
if (copy->aspect == NULL || copy->aspect->sprite == NULL) {
put_err("NULL aspect for entities when rendering");
return;
}
sfSprite_setOrigin(copy->aspect->sprite, (sfVector2f){width, height});
sfSprite_setTextureRect(copy->aspect->sprite, copy->aspect->sheet->rect);
sfSprite_setPosition(copy->aspect->sprite, copy->spot);
rotation = copy->angle + copy->aspect->rotation;
sfSprite_setRotation(copy->aspect->sprite, rotation);
if (copy->visible == true)
sfRenderWindow_drawSprite(window, copy->aspect->sprite, NULL);
}
{
float rotation = 0.0f;
int height = (int)copy->aspect->sheet->rect.height / 2;
int width = (int)copy->aspect->sheet->rect.width / 2;
copy->size.x = width;
copy->size.y = height;
if (copy->aspect == NULL || copy->aspect->sprite == NULL) {
put_err("NULL aspect for entities when rendering");
return;
}
sfSprite_setOrigin(copy->aspect->sprite, (sfVector2f){width, height});
sfSprite_setTextureRect(copy->aspect->sprite, copy->aspect->sheet->rect);
sfSprite_setPosition(copy->aspect->sprite, copy->spot);
rotation = copy->angle + copy->aspect->rotation;
sfSprite_setRotation(copy->aspect->sprite, rotation);
if (copy->visible == true)
sfRenderWindow_drawSprite(window, copy->aspect->sprite, NULL);
}
saving score / loading statistics ...