dl
dl_system.h
浏览该文件的文档.
1
12#pragma once
13
14#ifndef DL_DISABLE_RENDER
15#include <string_view>
16#include <vector>
17
18#include "dl_type.h"
19#include "base/dl_type_user.h"
20
21namespace dl
22{
30
32{
33 std::string _strTitle;
35 FullScreenMode _fullScreenMode; //0.窗口 1.全屏 2.全屏窗口
36
38 _strTitle{ "C++ drawing library" },
39 _size{ 800,600 },
41 {}
42};
43
52
53class SystemImp;
55class System
56{
57public:
58 using Func = void (*)(void);
61
67 void Start(std::string_view json_window,
68 std::string_view json_path = "");
69
73 void Start(const ParamWindow& param = {});
77 void Exit();
81 void SetFuncInit(Func func) { _funcInit = func; }
85 void SetFuncRun(Func func) { _funcRun = func; }
86
93
105 void SetWindowPoint(const Point& xy);
106
114 void SetWindowTitle(std::string_view str);
119
123
127 void ScreenShot(std::string_view path_name);
128
129 enum class CursorMode
130 {
134 };
135
140
144 void SetClipboardString(std::string_view str);
148 std::string GetClipboardString();
149
154 {
155 _vecDropFile.clear();
156 }
157
160 const std::vector<std::string>& GetDropFile()
161 {
162 return _vecDropFile;
163 }
164
169 void ShowMessageBox(std::string_view title, std::string_view text);
170
172 void SetFullScreen(FullScreenMode mode, const Size& size = {});
173
175 void SetWindowSize(const Size& size);
176
178 SystemStep GetStep() { return _step; }
179
181 void _add_drop_file(std::string_view str)
182 {
183 _vecDropFile.push_back(std::string{ str });
184 }
185
186 SystemImp* GetImp() { return _imp; }
187
188 // 提前初始化,以便使用glfw的一些接口,例如显示器相关
191
192 //--------------------------lua----------------------------
193 void lua_SetFuncUpdate(std::string_view str);
194private:
195 SystemImp* _imp;
196 Func _funcInit;
197 Func _funcRun;
198 SystemStep _step;
199
200 CursorMode _cursorMode;
201 bool _bCursorModeChange;
202
203 void* _nativeWindow;
204
205 std::vector<std::string> _vecDropFile;
206 FullScreenMode _fullScreenMode;
207 Size _desktopSize;// 仅用于恢复全屏到窗口全屏使用
208
209 struct
210 {
211 std::string _funcUpdate;
212 }_lua;
213};
214extern System* g_system;
215}
216
217#endif
void SetFuncInit(Func func)
设置 初始化函数
void SetFullScreen(FullScreenMode mode, const Size &size={})
设置全屏
const std::vector< std::string > & GetDropFile()
返回拖入文件列表
void Start(const ParamWindow &param={})
创建窗口 并进入 游戏循环
void _init_glfw()
void SetWindowTitle(std::string_view str)
设置窗口标题
void SetFuncRun(Func func)
设置 帧函数
SystemStep GetStep()
返回引擎运行状态
void _delete_glfw()
void ScreenShot(std::string_view path_name)
截屏
std::string GetClipboardString()
返回剪贴板
Size GetWindowSize()
返回窗口大小
void SetWindowPoint(const Point &xy)
设置窗口位置
void _add_drop_file(std::string_view str)
内部调用
bool IsWindowExist()
窗口是否存在
std::string _funcUpdate
const RenderInfo2D & GetRenderInfo2D()
返回上一帧绘图信息
void SetWindowCenter()
设置窗口居中(以工作区大小)
SystemImp * GetImp()
void SetWindowSize(const Size &size)
设置窗口大小
void ClearDropFile()
清空拖入文件列表
void Exit()
创建窗口 并进入 游戏循环
void SetClipboardString(std::string_view str)
设置剪贴板
void SetCursorMode(CursorMode mode)
设置光标模式
void SetCursorPosition(Point xy)
设置鼠标位置,不用此来实现摄像机
const RenderInfo3D & GetRenderInfo3D()
void Start(std::string_view json_window, std::string_view json_path="")
进入 游戏循环
void ShowMessageBox(std::string_view title, std::string_view text)
系统框提示
void lua_SetFuncUpdate(std::string_view str)
Size GetWorkArea()
获取桌面大小,不包含任务栏
void(*)(void) Func
通用类型
常用类型
SystemStep
运行步骤
System * g_system
FullScreenMode
全屏模式
PointU Size
Point2 Point
创建窗口参数
std::string _strTitle
FullScreenMode _fullScreenMode