wx_BGI_Graphics
Classic BGI-compatible graphics API with modern OpenGL extension API
Loading...
Searching...
No Matches
Typedefs | Functions
Standalone wx Window API

wxPython-style App/Frame/MainLoop API for Python, Pascal, and simple C programs. More...

Collaboration diagram for Standalone wx Window API:

Typedefs

typedef void(BGI_CALLWxbgiFrameCallback) (void)
 Callback type for animation / per-frame update.
 

Functions

BGI_API void BGI_CALL wxbgi_wx_app_create (void)
 Create the wx application instance.
 
BGI_API void BGI_CALL wxbgi_wx_app_main_loop (void)
 Run the wx event loop.
 
BGI_API void BGI_CALL wxbgi_wx_close_after_ms (int ms)
 Schedule the frame to close after ms milliseconds.
 
BGI_API void BGI_CALL wxbgi_wx_close_frame (void)
 Close the standalone frame immediately.
 
BGI_API void BGI_CALL wxbgi_wx_frame_create (int width, int height, const char *title)
 Create a top-level wxFrame with an embedded WxBgiCanvas.
 
BGI_API void BGI_CALL wxbgi_wx_refresh (void)
 Request an immediate canvas repaint.
 
BGI_API void BGI_CALL wxbgi_wx_set_frame_rate (int fps)
 Set the auto-refresh rate in frames per second (default 0 = no auto-refresh).
 
BGI_API void BGI_CALL wxbgi_wx_set_idle_callback (WxbgiFrameCallback fn)
 Register a per-frame callback.
 

Detailed Description

wxPython-style App/Frame/MainLoop API for Python, Pascal, and simple C programs.

These functions create and run a wxWidgets window with an embedded WxBgiCanvas without requiring the caller to write any C++ wxFrame subclass.

Typical usage (analogous to wxPython):

// C / Python ctypes / Pascal cdecl:
wxbgi_wx_frame_create(640, 480, "My BGI App");
// ... BGI drawing calls here (write to CPU offscreen buffer) ...
wxbgi_wx_close_after_ms(5000); // for automated tests
wxbgi_wx_app_main_loop(); // blocking -- returns when window closes
BGI_API void BGI_CALL wxbgi_wx_app_create(void)
Create the wx application instance.
BGI_API void BGI_CALL wxbgi_wx_app_main_loop(void)
Run the wx event loop.
BGI_API void BGI_CALL wxbgi_wx_close_after_ms(int ms)
Schedule the frame to close after ms milliseconds.
BGI_API void BGI_CALL wxbgi_wx_frame_create(int width, int height, const char *title)
Create a top-level wxFrame with an embedded WxBgiCanvas.
Warning
Do NOT call wxbgi_wx_app_create() from a C++ application that already owns a wxApp via wxIMPLEMENT_APP. In that case use the wx_bgi_wx static library and WxBgiCanvas directly.

Typedef Documentation

◆ WxbgiFrameCallback

typedef void(BGI_CALL * WxbgiFrameCallback) (void)

Callback type for animation / per-frame update.

Function Documentation

◆ wxbgi_wx_app_create()

BGI_API void BGI_CALL wxbgi_wx_app_create ( void  )

Create the wx application instance.

Analogous to wx.App() in wxPython. Must be called once before wxbgi_wx_frame_create(). Safe to call multiple times (idempotent if a wxApp already exists).

◆ wxbgi_wx_app_main_loop()

BGI_API void BGI_CALL wxbgi_wx_app_main_loop ( void  )

Run the wx event loop.

Analogous to app.MainLoop() in wxPython. Blocks until all top-level windows are closed. Returns only after cleanup.

◆ wxbgi_wx_close_after_ms()

BGI_API void BGI_CALL wxbgi_wx_close_after_ms ( int  ms)

Schedule the frame to close after ms milliseconds.

Useful for automated tests that need a short visible window.

◆ wxbgi_wx_close_frame()

BGI_API void BGI_CALL wxbgi_wx_close_frame ( void  )

Close the standalone frame immediately.

◆ wxbgi_wx_frame_create()

BGI_API void BGI_CALL wxbgi_wx_frame_create ( int  width,
int  height,
const char *  title 
)

Create a top-level wxFrame with an embedded WxBgiCanvas.

Analogous to wx.Frame() in wxPython. Also initialises the BGI CPU page buffers (calls wxbgi_wx_init_for_canvas internally) so that BGI drawing functions can be called before wxbgi_wx_app_main_loop().

◆ wxbgi_wx_refresh()

BGI_API void BGI_CALL wxbgi_wx_refresh ( void  )

Request an immediate canvas repaint.

◆ wxbgi_wx_set_frame_rate()

BGI_API void BGI_CALL wxbgi_wx_set_frame_rate ( int  fps)

Set the auto-refresh rate in frames per second (default 0 = no auto-refresh).

Must be called after wxbgi_wx_frame_create().

◆ wxbgi_wx_set_idle_callback()

BGI_API void BGI_CALL wxbgi_wx_set_idle_callback ( WxbgiFrameCallback  fn)

Register a per-frame callback.

Called on each timer tick set by wxbgi_wx_set_frame_rate(). Draw your scene here; the canvas is automatically refreshed after the callback returns. Pass NULL to deregister.