Remove debugging output

This commit is contained in:
John McCardle 2026-02-01 16:40:23 -05:00
commit 3b27401f29
3 changed files with 3 additions and 88 deletions

View file

@ -123,21 +123,11 @@ GameEngine::GameEngine(const McRogueFaceConfig& cfg)
!config.python_mode; !config.python_mode;
if (should_load_game) { if (should_load_game) {
std::cerr << "[DEBUG] GameEngine: loading default game.py" << std::endl;
std::cerr.flush();
if (!Py_IsInitialized()) { if (!Py_IsInitialized()) {
std::cerr << "[DEBUG] GameEngine: initializing Python API" << std::endl;
std::cerr.flush();
McRFPy_API::api_init(); McRFPy_API::api_init();
} }
std::cerr << "[DEBUG] GameEngine: importing mcrfpy" << std::endl;
std::cerr.flush();
McRFPy_API::executePyString("import mcrfpy"); McRFPy_API::executePyString("import mcrfpy");
std::cerr << "[DEBUG] GameEngine: executing scripts/game.py" << std::endl;
std::cerr.flush();
McRFPy_API::executeScript("scripts/game.py"); McRFPy_API::executeScript("scripts/game.py");
std::cerr << "[DEBUG] GameEngine: game.py execution complete" << std::endl;
std::cerr.flush();
} }
// Note: --exec scripts are NOT executed here. // Note: --exec scripts are NOT executed here.

View file

@ -699,28 +699,18 @@ PyObject* PyInit_mcrfpy()
// init_python - configure interpreter details here // init_python - configure interpreter details here
PyStatus init_python(const char *program_name) PyStatus init_python(const char *program_name)
{ {
std::cerr << "[DEBUG] api_init: starting" << std::endl;
std::cerr.flush();
PyStatus status; PyStatus status;
//**preconfig to establish locale** // Preconfig to establish locale
PyPreConfig preconfig; PyPreConfig preconfig;
PyPreConfig_InitIsolatedConfig(&preconfig); PyPreConfig_InitIsolatedConfig(&preconfig);
preconfig.utf8_mode = 1; preconfig.utf8_mode = 1;
std::cerr << "[DEBUG] api_init: Py_PreInitialize" << std::endl;
std::cerr.flush();
status = Py_PreInitialize(&preconfig); status = Py_PreInitialize(&preconfig);
if (PyStatus_Exception(status)) { if (PyStatus_Exception(status)) {
std::cerr << "[DEBUG] api_init: PreInit failed" << std::endl;
Py_ExitStatusException(status); Py_ExitStatusException(status);
} }
std::cerr << "[DEBUG] api_init: PyConfig setup" << std::endl;
std::cerr.flush();
PyConfig config; PyConfig config;
PyConfig_InitIsolatedConfig(&config); PyConfig_InitIsolatedConfig(&config);
config.dev_mode = 0; config.dev_mode = 0;
@ -731,9 +721,6 @@ PyStatus init_python(const char *program_name)
config.configure_c_stdio = 1; config.configure_c_stdio = 1;
#ifdef __EMSCRIPTEN__ #ifdef __EMSCRIPTEN__
std::cerr << "[DEBUG] api_init: WASM path config" << std::endl;
std::cerr.flush();
// WASM: Use absolute paths in virtual filesystem // WASM: Use absolute paths in virtual filesystem
PyConfig_SetString(&config, &config.executable, L"/mcrogueface"); PyConfig_SetString(&config, &config.executable, L"/mcrogueface");
PyConfig_SetString(&config, &config.home, L"/lib/python3.14"); PyConfig_SetString(&config, &config.home, L"/lib/python3.14");
@ -814,18 +801,11 @@ PyStatus init_python(const char *program_name)
PyStatus McRFPy_API::init_python_with_config(const McRogueFaceConfig& config) PyStatus McRFPy_API::init_python_with_config(const McRogueFaceConfig& config)
{ {
std::cerr << "[DEBUG] init_python_with_config: starting" << std::endl;
std::cerr.flush();
// If Python is already initialized, just return success // If Python is already initialized, just return success
if (Py_IsInitialized()) { if (Py_IsInitialized()) {
std::cerr << "[DEBUG] init_python_with_config: already initialized" << std::endl;
return PyStatus_Ok(); return PyStatus_Ok();
} }
std::cerr << "[DEBUG] init_python_with_config: PyConfig_InitIsolatedConfig" << std::endl;
std::cerr.flush();
PyStatus status; PyStatus status;
PyConfig pyconfig; PyConfig pyconfig;
PyConfig_InitIsolatedConfig(&pyconfig); PyConfig_InitIsolatedConfig(&pyconfig);

View file

@ -377,16 +377,9 @@ void SDL2Renderer::setProjection(float left, float right, float bottom, float to
projectionMatrix_[15] = 1.0f; projectionMatrix_[15] = 1.0f;
} }
static int clearCount = 0;
void SDL2Renderer::clear(float r, float g, float b, float a) { void SDL2Renderer::clear(float r, float g, float b, float a) {
glClearColor(r, g, b, a); glClearColor(r, g, b, a);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
// Debug: Log first few clears to confirm render loop is running
if (clearCount < 5) {
std::cout << "SDL2Renderer::clear(" << r << ", " << g << ", " << b << ", " << a << ") #" << clearCount << std::endl;
clearCount++;
}
} }
void SDL2Renderer::pushRenderState(unsigned int width, unsigned int height) { void SDL2Renderer::pushRenderState(unsigned int width, unsigned int height) {
@ -466,22 +459,6 @@ void SDL2Renderer::drawTriangles(const float* vertices, size_t vertexCount,
glBindTexture(GL_TEXTURE_2D, textureId); glBindTexture(GL_TEXTURE_2D, textureId);
int texLoc = glGetUniformLocation(program, "u_texture"); int texLoc = glGetUniformLocation(program, "u_texture");
glUniform1i(texLoc, 0); glUniform1i(texLoc, 0);
// Debug: verify texture binding for text shader
static int texBindDebug = 0;
if (texBindDebug < 2 && shaderType == ShaderType::Text) {
std::cout << "drawTriangles(Text): textureId=" << textureId
<< " texLoc=" << texLoc << " program=" << program << std::endl;
texBindDebug++;
}
} else if (shaderType == ShaderType::Text) {
// This would explain solid boxes - texture not being bound!
static bool warnOnce = true;
if (warnOnce) {
std::cerr << "WARNING: Text shader used but texture not bound! texCoords="
<< (texCoords ? "valid" : "null") << " textureId=" << textureId << std::endl;
warnOnce = false;
}
} }
// Draw // Draw
@ -541,8 +518,6 @@ void RenderWindow::create(VideoMode mode, const std::string& title, uint32_t sty
// Set the canvas size explicitly before creating the window // Set the canvas size explicitly before creating the window
emscripten_set_canvas_element_size("#canvas", mode.width, mode.height); emscripten_set_canvas_element_size("#canvas", mode.width, mode.height);
std::cout << "Emscripten: Setting canvas to " << mode.width << "x" << mode.height << std::endl;
#endif #endif
// Create window // Create window
@ -605,37 +580,16 @@ void RenderWindow::create(VideoMode mode, const std::string& title, uint32_t sty
// Set up OpenGL state // Set up OpenGL state
glViewport(0, 0, mode.width, mode.height); glViewport(0, 0, mode.width, mode.height);
std::cout << "GL viewport set to " << mode.width << "x" << mode.height << std::endl;
GLenum err = glGetError();
if (err != GL_NO_ERROR) {
std::cerr << "GL error after viewport: " << err << std::endl;
}
SDL2Renderer::getInstance().setProjection(0, mode.width, mode.height, 0); SDL2Renderer::getInstance().setProjection(0, mode.width, mode.height, 0);
// Enable blending for transparency // Enable blending for transparency
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// Initial clear to a visible color to confirm GL is working // Initial clear
glClearColor(0.2f, 0.3f, 0.4f, 1.0f); // Blue-gray glClearColor(0.2f, 0.3f, 0.4f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
err = glGetError();
if (err != GL_NO_ERROR) {
std::cerr << "GL error after clear: " << err << std::endl;
}
SDL_GL_SwapWindow(window); SDL_GL_SwapWindow(window);
err = glGetError();
if (err != GL_NO_ERROR) {
std::cerr << "GL error after swap: " << err << std::endl;
}
std::cout << "RenderWindow: Created " << mode.width << "x" << mode.height << " window" << std::endl;
std::cout << "WebGL context should now show blue-gray" << std::endl;
} }
void RenderWindow::close() { void RenderWindow::close() {
@ -1277,7 +1231,6 @@ bool Font::loadFromFile(const std::string& filename) {
ftStroker_ = stroker; ftStroker_ = stroker;
loaded_ = true; loaded_ = true;
std::cout << "Font: Loaded " << filename << " with FreeType" << std::endl;
return true; return true;
} }
@ -2129,10 +2082,6 @@ bool FontAtlas::load(const Font* font, float fontSize) {
} }
textureId_ = SDL2Renderer::getInstance().createTexture(ATLAS_SIZE, ATLAS_SIZE, rgbaPixels.data()); textureId_ = SDL2Renderer::getInstance().createTexture(ATLAS_SIZE, ATLAS_SIZE, rgbaPixels.data());
std::cout << "FontAtlas: created " << ATLAS_SIZE << "x" << ATLAS_SIZE
<< " atlas with " << simpleGlyphCache_.size() << " glyphs, textureId=" << textureId_ << std::endl;
return true; return true;
} }
@ -2234,10 +2183,6 @@ bool FontAtlas::load(const unsigned char* fontData, size_t dataSize, float fontS
} }
textureId_ = SDL2Renderer::getInstance().createTexture(ATLAS_SIZE, ATLAS_SIZE, rgbaPixels.data()); textureId_ = SDL2Renderer::getInstance().createTexture(ATLAS_SIZE, ATLAS_SIZE, rgbaPixels.data());
std::cout << "FontAtlas: created " << ATLAS_SIZE << "x" << ATLAS_SIZE
<< " atlas with " << simpleGlyphCache_.size() << " glyphs, textureId=" << textureId_ << std::endl;
return true; return true;
} }