update zpl
parent
4ea2ba6188
commit
e056395f8f
|
@ -2,19 +2,20 @@
|
||||||
#include "zpl.h"
|
#include "zpl.h"
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#ifdef ZPL_SYSTEM_WINDOWS
|
#ifdef ZPL_SYSTEM_WINDOWS
|
||||||
|
#include <Windows.h>
|
||||||
|
|
||||||
static BOOL WINAPI _sighandler_win32_control_handler(DWORD control_type)
|
static BOOL WINAPI _sighandler_win32_control_handler(DWORD control_type)
|
||||||
{
|
{
|
||||||
switch (control_type)
|
switch (control_type)
|
||||||
{
|
{
|
||||||
case CTRL_C_EVENT:
|
case CTRL_C_EVENT:
|
||||||
case DBG_CONTROL_C:
|
case DBG_CONTROL_C:
|
||||||
platform_shutdown();
|
platform_shutdown();
|
||||||
return 0;
|
return 0;
|
||||||
case CTRL_CLOSE_EVENT:
|
case CTRL_CLOSE_EVENT:
|
||||||
case CTRL_LOGOFF_EVENT:
|
case CTRL_LOGOFF_EVENT:
|
||||||
case CTRL_BREAK_EVENT:
|
case CTRL_BREAK_EVENT:
|
||||||
case CTRL_SHUTDOWN_EVENT:
|
case CTRL_SHUTDOWN_EVENT:
|
||||||
platform_shutdown();
|
platform_shutdown();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -29,25 +30,25 @@ static void _sighandler_posix_signal_handler(int sig) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void sighandler_register() {
|
void sighandler_register() {
|
||||||
#ifdef ZPL_SYSTEM_WINDOWS
|
#ifdef ZPL_SYSTEM_WINDOWS
|
||||||
{
|
{
|
||||||
if (!SetConsoleCtrlHandler(_sighandler_win32_control_handler, 1)) {
|
if (!SetConsoleCtrlHandler(_sighandler_win32_control_handler, 1)) {
|
||||||
zpl_printf("Could not set up signal handler!\n");
|
zpl_printf("Could not set up signal handler!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else // POSIX compliant
|
#else // POSIX compliant
|
||||||
signal(SIGINT, &_sighandler_posix_signal_handler);
|
signal(SIGINT, &_sighandler_posix_signal_handler);
|
||||||
signal(SIGTERM, &_sighandler_posix_signal_handler);
|
signal(SIGTERM, &_sighandler_posix_signal_handler);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void sighandler_unregister() {
|
void sighandler_unregister() {
|
||||||
#ifdef ZPL_SYSTEM_WINDOWS
|
#ifdef ZPL_SYSTEM_WINDOWS
|
||||||
{
|
{
|
||||||
if (!SetConsoleCtrlHandler(_sighandler_win32_control_handler, 0)) {
|
if (!SetConsoleCtrlHandler(_sighandler_win32_control_handler, 0)) {
|
||||||
zpl_printf("Could not uninstall signal handler!");
|
zpl_printf("Could not uninstall signal handler!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else // POSIX compliant
|
#else // POSIX compliant
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,36 +134,36 @@
|
||||||
#define RAYGUI_VERSION "2.9-dev"
|
#define RAYGUI_VERSION "2.9-dev"
|
||||||
|
|
||||||
#if !defined(RAYGUI_STANDALONE)
|
#if !defined(RAYGUI_STANDALONE)
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Define functions scope to be used internally (static) or externally (extern) to the module including this file
|
// Define functions scope to be used internally (static) or externally (extern) to the module including this file
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
// Microsoft attibutes to tell compiler that symbols are imported/exported from a .dll
|
// Microsoft attibutes to tell compiler that symbols are imported/exported from a .dll
|
||||||
#if defined(BUILD_LIBTYPE_SHARED)
|
#if defined(BUILD_LIBTYPE_SHARED)
|
||||||
#define RAYGUIDEF __declspec(dllexport) // We are building raygui as a Win32 shared library (.dll)
|
#define RAYGUIDEF __declspec(dllexport) // We are building raygui as a Win32 shared library (.dll)
|
||||||
#elif defined(USE_LIBTYPE_SHARED)
|
#elif defined(USE_LIBTYPE_SHARED)
|
||||||
#define RAYGUIDEF __declspec(dllimport) // We are using raygui as a Win32 shared library (.dll)
|
#define RAYGUIDEF __declspec(dllimport) // We are using raygui as a Win32 shared library (.dll)
|
||||||
|
#else
|
||||||
|
#define RAYGUIDEF // We are building or using raygui as a static library
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#define RAYGUIDEF // We are building or using raygui as a static library
|
#define RAYGUIDEF // We are building or using raygui as a static library (or Linux shared library)
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#define RAYGUIDEF // We are building or using raygui as a static library (or Linux shared library)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(RAYGUI_MALLOC) && !defined(RAYGUI_CALLOC) && !defined(RAYGUI_FREE)
|
#if !defined(RAYGUI_MALLOC) && !defined(RAYGUI_CALLOC) && !defined(RAYGUI_FREE)
|
||||||
#include <stdlib.h> // Required for: malloc(), calloc(), free()
|
#include <stdlib.h> // Required for: malloc(), calloc(), free()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Allow custom memory allocators
|
// Allow custom memory allocators
|
||||||
#ifndef RAYGUI_MALLOC
|
#ifndef RAYGUI_MALLOC
|
||||||
#define RAYGUI_MALLOC(sz) malloc(sz)
|
#define RAYGUI_MALLOC(sz) malloc(sz)
|
||||||
#endif
|
#endif
|
||||||
#ifndef RAYGUI_CALLOC
|
#ifndef RAYGUI_CALLOC
|
||||||
#define RAYGUI_CALLOC(n,sz) calloc(n,sz)
|
#define RAYGUI_CALLOC(n,sz) calloc(n,sz)
|
||||||
#endif
|
#endif
|
||||||
#ifndef RAYGUI_FREE
|
#ifndef RAYGUI_FREE
|
||||||
#define RAYGUI_FREE(p) free(p)
|
#define RAYGUI_FREE(p) free(p)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
@ -179,17 +179,17 @@
|
||||||
extern "C" { // Prevents name mangling of functions
|
extern "C" { // Prevents name mangling of functions
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Types and Structures Definition
|
// Types and Structures Definition
|
||||||
// NOTE: Some types are required for RAYGUI_STANDALONE usage
|
// NOTE: Some types are required for RAYGUI_STANDALONE usage
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
#if defined(RAYGUI_STANDALONE)
|
#if defined(RAYGUI_STANDALONE)
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
// Boolean type
|
// Boolean type
|
||||||
#ifndef true
|
#ifndef true
|
||||||
typedef enum { false, true } bool;
|
typedef enum { false, true } bool;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Vector2 type
|
// Vector2 type
|
||||||
typedef struct Vector2 {
|
typedef struct Vector2 {
|
||||||
|
@ -244,264 +244,258 @@ extern "C" { // Prevents name mangling of functions
|
||||||
} Font;
|
} Font;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Style property
|
// Style property
|
||||||
typedef struct GuiStyleProp {
|
typedef struct GuiStyleProp {
|
||||||
unsigned short controlId;
|
unsigned short controlId;
|
||||||
unsigned short propertyId;
|
unsigned short propertyId;
|
||||||
int propertyValue;
|
int propertyValue;
|
||||||
} GuiStyleProp;
|
} GuiStyleProp;
|
||||||
|
|
||||||
// Gui control state
|
// Gui control state
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GUI_STATE_NORMAL = 0,
|
GUI_STATE_NORMAL = 0,
|
||||||
GUI_STATE_FOCUSED,
|
GUI_STATE_FOCUSED,
|
||||||
GUI_STATE_PRESSED,
|
GUI_STATE_PRESSED,
|
||||||
GUI_STATE_DISABLED,
|
GUI_STATE_DISABLED,
|
||||||
} GuiControlState;
|
} GuiControlState;
|
||||||
|
|
||||||
// Gui control text alignment
|
// Gui control text alignment
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GUI_TEXT_ALIGN_LEFT = 0,
|
GUI_TEXT_ALIGN_LEFT = 0,
|
||||||
GUI_TEXT_ALIGN_CENTER,
|
GUI_TEXT_ALIGN_CENTER,
|
||||||
GUI_TEXT_ALIGN_RIGHT,
|
GUI_TEXT_ALIGN_RIGHT,
|
||||||
} GuiTextAlignment;
|
} GuiTextAlignment;
|
||||||
|
|
||||||
// Gui controls
|
// Gui controls
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DEFAULT = 0,
|
DEFAULT = 0,
|
||||||
LABEL, // LABELBUTTON
|
LABEL, // LABELBUTTON
|
||||||
BUTTON, // IMAGEBUTTON
|
BUTTON, // IMAGEBUTTON
|
||||||
TOGGLE, // TOGGLEGROUP
|
TOGGLE, // TOGGLEGROUP
|
||||||
SLIDER, // SLIDERBAR
|
SLIDER, // SLIDERBAR
|
||||||
PROGRESSBAR,
|
PROGRESSBAR,
|
||||||
CHECKBOX,
|
CHECKBOX,
|
||||||
COMBOBOX,
|
COMBOBOX,
|
||||||
DROPDOWNBOX,
|
DROPDOWNBOX,
|
||||||
TEXTBOX, // TEXTBOXMULTI
|
TEXTBOX, // TEXTBOXMULTI
|
||||||
VALUEBOX,
|
VALUEBOX,
|
||||||
SPINNER,
|
SPINNER,
|
||||||
LISTVIEW,
|
LISTVIEW,
|
||||||
COLORPICKER,
|
COLORPICKER,
|
||||||
SCROLLBAR,
|
SCROLLBAR,
|
||||||
STATUSBAR
|
STATUSBAR
|
||||||
} GuiControl;
|
} GuiControl;
|
||||||
|
|
||||||
// Gui base properties for every control
|
// Gui base properties for every control
|
||||||
typedef enum {
|
typedef enum {
|
||||||
BORDER_COLOR_NORMAL = 0,
|
BORDER_COLOR_NORMAL = 0,
|
||||||
BASE_COLOR_NORMAL,
|
BASE_COLOR_NORMAL,
|
||||||
TEXT_COLOR_NORMAL,
|
TEXT_COLOR_NORMAL,
|
||||||
BORDER_COLOR_FOCUSED,
|
BORDER_COLOR_FOCUSED,
|
||||||
BASE_COLOR_FOCUSED,
|
BASE_COLOR_FOCUSED,
|
||||||
TEXT_COLOR_FOCUSED,
|
TEXT_COLOR_FOCUSED,
|
||||||
BORDER_COLOR_PRESSED,
|
BORDER_COLOR_PRESSED,
|
||||||
BASE_COLOR_PRESSED,
|
BASE_COLOR_PRESSED,
|
||||||
TEXT_COLOR_PRESSED,
|
TEXT_COLOR_PRESSED,
|
||||||
BORDER_COLOR_DISABLED,
|
BORDER_COLOR_DISABLED,
|
||||||
BASE_COLOR_DISABLED,
|
BASE_COLOR_DISABLED,
|
||||||
TEXT_COLOR_DISABLED,
|
TEXT_COLOR_DISABLED,
|
||||||
BORDER_WIDTH,
|
BORDER_WIDTH,
|
||||||
TEXT_PADDING,
|
TEXT_PADDING,
|
||||||
TEXT_ALIGNMENT,
|
TEXT_ALIGNMENT,
|
||||||
RESERVED
|
RESERVED
|
||||||
} GuiControlProperty;
|
} GuiControlProperty;
|
||||||
|
|
||||||
// Gui extended properties depend on control
|
// Gui extended properties depend on control
|
||||||
// NOTE: We reserve a fixed size of additional properties per control
|
// NOTE: We reserve a fixed size of additional properties per control
|
||||||
|
|
||||||
// DEFAULT properties
|
// DEFAULT properties
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TEXT_SIZE = 16,
|
TEXT_SIZE = 16,
|
||||||
TEXT_SPACING,
|
TEXT_SPACING,
|
||||||
LINE_COLOR,
|
LINE_COLOR,
|
||||||
BACKGROUND_COLOR,
|
BACKGROUND_COLOR,
|
||||||
} GuiDefaultProperty;
|
} GuiDefaultProperty;
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
//typedef enum { } GuiLabelProperty;
|
//typedef enum { } GuiLabelProperty;
|
||||||
|
|
||||||
// Button
|
// Button
|
||||||
//typedef enum { } GuiButtonProperty;
|
//typedef enum { } GuiButtonProperty;
|
||||||
|
|
||||||
// Toggle / ToggleGroup
|
// Toggle / ToggleGroup
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GROUP_PADDING = 16,
|
GROUP_PADDING = 16,
|
||||||
} GuiToggleProperty;
|
} GuiToggleProperty;
|
||||||
|
|
||||||
// Slider / SliderBar
|
// Slider / SliderBar
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SLIDER_WIDTH = 16,
|
SLIDER_WIDTH = 16,
|
||||||
SLIDER_PADDING
|
SLIDER_PADDING
|
||||||
} GuiSliderProperty;
|
} GuiSliderProperty;
|
||||||
|
|
||||||
// ProgressBar
|
// ProgressBar
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PROGRESS_PADDING = 16,
|
PROGRESS_PADDING = 16,
|
||||||
} GuiProgressBarProperty;
|
} GuiProgressBarProperty;
|
||||||
|
|
||||||
// CheckBox
|
// CheckBox
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CHECK_PADDING = 16
|
CHECK_PADDING = 16
|
||||||
} GuiCheckBoxProperty;
|
} GuiCheckBoxProperty;
|
||||||
|
|
||||||
// ComboBox
|
// ComboBox
|
||||||
typedef enum {
|
typedef enum {
|
||||||
COMBO_BUTTON_WIDTH = 16,
|
COMBO_BUTTON_WIDTH = 16,
|
||||||
COMBO_BUTTON_PADDING
|
COMBO_BUTTON_PADDING
|
||||||
} GuiComboBoxProperty;
|
} GuiComboBoxProperty;
|
||||||
|
|
||||||
// DropdownBox
|
// DropdownBox
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ARROW_PADDING = 16,
|
ARROW_PADDING = 16,
|
||||||
DROPDOWN_ITEMS_PADDING
|
DROPDOWN_ITEMS_PADDING
|
||||||
} GuiDropdownBoxProperty;
|
} GuiDropdownBoxProperty;
|
||||||
|
|
||||||
// TextBox / TextBoxMulti / ValueBox / Spinner
|
// TextBox / TextBoxMulti / ValueBox / Spinner
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TEXT_INNER_PADDING = 16,
|
TEXT_INNER_PADDING = 16,
|
||||||
TEXT_LINES_PADDING,
|
TEXT_LINES_PADDING,
|
||||||
COLOR_SELECTED_FG,
|
COLOR_SELECTED_FG,
|
||||||
COLOR_SELECTED_BG
|
COLOR_SELECTED_BG
|
||||||
} GuiTextBoxProperty;
|
} GuiTextBoxProperty;
|
||||||
|
|
||||||
// Spinner
|
// Spinner
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SPIN_BUTTON_WIDTH = 16,
|
SPIN_BUTTON_WIDTH = 16,
|
||||||
SPIN_BUTTON_PADDING,
|
SPIN_BUTTON_PADDING,
|
||||||
} GuiSpinnerProperty;
|
} GuiSpinnerProperty;
|
||||||
|
|
||||||
// ScrollBar
|
// ScrollBar
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ARROWS_SIZE = 16,
|
ARROWS_SIZE = 16,
|
||||||
ARROWS_VISIBLE,
|
ARROWS_VISIBLE,
|
||||||
SCROLL_SLIDER_PADDING,
|
SCROLL_SLIDER_PADDING,
|
||||||
SCROLL_SLIDER_SIZE,
|
SCROLL_SLIDER_SIZE,
|
||||||
SCROLL_PADDING,
|
SCROLL_PADDING,
|
||||||
SCROLL_SPEED,
|
SCROLL_SPEED,
|
||||||
} GuiScrollBarProperty;
|
} GuiScrollBarProperty;
|
||||||
|
|
||||||
// ScrollBar side
|
// ScrollBar side
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SCROLLBAR_LEFT_SIDE = 0,
|
SCROLLBAR_LEFT_SIDE = 0,
|
||||||
SCROLLBAR_RIGHT_SIDE
|
SCROLLBAR_RIGHT_SIDE
|
||||||
} GuiScrollBarSide;
|
} GuiScrollBarSide;
|
||||||
|
|
||||||
// ListView
|
// ListView
|
||||||
typedef enum {
|
typedef enum {
|
||||||
LIST_ITEMS_HEIGHT = 16,
|
LIST_ITEMS_HEIGHT = 16,
|
||||||
LIST_ITEMS_PADDING,
|
LIST_ITEMS_PADDING,
|
||||||
SCROLLBAR_WIDTH,
|
SCROLLBAR_WIDTH,
|
||||||
SCROLLBAR_SIDE,
|
SCROLLBAR_SIDE,
|
||||||
} GuiListViewProperty;
|
} GuiListViewProperty;
|
||||||
|
|
||||||
// ColorPicker
|
// ColorPicker
|
||||||
typedef enum {
|
typedef enum {
|
||||||
COLOR_SELECTOR_SIZE = 16,
|
COLOR_SELECTOR_SIZE = 16,
|
||||||
HUEBAR_WIDTH, // Right hue bar width
|
HUEBAR_WIDTH, // Right hue bar width
|
||||||
HUEBAR_PADDING, // Right hue bar separation from panel
|
HUEBAR_PADDING, // Right hue bar separation from panel
|
||||||
HUEBAR_SELECTOR_HEIGHT, // Right hue bar selector height
|
HUEBAR_SELECTOR_HEIGHT, // Right hue bar selector height
|
||||||
HUEBAR_SELECTOR_OVERFLOW // Right hue bar selector overflow
|
HUEBAR_SELECTOR_OVERFLOW // Right hue bar selector overflow
|
||||||
} GuiColorPickerProperty;
|
} GuiColorPickerProperty;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Global Variables Definition
|
// Global Variables Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module Functions Declaration
|
// Module Functions Declaration
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// State modification functions
|
// State modification functions
|
||||||
RAYGUIDEF void GuiEnable(void); // Enable gui controls (global state)
|
RAYGUIDEF void GuiEnable(void); // Enable gui controls (global state)
|
||||||
RAYGUIDEF void GuiDisable(void); // Disable gui controls (global state)
|
RAYGUIDEF void GuiDisable(void); // Disable gui controls (global state)
|
||||||
RAYGUIDEF void GuiLock(void); // Lock gui controls (global state)
|
RAYGUIDEF void GuiLock(void); // Lock gui controls (global state)
|
||||||
RAYGUIDEF void GuiUnlock(void); // Unlock gui controls (global state)
|
RAYGUIDEF void GuiUnlock(void); // Unlock gui controls (global state)
|
||||||
RAYGUIDEF void GuiFade(float alpha); // Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f
|
RAYGUIDEF void GuiFade(float alpha); // Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f
|
||||||
RAYGUIDEF void GuiSetState(int state); // Set gui state (global state)
|
RAYGUIDEF void GuiSetState(int state); // Set gui state (global state)
|
||||||
RAYGUIDEF int GuiGetState(void); // Get gui state (global state)
|
RAYGUIDEF int GuiGetState(void); // Get gui state (global state)
|
||||||
|
|
||||||
// Font set/get functions
|
// Font set/get functions
|
||||||
RAYGUIDEF void GuiSetFont(Font font); // Set gui custom font (global state)
|
RAYGUIDEF void GuiSetFont(Font font); // Set gui custom font (global state)
|
||||||
RAYGUIDEF Font GuiGetFont(void); // Get gui custom font (global state)
|
RAYGUIDEF Font GuiGetFont(void); // Get gui custom font (global state)
|
||||||
|
|
||||||
// Style set/get functions
|
// Style set/get functions
|
||||||
RAYGUIDEF void GuiSetStyle(int control, int property, int value); // Set one style property
|
RAYGUIDEF void GuiSetStyle(int control, int property, int value); // Set one style property
|
||||||
RAYGUIDEF int GuiGetStyle(int control, int property); // Get one style property
|
RAYGUIDEF int GuiGetStyle(int control, int property); // Get one style property
|
||||||
|
|
||||||
// Container/separator controls, useful for controls organization
|
// Container/separator controls, useful for controls organization
|
||||||
RAYGUIDEF bool GuiWindowBox(Rectangle bounds, const char *title); // Window Box control, shows a window that can be closed
|
RAYGUIDEF bool GuiWindowBox(Rectangle bounds, const char *title); // Window Box control, shows a window that can be closed
|
||||||
RAYGUIDEF void GuiGroupBox(Rectangle bounds, const char *text); // Group Box control with text name
|
RAYGUIDEF void GuiGroupBox(Rectangle bounds, const char *text); // Group Box control with text name
|
||||||
RAYGUIDEF void GuiLine(Rectangle bounds, const char *text); // Line separator control, could contain text
|
RAYGUIDEF void GuiLine(Rectangle bounds, const char *text); // Line separator control, could contain text
|
||||||
RAYGUIDEF void GuiPanel(Rectangle bounds); // Panel control, useful to group controls
|
RAYGUIDEF void GuiPanel(Rectangle bounds); // Panel control, useful to group controls
|
||||||
RAYGUIDEF Rectangle GuiScrollPanel(Rectangle bounds, Rectangle content, Vector2 *scroll); // Scroll Panel control
|
RAYGUIDEF Rectangle GuiScrollPanel(Rectangle bounds, Rectangle content, Vector2 *scroll); // Scroll Panel control
|
||||||
|
|
||||||
// Basic controls set
|
// Basic controls set
|
||||||
RAYGUIDEF void GuiLabel(Rectangle bounds, const char *text); // Label control, shows text
|
RAYGUIDEF void GuiLabel(Rectangle bounds, const char *text); // Label control, shows text
|
||||||
RAYGUIDEF bool GuiButton(Rectangle bounds, const char *text); // Button control, returns true when clicked
|
RAYGUIDEF bool GuiButton(Rectangle bounds, const char *text); // Button control, returns true when clicked
|
||||||
RAYGUIDEF bool GuiLabelButton(Rectangle bounds, const char *text); // Label button control, show true when clicked
|
RAYGUIDEF bool GuiLabelButton(Rectangle bounds, const char *text); // Label button control, show true when clicked
|
||||||
RAYGUIDEF bool GuiImageButton(Rectangle bounds, const char *text, Texture2D texture); // Image button control, returns true when clicked
|
RAYGUIDEF bool GuiImageButton(Rectangle bounds, const char *text, Texture2D texture); // Image button control, returns true when clicked
|
||||||
RAYGUIDEF bool GuiImageButtonEx(Rectangle bounds, const char *text, Texture2D texture, Rectangle texSource); // Image button extended control, returns true when clicked
|
RAYGUIDEF bool GuiImageButtonEx(Rectangle bounds, const char *text, Texture2D texture, Rectangle texSource); // Image button extended control, returns true when clicked
|
||||||
RAYGUIDEF bool GuiToggle(Rectangle bounds, const char *text, bool active); // Toggle Button control, returns true when active
|
RAYGUIDEF bool GuiToggle(Rectangle bounds, const char *text, bool active); // Toggle Button control, returns true when active
|
||||||
RAYGUIDEF int GuiToggleGroup(Rectangle bounds, const char *text, int active); // Toggle Group control, returns active toggle index
|
RAYGUIDEF int GuiToggleGroup(Rectangle bounds, const char *text, int active); // Toggle Group control, returns active toggle index
|
||||||
RAYGUIDEF bool GuiCheckBox(Rectangle bounds, const char *text, bool checked); // Check Box control, returns true when active
|
RAYGUIDEF bool GuiCheckBox(Rectangle bounds, const char *text, bool checked); // Check Box control, returns true when active
|
||||||
RAYGUIDEF int GuiComboBox(Rectangle bounds, const char *text, int active); // Combo Box control, returns selected item index
|
RAYGUIDEF int GuiComboBox(Rectangle bounds, const char *text, int active); // Combo Box control, returns selected item index
|
||||||
RAYGUIDEF bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMode); // Dropdown Box control, returns selected item
|
RAYGUIDEF bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMode); // Dropdown Box control, returns selected item
|
||||||
RAYGUIDEF bool GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode); // Spinner control, returns selected value
|
RAYGUIDEF bool GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode); // Spinner control, returns selected value
|
||||||
RAYGUIDEF bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode); // Value Box control, updates input text with numbers
|
RAYGUIDEF bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode); // Value Box control, updates input text with numbers
|
||||||
RAYGUIDEF bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode); // Text Box control, updates input text
|
RAYGUIDEF bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode); // Text Box control, updates input text
|
||||||
RAYGUIDEF bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode); // Text Box control with multiple lines
|
RAYGUIDEF bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode); // Text Box control with multiple lines
|
||||||
RAYGUIDEF float GuiSlider(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue); // Slider control, returns selected value
|
RAYGUIDEF float GuiSlider(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue); // Slider control, returns selected value
|
||||||
RAYGUIDEF float GuiSliderBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue); // Slider Bar control, returns selected value
|
RAYGUIDEF float GuiSliderBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue); // Slider Bar control, returns selected value
|
||||||
RAYGUIDEF float GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue); // Progress Bar control, shows current progress value
|
RAYGUIDEF float GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue); // Progress Bar control, shows current progress value
|
||||||
RAYGUIDEF void GuiStatusBar(Rectangle bounds, const char *text); // Status Bar control, shows info text
|
RAYGUIDEF void GuiStatusBar(Rectangle bounds, const char *text); // Status Bar control, shows info text
|
||||||
RAYGUIDEF void GuiDummyRec(Rectangle bounds, const char *text); // Dummy control for placeholders
|
RAYGUIDEF void GuiDummyRec(Rectangle bounds, const char *text); // Dummy control for placeholders
|
||||||
RAYGUIDEF int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue); // Scroll Bar control
|
RAYGUIDEF int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue); // Scroll Bar control
|
||||||
RAYGUIDEF Vector2 GuiGrid(Rectangle bounds, float spacing, int subdivs); // Grid control
|
RAYGUIDEF Vector2 GuiGrid(Rectangle bounds, float spacing, int subdivs); // Grid control
|
||||||
|
|
||||||
|
|
||||||
// Advance controls set
|
// Advance controls set
|
||||||
RAYGUIDEF int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int active); // List View control, returns selected list item index
|
RAYGUIDEF int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int active); // List View control, returns selected list item index
|
||||||
RAYGUIDEF int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, int *scrollIndex, int active); // List View with extended parameters
|
RAYGUIDEF int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, int *scrollIndex, int active); // List View with extended parameters
|
||||||
RAYGUIDEF int GuiMessageBox(Rectangle bounds, const char *title, const char *message, const char *buttons); // Message Box control, displays a message
|
RAYGUIDEF int GuiMessageBox(Rectangle bounds, const char *title, const char *message, const char *buttons); // Message Box control, displays a message
|
||||||
RAYGUIDEF int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text); // Text Input Box control, ask for text
|
RAYGUIDEF int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text); // Text Input Box control, ask for text
|
||||||
RAYGUIDEF Color GuiColorPicker(Rectangle bounds, Color color); // Color Picker control (multiple color controls)
|
RAYGUIDEF Color GuiColorPicker(Rectangle bounds, Color color); // Color Picker control (multiple color controls)
|
||||||
RAYGUIDEF Color GuiColorPanel(Rectangle bounds, Color color); // Color Panel control
|
RAYGUIDEF Color GuiColorPanel(Rectangle bounds, Color color); // Color Panel control
|
||||||
RAYGUIDEF float GuiColorBarAlpha(Rectangle bounds, float alpha); // Color Bar Alpha control
|
RAYGUIDEF float GuiColorBarAlpha(Rectangle bounds, float alpha); // Color Bar Alpha control
|
||||||
RAYGUIDEF float GuiColorBarHue(Rectangle bounds, float value); // Color Bar Hue control
|
RAYGUIDEF float GuiColorBarHue(Rectangle bounds, float value); // Color Bar Hue control
|
||||||
|
|
||||||
// Styles loading functions
|
// Styles loading functions
|
||||||
RAYGUIDEF void GuiLoadStyle(const char *fileName); // Load style file (.rgs)
|
RAYGUIDEF void GuiLoadStyle(const char *fileName); // Load style file (.rgs)
|
||||||
RAYGUIDEF void GuiLoadStyleDefault(void); // Load style default over global style
|
RAYGUIDEF void GuiLoadStyleDefault(void); // Load style default over global style
|
||||||
|
|
||||||
/*
|
/*
|
||||||
typedef GuiStyle (unsigned int *)
|
typedef GuiStyle (unsigned int *)
|
||||||
RAYGUIDEF GuiStyle LoadGuiStyle(const char *fileName); // Load style from file (.rgs)
|
RAYGUIDEF GuiStyle LoadGuiStyle(const char *fileName); // Load style from file (.rgs)
|
||||||
RAYGUIDEF void UnloadGuiStyle(GuiStyle style); // Unload style
|
RAYGUIDEF void UnloadGuiStyle(GuiStyle style); // Unload style
|
||||||
*/
|
*/
|
||||||
|
|
||||||
RAYGUIDEF const char *GuiIconText(int iconId, const char *text); // Get text with icon id prepended (if supported)
|
RAYGUIDEF const char *GuiIconText(int iconId, const char *text); // Get text with icon id prepended (if supported)
|
||||||
|
|
||||||
#if defined(RAYGUI_SUPPORT_ICONS)
|
#if defined(RAYGUI_SUPPORT_ICONS)
|
||||||
// Gui icons functionality
|
// Gui icons functionality
|
||||||
RAYGUIDEF void GuiDrawIcon(int iconId, Vector2 position, int pixelSize, Color color);
|
RAYGUIDEF void GuiDrawIcon(int iconId, Vector2 position, int pixelSize, Color color);
|
||||||
|
|
||||||
RAYGUIDEF unsigned int *GuiGetIcons(void); // Get full icons data pointer
|
RAYGUIDEF unsigned int *GuiGetIcons(void); // Get full icons data pointer
|
||||||
RAYGUIDEF unsigned int *GuiGetIconData(int iconId); // Get icon bit data
|
RAYGUIDEF unsigned int *GuiGetIconData(int iconId); // Get icon bit data
|
||||||
RAYGUIDEF void GuiSetIconData(int iconId, unsigned int *data); // Set icon bit data
|
RAYGUIDEF void GuiSetIconData(int iconId, unsigned int *data); // Set icon bit data
|
||||||
|
|
||||||
RAYGUIDEF void GuiSetIconPixel(int iconId, int x, int y); // Set icon pixel value
|
RAYGUIDEF void GuiSetIconPixel(int iconId, int x, int y); // Set icon pixel value
|
||||||
RAYGUIDEF void GuiClearIconPixel(int iconId, int x, int y); // Clear icon pixel value
|
RAYGUIDEF void GuiClearIconPixel(int iconId, int x, int y); // Clear icon pixel value
|
||||||
RAYGUIDEF bool GuiCheckIconPixel(int iconId, int x, int y); // Check icon pixel value
|
RAYGUIDEF bool GuiCheckIconPixel(int iconId, int x, int y); // Check icon pixel value
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
} // Prevents name mangling of functions
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // RAYGUI_H
|
|
||||||
|
|
||||||
/***********************************************************************************
|
/***********************************************************************************
|
||||||
*
|
*
|
||||||
* RAYGUI IMPLEMENTATION
|
* RAYGUI IMPLEMENTATION
|
||||||
|
@ -511,8 +505,8 @@ extern "C" { // Prevents name mangling of functions
|
||||||
#if defined(RAYGUI_IMPLEMENTATION)
|
#if defined(RAYGUI_IMPLEMENTATION)
|
||||||
|
|
||||||
#if defined(RAYGUI_SUPPORT_ICONS)
|
#if defined(RAYGUI_SUPPORT_ICONS)
|
||||||
#define RICONS_IMPLEMENTATION
|
#define RICONS_IMPLEMENTATION
|
||||||
#include "ricons.h" // Required for: raygui icons data
|
#include "ricons.h" // Required for: raygui icons data
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h> // Required for: FILE, fopen(), fclose(), fprintf(), feof(), fscanf(), vsprintf()
|
#include <stdio.h> // Required for: FILE, fopen(), fclose(), fprintf(), feof(), fscanf(), vsprintf()
|
||||||
|
@ -520,13 +514,13 @@ extern "C" { // Prevents name mangling of functions
|
||||||
#include <math.h> // Required for: roundf() on GuiColorPicker()
|
#include <math.h> // Required for: roundf() on GuiColorPicker()
|
||||||
|
|
||||||
#if defined(RAYGUI_STANDALONE)
|
#if defined(RAYGUI_STANDALONE)
|
||||||
#include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end()
|
#include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#define RAYGUI_CLITERAL(name) name
|
#define RAYGUI_CLITERAL(name) name
|
||||||
#else
|
#else
|
||||||
#define RAYGUI_CLITERAL(name) (name)
|
#define RAYGUI_CLITERAL(name) (name)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
@ -717,7 +711,7 @@ int GuiGetStyle(int control, int property)
|
||||||
bool GuiWindowBox(Rectangle bounds, const char *title)
|
bool GuiWindowBox(Rectangle bounds, const char *title)
|
||||||
{
|
{
|
||||||
// NOTE: This define is also used by GuiMessageBox() and GuiTextInputBox()
|
// NOTE: This define is also used by GuiMessageBox() and GuiTextInputBox()
|
||||||
#define WINDOW_STATUSBAR_HEIGHT 22
|
#define WINDOW_STATUSBAR_HEIGHT 22
|
||||||
|
|
||||||
//GuiControlState state = guiState;
|
//GuiControlState state = guiState;
|
||||||
bool clicked = false;
|
bool clicked = false;
|
||||||
|
@ -730,7 +724,7 @@ bool GuiWindowBox(Rectangle bounds, const char *title)
|
||||||
|
|
||||||
Rectangle windowPanel = { bounds.x, bounds.y + (float)statusBarHeight - 1, bounds.width, bounds.height - (float)statusBarHeight };
|
Rectangle windowPanel = { bounds.x, bounds.y + (float)statusBarHeight - 1, bounds.width, bounds.height - (float)statusBarHeight };
|
||||||
Rectangle closeButtonRec = { statusBar.x + statusBar.width - GuiGetStyle(STATUSBAR, BORDER_WIDTH) - 20,
|
Rectangle closeButtonRec = { statusBar.x + statusBar.width - GuiGetStyle(STATUSBAR, BORDER_WIDTH) - 20,
|
||||||
statusBar.y + statusBarHeight/2.0f - 18.0f/2.0f, 18, 18 };
|
statusBar.y + statusBarHeight/2.0f - 18.0f/2.0f, 18, 18 };
|
||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
@ -762,8 +756,8 @@ bool GuiWindowBox(Rectangle bounds, const char *title)
|
||||||
// Group Box control with text name
|
// Group Box control with text name
|
||||||
void GuiGroupBox(Rectangle bounds, const char *text)
|
void GuiGroupBox(Rectangle bounds, const char *text)
|
||||||
{
|
{
|
||||||
#define GROUPBOX_LINE_THICK 1
|
#define GROUPBOX_LINE_THICK 1
|
||||||
#define GROUPBOX_TEXT_PADDING 10
|
#define GROUPBOX_TEXT_PADDING 10
|
||||||
|
|
||||||
GuiControlState state = guiState;
|
GuiControlState state = guiState;
|
||||||
|
|
||||||
|
@ -780,7 +774,7 @@ void GuiGroupBox(Rectangle bounds, const char *text)
|
||||||
// Line control
|
// Line control
|
||||||
void GuiLine(Rectangle bounds, const char *text)
|
void GuiLine(Rectangle bounds, const char *text)
|
||||||
{
|
{
|
||||||
#define LINE_TEXT_PADDING 10
|
#define LINE_TEXT_PADDING 10
|
||||||
|
|
||||||
GuiControlState state = guiState;
|
GuiControlState state = guiState;
|
||||||
|
|
||||||
|
@ -808,7 +802,7 @@ void GuiLine(Rectangle bounds, const char *text)
|
||||||
// Panel control
|
// Panel control
|
||||||
void GuiPanel(Rectangle bounds)
|
void GuiPanel(Rectangle bounds)
|
||||||
{
|
{
|
||||||
#define PANEL_BORDER_WIDTH 1
|
#define PANEL_BORDER_WIDTH 1
|
||||||
|
|
||||||
GuiControlState state = guiState;
|
GuiControlState state = guiState;
|
||||||
|
|
||||||
|
@ -841,8 +835,8 @@ Rectangle GuiScrollPanel(Rectangle bounds, Rectangle content, Vector2 *scroll)
|
||||||
|
|
||||||
// Calculate view area (area without the scrollbars)
|
// Calculate view area (area without the scrollbars)
|
||||||
Rectangle view = (GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)?
|
Rectangle view = (GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)?
|
||||||
RAYGUI_CLITERAL(Rectangle){ bounds.x + verticalScrollBarWidth + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.y + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth, bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth } :
|
RAYGUI_CLITERAL(Rectangle){ bounds.x + verticalScrollBarWidth + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.y + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth, bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth } :
|
||||||
RAYGUI_CLITERAL(Rectangle){ bounds.x + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.y + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth, bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth };
|
RAYGUI_CLITERAL(Rectangle){ bounds.x + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.y + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth, bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth };
|
||||||
|
|
||||||
// Clip view area to the actual content size
|
// Clip view area to the actual content size
|
||||||
if (view.width > content.width) view.width = content.width;
|
if (view.width > content.width) view.width = content.width;
|
||||||
|
@ -1102,9 +1096,9 @@ bool GuiToggle(Rectangle bounds, const char *text, bool active)
|
||||||
// Toggle Group control, returns toggled button index
|
// Toggle Group control, returns toggled button index
|
||||||
int GuiToggleGroup(Rectangle bounds, const char *text, int active)
|
int GuiToggleGroup(Rectangle bounds, const char *text, int active)
|
||||||
{
|
{
|
||||||
#if !defined(TOGGLEGROUP_MAX_ELEMENTS)
|
#if !defined(TOGGLEGROUP_MAX_ELEMENTS)
|
||||||
#define TOGGLEGROUP_MAX_ELEMENTS 32
|
#define TOGGLEGROUP_MAX_ELEMENTS 32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float initBoundsX = bounds.x;
|
float initBoundsX = bounds.x;
|
||||||
|
|
||||||
|
@ -1180,9 +1174,9 @@ bool GuiCheckBox(Rectangle bounds, const char *text, bool checked)
|
||||||
if (checked)
|
if (checked)
|
||||||
{
|
{
|
||||||
Rectangle check = { bounds.x + GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING),
|
Rectangle check = { bounds.x + GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING),
|
||||||
bounds.y + GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING),
|
bounds.y + GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING),
|
||||||
bounds.width - 2*(GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING)),
|
bounds.width - 2*(GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING)),
|
||||||
bounds.height - 2*(GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING)) };
|
bounds.height - 2*(GuiGetStyle(CHECKBOX, BORDER_WIDTH) + GuiGetStyle(CHECKBOX, CHECK_PADDING)) };
|
||||||
GuiDrawRectangle(check, 0, BLANK, Fade(GetColor(GuiGetStyle(CHECKBOX, TEXT + state*3)), guiAlpha));
|
GuiDrawRectangle(check, 0, BLANK, Fade(GetColor(GuiGetStyle(CHECKBOX, TEXT + state*3)), guiAlpha));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1200,7 +1194,7 @@ int GuiComboBox(Rectangle bounds, const char *text, int active)
|
||||||
bounds.width -= (GuiGetStyle(COMBOBOX, COMBO_BUTTON_WIDTH) + GuiGetStyle(COMBOBOX, COMBO_BUTTON_PADDING));
|
bounds.width -= (GuiGetStyle(COMBOBOX, COMBO_BUTTON_WIDTH) + GuiGetStyle(COMBOBOX, COMBO_BUTTON_PADDING));
|
||||||
|
|
||||||
Rectangle selector = { (float)bounds.x + bounds.width + GuiGetStyle(COMBOBOX, COMBO_BUTTON_PADDING),
|
Rectangle selector = { (float)bounds.x + bounds.width + GuiGetStyle(COMBOBOX, COMBO_BUTTON_PADDING),
|
||||||
(float)bounds.y, (float)GuiGetStyle(COMBOBOX, COMBO_BUTTON_WIDTH), (float)bounds.height };
|
(float)bounds.y, (float)GuiGetStyle(COMBOBOX, COMBO_BUTTON_WIDTH), (float)bounds.height };
|
||||||
|
|
||||||
// Get substrings items from text (items pointers, lengths and count)
|
// Get substrings items from text (items pointers, lengths and count)
|
||||||
int itemsCount = 0;
|
int itemsCount = 0;
|
||||||
|
@ -1487,7 +1481,7 @@ bool GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, in
|
||||||
int tempValue = *value;
|
int tempValue = *value;
|
||||||
|
|
||||||
Rectangle spinner = { bounds.x + GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH) + GuiGetStyle(SPINNER, SPIN_BUTTON_PADDING), bounds.y,
|
Rectangle spinner = { bounds.x + GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH) + GuiGetStyle(SPINNER, SPIN_BUTTON_PADDING), bounds.y,
|
||||||
bounds.width - 2*(GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH) + GuiGetStyle(SPINNER, SPIN_BUTTON_PADDING)), bounds.height };
|
bounds.width - 2*(GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH) + GuiGetStyle(SPINNER, SPIN_BUTTON_PADDING)), bounds.height };
|
||||||
Rectangle leftButtonBound = { (float)bounds.x, (float)bounds.y, (float)GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.height };
|
Rectangle leftButtonBound = { (float)bounds.x, (float)bounds.y, (float)GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.height };
|
||||||
Rectangle rightButtonBound = { (float)bounds.x + bounds.width - GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.y, (float)GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.height };
|
Rectangle rightButtonBound = { (float)bounds.x + bounds.width - GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.y, (float)GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.height };
|
||||||
|
|
||||||
|
@ -1557,9 +1551,9 @@ bool GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, in
|
||||||
// NOTE: Requires static variables: framesCounter
|
// NOTE: Requires static variables: framesCounter
|
||||||
bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode)
|
bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode)
|
||||||
{
|
{
|
||||||
#if !defined(VALUEBOX_MAX_CHARS)
|
#if !defined(VALUEBOX_MAX_CHARS)
|
||||||
#define VALUEBOX_MAX_CHARS 32
|
#define VALUEBOX_MAX_CHARS 32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int framesCounter = 0; // Required for blinking cursor
|
static int framesCounter = 0; // Required for blinking cursor
|
||||||
|
|
||||||
|
@ -1684,14 +1678,14 @@ bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode)
|
||||||
bool pressed = false;
|
bool pressed = false;
|
||||||
|
|
||||||
Rectangle textAreaBounds = {
|
Rectangle textAreaBounds = {
|
||||||
bounds.x + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING),
|
bounds.x + GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING),
|
||||||
bounds.y + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING),
|
bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING),
|
||||||
bounds.width - 2*GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING),
|
bounds.width - 2 * (GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING)),
|
||||||
bounds.height - 2*GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING)
|
bounds.height - 2 * (GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING))
|
||||||
};
|
};
|
||||||
|
|
||||||
// Cursor position, [x, y] values should be updated
|
// Cursor position, [x, y] values should be updated
|
||||||
Rectangle cursor = { 0, 0, 1, (float)GuiGetStyle(DEFAULT, TEXT_SIZE) + 2 };
|
Rectangle cursor = { 0, 0, (GuiGetStyle(DEFAULT, TEXT_SIZE) < 10) ? 1 : (GuiGetStyle(DEFAULT, TEXT_SIZE) * 0.1f), (float)GuiGetStyle(DEFAULT, TEXT_SIZE) + 2 };
|
||||||
|
|
||||||
int textWidth = 0;
|
int textWidth = 0;
|
||||||
int currentLine = 0;
|
int currentLine = 0;
|
||||||
|
@ -1761,7 +1755,7 @@ bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode)
|
||||||
|
|
||||||
if (text[i] == ' ' || text[i] == '\n') lastBreakingPos = i;
|
if (text[i] == ' ' || text[i] == '\n') lastBreakingPos = i;
|
||||||
|
|
||||||
if ( text[i] == '\n' || textWidth >= textAreaBounds.width)
|
if ( text[i] == '\n' || textWidth + 1 >= textAreaBounds.width)
|
||||||
{
|
{
|
||||||
currentLine++;
|
currentLine++;
|
||||||
textWidth = 0;
|
textWidth = 0;
|
||||||
|
@ -1773,8 +1767,8 @@ bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor.x = bounds.x + GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING) + textWidth - GuiGetStyle(DEFAULT, TEXT_SPACING);
|
cursor.x = textAreaBounds.x + textWidth - GuiGetStyle(DEFAULT, TEXT_SPACING);
|
||||||
cursor.y = bounds.y + GuiGetStyle(TEXTBOX, BORDER_WIDTH) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING)/2 + ((GuiGetStyle(DEFAULT, TEXT_SIZE) + GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING))*currentLine);
|
cursor.y = textAreaBounds.y + ((GuiGetStyle(DEFAULT, TEXT_SIZE) + GuiGetStyle(DEFAULT, TEXT_SIZE)/2)*currentLine);
|
||||||
|
|
||||||
// Exit edit mode
|
// Exit edit mode
|
||||||
if (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true;
|
if (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true;
|
||||||
|
@ -1822,7 +1816,7 @@ float GuiSliderPro(Rectangle bounds, const char *textLeft, const char *textRight
|
||||||
int sliderValue = (int)(((value - minValue)/(maxValue - minValue))*(bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH)));
|
int sliderValue = (int)(((value - minValue)/(maxValue - minValue))*(bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH)));
|
||||||
|
|
||||||
Rectangle slider = { bounds.x, bounds.y + GuiGetStyle(SLIDER, BORDER_WIDTH) + GuiGetStyle(SLIDER, SLIDER_PADDING),
|
Rectangle slider = { bounds.x, bounds.y + GuiGetStyle(SLIDER, BORDER_WIDTH) + GuiGetStyle(SLIDER, SLIDER_PADDING),
|
||||||
0, bounds.height - 2*GuiGetStyle(SLIDER, BORDER_WIDTH) - 2*GuiGetStyle(SLIDER, SLIDER_PADDING) };
|
0, bounds.height - 2*GuiGetStyle(SLIDER, BORDER_WIDTH) - 2*GuiGetStyle(SLIDER, SLIDER_PADDING) };
|
||||||
|
|
||||||
if (sliderWidth > 0) // Slider
|
if (sliderWidth > 0) // Slider
|
||||||
{
|
{
|
||||||
|
@ -1925,8 +1919,8 @@ float GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRig
|
||||||
GuiControlState state = guiState;
|
GuiControlState state = guiState;
|
||||||
|
|
||||||
Rectangle progress = { bounds.x + GuiGetStyle(PROGRESSBAR, BORDER_WIDTH),
|
Rectangle progress = { bounds.x + GuiGetStyle(PROGRESSBAR, BORDER_WIDTH),
|
||||||
bounds.y + GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) + GuiGetStyle(PROGRESSBAR, PROGRESS_PADDING), 0,
|
bounds.y + GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) + GuiGetStyle(PROGRESSBAR, PROGRESS_PADDING), 0,
|
||||||
bounds.height - 2*GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) - 2*GuiGetStyle(PROGRESSBAR, PROGRESS_PADDING) };
|
bounds.height - 2*GuiGetStyle(PROGRESSBAR, BORDER_WIDTH) - 2*GuiGetStyle(PROGRESSBAR, PROGRESS_PADDING) };
|
||||||
|
|
||||||
// Update control
|
// Update control
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
@ -2318,8 +2312,8 @@ Color GuiColorPanelEx(Rectangle bounds, Color color, float hue)
|
||||||
Vector3 maxHue = { hue >= 0.0f ? hue : hsv.x, 1.0f, 1.0f };
|
Vector3 maxHue = { hue >= 0.0f ? hue : hsv.x, 1.0f, 1.0f };
|
||||||
Vector3 rgbHue = ConvertHSVtoRGB(maxHue);
|
Vector3 rgbHue = ConvertHSVtoRGB(maxHue);
|
||||||
Color maxHueCol = { (unsigned char)(255.0f*rgbHue.x),
|
Color maxHueCol = { (unsigned char)(255.0f*rgbHue.x),
|
||||||
(unsigned char)(255.0f*rgbHue.y),
|
(unsigned char)(255.0f*rgbHue.y),
|
||||||
(unsigned char)(255.0f*rgbHue.z), 255 };
|
(unsigned char)(255.0f*rgbHue.z), 255 };
|
||||||
|
|
||||||
const Color colWhite = { 255, 255, 255, 255 };
|
const Color colWhite = { 255, 255, 255, 255 };
|
||||||
const Color colBlack = { 0, 0, 0, 255 };
|
const Color colBlack = { 0, 0, 0, 255 };
|
||||||
|
@ -2350,9 +2344,9 @@ Color GuiColorPanelEx(Rectangle bounds, Color color, float hue)
|
||||||
|
|
||||||
// NOTE: Vector3ToColor() only available on raylib 1.8.1
|
// NOTE: Vector3ToColor() only available on raylib 1.8.1
|
||||||
color = RAYGUI_CLITERAL(Color){ (unsigned char)(255.0f*rgb.x),
|
color = RAYGUI_CLITERAL(Color){ (unsigned char)(255.0f*rgb.x),
|
||||||
(unsigned char)(255.0f*rgb.y),
|
(unsigned char)(255.0f*rgb.y),
|
||||||
(unsigned char)(255.0f*rgb.z),
|
(unsigned char)(255.0f*rgb.z),
|
||||||
(unsigned char)(255.0f*(float)color.a/255.0f) };
|
(unsigned char)(255.0f*(float)color.a/255.0f) };
|
||||||
|
|
||||||
}
|
}
|
||||||
else state = GUI_STATE_FOCUSED;
|
else state = GUI_STATE_FOCUSED;
|
||||||
|
@ -2391,7 +2385,7 @@ Color GuiColorPanel(Rectangle bounds, Color color)
|
||||||
// NOTE: Returns alpha value normalized [0..1]
|
// NOTE: Returns alpha value normalized [0..1]
|
||||||
float GuiColorBarAlpha(Rectangle bounds, float alpha)
|
float GuiColorBarAlpha(Rectangle bounds, float alpha)
|
||||||
{
|
{
|
||||||
#define COLORBARALPHA_CHECKED_SIZE 10
|
#define COLORBARALPHA_CHECKED_SIZE 10
|
||||||
|
|
||||||
GuiControlState state = guiState;
|
GuiControlState state = guiState;
|
||||||
Rectangle selector = { (float)bounds.x + alpha*bounds.width - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW), (float)bounds.y - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW), (float)GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT), (float)bounds.height + GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW)*2 };
|
Rectangle selector = { (float)bounds.x + alpha*bounds.width - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW), (float)bounds.y - GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW), (float)GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_HEIGHT), (float)bounds.height + GuiGetStyle(COLORPICKER, HUEBAR_SELECTOR_OVERFLOW)*2 };
|
||||||
|
@ -2531,11 +2525,11 @@ Color GuiColorPicker(Rectangle bounds, Color color)
|
||||||
color = GuiColorPanel(bounds, color);
|
color = GuiColorPanel(bounds, color);
|
||||||
|
|
||||||
Rectangle boundsHue = { (float)bounds.x + bounds.width + GuiGetStyle(COLORPICKER, HUEBAR_PADDING), (float)bounds.y, (float)GuiGetStyle(COLORPICKER, HUEBAR_WIDTH), (float)bounds.height };
|
Rectangle boundsHue = { (float)bounds.x + bounds.width + GuiGetStyle(COLORPICKER, HUEBAR_PADDING), (float)bounds.y, (float)GuiGetStyle(COLORPICKER, HUEBAR_WIDTH), (float)bounds.height };
|
||||||
Rectangle boundsAlpha = { bounds.x, bounds.y + bounds.height + GuiGetStyle(COLORPICKER, HUEBAR_PADDING), bounds.width, GuiGetStyle(COLORPICKER, HUEBAR_WIDTH) };
|
//Rectangle boundsAlpha = { bounds.x, bounds.y + bounds.height + GuiGetStyle(COLORPICKER, BARS_PADDING), bounds.width, GuiGetStyle(COLORPICKER, BARS_THICK) };
|
||||||
|
|
||||||
Vector3 hsv = ConvertRGBtoHSV(RAYGUI_CLITERAL(Vector3){ color.r/255.0f, color.g/255.0f, color.b/255.0f });
|
Vector3 hsv = ConvertRGBtoHSV(RAYGUI_CLITERAL(Vector3){ color.r/255.0f, color.g/255.0f, color.b/255.0f });
|
||||||
hsv.x = GuiColorBarHue(boundsHue, hsv.x);
|
hsv.x = GuiColorBarHue(boundsHue, hsv.x);
|
||||||
color.a = (unsigned char)(GuiColorBarAlpha(boundsAlpha, (float)color.a/255.0f)*255.0f);
|
//color.a = (unsigned char)(GuiColorBarAlpha(boundsAlpha, (float)color.a/255.0f)*255.0f);
|
||||||
Vector3 rgb = ConvertHSVtoRGB(hsv);
|
Vector3 rgb = ConvertHSVtoRGB(hsv);
|
||||||
color = RAYGUI_CLITERAL(Color){ (unsigned char)roundf(rgb.x*255.0f), (unsigned char)roundf(rgb.y*255.0f), (unsigned char)roundf(rgb.z*255.0f), color.a };
|
color = RAYGUI_CLITERAL(Color){ (unsigned char)roundf(rgb.x*255.0f), (unsigned char)roundf(rgb.y*255.0f), (unsigned char)roundf(rgb.z*255.0f), color.a };
|
||||||
|
|
||||||
|
@ -2545,8 +2539,8 @@ Color GuiColorPicker(Rectangle bounds, Color color)
|
||||||
// Message Box control
|
// Message Box control
|
||||||
int GuiMessageBox(Rectangle bounds, const char *title, const char *message, const char *buttons)
|
int GuiMessageBox(Rectangle bounds, const char *title, const char *message, const char *buttons)
|
||||||
{
|
{
|
||||||
#define MESSAGEBOX_BUTTON_HEIGHT 24
|
#define MESSAGEBOX_BUTTON_HEIGHT 24
|
||||||
#define MESSAGEBOX_BUTTON_PADDING 10
|
#define MESSAGEBOX_BUTTON_PADDING 10
|
||||||
|
|
||||||
int clicked = -1; // Returns clicked button from buttons list, 0 refers to closed window button
|
int clicked = -1; // Returns clicked button from buttons list, 0 refers to closed window button
|
||||||
|
|
||||||
|
@ -2593,11 +2587,11 @@ int GuiMessageBox(Rectangle bounds, const char *title, const char *message, cons
|
||||||
// Text Input Box control, ask for text
|
// Text Input Box control, ask for text
|
||||||
int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text)
|
int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text)
|
||||||
{
|
{
|
||||||
#define TEXTINPUTBOX_BUTTON_HEIGHT 24
|
#define TEXTINPUTBOX_BUTTON_HEIGHT 24
|
||||||
#define TEXTINPUTBOX_BUTTON_PADDING 10
|
#define TEXTINPUTBOX_BUTTON_PADDING 10
|
||||||
#define TEXTINPUTBOX_HEIGHT 30
|
#define TEXTINPUTBOX_HEIGHT 30
|
||||||
|
|
||||||
#define TEXTINPUTBOX_MAX_TEXT_LENGTH 256
|
#define TEXTINPUTBOX_MAX_TEXT_LENGTH 256
|
||||||
|
|
||||||
// Used to enable text edit mode
|
// Used to enable text edit mode
|
||||||
// WARNING: No more than one GuiTextInputBox() should be open at the same time
|
// WARNING: No more than one GuiTextInputBox() should be open at the same time
|
||||||
|
@ -2670,9 +2664,9 @@ int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, co
|
||||||
// https://stackoverflow.com/questions/4435450/2d-opengl-drawing-lines-that-dont-exactly-fit-pixel-raster
|
// https://stackoverflow.com/questions/4435450/2d-opengl-drawing-lines-that-dont-exactly-fit-pixel-raster
|
||||||
Vector2 GuiGrid(Rectangle bounds, float spacing, int subdivs)
|
Vector2 GuiGrid(Rectangle bounds, float spacing, int subdivs)
|
||||||
{
|
{
|
||||||
#if !defined(GRID_COLOR_ALPHA)
|
#if !defined(GRID_COLOR_ALPHA)
|
||||||
#define GRID_COLOR_ALPHA 0.15f // Grid lines alpha amount
|
#define GRID_COLOR_ALPHA 0.15f // Grid lines alpha amount
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GuiControlState state = guiState;
|
GuiControlState state = guiState;
|
||||||
Vector2 mousePoint = GetMousePosition();
|
Vector2 mousePoint = GetMousePosition();
|
||||||
|
@ -3100,7 +3094,7 @@ char **GuiLoadIcons(const char *fileName, bool loadIconsName)
|
||||||
// Draw selected icon using rectangles pixel-by-pixel
|
// Draw selected icon using rectangles pixel-by-pixel
|
||||||
void GuiDrawIcon(int iconId, Vector2 position, int pixelSize, Color color)
|
void GuiDrawIcon(int iconId, Vector2 position, int pixelSize, Color color)
|
||||||
{
|
{
|
||||||
#define BIT_CHECK(a,b) ((a) & (1<<(b)))
|
#define BIT_CHECK(a,b) ((a) & (1<<(b)))
|
||||||
|
|
||||||
for (int i = 0, y = 0; i < RICON_SIZE*RICON_SIZE/32; i++)
|
for (int i = 0, y = 0; i < RICON_SIZE*RICON_SIZE/32; i++)
|
||||||
{
|
{
|
||||||
|
@ -3108,9 +3102,9 @@ void GuiDrawIcon(int iconId, Vector2 position, int pixelSize, Color color)
|
||||||
{
|
{
|
||||||
if (BIT_CHECK(guiIcons[iconId*RICON_DATA_ELEMENTS + i], k))
|
if (BIT_CHECK(guiIcons[iconId*RICON_DATA_ELEMENTS + i], k))
|
||||||
{
|
{
|
||||||
#if !defined(RAYGUI_STANDALONE)
|
#if !defined(RAYGUI_STANDALONE)
|
||||||
DrawRectangle(position.x + (k%RICON_SIZE)*pixelSize, position.y + y*pixelSize, pixelSize, pixelSize, color);
|
DrawRectangle(position.x + (k%RICON_SIZE)*pixelSize, position.y + y*pixelSize, pixelSize, pixelSize, color);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((k == 15) || (k == 31)) y++;
|
if ((k == 15) || (k == 31)) y++;
|
||||||
|
@ -3140,7 +3134,7 @@ void GuiSetIconData(int iconId, unsigned int *data)
|
||||||
// Set icon pixel value
|
// Set icon pixel value
|
||||||
void GuiSetIconPixel(int iconId, int x, int y)
|
void GuiSetIconPixel(int iconId, int x, int y)
|
||||||
{
|
{
|
||||||
#define BIT_SET(a,b) ((a) |= (1<<(b)))
|
#define BIT_SET(a,b) ((a) |= (1<<(b)))
|
||||||
|
|
||||||
// This logic works for any RICON_SIZE pixels icons,
|
// This logic works for any RICON_SIZE pixels icons,
|
||||||
// For example, in case of 16x16 pixels, every 2 lines fit in one unsigned int data element
|
// For example, in case of 16x16 pixels, every 2 lines fit in one unsigned int data element
|
||||||
|
@ -3150,7 +3144,7 @@ void GuiSetIconPixel(int iconId, int x, int y)
|
||||||
// Clear icon pixel value
|
// Clear icon pixel value
|
||||||
void GuiClearIconPixel(int iconId, int x, int y)
|
void GuiClearIconPixel(int iconId, int x, int y)
|
||||||
{
|
{
|
||||||
#define BIT_CLEAR(a,b) ((a) &= ~((1)<<(b)))
|
#define BIT_CLEAR(a,b) ((a) &= ~((1)<<(b)))
|
||||||
|
|
||||||
// This logic works for any RICON_SIZE pixels icons,
|
// This logic works for any RICON_SIZE pixels icons,
|
||||||
// For example, in case of 16x16 pixels, every 2 lines fit in one unsigned int data element
|
// For example, in case of 16x16 pixels, every 2 lines fit in one unsigned int data element
|
||||||
|
@ -3160,7 +3154,7 @@ void GuiClearIconPixel(int iconId, int x, int y)
|
||||||
// Check icon pixel value
|
// Check icon pixel value
|
||||||
bool GuiCheckIconPixel(int iconId, int x, int y)
|
bool GuiCheckIconPixel(int iconId, int x, int y)
|
||||||
{
|
{
|
||||||
#define BIT_CHECK(a,b) ((a) & (1<<(b)))
|
#define BIT_CHECK(a,b) ((a) & (1<<(b)))
|
||||||
|
|
||||||
return (BIT_CHECK(guiIcons[iconId*8 + y/2], x + (y%2*16)));
|
return (BIT_CHECK(guiIcons[iconId*8 + y/2], x + (y%2*16)));
|
||||||
}
|
}
|
||||||
|
@ -3243,7 +3237,7 @@ static const char *GetTextIcon(const char *text, int *iconId)
|
||||||
// Gui draw text using default font
|
// Gui draw text using default font
|
||||||
static void GuiDrawText(const char *text, Rectangle bounds, int alignment, Color tint)
|
static void GuiDrawText(const char *text, Rectangle bounds, int alignment, Color tint)
|
||||||
{
|
{
|
||||||
#define TEXT_VALIGN_PIXEL_OFFSET(h) ((int)h%2) // Vertical alignment for pixel perfect
|
#define TEXT_VALIGN_PIXEL_OFFSET(h) ((int)h%2) // Vertical alignment for pixel perfect
|
||||||
|
|
||||||
if ((text != NULL) && (text[0] != '\0'))
|
if ((text != NULL) && (text[0] != '\0'))
|
||||||
{
|
{
|
||||||
|
@ -3252,7 +3246,7 @@ static void GuiDrawText(const char *text, Rectangle bounds, int alignment, Color
|
||||||
|
|
||||||
// Get text position depending on alignment and iconId
|
// Get text position depending on alignment and iconId
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
#define ICON_TEXT_PADDING 4
|
#define ICON_TEXT_PADDING 4
|
||||||
|
|
||||||
Vector2 position = { bounds.x, bounds.y };
|
Vector2 position = { bounds.x, bounds.y };
|
||||||
|
|
||||||
|
@ -3344,13 +3338,13 @@ static const char **GuiTextSplit(const char *text, int *count, int *textRow)
|
||||||
// 2. Maximum size of text to split is TEXTSPLIT_MAX_TEXT_LENGTH
|
// 2. Maximum size of text to split is TEXTSPLIT_MAX_TEXT_LENGTH
|
||||||
// NOTE: Those definitions could be externally provided if required
|
// NOTE: Those definitions could be externally provided if required
|
||||||
|
|
||||||
#if !defined(TEXTSPLIT_MAX_TEXT_LENGTH)
|
#if !defined(TEXTSPLIT_MAX_TEXT_LENGTH)
|
||||||
#define TEXTSPLIT_MAX_TEXT_LENGTH 1024
|
#define TEXTSPLIT_MAX_TEXT_LENGTH 1024
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(TEXTSPLIT_MAX_TEXT_ELEMENTS)
|
#if !defined(TEXTSPLIT_MAX_TEXT_ELEMENTS)
|
||||||
#define TEXTSPLIT_MAX_TEXT_ELEMENTS 128
|
#define TEXTSPLIT_MAX_TEXT_ELEMENTS 128
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char *result[TEXTSPLIT_MAX_TEXT_ELEMENTS] = { NULL };
|
static const char *result[TEXTSPLIT_MAX_TEXT_ELEMENTS] = { NULL };
|
||||||
static char buffer[TEXTSPLIT_MAX_TEXT_LENGTH] = { 0 };
|
static char buffer[TEXTSPLIT_MAX_TEXT_LENGTH] = { 0 };
|
||||||
|
@ -3557,7 +3551,7 @@ static Color Fade(Color color, float alpha)
|
||||||
// Formatting of text with variables to 'embed'
|
// Formatting of text with variables to 'embed'
|
||||||
static const char *TextFormat(const char *text, ...)
|
static const char *TextFormat(const char *text, ...)
|
||||||
{
|
{
|
||||||
#define MAX_FORMATTEXT_LENGTH 64
|
#define MAX_FORMATTEXT_LENGTH 64
|
||||||
|
|
||||||
static char buffer[MAX_FORMATTEXT_LENGTH];
|
static char buffer[MAX_FORMATTEXT_LENGTH];
|
||||||
|
|
||||||
|
@ -3679,3 +3673,9 @@ static const char *CodepointToUtf8(int codepoint, int *byteLength)
|
||||||
#endif // RAYGUI_STANDALONE
|
#endif // RAYGUI_STANDALONE
|
||||||
|
|
||||||
#endif // RAYGUI_IMPLEMENTATION
|
#endif // RAYGUI_IMPLEMENTATION
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
} // Prevents name mangling of functions
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // RAYGUI_H
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue