Fixed an issue with clipping the render rectangle
This commit is contained in:
1 parent
2eb8d83dc0
commit
c1659dcf88
5 files changed
+99
-39
No files matched your search
@@ -3,8 +3,8 @@
|
||||
|
||||
#include "AssetManager.h"
|
||||
#include "ObjectStore.h"
|
||||
#include "Renderer.h"
|
||||
#include "SDL_pixels.h"
|
||||
#include "SDL_rect.h"
|
||||
#include "Window.h"
|
||||
#include "reusable_ids.h"
|
||||
#include <stdbool.h>
|
||||
@@ -61,15 +61,16 @@ WindowSize get_window_real_size();
|
||||
*/
|
||||
WindowDrawingArea get_window_drawing_area();
|
||||
|
||||
void fill_rectangle(float x, float y, float w, float h, SDL_Color color);
|
||||
void fill_rectangle(RenderRect rect, SDL_Color color);
|
||||
|
||||
/**
|
||||
* Ensures that a rendered rectangle is clipped to the drawing area when it is
|
||||
* smaller than the actual size of the window.
|
||||
*/
|
||||
void clip_render_rect_to_drawing_area(SDL_FRect *rect);
|
||||
void clip_source_rect_to_drawing_area(RenderRect *src, RenderRect *dest);
|
||||
|
||||
void render_texture_asset(AssetID id, float x, float y, float w, float h);
|
||||
RenderRect get_texture_asset_rect(AssetID id);
|
||||
void render_texture_asset(AssetID id, RenderRect *src, RenderRect *dest);
|
||||
void render_text_with_font_asset(AssetID id, const char *text, float x,
|
||||
float y);
|
||||
void set_font_asset_size(AssetID id, uint32_t size);
|
||||
|
||||
+11
-4
@@ -14,6 +14,13 @@ extern "C" {
|
||||
|
||||
typedef struct renderer Renderer;
|
||||
|
||||
typedef struct {
|
||||
float x;
|
||||
float y;
|
||||
float width;
|
||||
float height;
|
||||
} RenderRect;
|
||||
|
||||
/**
|
||||
* Attempts to allocate a Renderer object on the heap.
|
||||
*
|
||||
@@ -32,10 +39,10 @@ void get_render_output_size(Renderer *renderer, int32_t *w, int32_t *h);
|
||||
void render_clear(const Renderer *renderer, SDL_Color color);
|
||||
void fill_rect(const Renderer *renderer, SDL_Color color, float x, float y,
|
||||
float w, float h);
|
||||
void render_surface(const Renderer *renderer, SDL_Surface *surface, float x,
|
||||
float y, float w, float h);
|
||||
void render_texture(const Renderer *renderer, SDL_Texture *texture, float x,
|
||||
float y, float w, float h);
|
||||
void render_surface(const Renderer *renderer, SDL_Surface *surface,
|
||||
const RenderRect *dest);
|
||||
void render_texture(const Renderer *renderer, SDL_Texture *texture,
|
||||
const RenderRect *src, const RenderRect *dest);
|
||||
void swap_buffers(const Renderer *renderer);
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user