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 SetFuncInit(Func func) { _funcInit = func; }
62 void SetFuncRun(Func func) { _funcRun = func; }
63
70
82 void SetWindowPoint(const Point& xy);
83
91 void SetWindowTitle(std::string_view str);
96
100
104 void ScreenShot(std::string_view path_name);
105
106 enum class CursorMode
107 {
108 NORMAL,
109 HIDE,
110 DISABLE
111 };
117
121 void SetClipboardString(std::string_view str);
125 std::string GetClipboardString();
126
131 {
132 _vecDropFile.clear();
133 }
137 const std::vector<std::string>& GetDropFile()
138 {
139 return _vecDropFile;
140 }
141
143 void _add_drop_file(std::string_view str)
144 {
145 _vecDropFile.push_back(std::string{ str });
146 }
147
148 SystemImp* GetImp() { return _imp; }
149private:
150 SystemImp* _imp;
151 Func _funcInit;
152 Func _funcRun;
153
154 CursorMode _cursorMode;
155 bool _bCursorModeChange;
156
157 std::vector<std::string> _vecDropFile;
158};
159extern System* g_system;
160}
161
162#endif
void SetFuncInit(Func func)
设置 初始化函数
Definition: dl_system.h:58
const std::vector< std::string > & GetDropFile()
返回拖入文件列表
Definition: dl_system.h:137
void Start(const ParamWindow &param={})
创建窗口 并进入 游戏循环
void SetWindowTitle(std::string_view str)
设置窗口标题
void SetFuncRun(Func func)
设置 帧函数
Definition: dl_system.h:62
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:143
bool IsWindowExist()
窗口是否存在
const RenderInfo2D & GetRenderInfo2D()
返回上一帧绘图信息
void SetWindowCenter()
设置窗口居中(以工作区大小)
SystemImp * GetImp()
Definition: dl_system.h:148
void ClearDropFile()
清空拖入文件列表
Definition: dl_system.h:130
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="")
进入 游戏循环
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