slider widget, tons of fixes and improvements for win32, reworked font loading.
This commit is contained in:
parent
54a0f5eb4e
commit
69f8a273f3
18 changed files with 452 additions and 90 deletions
|
|
@ -7,6 +7,13 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This function adjusts the values of the parameters that are passed to the
|
||||
* event method to match the values that are passed to the render function. */
|
||||
void pgpl_gui_widget_adjust_event_params(PGPL_GuiWidget *widget,
|
||||
PGPL_GuiTheme *theme, double *x,
|
||||
double *y, double *max_width,
|
||||
double *max_height);
|
||||
|
||||
/* This function basically subtracts margin, border and padding from the
|
||||
* max_width and max_height, and then return that through the width and height
|
||||
* pointers. */
|
||||
|
|
@ -31,6 +38,11 @@ void pgpl_gui_widget_render_full(PGPL_GuiWidget *widget,
|
|||
double x, double y, double max_width,
|
||||
double max_height);
|
||||
|
||||
/* Checks if a point is within the bounds of the area. */
|
||||
bool pgpl_gui_widget_within_area(double x, double y, double area_x,
|
||||
double area_y, double area_width,
|
||||
double area_height);
|
||||
|
||||
/* Checks if x and y lie within the visible bounds of a widget, accounting for
|
||||
* margin, border and padding and returns true or false. */
|
||||
bool pgpl_gui_widget_within_bounds(PGPL_GuiWidget *widget, PGPL_GuiTheme *theme,
|
||||
|
|
|
|||
|
|
@ -89,6 +89,30 @@ PGPL_GuiWidget *pgpl_gui_empty_widget_create(void);
|
|||
/* Destroys a empty widget. */
|
||||
void pgpl_gui_empty_widget_destroy(PGPL_GuiWidget *empty_widget);
|
||||
|
||||
/* This is the struct for a slider widget. The inversed option inverses its
|
||||
* slide direction, vertical determines if it's vertical or horizontal. The
|
||||
* bar_height is the height of the slider bar. The slide_callback gets called
|
||||
* whenever there is sliding activity. */
|
||||
typedef struct PGPL_GuiSliderWidget {
|
||||
PGPL_GuiWidget parent;
|
||||
uint32_t bar_height;
|
||||
bool inversed;
|
||||
bool vertical;
|
||||
double current_value;
|
||||
void (*slide_callback)(void *app_data, double value);
|
||||
/* Do not modify the following two attributes manually. */
|
||||
bool sliding;
|
||||
double last_pos;
|
||||
} PGPL_GuiSliderWidget;
|
||||
|
||||
/* This creates a new slider with the given properties. */
|
||||
PGPL_GuiSliderWidget *pgpl_gui_slider_widget_create(
|
||||
uint32_t bar_height, bool inversed, bool vertical, double value,
|
||||
void (*slide_callback)(void *app_data, double value));
|
||||
|
||||
/* This destorys a slider widget. */
|
||||
void pgpl_gui_slider_widget_destroy(PGPL_GuiSliderWidget *slider_widget);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -7,17 +7,24 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* These are the different supported logging levels. */
|
||||
typedef enum PGPL_LogLevel {
|
||||
PGPL_LOG_LEVEL_DEBUG,
|
||||
PGPL_LOG_LEVEL_INFO,
|
||||
PGPL_LOG_LEVEL_WARN,
|
||||
PGPL_LOG_LEVEL_ERROR,
|
||||
PGPL_LOG_LEVEL_DEBUG, /* For frequent debug prints, use this. */
|
||||
PGPL_LOG_LEVEL_INFO, /* For general info, that isn't spammed. */
|
||||
PGPL_LOG_LEVEL_WARN, /* For non-critical problems. */
|
||||
PGPL_LOG_LEVEL_ERROR, /* For critical problems that could halt the program */
|
||||
} PGPL_LogLevel;
|
||||
|
||||
/* This sets the minimum level required for a message to be displayed. */
|
||||
void pgpl_log_set_minimum_level(PGPL_LogLevel level);
|
||||
|
||||
/* This selects the file that things should be outputted to. By default this is
|
||||
* goes to stderr. */
|
||||
void pgpl_log_output_file(FILE *file);
|
||||
|
||||
/* This logs a message. This function can be used like printf. The output
|
||||
* follows the following scheme: [ERROR] <message>
|
||||
* It is also terminated by a newline. */
|
||||
void pgpl_log_message(PGPL_LogLevel level, const char *message, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -14,8 +14,9 @@ extern "C" {
|
|||
* can be any custom pointer to anything that might be needed inside of the
|
||||
* event_loop. If the user_data is not needed it can also be NULL.
|
||||
*
|
||||
* Returning false from the event_loop will close the window.
|
||||
*/
|
||||
* Returning false from the event_loop will close the window. Do not call any of
|
||||
* the window_thread functions from within the event loop, as this will cause
|
||||
* the thread to lock up. Use the window functions directly. */
|
||||
PGPL_WindowThread *pgpl_window_thread_create(
|
||||
const char *title, uint32_t width, uint32_t height, int32_t x, int32_t y,
|
||||
bool (*event_loop)(PGPL_Window *window, PGPL_WindowEventType event,
|
||||
|
|
@ -93,8 +94,7 @@ void pgpl_window_thread_reparent_to(PGPL_WindowThread *window_thread,
|
|||
* pgpl_window_get_raw_window for more information. */
|
||||
void *pgpl_window_thread_get_raw_window(PGPL_WindowThread *window_thread);
|
||||
|
||||
/* This function halts until the window_thread is destroyed. This function only
|
||||
* works once per window_thread. */
|
||||
/* This function halts until the window_thread is destroyed. */
|
||||
void pgpl_window_thread_await_destruction(PGPL_WindowThread *window_thread);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue