mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-07-04 04:50:22 +00:00
Address issues mentioned in #216
This commit is contained in:
parent
6b60048d9e
commit
56c7936fb4
11
Makefile
11
Makefile
|
@ -126,7 +126,7 @@ endif
|
|||
GENERATE_LICENSE ?= n
|
||||
|
||||
LICENSE ?= $(EXE).license.txt
|
||||
LICENSE_IN_USE := qb64
|
||||
LICENSE_IN_USE := qb64 tinyfiledialogs
|
||||
|
||||
all: $(EXE)
|
||||
|
||||
|
@ -216,15 +216,6 @@ else
|
|||
QBLIB_NAME := $(addsuffix 0,$(QBLIB_NAME))
|
||||
endif
|
||||
|
||||
ifneq ($(filter y,$(DEP_COMMON_DIALOGS)),)
|
||||
CXXFLAGS += -DDEPENDENCY_COMMON_DIALOGS
|
||||
QBLIB_NAME := $(addsuffix 1,$(QBLIB_NAME))
|
||||
|
||||
LICENSE_IN_USE += tinyfiledialogs
|
||||
else
|
||||
QBLIB_NAME := $(addsuffix 0,$(QBLIB_NAME))
|
||||
endif
|
||||
|
||||
ifneq ($(filter y,$(DEP_CONSOLE_ONLY)),)
|
||||
CXXFLAGS += -DDEPENDENCY_CONSOLE_ONLY
|
||||
QBLIB_NAME := $(addsuffix 1,$(QBLIB_NAME))
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#include "libqb.h"
|
||||
#include "common.h"
|
||||
|
||||
#include "parts/gui/tinyfiledialogs.h" // We need this for alert(...)
|
||||
|
||||
#ifdef QB64_GUI
|
||||
# include "parts/core/glew/src/glew.c"
|
||||
#endif
|
||||
|
@ -501,21 +499,6 @@ int32 dont_call_sub_gl = 0;
|
|||
|
||||
void GLUT_DISPLAY_REQUEST();
|
||||
|
||||
// a740g: These are driven via tiny file dialogs
|
||||
int alert(char* message, char* title, char* type) {
|
||||
return tinyfd_messageBox((const char*)title, (const char*)message, (const char*)type, "error", 1);
|
||||
}
|
||||
|
||||
void alert(char* message) {
|
||||
alert(message, "Alert", "ok");
|
||||
}
|
||||
|
||||
void alert(int64_t x) {
|
||||
static char buffer[32] = {};
|
||||
sprintf(buffer, "%lld", x);
|
||||
alert(buffer);
|
||||
}
|
||||
|
||||
void timerCB(int millisec) // not currently being used
|
||||
{
|
||||
#ifdef QB64_GLUT
|
||||
|
@ -616,8 +599,7 @@ ptrszint list_add(list *L) {
|
|||
// note: L->structure is only modified by list_add
|
||||
L->structure = (uint8 *)calloc(1, L->internal_structure_size * (new_structures_last + 1));
|
||||
if (L->structure == NULL) {
|
||||
alert("list_add: failed to allocate new buffer, structure size:");
|
||||
alert(L->internal_structure_size);
|
||||
gui_alert("list_add: failed to allocate new buffer, structure size: %lld", (int64_t)L->internal_structure_size);
|
||||
}
|
||||
L->structures_last = new_structures_last;
|
||||
L->structures = 0;
|
||||
|
@ -1077,8 +1059,7 @@ int32 new_hardware_img(int32 x, int32 y, uint32 *pixels, int32 flags) {
|
|||
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, x, y, GL_BGRA, GL_UNSIGNED_BYTE, pixels);
|
||||
glerrorcode = glGetError();
|
||||
if (glerrorcode) {
|
||||
alert("gluBuild2DMipmaps failed");
|
||||
alert(glerrorcode);
|
||||
gui_alert("gluBuild2DMipmaps failed: %i", glerrorcode);
|
||||
}
|
||||
hardware_img->source_state.PO2_fix = PO2_FIX__MIPMAPPED;
|
||||
hardware_img->PO2_w = x;
|
||||
|
@ -1115,8 +1096,7 @@ void hardware_img_buffer_to_texture(int32 handle) {
|
|||
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, hardware_img->w, hardware_img->h, GL_BGRA, GL_UNSIGNED_BYTE, hardware_img->software_pixel_buffer);
|
||||
glerrorcode = glGetError();
|
||||
if (glerrorcode) {
|
||||
alert("gluBuild2DMipmaps failed");
|
||||
alert(glerrorcode);
|
||||
gui_alert("gluBuild2DMipmaps failed: %i", glerrorcode);
|
||||
}
|
||||
hardware_img->source_state.PO2_fix = PO2_FIX__MIPMAPPED;
|
||||
hardware_img->PO2_w = hardware_img->w;
|
||||
|
@ -7645,7 +7625,7 @@ skip_0F_opcodes:
|
|||
else
|
||||
i2 = i2 - 10 + 65;
|
||||
unknown_opcode_mess->chr[17] = i2;
|
||||
alert((char *)unknown_opcode_mess->chr, "X86 Error", "ok");
|
||||
gui_alert((const char *)unknown_opcode_mess->chr, "X86 Error", "ok");
|
||||
exit(86);
|
||||
done:
|
||||
if (*ip)
|
||||
|
@ -7936,10 +7916,10 @@ void fix_error() {
|
|||
snprintf(errtitle, len + 1, FIXERRMSG_TITLE, (!prevent_handling ? FIXERRMSG_UNHAND : FIXERRMSG_CRIT), new_error, binary_name->chr);
|
||||
|
||||
if (prevent_handling) {
|
||||
v = alert(errmess, errtitle, "ok");
|
||||
v = gui_alert(errmess, errtitle, "ok");
|
||||
exit(0);
|
||||
} else {
|
||||
v = alert(errmess, errtitle, "yesno");
|
||||
v = gui_alert(errmess, errtitle, "yesno");
|
||||
}
|
||||
|
||||
if ((v == 2) || (v == 0)) {
|
||||
|
@ -7963,107 +7943,107 @@ void error(int32 error_number) {
|
|||
|
||||
// out of memory errors
|
||||
if (error_number == 257) {
|
||||
alert("Out of memory", "Critical Error #1", "ok");
|
||||
gui_alert("Out of memory", "Critical Error #1", "ok");
|
||||
exit(0);
|
||||
} // generic "Out of memory" error
|
||||
// tracable "Out of memory" errors
|
||||
if (error_number == 502) {
|
||||
alert("Out of memory", "Critical Error #2", "ok");
|
||||
gui_alert("Out of memory", "Critical Error #2", "ok");
|
||||
exit(0);
|
||||
}
|
||||
if (error_number == 503) {
|
||||
alert("Out of memory", "Critical Error #3", "ok");
|
||||
gui_alert("Out of memory", "Critical Error #3", "ok");
|
||||
exit(0);
|
||||
}
|
||||
if (error_number == 504) {
|
||||
alert("Out of memory", "Critical Error #4", "ok");
|
||||
gui_alert("Out of memory", "Critical Error #4", "ok");
|
||||
exit(0);
|
||||
}
|
||||
if (error_number == 505) {
|
||||
alert("Out of memory", "Critical Error #5", "ok");
|
||||
gui_alert("Out of memory", "Critical Error #5", "ok");
|
||||
exit(0);
|
||||
}
|
||||
if (error_number == 506) {
|
||||
alert("Out of memory", "Critical Error #6", "ok");
|
||||
gui_alert("Out of memory", "Critical Error #6", "ok");
|
||||
exit(0);
|
||||
}
|
||||
if (error_number == 507) {
|
||||
alert("Out of memory", "Critical Error #7", "ok");
|
||||
gui_alert("Out of memory", "Critical Error #7", "ok");
|
||||
exit(0);
|
||||
}
|
||||
if (error_number == 508) {
|
||||
alert("Out of memory", "Critical Error #8", "ok");
|
||||
gui_alert("Out of memory", "Critical Error #8", "ok");
|
||||
exit(0);
|
||||
}
|
||||
if (error_number == 509) {
|
||||
alert("Out of memory", "Critical Error #9", "ok");
|
||||
gui_alert("Out of memory", "Critical Error #9", "ok");
|
||||
exit(0);
|
||||
}
|
||||
if (error_number == 510) {
|
||||
alert("Out of memory", "Critical Error #10", "ok");
|
||||
gui_alert("Out of memory", "Critical Error #10", "ok");
|
||||
exit(0);
|
||||
}
|
||||
if (error_number == 511) {
|
||||
alert("Out of memory", "Critical Error #11", "ok");
|
||||
gui_alert("Out of memory", "Critical Error #11", "ok");
|
||||
exit(0);
|
||||
}
|
||||
if (error_number == 512) {
|
||||
alert("Out of memory", "Critical Error #12", "ok");
|
||||
gui_alert("Out of memory", "Critical Error #12", "ok");
|
||||
exit(0);
|
||||
}
|
||||
if (error_number == 513) {
|
||||
alert("Out of memory", "Critical Error #13", "ok");
|
||||
gui_alert("Out of memory", "Critical Error #13", "ok");
|
||||
exit(0);
|
||||
}
|
||||
if (error_number == 514) {
|
||||
alert("Out of memory", "Critical Error #14", "ok");
|
||||
gui_alert("Out of memory", "Critical Error #14", "ok");
|
||||
exit(0);
|
||||
}
|
||||
if (error_number == 515) {
|
||||
alert("Out of memory", "Critical Error #15", "ok");
|
||||
gui_alert("Out of memory", "Critical Error #15", "ok");
|
||||
exit(0);
|
||||
}
|
||||
if (error_number == 516) {
|
||||
alert("Out of memory", "Critical Error #16", "ok");
|
||||
gui_alert("Out of memory", "Critical Error #16", "ok");
|
||||
exit(0);
|
||||
}
|
||||
if (error_number == 517) {
|
||||
alert("Out of memory", "Critical Error #17", "ok");
|
||||
gui_alert("Out of memory", "Critical Error #17", "ok");
|
||||
exit(0);
|
||||
}
|
||||
if (error_number == 518) {
|
||||
alert("Out of memory", "Critical Error #18", "ok");
|
||||
gui_alert("Out of memory", "Critical Error #18", "ok");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// other critical errors
|
||||
if (error_number == 11) {
|
||||
alert("Division by zero", "Critical Error", "ok");
|
||||
gui_alert("Division by zero", "Critical Error", "ok");
|
||||
exit(0);
|
||||
}
|
||||
if (error_number == 256) {
|
||||
alert("Out of stack space", "Critical Error", "ok");
|
||||
gui_alert("Out of stack space", "Critical Error", "ok");
|
||||
exit(0);
|
||||
}
|
||||
if (error_number == 259) {
|
||||
alert("Cannot find dynamic library file", "Critical Error", "ok");
|
||||
gui_alert("Cannot find dynamic library file", "Critical Error", "ok");
|
||||
exit(0);
|
||||
}
|
||||
if (error_number == 260) {
|
||||
alert("Sub/Function does not exist in dynamic library", "Critical Error", "ok");
|
||||
gui_alert("Sub/Function does not exist in dynamic library", "Critical Error", "ok");
|
||||
exit(0);
|
||||
}
|
||||
if (error_number == 261) {
|
||||
alert("Sub/Function does not exist in dynamic library", "Critical Error", "ok");
|
||||
gui_alert("Sub/Function does not exist in dynamic library", "Critical Error", "ok");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (error_number == 270) {
|
||||
alert("_GL command called outside of SUB _GL's scope", "Critical Error", "ok");
|
||||
gui_alert("_GL command called outside of SUB _GL's scope", "Critical Error", "ok");
|
||||
exit(0);
|
||||
}
|
||||
if (error_number == 271) {
|
||||
alert("END/SYSTEM called within SUB _GL's scope", "Critical Error", "ok");
|
||||
gui_alert("END/SYSTEM called within SUB _GL's scope", "Critical Error", "ok");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -28343,7 +28323,7 @@ void showvalue(__int64 v) {
|
|||
if (s == NULL)
|
||||
s = qbs_new(0, 0);
|
||||
qbs_set(s, qbs_str(v));
|
||||
alert((char *)s->chr, "showvalue", "ok");
|
||||
gui_alert((char *)s->chr, "showvalue", "ok");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -35006,7 +34986,7 @@ void free_hardware_img(int32 handle, int32 caller_id) {
|
|||
hardware_img = (hardware_img_struct *)list_get(hardware_img_handles, handle);
|
||||
|
||||
if (hardware_img == NULL) {
|
||||
alert("free_hardware_img: image does not exist");
|
||||
gui_alert("free_hardware_img: image does not exist");
|
||||
}
|
||||
|
||||
if (hardware_img->dest_context_handle) {
|
||||
|
@ -36395,10 +36375,10 @@ void GLUT_DISPLAY_REQUEST() {
|
|||
static hardware_img_struct *f1;
|
||||
f1 = (hardware_img_struct *)list_get(hardware_img_handles, software_screen_hardware_frame);
|
||||
if (software_screen_hardware_frame == 0) {
|
||||
alert("Invalid software_screen_hardware_frame!!");
|
||||
gui_alert("Invalid software_screen_hardware_frame!!");
|
||||
}
|
||||
if (f1 == NULL)
|
||||
alert("Invalid software_screen_hardware_frame!");
|
||||
gui_alert("Invalid software_screen_hardware_frame!");
|
||||
|
||||
static int32 use_alpha;
|
||||
use_alpha = 0;
|
||||
|
@ -36438,7 +36418,7 @@ void GLUT_DISPLAY_REQUEST() {
|
|||
hardware_graphics_command_struct *last_hgc =
|
||||
(hardware_graphics_command_struct *)list_get(hardware_graphics_command_handles, last_hardware_command_rendered);
|
||||
if (last_hgc == NULL)
|
||||
alert("Rendering: Last HGC is NULL!");
|
||||
gui_alert("Rendering: Last HGC is NULL!");
|
||||
command = last_hgc->next_command;
|
||||
caller_flag = 200;
|
||||
}
|
||||
|
@ -36526,10 +36506,8 @@ void GLUT_DISPLAY_REQUEST() {
|
|||
|
||||
hardware_graphics_command_struct *hgcx =
|
||||
(hardware_graphics_command_struct *)list_get(hardware_graphics_command_handles, next_hardware_command_to_remove);
|
||||
alert(order);
|
||||
alert(hgcx->order);
|
||||
alert(command);
|
||||
alert("Renderer: Command does not exist.");
|
||||
gui_alert("Renderer: Command does not exist: command = %i, hgcx->order = %lld, order = %lld", command, hgcx->order, order);
|
||||
|
||||
}
|
||||
if (hgc->order == order) {
|
||||
if (first_command_prev_order == 0)
|
||||
|
@ -37958,7 +37936,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
GLenum err = glewInit();
|
||||
if (GLEW_OK != err) {
|
||||
alert((char *)glewGetErrorString(err));
|
||||
gui_alert((char *)glewGetErrorString(err));
|
||||
}
|
||||
if (glewIsSupported("GL_EXT_framebuffer_object"))
|
||||
framebufferobjects_supported = 1;
|
||||
|
@ -38254,7 +38232,7 @@ void display() {
|
|||
}
|
||||
}
|
||||
if (frame_i == -1) {
|
||||
alert("Software frame buffer: Failed to find available frame");
|
||||
gui_alert("Software frame buffer: Failed to find available frame");
|
||||
return;
|
||||
}
|
||||
display_frame[frame_i].state = DISPLAY_FRAME_STATE__BUILDING;
|
||||
|
@ -38431,7 +38409,7 @@ void display() {
|
|||
if (i2 != -1) {
|
||||
memcpy(display_frame[frame_i].bgra, display_frame[i2].bgra, display_frame[frame_i].w * display_frame[frame_i].h * 4);
|
||||
} else {
|
||||
alert("Text Screen Update: Failed to locate previous frame's data for comparison");
|
||||
gui_alert("Text Screen Update: Failed to locate previous frame's data for comparison");
|
||||
check_last = 0; // never occurs, safe-guard only
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,4 +39,7 @@ uint32_t func__guiColorChooserDialog(qbs *qbsTitle, uint32_t nDefaultRGB, int32_
|
|||
qbs *func__guiOpenFileDialog(qbs *qbsTitle, qbs *qbsDefaultPathAndFile, qbs *qbsFilterPatterns, qbs *qbsSingleFilterDescription, int32_t nAllowMultipleSelects,
|
||||
int32_t passed);
|
||||
qbs *func__guiSaveFileDialog(qbs *qbsTitle, qbs *qbsDefaultPathAndFile, qbs *qbsFilterPatterns, qbs *qbsSingleFilterDescription);
|
||||
|
||||
int gui_alert(const char *message, const char *title, const char *type);
|
||||
bool gui_alert(const char *fmt, ...);
|
||||
//-----------------------------------------------------------------------------------------------------
|
|
@ -15,11 +15,6 @@ $(PATH_INTERNAL_C)/parts/gui/%.o: $(PATH_INTERNAL_C)/parts/gui/%.c
|
|||
$(PATH_INTERNAL_C)/parts/gui/%.o: $(PATH_INTERNAL_C)/parts/gui/%.cpp
|
||||
$(CXX) -O2 $(CXXFLAGS) -DDEPENDENCY_CONSOLE_ONLY -Wall $< -c -o $@
|
||||
|
||||
# We'll use tdf to replace the libqb Alert & MessageBox stuff
|
||||
EXE_LIBS += $(TFD_OBJS)
|
||||
|
||||
ifdef DEP_COMMON_DIALOGS
|
||||
EXE_LIBS += $(GUI_OBJS)
|
||||
endif
|
||||
EXE_LIBS += $(TFD_OBJS) $(GUI_OBJS)
|
||||
|
||||
CLEAN_LIST += $(TFD_OBJS) $(GUI_OBJS)
|
||||
|
|
|
@ -194,7 +194,7 @@ qbs *func__guiInputBox(qbs *qbsTitle, qbs *qbsMessage, qbs *qbsDefaultInput, int
|
|||
static qbs *aTitle = nullptr;
|
||||
static qbs *aMessage = nullptr;
|
||||
static qbs *aDefaultInput = nullptr;
|
||||
char *sDefaultInput = nullptr;
|
||||
static qbs *qbsInput;
|
||||
|
||||
if (!aTitle)
|
||||
aTitle = qbs_new(0, 0);
|
||||
|
@ -208,6 +208,8 @@ qbs *func__guiInputBox(qbs *qbsTitle, qbs *qbsMessage, qbs *qbsDefaultInput, int
|
|||
qbs_set(aTitle, qbs_add(qbsTitle, qbs_new_txt_len("\0", 1)));
|
||||
qbs_set(aMessage, qbs_add(qbsMessage, qbs_new_txt_len("\0", 1)));
|
||||
|
||||
char *sDefaultInput;
|
||||
|
||||
if (passed) {
|
||||
qbs_set(aDefaultInput, qbs_add(qbsDefaultInput, qbs_new_txt_len("\0", 1)));
|
||||
sDefaultInput =
|
||||
|
@ -219,7 +221,12 @@ qbs *func__guiInputBox(qbs *qbsTitle, qbs *qbsMessage, qbs *qbsDefaultInput, int
|
|||
|
||||
auto sInput = tinyfd_inputBox((const char *)aTitle->chr, (const char *)aMessage->chr, (const char *)sDefaultInput);
|
||||
|
||||
return qbs_new_txt(sInput);
|
||||
// Create a new qbs and then copy the string to it
|
||||
qbsInput = qbs_new(sInput ? strlen(sInput): 0, 1);
|
||||
if (qbsInput->len)
|
||||
memcpy(qbsInput->chr, sInput, qbsInput->len);
|
||||
|
||||
return qbsInput;
|
||||
}
|
||||
|
||||
/// @brief Shows the browse for folder dialog box
|
||||
|
@ -230,6 +237,7 @@ qbs *func__guiInputBox(qbs *qbsTitle, qbs *qbsMessage, qbs *qbsDefaultInput, int
|
|||
qbs *func__guiSelectFolderDialog(qbs *qbsTitle, qbs *qbsDefaultPath, int32_t passed) {
|
||||
static qbs *aTitle = nullptr;
|
||||
static qbs *aDefaultPath = nullptr;
|
||||
static qbs *qbsFolder;
|
||||
|
||||
if (!aTitle)
|
||||
aTitle = qbs_new(0, 0);
|
||||
|
@ -246,7 +254,12 @@ qbs *func__guiSelectFolderDialog(qbs *qbsTitle, qbs *qbsDefaultPath, int32_t pas
|
|||
|
||||
auto sFolder = tinyfd_selectFolderDialog((const char *)aTitle->chr, (const char *)aDefaultPath->chr);
|
||||
|
||||
return qbs_new_txt(sFolder);
|
||||
// Create a new qbs and then copy the string to it
|
||||
qbsFolder = qbs_new(sFolder ? strlen(sFolder) : 0, 1);
|
||||
if (qbsFolder->chr)
|
||||
memcpy(qbsFolder->chr, sFolder, qbsFolder->len);
|
||||
|
||||
return qbsFolder;
|
||||
}
|
||||
|
||||
/// @brief Shows the color picker dialog box
|
||||
|
@ -286,6 +299,7 @@ qbs *func__guiOpenFileDialog(qbs *qbsTitle, qbs *qbsDefaultPathAndFile, qbs *qbs
|
|||
static qbs *aDefaultPathAndFile = nullptr;
|
||||
static qbs *aFilterPatterns = nullptr;
|
||||
static qbs *aSingleFilterDescription = nullptr;
|
||||
static qbs *qbsFileName;
|
||||
|
||||
if (!aTitle)
|
||||
aTitle = qbs_new(0, 0);
|
||||
|
@ -317,7 +331,12 @@ qbs *func__guiOpenFileDialog(qbs *qbsTitle, qbs *qbsDefaultPathAndFile, qbs *qbs
|
|||
|
||||
gui_free_tokens(psaFilterPatterns); // free memory used by tokenizer
|
||||
|
||||
return qbs_new_txt(sFileName);
|
||||
// Create a new qbs and then copy the string to it
|
||||
qbsFileName = qbs_new(sFileName ? strlen(sFileName) : 0, 1);
|
||||
if (qbsFileName->len)
|
||||
memcpy(qbsFileName->chr, sFileName, qbsFileName->len);
|
||||
|
||||
return qbsFileName;
|
||||
}
|
||||
|
||||
/// @brief Shows the system file save dialog box
|
||||
|
@ -331,6 +350,7 @@ qbs *func__guiSaveFileDialog(qbs *qbsTitle, qbs *qbsDefaultPathAndFile, qbs *qbs
|
|||
static qbs *aDefaultPathAndFile = nullptr;
|
||||
static qbs *aFilterPatterns = nullptr;
|
||||
static qbs *aSingleFilterDescription = nullptr;
|
||||
static qbs *qbsFileName;
|
||||
|
||||
if (!aTitle)
|
||||
aTitle = qbs_new(0, 0);
|
||||
|
@ -359,7 +379,51 @@ qbs *func__guiSaveFileDialog(qbs *qbsTitle, qbs *qbsDefaultPathAndFile, qbs *qbs
|
|||
|
||||
gui_free_tokens(psaFilterPatterns); // free memory used by tokenizer
|
||||
|
||||
return qbs_new_txt(sFileName);
|
||||
// Create a new qbs and then copy the string to it
|
||||
qbsFileName = qbs_new(sFileName ? strlen(sFileName) : 0, 1);
|
||||
if (qbsFileName->len)
|
||||
memcpy(qbsFileName->chr, sFileName, qbsFileName->len);
|
||||
|
||||
return qbsFileName;
|
||||
}
|
||||
|
||||
/// @brief This is used internally by libqb to show warning and failure messages
|
||||
/// @param message The message the will show inside the dialog box
|
||||
/// @param title The dialog box title
|
||||
/// @param type The type of dialog box (see tinyfd_messageBox)
|
||||
/// @return returns the value retured by tinyfd_messageBox
|
||||
int gui_alert(const char *message, const char *title, const char *type) { return tinyfd_messageBox(title, message, type, "error", 1); }
|
||||
|
||||
/// @brief This is used internally by libqb to show warning and failure messages
|
||||
/// @param fmt A string that contains a printf style format
|
||||
/// @param ... Additional arguments
|
||||
/// @return true if successful, false otherwise
|
||||
bool gui_alert(const char *fmt, ...) {
|
||||
if (!fmt) return false;
|
||||
|
||||
size_t l = strlen(fmt) * 2 + UCHAR_MAX;
|
||||
|
||||
char *buf = (char *)malloc(l);
|
||||
if (!buf)
|
||||
return false;
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
if (vsnprintf(buf, l, fmt, args) < 0) {
|
||||
va_end(args);
|
||||
free(buf);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
va_end(args);
|
||||
|
||||
gui_alert(buf, "Alert", "ok");
|
||||
|
||||
free(buf);
|
||||
|
||||
return true;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -91,6 +91,14 @@ These are used if you make use of MIDI support.
|
|||
| TinySoundFont | MIT | license_tinysoundfont.txt | internal/c/parts/audio/extras/tinysoundfont/tsf.h
|
||||
| TinyMidiLoader | ZLIB | license_tinymidiloader.txt | internal/c/parts/audio/extras/tinysoundfont.tml.h |
|
||||
|
||||
## Common Dialogs Support
|
||||
|
||||
This is used by libqb to show alerts and also by the common dialog functions and subroutines.
|
||||
|
||||
| Library | License | License file | Location |
|
||||
| :------ | :-----: | :----------- | :------- |
|
||||
| tiny file dialogs | ZLIB | license_tinyfiledialogs.txt | internal/c/parts/gui
|
||||
|
||||
## Legacy OpenAL audio backend
|
||||
|
||||
The below licenses apply when making use of the legacy OpenAL audio backend (can be enabled in `Compiler Settings`). These replace all other sound related libraries:
|
||||
|
|
|
@ -107,7 +107,6 @@ CONST DEPENDENCY_ICON = 10: DEPENDENCY_LAST = DEPENDENCY_LAST + 1
|
|||
CONST DEPENDENCY_SCREENIMAGE = 11: DEPENDENCY_LAST = DEPENDENCY_LAST + 1
|
||||
CONST DEPENDENCY_DEVICEINPUT = 12: DEPENDENCY_LAST = DEPENDENCY_LAST + 1 'removes support for gamepad input if not present
|
||||
CONST DEPENDENCY_ZLIB = 13: DEPENDENCY_LAST = DEPENDENCY_LAST + 1 'ZLIB library linkage, if desired, for compression/decompression.
|
||||
CONST DEPENDENCY_COMMON_DIALOGS = 14: DEPENDENCY_LAST = DEPENDENCY_LAST + 1 ' a740g: common dialogs support using tiny file dialogs
|
||||
|
||||
|
||||
|
||||
|
@ -12512,7 +12511,6 @@ IF DEPENDENCY(DEPENDENCY_SCREENIMAGE) THEN makedeps$ = makedeps$ + " DEP_SCREENI
|
|||
IF DEPENDENCY(DEPENDENCY_LOADFONT) THEN makedeps$ = makedeps$ + " DEP_FONT=y"
|
||||
IF DEPENDENCY(DEPENDENCY_DEVICEINPUT) THEN makedeps$ = makedeps$ + " DEP_DEVICEINPUT=y"
|
||||
IF DEPENDENCY(DEPENDENCY_ZLIB) THEN makedeps$ = makedeps$ + " DEP_ZLIB=y"
|
||||
IF DEPENDENCY(DEPENDENCY_COMMON_DIALOGS) THEN makedeps$ = makedeps$ + " DEP_COMMON_DIALOGS=y" ' a740g: Common dialogs support using tiny file dialogs
|
||||
IF inline_DATA = 0 AND DataOffset THEN makedeps$ = makedeps$ + " DEP_DATA=y"
|
||||
IF Console THEN makedeps$ = makedeps$ + " DEP_CONSOLE=y"
|
||||
IF ExeIconSet OR VersionInfoSet THEN makedeps$ = makedeps$ + " DEP_ICON_RC=y"
|
||||
|
|
|
@ -3870,7 +3870,6 @@ regid
|
|||
' a740g: Common dialog support using tiny file dialogs
|
||||
clearid
|
||||
id.n = qb64prefix$ + "NotifyPopup" ' Name in CaMeL case
|
||||
id.Dependency = DEPENDENCY_COMMON_DIALOGS ' QB64-PE library dependency
|
||||
id.subfunc = 2 ' 1 = function, 2 = sub
|
||||
id.callname = "sub__guiNotifyPopup" ' C/C++ function name
|
||||
id.args = 3 ' number of arguments - "passed"
|
||||
|
@ -3881,7 +3880,6 @@ id.hr_syntax = "_NOTIFYPOPUP [title$][, message$][, iconType$]" ' syntax help
|
|||
regid
|
||||
clearid
|
||||
id.n = qb64prefix$ + "MessageBox" ' Name in CaMeL case
|
||||
id.Dependency = DEPENDENCY_COMMON_DIALOGS ' QB64-PE library dependency
|
||||
id.subfunc = 2 ' 1 = function, 2 = sub
|
||||
id.callname = "sub__guiMessageBox" ' C/C++ function name
|
||||
id.args = 3 ' number of arguments - "passed"
|
||||
|
@ -3893,7 +3891,6 @@ regid
|
|||
clearid
|
||||
id.n = qb64prefix$ + "SelectFolderDialog" ' Name in CaMeL case
|
||||
id.musthave = "$"
|
||||
id.Dependency = DEPENDENCY_COMMON_DIALOGS ' QB64-PE library dependency
|
||||
id.subfunc = 1 ' 1 = function, 2 = sub
|
||||
id.callname = "func__guiSelectFolderDialog" ' C/C++ function name
|
||||
id.args = 2 ' number of arguments - "passed"
|
||||
|
@ -3905,7 +3902,6 @@ regid
|
|||
|
||||
clearid
|
||||
id.n = qb64prefix$ + "ColorChooserDialog" ' Name in CaMeL case
|
||||
id.Dependency = DEPENDENCY_COMMON_DIALOGS ' QB64-PE library dependency
|
||||
id.subfunc = 1 ' 1 = function, 2 = sub
|
||||
id.callname = "func__guiColorChooserDialog" ' C/C++ function name
|
||||
id.args = 2 ' number of arguments - "passed"
|
||||
|
@ -3917,7 +3913,6 @@ regid
|
|||
|
||||
clearid
|
||||
id.n = qb64prefix$ + "MessageBox" ' Name in CaMeL case
|
||||
id.Dependency = DEPENDENCY_COMMON_DIALOGS ' QB64-PE library dependency
|
||||
id.subfunc = 1 ' 1 = function, 2 = sub
|
||||
id.callname = "func__guiMessageBox" ' C/C++ function name
|
||||
id.args = 5 ' number of arguments - "passed"
|
||||
|
@ -3930,7 +3925,6 @@ regid
|
|||
clearid
|
||||
id.n = qb64prefix$ + "InputBox" ' Name in CaMeL case
|
||||
id.musthave = "$"
|
||||
id.Dependency = DEPENDENCY_COMMON_DIALOGS ' QB64-PE library dependency
|
||||
id.subfunc = 1 ' 1 = function, 2 = sub
|
||||
id.callname = "func__guiInputBox" ' C/C++ function name
|
||||
id.args = 3 ' number of arguments - "passed"
|
||||
|
@ -3943,7 +3937,6 @@ regid
|
|||
clearid
|
||||
id.n = qb64prefix$ + "OpenFileDialog" ' Name in CaMeL case
|
||||
id.musthave = "$"
|
||||
id.Dependency = DEPENDENCY_COMMON_DIALOGS ' QB64-PE library dependency
|
||||
id.subfunc = 1 ' 1 = function, 2 = sub
|
||||
id.callname = "func__guiOpenFileDialog" ' C/C++ function name
|
||||
id.args = 5 ' number of arguments - "passed"
|
||||
|
@ -3956,7 +3949,6 @@ regid
|
|||
clearid
|
||||
id.n = qb64prefix$ + "SaveFileDialog" ' Name in CaMeL case
|
||||
id.musthave = "$"
|
||||
id.Dependency = DEPENDENCY_COMMON_DIALOGS ' QB64-PE library dependency
|
||||
id.subfunc = 1 ' 1 = function, 2 = sub
|
||||
id.callname = "func__guiSaveFileDialog" ' C/C++ function name
|
||||
id.args = 4 ' number of arguments - "passed"
|
||||
|
|
Loading…
Reference in a new issue