Skip to content

Commit 9193f38

Browse files
authored
Fixed examples (#505)
1 parent 6530ee1 commit 9193f38

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

examples/custom_input_box/custom_input_box.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ int GuiFloatBox(Rectangle bounds, const char* text, float* value, int minValue,
9797
Rectangle textBounds = { 0 };
9898
if (text != NULL)
9999
{
100-
textBounds.width = (float)GetTextWidth(text) + 2;
100+
textBounds.width = (float)GuiGetTextWidth(text) + 2;
101101
textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
102102
textBounds.x = bounds.x + bounds.width + GuiGetStyle(VALUEBOX, TEXT_PADDING);
103103
textBounds.y = bounds.y + bounds.height / 2.0f - GuiGetStyle(DEFAULT, TEXT_SIZE) / 2.0f;
@@ -124,7 +124,7 @@ int GuiFloatBox(Rectangle bounds, const char* text, float* value, int minValue,
124124
// Only allow keys in range [48..57]
125125
if (keyCount < RAYGUI_VALUEBOX_MAX_CHARS)
126126
{
127-
if (GetTextWidth(textValue) < bounds.width)
127+
if (GuiGetTextWidth(textValue) < bounds.width)
128128
{
129129
int key = GetCharPressed();
130130
if ((key >= 48) && (key <= 57) && guiFloatingPointIndex)
@@ -211,7 +211,7 @@ int GuiFloatBox(Rectangle bounds, const char* text, float* value, int minValue,
211211
if (editMode)
212212
{
213213
// NOTE: ValueBox internal text is always centered
214-
Rectangle cursor = { bounds.x + GetTextWidth(textValue) / 2.0f + bounds.width / 2.0f + 1, bounds.y + 2.0f * GuiGetStyle(VALUEBOX, BORDER_WIDTH), 4, bounds.height - 4 * GuiGetStyle(VALUEBOX, BORDER_WIDTH) };
214+
Rectangle cursor = { bounds.x + GuiGetTextWidth(textValue) / 2.0f + bounds.width / 2.0f + 1, bounds.y + 2.0f * GuiGetStyle(VALUEBOX, BORDER_WIDTH), 4, bounds.height - 4 * GuiGetStyle(VALUEBOX, BORDER_WIDTH) };
215215
GuiDrawRectangle(cursor, 0, BLANK, Fade(GetColor(GuiGetStyle(VALUEBOX, BORDER_COLOR_PRESSED)), guiAlpha));
216216
}
217217

examples/custom_sliders/custom_sliders.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ float GuiVerticalSliderPro(Rectangle bounds, const char *textTop, const char *te
182182
if (textTop != NULL)
183183
{
184184
Rectangle textBounds = { 0 };
185-
textBounds.width = (float)GetTextWidth(textTop);
185+
textBounds.width = (float)GuiGetTextWidth(textTop);
186186
textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
187187
textBounds.x = bounds.x + bounds.width/2 - textBounds.width/2;
188188
textBounds.y = bounds.y - textBounds.height - GuiGetStyle(SLIDER, TEXT_PADDING);
@@ -193,7 +193,7 @@ float GuiVerticalSliderPro(Rectangle bounds, const char *textTop, const char *te
193193
if (textBottom != NULL)
194194
{
195195
Rectangle textBounds = { 0 };
196-
textBounds.width = (float)GetTextWidth(textBottom);
196+
textBounds.width = (float)GuiGetTextWidth(textBottom);
197197
textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
198198
textBounds.x = bounds.x + bounds.width/2 - textBounds.width/2;
199199
textBounds.y = bounds.y + bounds.height + GuiGetStyle(SLIDER, TEXT_PADDING);
@@ -304,7 +304,7 @@ bool GuiSliderProOwning(Rectangle bounds, const char *textLeft, const char *text
304304
if (textLeft != NULL)
305305
{
306306
Rectangle textBounds = { 0 };
307-
textBounds.width = (float)GetTextWidth(textLeft);
307+
textBounds.width = (float)GuiGetTextWidth(textLeft);
308308
textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
309309
textBounds.x = bounds.x - textBounds.width - GuiGetStyle(SLIDER, TEXT_PADDING);
310310
textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2;
@@ -315,7 +315,7 @@ bool GuiSliderProOwning(Rectangle bounds, const char *textLeft, const char *text
315315
if (textRight != NULL)
316316
{
317317
Rectangle textBounds = { 0 };
318-
textBounds.width = (float)GetTextWidth(textRight);
318+
textBounds.width = (float)GuiGetTextWidth(textRight);
319319
textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
320320
textBounds.x = bounds.x + bounds.width + GuiGetStyle(SLIDER, TEXT_PADDING);
321321
textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2;
@@ -435,7 +435,7 @@ bool GuiVerticalSliderProOwning(Rectangle bounds, const char *textTop, const cha
435435
if (textTop != NULL)
436436
{
437437
Rectangle textBounds = { 0 };
438-
textBounds.width = (float)GetTextWidth(textTop);
438+
textBounds.width = (float)GuiGetTextWidth(textTop);
439439
textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
440440
textBounds.x = bounds.x + bounds.width/2 - textBounds.width/2;
441441
textBounds.y = bounds.y - textBounds.height - GuiGetStyle(SLIDER, TEXT_PADDING);
@@ -446,7 +446,7 @@ bool GuiVerticalSliderProOwning(Rectangle bounds, const char *textTop, const cha
446446
if (textBottom != NULL)
447447
{
448448
Rectangle textBounds = { 0 };
449-
textBounds.width = (float)GetTextWidth(textBottom);
449+
textBounds.width = (float)GuiGetTextWidth(textBottom);
450450
textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
451451
textBounds.x = bounds.x + bounds.width/2 - textBounds.width/2;
452452
textBounds.y = bounds.y + bounds.height + GuiGetStyle(SLIDER, TEXT_PADDING);

examples/image_exporter/image_exporter.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ int main(int argc, char *argv[])
3838
bool windowBoxActive = false;
3939

4040
int fileFormatActive = 0;
41-
char *fileFormatTextList[3] = { "IMAGE (.png)", "DATA (.raw)", "CODE (.h)" };
41+
const char *fileFormatTextList[3] = { "IMAGE (.png)", "DATA (.raw)", "CODE (.h)" };
4242

4343
int pixelFormatActive = 0;
44-
char *pixelFormatTextList[7] = { "GRAYSCALE", "GRAY ALPHA", "R5G6B5", "R8G8B8", "R5G5B5A1", "R4G4B4A4", "R8G8B8A8" };
44+
const char *pixelFormatTextList[7] = { "GRAYSCALE", "GRAY ALPHA", "R5G6B5", "R8G8B8", "R5G5B5A1", "R4G4B4A4", "R8G8B8A8" };
4545

4646
bool textBoxEditMode = false;
4747
char fileName[64] = "untitled";

examples/image_importer_raw/image_importer_raw.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ int main()
5050
bool heightEditMode = false;
5151

5252
int pixelFormatActive = 0;
53-
char *pixelFormatTextList[8] = { "CUSTOM", "GRAYSCALE", "GRAY ALPHA", "R5G6B5", "R8G8B8", "R5G5B5A1", "R4G4B4A4", "R8G8B8A8" };
53+
const char *pixelFormatTextList[8] = { "CUSTOM", "GRAYSCALE", "GRAY ALPHA", "R5G6B5", "R8G8B8", "R5G5B5A1", "R4G4B4A4", "R8G8B8A8" };
5454

5555
int channelsActive = 3;
56-
char *channelsTextList[4] = { "1", "2", "3", "4" };
56+
const char *channelsTextList[4] = { "1", "2", "3", "4" };
5757
int bitDepthActive = 0;
58-
char *bitDepthTextList[3] = { "8", "16", "32" };
58+
const char *bitDepthTextList[3] = { "8", "16", "32" };
5959

6060
int headerSizeValue = 0;
6161
bool headerSizeEditMode = false;

examples/property_list/dm_property_list.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ double GuiDMValueBox(Rectangle bounds, double value, double minValue, double max
323323
Rectangle textBounds = {bounds.x + GuiGetStyle(VALUEBOX, BORDER_WIDTH) + textPadding, bounds.y + GuiGetStyle(VALUEBOX, BORDER_WIDTH),
324324
bounds.width - 2*(GuiGetStyle(VALUEBOX, BORDER_WIDTH) + textPadding), bounds.height - 2*GuiGetStyle(VALUEBOX, BORDER_WIDTH)};
325325

326-
int textWidth = GetTextWidth(textValue);
326+
int textWidth = GuiGetTextWidth(textValue);
327327
if(textWidth > textBounds.width) textBounds.width = textWidth;
328328

329329
if (state == STATE_PRESSED)
@@ -338,7 +338,7 @@ double GuiDMValueBox(Rectangle bounds, double value, double minValue, double max
338338
if(cursor > 0) {
339339
char c = textValue[cursor];
340340
textValue[cursor] = '\0';
341-
textWidthCursor = GetTextWidth(textValue);
341+
textWidthCursor = GuiGetTextWidth(textValue);
342342
textValue[cursor] = c;
343343
}
344344
//DrawRectangle(bounds.x + textWidthCursor + textPadding + 2, bounds.y + 2*GuiGetStyle(VALUEBOX, BORDER_WIDTH), 1, bounds.height - 4*GuiGetStyle(VALUEBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(VALUEBOX, BORDER_COLOR_PRESSED)), guiAlpha));
@@ -608,7 +608,7 @@ void GuiDMPropertyList(Rectangle bounds, GuiDMProperty* props, int count, int* f
608608
// draw X, Y, Z, W values (only when expanded)
609609
if(!PROP_CHECK_FLAG(&props[p], GUI_PFLAG_COLLAPSED)) {
610610
Rectangle slotBounds = { propBounds.x, propBounds.y+GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)+1, propBounds.width, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)-2};
611-
Rectangle lblBounds = { propBounds.x+PROPERTY_PADDING, slotBounds.y, GetTextWidth("A"), slotBounds.height};
611+
Rectangle lblBounds = { propBounds.x+PROPERTY_PADDING, slotBounds.y, GuiGetTextWidth("A"), slotBounds.height};
612612
Rectangle valBounds = { lblBounds.x+lblBounds.width+PROPERTY_PADDING, slotBounds.y, propBounds.width-lblBounds.width-2*PROPERTY_PADDING, slotBounds.height};
613613
GuiDrawText("X", lblBounds, TEXT_ALIGN_LEFT, textColor);
614614
props[p].value.v2.x = GuiDMSpinner(valBounds, props[p].value.v2.x, 0.0, 0.0, 1.0, PROPERTY_DECIMAL_DIGITS, (propState == STATE_FOCUSED) && CheckCollisionPointRec(mousePos, slotBounds) );
@@ -647,7 +647,7 @@ void GuiDMPropertyList(Rectangle bounds, GuiDMProperty* props, int count, int* f
647647
// draw X, Y, Width, Height values (only when expanded)
648648
if(!PROP_CHECK_FLAG(&props[p], GUI_PFLAG_COLLAPSED)) {
649649
Rectangle slotBounds = { propBounds.x, propBounds.y+GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)+1, propBounds.width, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)-2};
650-
Rectangle lblBounds = { propBounds.x+PROPERTY_PADDING, slotBounds.y, GetTextWidth("Height"), slotBounds.height};
650+
Rectangle lblBounds = { propBounds.x+PROPERTY_PADDING, slotBounds.y, GuiGetTextWidth("Height"), slotBounds.height};
651651
Rectangle valBounds = { lblBounds.x+lblBounds.width+PROPERTY_PADDING, slotBounds.y, propBounds.width-lblBounds.width-2*PROPERTY_PADDING, slotBounds.height};
652652
GuiDrawText("X", lblBounds, TEXT_ALIGN_LEFT, textColor);
653653
props[p].value.vrect.x = GuiDMSpinner(valBounds, props[p].value.vrect.x, 0.0, 0.0, 1.0, 0, (propState == STATE_FOCUSED) && CheckCollisionPointRec(mousePos, slotBounds) );
@@ -685,8 +685,8 @@ void GuiDMPropertyList(Rectangle bounds, GuiDMProperty* props, int count, int* f
685685
// draw R, G, B, A values (only when expanded)
686686
if(!PROP_CHECK_FLAG(&props[p], GUI_PFLAG_COLLAPSED)) {
687687
Rectangle slotBounds = { propBounds.x, propBounds.y+GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)+1, propBounds.width, GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)-2};
688-
Rectangle lblBounds = { propBounds.x+PROPERTY_PADDING, slotBounds.y, GetTextWidth("A"), slotBounds.height};
689-
Rectangle valBounds = { lblBounds.x+lblBounds.width+PROPERTY_PADDING, slotBounds.y, GetTextWidth("000000"), slotBounds.height};
688+
Rectangle lblBounds = { propBounds.x+PROPERTY_PADDING, slotBounds.y, GuiGetTextWidth("A"), slotBounds.height};
689+
Rectangle valBounds = { lblBounds.x+lblBounds.width+PROPERTY_PADDING, slotBounds.y, GuiGetTextWidth("000000"), slotBounds.height};
690690
Rectangle sbarBounds = { valBounds.x + valBounds.width + PROPERTY_PADDING, slotBounds.y, slotBounds.width - 3*PROPERTY_PADDING - lblBounds.width - valBounds.width, slotBounds.height };
691691

692692
if(sbarBounds.width <= GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT)-2) valBounds.width = propBounds.width-lblBounds.width-2*PROPERTY_PADDING; // hide slider when no space
@@ -865,4 +865,4 @@ bool GuiDMSaveProperties(const char* file, GuiDMProperty* props, int count) {
865865
return true;
866866
}
867867

868-
#endif // GUI_PROPERTY_LIST_IMPLEMENTATION
868+
#endif // GUI_PROPERTY_LIST_IMPLEMENTATION

0 commit comments

Comments
 (0)