GroveEngine/tests/visual/test_minimal_sdl.cpp
StillHammer 0540fbf526 fix: Resolve bgfx Frame 1 crash on Windows DLL + MinGW GCC 15 compatibility
- Add BGFX_CONFIG_MULTITHREADED=0 to fix TLS crash when bgfx runs from DLL
- Add -include stdint.h for MinGW GCC 15+ compatibility with bgfx third-party code
- Guard SDL2-dependent visual tests with if(SDL2_FOUND)
- Clean up debug logging in BgfxDevice::frame() and BgfxRendererModule::process()
- Re-enable all modules in test_full_stack_interactive.cpp
- Add grove::fs namespace for cross-platform filesystem operations
- Add InputModule C export for feedEvent across DLL boundary

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 11:03:06 +07:00

81 lines
2.0 KiB
C++

/**
* Minimal SDL test - just open a window
* If this doesn't work, we have SDL/DLL issues
*/
#include <SDL.h>
#include <fstream>
#include <iostream>
#undef main
int main(int argc, char* argv[]) {
// Write to file FIRST (before anything can crash)
std::ofstream log("minimal_test.log");
log << "=== Minimal SDL Test ===" << std::endl;
log << "Step 1: Program started" << std::endl;
log.flush();
// Try SDL init
log << "Step 2: Attempting SDL_Init..." << std::endl;
log.flush();
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
log << "ERROR: SDL_Init failed: " << SDL_GetError() << std::endl;
log.close();
std::cerr << "SDL_Init failed - check minimal_test.log\n";
return 1;
}
log << "Step 3: SDL_Init SUCCESS" << std::endl;
log.flush();
// Try window creation
log << "Step 4: Creating window..." << std::endl;
log.flush();
SDL_Window* window = SDL_CreateWindow(
"Minimal Test",
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
800, 600,
SDL_WINDOW_SHOWN
);
if (!window) {
log << "ERROR: SDL_CreateWindow failed: " << SDL_GetError() << std::endl;
SDL_Quit();
log.close();
return 1;
}
log << "Step 5: Window created SUCCESS" << std::endl;
log << "Window is visible - press any key to close" << std::endl;
log.flush();
std::cout << "Window created! Check minimal_test.log for details.\n";
std::cout << "Press any key in the window to close...\n";
// Wait for key press
bool running = true;
SDL_Event event;
while (running) {
while (SDL_PollEvent(&event)) {
if (event.type == SDL_QUIT || event.type == SDL_KEYDOWN) {
running = false;
}
}
SDL_Delay(10);
}
log << "Step 6: Cleaning up..." << std::endl;
SDL_DestroyWindow(window);
SDL_Quit();
log << "Step 7: Program exited cleanly" << std::endl;
log.close();
std::cout << "Test completed successfully!\n";
return 0;
}