-
Notifications
You must be signed in to change notification settings - Fork 0
ButtonO Class Variables
Alex Ricciardi edited this page Feb 5, 2023
·
2 revisions
Note: The variables for this class are public.
// Button rectangle rounded edges outline
float roundness = 1.0f;
---------------------------------
Inherited from ButtonR class
---------------------------------
//---- Font
Font font = GetFontDefault();
float fontSize = 32,
fontSpacing = 3.0f;
Color fontColor = BLACK;
bool isRayFont = true;
//---- Text
string text = "Button";
Vector2 textSize = MeasureTextEx(font, text.c_str(), fontSize, fontSpacing),
oneCharSize = MeasureTextEx(font, "C", fontSize, fontSpacing);
//--- Button position, size, color
/*
The button size is computed from the font size and length of the text
See mutators to modify the button’s position,
the text’s position in the button, and the button’s size.
*/
bool txtResizeBtn = true;
float btnWidth = (textSize.x + 3.5f * oneCharSize.x),
btnHeight = textSize.y * (float)(2.0f * (textSize.y / fontSize));
Rectangle rect{ 100, 100, btnWidth, btnHeight };
// colors
Color btnLiveColor = { 222, 214, 202, 255 },
// Botton state
btnHover = { 135, 195, 74, 100 },
btnPressed = { 66, 165, 245, 100 },
btnIdle = btnLiveColor; // idle state
//---- Button border position, size, color, thickness
/*
The boder size is computed from the font size and length of the text
modifying the button's size, we also modify the border's size.
See mutators for modifying specifically the shadow's size.
*/
Rectangle border{ rect.x, rect.y, btnWidth, btnHeight };
// color
Color borderLiveColor = BLACK,
// Botton state
borderHover = { 57, 73, 171, 100 },
borderPressed = { 0, 105, 92, 100 },
borderIdle = borderLiveColor;
float borderThickness = (rect.width + rect.height) / 150;
bool isBorder = true;
//---- Shaddow
/*
The shadow size is computed from the font size andlength of the text
modifying the button's size, we also modify the shadow's size.
See mutators for modifying specifically the shadow's size and position.
*/
double shadowOffset = 0.05;
Rectangle shadow{ rect.x + 5, rect.y + 5, btnWidth, btnHeight };
Color shadowColor = GRAY;
bool isShadow = true;
//--- Centers text in button
Vector2 textPos =
{
rect.x + (rect.width - textSize.x) / 2,
rect.y + (rect.height - textSize.y) / 2
};