载入中...
搜索中...
未找到
WindowSurfaceHost.h
浏览该文件的文档.
1#pragma once
2
3// Capability interface: window -> graphics binding.
4//
5// The window module owns the native window lifecycle (SDL_CreateWindow /
6// SDL_DestroyWindow / resize events) and the graphics module owns the render
7// surface. Window must not include graphics headers — that is an upward
8// dependency (window is L1, graphics is L3) and it welded the two modules
9// together at link time.
10//
11// Instead, graphics registers itself as the window's surface host through
12// eve::cap::provide<IWindowSurfaceHost>() (its Graphics base does this in the
13// constructor). The window queries the capability at the moment it needs a
14// surface: after native window creation, on resize, and just before the native
15// window is destroyed. With no graphics module in the build, the query returns
16// nullptr and window creation still works headless.
17//
18// The method set mirrors graphics::Graphics exactly, so the concrete backend
19// (VulkanGraphics / WebGpuGraphics) implements this interface with the virtuals
20// it already has; no forwarding shims are needed.
21
22#include "common/Export.h"
23
24namespace eve {
25
28public:
29 static constexpr const char* capabilityName = "IWindowSurfaceHost";
30
31 virtual ~IWindowSurfaceHost() = default;
32
34 virtual void initWithWindow(void* nativeWindow) = 0;
35
37 virtual void setViewportSize(int logicalWidth, int logicalHeight,
38 int pixelWidth, int pixelHeight) = 0;
39
41 virtual void onNativeWindowDestroyed() = 0;
42
44 virtual void setActive(bool active) = 0;
45
47 virtual void requestSurfaceRecreate() = 0;
48};
49
50} // namespace eve
bool active
Definition CardTypes.cpp:34
#define EVENGINE_API
宿主(eve / libmain)导出宏;插件从进程导入同一批符号。
Definition Export.h:16
Render-surface host for the window module (provided by graphics).
virtual void onNativeWindowDestroyed()=0
Native window is about to be destroyed; drop the surface/swapchain.
virtual ~IWindowSurfaceHost()=default
virtual void setViewportSize(int logicalWidth, int logicalHeight, int pixelWidth, int pixelHeight)=0
Logical and pixel viewport after creation or resize.
virtual void initWithWindow(void *nativeWindow)=0
Bind the render surface to a freshly created native window.
virtual void requestSurfaceRecreate()=0
Rebuild the render surface on the next frame (mobile foreground).
virtual void setActive(bool active)=0
Pause/resume presenting (mobile background/foreground).
Definition Build.cpp:11