some rumina hacks

This commit is contained in:
Sebastian Krzyszkowiak 2017-12-15 01:49:07 +01:00
parent 66818031ed
commit b1a0b814b8
4 changed files with 9 additions and 1 deletions

View file

@ -115,6 +115,7 @@ SYMBOL_EXPORT void RegisterSpritesheet(struct Game* game, struct Character* char
s->rows = strtol(al_get_config_value(config, "", "rows"), NULL, 10);
s->blanks = strtol(al_get_config_value(config, "", "blanks"), NULL, 10);
s->delay = strtod(al_get_config_value(config, "", "delay"), NULL);
s->flip = false;
const char* val = al_get_config_value(config, "", "repeat");
if (val) {
s->repeat = strtod(val, NULL);
@ -256,6 +257,9 @@ SYMBOL_EXPORT void DrawScaledCharacter(struct Game* game, struct Character* char
}
SYMBOL_EXPORT void DrawCharacter(struct Game* game, struct Character* character, ALLEGRO_COLOR tint, int flags) {
if (character->spritesheet->flip) {
flags = flags | ALLEGRO_FLIP_HORIZONTAL | ALLEGRO_FLIP_VERTICAL;
}
DrawScaledCharacter(game, character, tint, 1, 1, flags);
}

View file

@ -37,6 +37,7 @@ struct Spritesheet {
int delay;
bool kill;
int repeat;
bool flip;
float scale; /*!< Scale modifier of the frame. */
char* successor; /*!< Name of animation successor. If it's not blank, then animation will be played only once. */
struct Spritesheet* next; /*!< Next spritesheet in the queue. */

View file

@ -297,6 +297,7 @@ SYMBOL_INTERNAL void libsuperderpy_mainloop_exit(struct Game* game) {
SYMBOL_INTERNAL void libsuperderpy_mainloop(void* g) {
struct Game* game = (struct Game*)g;
redraw = true;
while (!al_is_event_queue_empty(game->_priv.event_queue) || redraw) {
#else
bool redraw = false;
@ -478,9 +479,9 @@ SYMBOL_INTERNAL void libsuperderpy_mainloop(void* g) {
al_attach_mixer_to_voice(game->audio.mixer, game->audio.v);
al_resume_timer(game->_priv.timer);
} else if (ev.type == ALLEGRO_EVENT_DISPLAY_RESIZE) {
al_acknowledge_resize(game->display);
SetupViewport(game, game->viewport_config);
ResizeGamestates(game);
al_acknowledge_resize(game->display);
}
#ifdef ALLEGRO_ANDROID
else if ((ev.type == ALLEGRO_EVENT_KEY_CHAR) && ((ev.keyboard.keycode == ALLEGRO_KEY_MENU) || (ev.keyboard.keycode == ALLEGRO_KEY_TILDE) || (ev.keyboard.keycode == ALLEGRO_KEY_BACKQUOTE))) {

View file

@ -472,11 +472,13 @@ SYMBOL_EXPORT ALLEGRO_BITMAP* CreateNotPreservedBitmap(int width, int height) {
}
SYMBOL_EXPORT void EnableCompositor(struct Game* game) {
PrintConsole(game, "Compositor enabled.");
game->handlers.compositor = SimpleCompositor;
ResizeGamestates(game);
}
SYMBOL_EXPORT void DisableCompositor(struct Game* game) {
PrintConsole(game, "Compositor disabled.");
game->handlers.compositor = NULL;
ResizeGamestates(game);
}