wx_BGI_Graphics
Classic BGI-compatible graphics API with modern OpenGL extension API
Loading...
Searching...
No Matches
wx_bgi_ext.h
Go to the documentation of this file.
1#pragma once
2
3#include "bgi_types.h"
4
58
68
79
80// ---------------------------------------------------------------------------
81// User Input Hook Callbacks
82// ---------------------------------------------------------------------------
83
110#define WXBGI_KEY_PRESS 1
111#define WXBGI_KEY_RELEASE 0
112#define WXBGI_KEY_REPEAT 2
113#define WXBGI_MOUSE_LEFT 0
114#define WXBGI_MOUSE_RIGHT 1
115#define WXBGI_MOUSE_MIDDLE 2
116#define WXBGI_MOD_SHIFT 0x0001
117#define WXBGI_MOD_CTRL 0x0002
118#define WXBGI_MOD_ALT 0x0004
120
134
145
155
169
179
198BGI_API void BGI_CALL wxbgi_get_scroll_delta(double *dx, double *dy);
199
229
236
260
263
272BGI_API int BGI_CALL wxbgi_hk_dds_get_selected_id(int index, char *outId, int maxLen);
273
279
286
293
296
310BGI_API int BGI_CALL wxbgi_hk_dds_pick_at(int x, int y, int ctrl);
311
321#ifdef WXBGI_ENABLE_TEST_SEAMS
341
356BGI_API int BGI_CALL wxbgi_test_simulate_key(int key, int scancode, int action, int mods);
357
369BGI_API int BGI_CALL wxbgi_test_simulate_char(unsigned int codepoint);
370
383
396BGI_API int BGI_CALL wxbgi_test_simulate_mouse_button(int button, int action, int mods);
397
409BGI_API int BGI_CALL wxbgi_test_simulate_scroll(double xoffset, double yoffset);
410#endif
423
442
449BGI_API int BGI_CALL wxbgi_get_window_size(int *width, int *height);
455BGI_API int BGI_CALL wxbgi_get_framebuffer_size(int *width, int *height);
462
474BGI_API void *BGI_CALL wxbgi_get_proc_address(const char *procName);
475
481BGI_API const char *BGI_CALL wxbgi_get_gl_string(int which);
482
490BGI_API int BGI_CALL wxbgi_begin_advanced_frame(float r, float g, float b, float a, int clearColor, int clearDepth);
497
504BGI_API int BGI_CALL wxbgi_read_pixels_rgba8(int x, int y, int width, int height, unsigned char *outBuffer, int outBufferSize);
505
513BGI_API int BGI_CALL wxbgi_write_pixels_rgba8(int x, int y, int width, int height, const unsigned char *inBuffer, int inBufferSize);
514
525BGI_API int BGI_CALL wxbgi_define_color(int idx, int r, int g, int b);
526
536BGI_API int BGI_CALL wxbgi_alloc_color(int r, int g, int b);
537
545
557BGI_API void BGI_CALL wxbgi_getrgb(int color, int *r, int *g, int *b);
558
559
560
561// ---------------------------------------------------------------------------
562
563// PNG framebuffer export
564
565// ---------------------------------------------------------------------------
566
567
568
605BGI_API int BGI_CALL wxbgi_export_png(const char *filePath);
606
607
608
629BGI_API int BGI_CALL wxbgi_export_png_window(const char *filePath);
630
631
632
658
659 const char *filePath);
660
661
662
// wxbgi_export_api
664
682BGI_API void BGI_CALL wxbgi_wx_init_for_canvas(int width, int height);
683
690BGI_API void BGI_CALL wxbgi_wx_render_page_gl(int width, int height);
691
699BGI_API void BGI_CALL wxbgi_wx_render_page_gl_vp(int pageW, int pageH, int vpW, int vpH);
700
718 int pageW, int pageH,
719 int vpW, int vpH);
720
726BGI_API void BGI_CALL wxbgi_wx_resize(int width, int height);
727
731BGI_API void BGI_CALL wxbgi_wx_get_size(int* width, int* height);
732
739BGI_API void BGI_CALL wxbgi_wx_key_event(int glfwKey, int action);
740
747
752
759BGI_API void BGI_CALL wxbgi_wx_mouse_button(int btn, int action);
760
767BGI_API void BGI_CALL wxbgi_wx_scroll(double xDelta, double yDelta);
768
// wxbgi_wx_api
770
799
804BGI_API void BGI_CALL wxbgi_wx_frame_create(int width, int height, const char* title);
805
810
813
817
819typedef void (BGI_CALL *WxbgiFrameCallback)(void);
820
826
830
833
// wxbgi_standalone_api
835
// wxbgi_ext_api
#define BGI_CALL
Definition bgi_types.h:20
#define BGI_API
Definition bgi_types.h:14
BGI_API int BGI_CALL wxbgi_export_png_camera_view(const char *camName, const char *filePath)
Render the DDS scene through a camera and export its viewport to PNG.
BGI_API int BGI_CALL wxbgi_export_png_window(const char *filePath)
Export the full OpenGL window content to a PNG file.
BGI_API int BGI_CALL wxbgi_export_png(const char *filePath)
Export the current visual-page pixel buffer to a PNG file.
BGI_API int BGI_CALL wxbgi_make_context_current(void)
Makes the library OpenGL context current on this thread.
BGI_API int BGI_CALL wxbgi_read_pixels_rgba8(int x, int y, int width, int height, unsigned char *outBuffer, int outBufferSize)
Reads RGBA8 pixels from the current framebuffer.
BGI_API int BGI_CALL wxbgi_is_key_down(int key)
Queries whether a raw GLFW key code is currently held down.
BGI_API int BGI_CALL wxbgi_test_clear_key_queue(void)
Optional internal test seam APIs.
BGI_API int BGI_CALL wxbgi_swap_window_buffers(void)
Swaps front/back window buffers immediately.
BGI_API int BGI_CALL wxbgi_write_pixels_rgba8(int x, int y, int width, int height, const unsigned char *inBuffer, int inBufferSize)
Writes RGBA8 pixels into the current framebuffer.
BGI_API int BGI_CALL wxbgi_test_inject_key_code(int keyCode)
Internal test seam: injects one translated key code into the queue.
BGI_API int BGI_CALL wxbgi_end_advanced_frame(int swapBuffers)
Ends a manual frame.
BGI_API void BGI_CALL wxbgi_get_mouse_pos(int *x, int *y)
Returns the current mouse cursor position in window pixels.
BGI_API void BGI_CALL wxbgi_request_close(void)
Requests closing the active graphics window.
BGI_API int BGI_CALL wxbgi_test_simulate_scroll(double xoffset, double yoffset)
Test seam: simulate the full scrollCallback pipeline.
BGI_API int BGI_CALL wxbgi_is_ready(void)
Checks whether advanced API operations can safely run.
BGI_API void BGI_CALL wxbgi_getrgb(int color, int *r, int *g, int *b)
Retrieves the RGB components of any colour index (0-255).
BGI_API int BGI_CALL wxbgi_poll_events(void)
Pumps pending OS/window events.
BGI_API int BGI_CALL wxbgi_key_pressed(void)
Reports whether a translated keyboard key event is pending.
BGI_API int BGI_CALL wxbgi_test_simulate_key(int key, int scancode, int action, int mods)
Test seam: simulate the full keyCallback pipeline.
BGI_API int BGI_CALL wxbgi_define_color(int idx, int r, int g, int b)
Assigns an RGB colour to a specific extended palette slot (index 16-255).
BGI_API int BGI_CALL wxbgi_test_inject_extended_scan(int scanCode)
Internal test seam: injects an extended DOS-style key sequence.
BGI_API int BGI_CALL wxbgi_set_vsync(int enabled)
Enables or disables vertical synchronization.
BGI_API double BGI_CALL wxbgi_get_time_seconds(void)
Returns the GLFW monotonic timer in seconds.
BGI_API int BGI_CALL wxbgi_test_simulate_cursor(int x, int y)
Test seam: simulate the full cursorPosCallback pipeline.
BGI_API int BGI_CALL wxbgi_mouse_moved(void)
Returns 1 if the mouse cursor moved since the last call to this function.
BGI_API int BGI_CALL wxbgi_test_simulate_char(unsigned int codepoint)
Test seam: simulate the full charCallback pipeline.
BGI_API void BGI_CALL wxbgi_free_color(int idx)
Releases an extended palette slot so it may be reused by wxbgi_alloc_color.
BGI_API int BGI_CALL wxbgi_get_framebuffer_size(int *width, int *height)
Retrieves framebuffer size in physical pixels.
BGI_API int BGI_CALL wxbgi_test_simulate_mouse_button(int button, int action, int mods)
Test seam: simulate the full mouseButtonCallback pipeline.
BGI_API int BGI_CALL wxbgi_set_window_title(const char *title)
Updates the native window title text.
BGI_API int BGI_CALL wxbgi_should_close(void)
Reports whether the window received a close request.
BGI_API int BGI_CALL wxbgi_begin_advanced_frame(float r, float g, float b, float a, int clearColor, int clearDepth)
Begins a manual OpenGL frame.
BGI_API int BGI_CALL wxbgi_get_window_size(int *width, int *height)
Retrieves window size in screen coordinates.
BGI_API const char *BGI_CALL wxbgi_get_gl_string(int which)
Returns OpenGL implementation strings.
BGI_API int BGI_CALL wxbgi_alloc_color(int r, int g, int b)
Allocates the next free extended palette slot and assigns it an RGB colour.
BGI_API int BGI_CALL wxbgi_read_key(void)
Reads the next translated keyboard event from the internal queue.
BGI_API void *BGI_CALL wxbgi_get_proc_address(const char *procName)
Resolves an OpenGL function pointer by symbol name.
BGI_API int BGI_CALL wxbgi_hk_dds_is_selected(const char *id)
Returns 1 if the DDS object with the given ID is selected (hook-context safe).
BGI_API void BGI_CALL wxbgi_hk_dds_deselect_all(void)
Clears the entire DDS selection (hook-context safe).
BGI_API int BGI_CALL wxbgi_hk_dds_get_selected_id(int index, char *outId, int maxLen)
Copies the ID of the nth selected object into outId (hook-context safe).
BGI_API void BGI_CALL wxbgi_hk_dds_select(const char *id)
Adds the DDS object with the given ID to the selection (hook-context safe).
BGI_API void BGI_CALL wxbgi_hk_dds_deselect(const char *id)
Removes the DDS object with the given ID from the selection (hook-context safe).
BGI_API int BGI_CALL wxbgi_hk_get_mouse_y(void)
Returns the current mouse Y position (hook-context safe).
BGI_API int BGI_CALL wxbgi_hk_dds_pick_at(int x, int y, int ctrl)
Manually runs the DDS pick algorithm at screen position (x, y) and updates selectedObjectIds (hook-co...
BGI_API int BGI_CALL wxbgi_hk_dds_get_selected_count(void)
Returns the number of currently selected DDS objects (hook-context safe).
BGI_API int BGI_CALL wxbgi_hk_get_mouse_x(void)
Returns the current mouse X position (hook-context safe).
BGI_API void BGI_CALL wxbgi_set_input_defaults(int flags)
Sets the active input default-behavior flags.
BGI_API int BGI_CALL wxbgi_get_input_defaults(void)
Returns the current input default-behavior bitmask.
BGI_API void BGI_CALL wxbgi_set_scroll_hook(WxbgiScrollHook cb)
Registers a user hook invoked after each mouse scroll (wheel) event.
BGI_API void BGI_CALL wxbgi_set_char_hook(WxbgiCharHook cb)
Registers a user hook invoked after each printable character input event.
BGI_API void BGI_CALL wxbgi_set_cursor_pos_hook(WxbgiCursorPosHook cb)
Registers a user hook invoked after every cursor position update.
BGI_API void BGI_CALL wxbgi_set_mouse_button_hook(WxbgiMouseButtonHook cb)
Registers a user hook invoked after each mouse button press or release.
BGI_API void BGI_CALL wxbgi_set_key_hook(WxbgiKeyHook cb)
Registers a user hook invoked after each key press, repeat, or release.
void(BGI_CALL * WxbgiScrollHook)(double xoffset, double yoffset)
User hook fired after each mouse scroll (wheel) event.
Definition bgi_types.h:83
void(BGI_CALL * WxbgiCursorPosHook)(int x, int y)
User hook fired after every mouse cursor movement.
Definition bgi_types.h:65
void(BGI_CALL * WxbgiCharHook)(unsigned int codepoint)
User hook fired after each printable Unicode character input event.
Definition bgi_types.h:57
void(BGI_CALL * WxbgiKeyHook)(int key, int scancode, int action, int mods)
User hook fired after each key press, repeat, or release event.
Definition bgi_types.h:49
void(BGI_CALL * WxbgiMouseButtonHook)(int button, int action, int mods)
User hook fired after each mouse button press or release.
Definition bgi_types.h:74
BGI_API void BGI_CALL wxbgi_get_scroll_delta(double *dx, double *dy)
Reads and atomically clears the accumulated scroll deltas.
BGI_API void BGI_CALL wxbgi_wx_refresh(void)
Request an immediate canvas repaint.
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_frame(void)
Close the standalone frame immediately.
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).
void(BGI_CALL * WxbgiFrameCallback)(void)
Callback type for animation / per-frame update.
Definition wx_bgi_ext.h:819
BGI_API void BGI_CALL wxbgi_wx_set_idle_callback(WxbgiFrameCallback fn)
Register a per-frame callback.
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.
BGI_API void BGI_CALL wxbgi_wx_init_for_canvas(int width, int height)
Initialise BGI state for wxWidgets-embedded mode (no GLFW).
BGI_API void BGI_CALL wxbgi_wx_mouse_move(int x, int y)
Inject a mouse-move event into BGI.
BGI_API void BGI_CALL wxbgi_wx_resize(int width, int height)
Notify BGI that the canvas has been resized.
BGI_API void BGI_CALL wxbgi_wx_render_overlays_for_camera(const char *camName, int pageW, int pageH, int vpW, int vpH)
Composite visual-aids overlays (grid, UCS axes, concentric circles, selection cursor) for a named cam...
BGI_API void BGI_CALL wxbgi_wx_char_event(int codepoint)
Inject a Unicode character event into the BGI key queue.
BGI_API void BGI_CALL wxbgi_wx_render_page_gl(int width, int height)
Render the BGI pixel buffer using the currently active OpenGL context.
BGI_API void BGI_CALL wxbgi_wx_get_size(int *width, int *height)
Get the current BGI canvas dimensions.
BGI_API void BGI_CALL wxbgi_wx_key_event(int glfwKey, int action)
Inject a keyboard key press or release event into BGI.
BGI_API void BGI_CALL wxbgi_wx_render_page_gl_vp(int pageW, int pageH, int vpW, int vpH)
Render with separate page-buffer and physical-viewport dimensions.
BGI_API void BGI_CALL wxbgi_wx_scroll(double xDelta, double yDelta)
Inject a scroll event into BGI.
BGI_API void BGI_CALL wxbgi_wx_mouse_button(int btn, int action)
Inject a mouse-button press or release into BGI.