Loading...
Searching...
No Matches
view.h
Go to the documentation of this file.
#ifndef ARC_GRAPHICS_VIEW_H_
#define ARC_GRAPHICS_VIEW_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "arc/graphics/renderer.h"
#include "arc/math/rectangle.h"
typedef struct ARC_View {
ARC_Renderer *renderer;
ARC_Rect bounds;
} ARC_View;
/**
* @brief a function for ARC_View where contents of the function will be rendered within a view
*
* @param data data to be used within ARC_View_RenderFn
*/
typedef void (* ARC_View_RenderFn)(void *data);
/**
* @brief creates ARC_View type
*
* @param view ARC_View to initialize
* @param renderer ARC_Renderer the view will render to
* @param bounds ARC_Rect bounds of the view within the renderer
*/
void ARC_View_Create(ARC_View **view, ARC_Renderer *renderer, ARC_Rect bounds);
/**
* @brief destroys ARC_View type
*/
void ARC_View_Destroy(ARC_View *view);
/**
* @brief renders callbacks contents within an ARC_View
*
* @param view ARC_View to be renedered to
* @param renderFn function which contents will render to given ARC_View
* @param data data to be used in renderFn
*/
void ARC_View_Render(ARC_View *view, ARC_View_RenderFn renderFn, void *data);
/**
* @brief gets bounds from ARC_View type
*
* @param view ARC_View to get bounds from
*
* @return bounds of the view
*/
ARC_Rect ARC_View_GetBounds(ARC_View *view);
#ifdef __cplusplus
}
#endif
#endif // !ARC_GRAPHICS_VIEW_H_
ARC_View
struct ARC_View ARC_View
ARC_View_GetBounds
ARC_Rect ARC_View_GetBounds(ARC_View *view)
gets bounds from ARC_View type
ARC_View_Render
void ARC_View_Render(ARC_View *view, ARC_View_RenderFn renderFn, void *data)
renders callbacks contents within an ARC_View
ARC_View_Destroy
void ARC_View_Destroy(ARC_View *view)
destroys ARC_View type
ARC_View_Create
void ARC_View_Create(ARC_View **view, ARC_Renderer *renderer, ARC_Rect bounds)
creates ARC_View type
ARC_View_RenderFn
void(* ARC_View_RenderFn)(void *data)
a function for ARC_View where contents of the function will be rendered within a view
Definition view.h:21
rectangle.h
renderer.h
ARC_Renderer
struct ARC_RendererType ARC_Renderer
Definition renderer.h:16
ARC_Rect
Definition rectangle.h:12
ARC_View
Definition view.h:11
ARC_View::renderer
ARC_Renderer * renderer
Definition view.h:12
ARC_View::bounds
ARC_Rect bounds
Definition view.h:13