Skip to content

Add show_error function - #399

Open
emiyl wants to merge 56 commits into
ButterscotchRunner:mainfrom
emiyl:show_error_new
Open

Add show_error function#399
emiyl wants to merge 56 commits into
ButterscotchRunner:mainfrom
emiyl:show_error_new

Conversation

@emiyl

@emiyl emiyl commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Adds support for show_error(message: String, abort: bool).

Implementation

The function takes two arguments. The first, the error message, is sent to runner->showErrorDialogue if it exists. A check is made before it's called, as showErrorDialogue is not implemented for all platforms. If the abort bool is true, it sets runner->shouldExit to true.

Regardless of what happens, the function also fprintf's the error to the console log.

Windows, macOS and Linux

Error messages must be implemented per platform. I've created a directory src/desktop/platform/ with files for windows.c, macos.m and gtk3.c.

  • Windows: We can call MessageBoxA.
  • macOS: We can use an NSAlert for macOS 10.3 and above, and an NSRunAlertPanel for versions prior to 10.3.
  • Linux : We can use GTK3 to show the error box.

macOS 26.5.1, native NSAlert

image

KDE Plasma VM, GTK3

image

Why not SDL2/3 SDL_ShowSimpleMessageBox?

First of all it looks.. really ugly. And @Un1q32 says that some older versions can segfault really easily. Also I think that targeting GTK3, Windows and macOS should cover >99% of desktop users.

PS Vita

SceMsgDialogParam is used to show an error message.

image

Android, Web, PS2 and PS3

Android and PS3 have native error dialogues that could be implemented. For all other devices, I'd like to implement a fallback with something like this.

image

While it's not pretty yet, it uses gamemaker builtin functions to draw to the screen, so we can guarantee that it'll be compatible with all platforms that butterscotch targets.

@emiyl
emiyl marked this pull request as draft August 11, 2026 11:33
emiyl and others added 19 commits August 11, 2026 17:35
* replace random with well512a

* fix

* fix

* bakc

* fix
* add call_later and call_cancel

* for wad17 or higher

* fix type conversions for ps2

* omg why is it so picky

* #if IS_WAD17_OR_HIGHER_ENABLED for builtin_call_later

* use a valid currentInstance context for callback execution
* add tile_layer_delete_at

* tile_layer_depth (I don't know if it works properly)
* arctan2

* dot_product_3d

* dot_product_(3d_)normalised

* draw_arrow

* calculate arrowhead before drawing line

* ln

* log10

* logn

* max3

* min3
fixes `GL_INVALID_OPERATION in glUniform1(rippleBanding@7 is int, not float)` in ch5
…tterscotchRunner#393)

* Improved memory, fixed shaders and fixed shoulder buttons

* Directly upload VBO data for the vita

* Delete .al_audio_system.c.kate-swp

* Change memory sizes around

* GL renderer optimizations for vita

* Nuke glClear calls for Vita
* macos test runner

* add x86_64 runner

* Fix uniq's reviews

* Fix typo

* Use AppKit

* chore(ci): matrix builds for macos

* chore(ci): macos glfw->appkit

* ccache

* remove deprecation warnings

* remove commit date/hash from cmake

* speed up homebrew?

---------

Co-authored-by: Fancy2209 <64917206+Fancy2209@users.noreply.github.com>
Co-authored-by: cobaltgit <cobaltsecuremail312@proton.me>
…ms (ButterscotchRunner#406)

* use glGetUniformLocation instead of looping through the shader uniforms

* make it a little nicer

* oopsies pointers
* chore(ci): use ninja for CI where possible to speed up builds

* fix(ci): install ninja in ps2dev container

* do the same for the tests

* ccache??

* fix(ci): use GNU tar in alpine containers

* chore(ci): speed-up Windows x86 build

* fix

* restore keys

* try use ccache for vitagl build

* trigger ci

* ccache for android?

* forgor

* trigger ci to test android

* remove ignore opts for all except ps2
* chore(ci): add ARM64 FreeBSD build

* aarch64

* why did they make the sysroot arch name different from the pkg arch name
@emiyl
emiyl marked this pull request as ready for review August 13, 2026 17:41
Comment thread .github/workflows/build.yml Outdated
-DWERROR=ON \
-DDESKTOP_BACKEND=glfw3 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS="-Wno-error=unused-but-set-global" \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there was some issue with an unused variable in glad

@Un1q32

Un1q32 commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

I think including gtk and qt isn't worth it and we should just use nuklear or some other solution that doesn't require platform specific apis or new big dependencies.

@emiyl

emiyl commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

I've removed qt6 now and GTK3 is an optional dependency that only adds it if it detects that it's installed. There's still a fallback to just print to the console.

If you want minimal dependencies then I think my fallback that uses GameMaker functions to draw the error message would be better than nuklear as we can 100% guarantee it'll work on any platform that Butterscotch works on.

@Un1q32

Un1q32 commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

If you want minimal dependencies then I think my fallback that uses GameMaker functions to draw the error message would be better than nuklear as we can 100% guarantee it'll work on any platform that Butterscotch works on.

Can we just use that everywhere (even on windows and mac), I think it looks better then messageboxes anyway.

@emiyl

emiyl commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

I mean I guess but I haven’t figured out how to properly do that yet, currently it’s just the ugly solution of pausing everything and forcing it to the screen. I think the messages boxes feel more native and are what a user would expect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants