diff infinite_canvas/web_surface.h @ 276:b55c22cff335

Add interactive infinite canvas prototype
author MrJuneJune <me@mrjunejune.com>
date Mon, 17 Aug 2026 16:57:56 -0700
parents
children 8d560f50ed4c
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/infinite_canvas/web_surface.h	Mon Aug 17 16:57:56 2026 -0700
@@ -0,0 +1,59 @@
+#ifndef INFINITE_CANVAS_WEB_SURFACE_H
+#define INFINITE_CANVAS_WEB_SURFACE_H
+
+#include "infinite_canvas/canvas.h"
+
+#define CANVAS_MAX_WEB_VIEWS 12
+
+typedef struct {
+    uint32 entity_id;
+    Canvas_Entity_Type entity_type;
+    void *p_native;
+    uint8 *p_pixels;
+    Texture2D texture;
+    int32 texture_width;
+    int32 texture_height;
+    size_t pixel_capacity;
+    char url[128];
+    boolean active;
+    boolean browser_created;
+    boolean texture_ready;
+    boolean pixels_dirty;
+} Canvas_Web_View;
+
+typedef struct {
+    Dowa_Arena *p_arena;
+    void *p_native;
+    Canvas_Web_View views[CANVAS_MAX_WEB_VIEWS];
+    uint32 focused_entity_id;
+    boolean initialized;
+} Canvas_Web_Surface;
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+int32 Canvas_Web_Surface_Execute_Subprocess(int argc, char **p_argv);
+boolean Canvas_Web_Surface_Init(
+    Canvas_Web_Surface *p_surface,
+    Dowa_Arena *p_arena);
+boolean Canvas_Web_Surface_Update_Input(
+    Canvas_Web_Surface *p_surface,
+    const Canvas_Camera *p_camera,
+    const Canvas_Scene *p_scene);
+void Canvas_Web_Surface_Sync(
+    Canvas_Web_Surface *p_surface,
+    const Canvas_Camera *p_camera,
+    const Canvas_Scene *p_scene);
+void Canvas_Web_Surface_Draw(
+    const Canvas_Web_Surface *p_surface,
+    const Canvas_Camera *p_camera,
+    const Canvas_Scene *p_scene);
+boolean Canvas_Web_Surface_Is_Focused(const Canvas_Web_Surface *p_surface);
+void Canvas_Web_Surface_Shutdown(Canvas_Web_Surface *p_surface);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif