mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2024-12-05 00:38:00 +01:00
utils: add transform-aware clipping rectangle functions
This commit is contained in:
parent
43c830bf99
commit
b84727bff0
2 changed files with 15 additions and 1 deletions
12
src/utils.c
12
src/utils.c
|
@ -613,6 +613,18 @@ SYMBOL_EXPORT void SetFramebufferAsTarget(struct Game* game) {
|
|||
}
|
||||
}
|
||||
|
||||
SYMBOL_EXPORT void SetClippingRectangle(int x, int y, int width, int height) {
|
||||
ALLEGRO_TRANSFORM transform = *al_get_current_transform();
|
||||
float nx = x, ny = y, nx2 = x + width, ny2 = y + height;
|
||||
al_transform_coordinates(&transform, &nx, &ny);
|
||||
al_transform_coordinates(&transform, &nx2, &ny2);
|
||||
al_set_clipping_rectangle(nx, ny, nx2 - nx, ny2 - ny);
|
||||
}
|
||||
|
||||
SYMBOL_EXPORT void ResetClippingRectangle(void) {
|
||||
al_reset_clipping_rectangle();
|
||||
}
|
||||
|
||||
SYMBOL_EXPORT ALLEGRO_BITMAP* CreateNotPreservedBitmap(int width, int height) {
|
||||
int flags = al_get_new_bitmap_flags();
|
||||
//al_set_new_bitmap_depth(24);
|
||||
|
|
|
@ -72,9 +72,11 @@ void SetupViewport(struct Game* game);
|
|||
void WindowCoordsToViewport(struct Game* game, int* x, int* y);
|
||||
|
||||
ALLEGRO_BITMAP* GetFramebuffer(struct Game* game);
|
||||
|
||||
void SetFramebufferAsTarget(struct Game* game);
|
||||
|
||||
void SetClippingRectangle(int x, int y, int width, int height);
|
||||
void ResetClippingRectangle(void);
|
||||
|
||||
ALLEGRO_BITMAP* CreateNotPreservedBitmap(int width, int height);
|
||||
|
||||
void EnableCompositor(struct Game* game, void compositor(struct Game* game, struct Gamestate* gamestates, ALLEGRO_BITMAP* loading_fb));
|
||||
|
|
Loading…
Reference in a new issue