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 {
112 NORMAL,
113 HIDE,
114 DISABLE
115 };
121
125 void SetClipboardString(std::string_view str);
129 std::string GetClipboardString();
130
135 {
136 _vecDropFile.clear();
137 }
141 const std::vector<std::string>& GetDropFile()
142 {
143 return _vecDropFile;
144 }
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的一些接口,例如显示器相关
163private:
164 SystemImp* _imp;
165 Func _funcInit;
166 Func _funcRun;
167
168 CursorMode _cursorMode;
169 bool _bCursorModeChange;
170
171 void* _nativeWindow;
172
173 std::vector<std::string> _vecDropFile;
174};
175extern System* g_system;
176}
177
178#endif
void SetFuncInit(Func func)
设置 初始化函数
Definition: dl_system.h:62
const std::vector< std::string > & GetDropFile()
返回拖入文件列表
Definition: dl_system.h:141
void Start(const ParamWindow &param={})
创建窗口 并进入 游戏循环
void _init_glfw()
void SetWindowTitle(std::string_view str)
设置窗口标题
void SetFuncRun(Func func)
设置 帧函数
Definition: dl_system.h:66
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)
内部调用
Definition: dl_system.h:154
bool IsWindowExist()
窗口是否存在
const RenderInfo2D & GetRenderInfo2D()
返回上一帧绘图信息
void SetWindowCenter()
设置窗口居中(以工作区大小)
SystemImp * GetImp()
Definition: dl_system.h:159
void ClearDropFile()
清空拖入文件列表
Definition: dl_system.h:134
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)
系统框提示
Size GetWorkArea()
获取桌面大小,不包含任务栏
void(*)(void) Func
Definition: dl_system.h:39
通用类型
常用类型
Definition: dl_array2.h:18
PointU Size
Definition: dl_type_def.h:34
System * g_system
Point2 Point
Definition: dl_type_def.h:23
std::string _strTitle
Definition: dl_system.h:26
绘图信息2d
Definition: dl_type_user.h:20
绘图信息3d
Definition: dl_type_user.h:34