Anonymous
Кнопка не печатает текст
Сообщение
Anonymous » 08 мар 2026, 15:59
У меня проблема: на первом экране кнопки работают, а на следующем нет.
Код: Выделить всё
#include
#define RAYGUI_IMPLEMENTATION
#include
#include
#include
#include
#include
#include
#define RGB 0xFF
#define GS 0x00
uint8_t ModeChoice() {
uint8_t Mode;
InitWindow(460, 90, "Noise type choice");
bool bRGB = false, bGS = false;
while (!WindowShouldClose() && !bRGB && !bGS) {
BeginDrawing();
ClearBackground(WHITE);
if (GuiButton((Rectangle){20, 20, 200, 50}, "All colors")) bRGB = true;
if (GuiButton((Rectangle){240, 20, 200, 50}, "Gray Scale")) bGS = true;
EndDrawing();
}
CloseWindow();
if (bRGB) Mode = RGB;
else Mode = GS;
return Mode;
}
uint8_t SizeChoice() {
uint8_t Size;
InitWindow(380, 160, "Size choice");
bool size[6] = {0,0,0,0,0,0};
while (!WindowShouldClose() && !size[0] && !size[1] && !size[2] && !size[3] && !size[4] && !size[5]) {
BeginDrawing();
ClearBackground(WHITE);
if (GuiButton((Rectangle){20, 20, 100, 50}, "100x100")) size[0] = true;
if (GuiButton((Rectangle){140, 20, 100, 50}, "1000x1000")) size[1] = true;
if (GuiButton((Rectangle){260, 20, 100, 50}, "HD")) size[2] = true;
if (GuiButton((Rectangle){20, 90, 100, 50}, "FHD")) size[3] = true;
if (GuiButton((Rectangle){140, 90, 100, 50}, "QHD")) size[4] = true;
if (GuiButton((Rectangle){260, 90, 100, 50}, "4K")) size[5] = true;
EndDrawing();
}
CloseWindow();
if (size[0]) Size = 0xAA;
if (size[1]) Size = 0xBB;
if (size[2]) Size = 0xCC;
if (size[3]) Size = 0xDD;
if (size[4]) Size = 0xEE;
if (size[5]) Size = 0xFF;
return Size;
}
int main() {
uint8_t Mode = ModeChoice();
uint8_t Size = SizeChoice();
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79903248/button-not-printing-text[/url]
1772974778
Anonymous
У меня проблема: на первом экране кнопки работают, а на следующем нет. [code]#include #define RAYGUI_IMPLEMENTATION #include #include #include #include #include #include #define RGB 0xFF #define GS 0x00 uint8_t ModeChoice() { uint8_t Mode; InitWindow(460, 90, "Noise type choice"); bool bRGB = false, bGS = false; while (!WindowShouldClose() && !bRGB && !bGS) { BeginDrawing(); ClearBackground(WHITE); if (GuiButton((Rectangle){20, 20, 200, 50}, "All colors")) bRGB = true; if (GuiButton((Rectangle){240, 20, 200, 50}, "Gray Scale")) bGS = true; EndDrawing(); } CloseWindow(); if (bRGB) Mode = RGB; else Mode = GS; return Mode; } uint8_t SizeChoice() { uint8_t Size; InitWindow(380, 160, "Size choice"); bool size[6] = {0,0,0,0,0,0}; while (!WindowShouldClose() && !size[0] && !size[1] && !size[2] && !size[3] && !size[4] && !size[5]) { BeginDrawing(); ClearBackground(WHITE); if (GuiButton((Rectangle){20, 20, 100, 50}, "100x100")) size[0] = true; if (GuiButton((Rectangle){140, 20, 100, 50}, "1000x1000")) size[1] = true; if (GuiButton((Rectangle){260, 20, 100, 50}, "HD")) size[2] = true; if (GuiButton((Rectangle){20, 90, 100, 50}, "FHD")) size[3] = true; if (GuiButton((Rectangle){140, 90, 100, 50}, "QHD")) size[4] = true; if (GuiButton((Rectangle){260, 90, 100, 50}, "4K")) size[5] = true; EndDrawing(); } CloseWindow(); if (size[0]) Size = 0xAA; if (size[1]) Size = 0xBB; if (size[2]) Size = 0xCC; if (size[3]) Size = 0xDD; if (size[4]) Size = 0xEE; if (size[5]) Size = 0xFF; return Size; } int main() { uint8_t Mode = ModeChoice(); uint8_t Size = SizeChoice(); std::cout Подробнее здесь: [url]https://stackoverflow.com/questions/79903248/button-not-printing-text[/url]