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{
23
25{
26 std::string _strTitle;
28
30 _strTitle{ "C++ drawing library" },
31 _size{ 800,600 }
32 {}
33};
34
35class SystemImp;
36class System
37{
38public:
39 using Func = void (*)(void);
42
48 void Start(std::string_view json_window,
49 std::string_view json_path = "");
50
54 void Start(const ParamWindow& param = {});
58 void Exit();
62 void SetFuncInit(Func func) { _funcInit = func; }
66 void SetFuncRun(Func func) { _funcRun = func; }
67
74
86 void SetWindowPoint(const Point& xy);
87
95 void SetWindowTitle(std::string_view str);
100
104
108 void ScreenShot(std::string_view path_name);
109
110 enum class CursorMode
111 {
115 };
116
121
125 void SetClipboardString(std::string_view str);
129 std::string GetClipboardString();
130
135 {
136 _vecDropFile.clear();
137 }
138
141 const std::vector<std::string>& GetDropFile()
142 {
143 return _vecDropFile;
144 }
145
150 void ShowMessageBox(std::string_view title, std::string_view text);
151
152
154 void _add_drop_file(std::string_view str)
155 {
156 _vecDropFile.push_back(std::string{ str });
157 }
158
159 SystemImp* GetImp() { return _imp; }
160
161 // 提前初始化,以便使用glfw的一些接口,例如显示器相关
164
165 //--------------------------lua----------------------------
166 void lua_SetFuncUpdate(std::string_view str);
167private:
168 SystemImp* _imp;
169 Func _funcInit;
170 Func _funcRun;
171
172 CursorMode _cursorMode;
173 bool _bCursorModeChange;
174
175 void* _nativeWindow;
176
177 std::vector<std::string> _vecDropFile;
178
179 struct
180 {
181 std::string _funcUpdate;
182 }_lua;
183};
184extern System* g_system;
185}
186
187#endif
void SetFuncInit(Func func)
设置 初始化函数
const std::vector< std::string > & GetDropFile()
返回拖入文件列表
void Start(const ParamWindow &param={})
创建窗口 并进入 游戏循环
void _init_glfw()
void SetWindowTitle(std::string_view str)
设置窗口标题
void SetFuncRun(Func func)
设置 帧函数
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 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
通用类型
常用类型
System * g_system
PointU Size
Point2 Point
std::string _strTitle