dl
dl_system.h
浏览该文件的文档.
1
12#pragma once
13
14#include <string_view>
15
16#include "dl_type.h"
17#include "base/dl_type_user.h"
18
19namespace dl
20{
21
23{
24 std::string _strTitle;
26
28 _strTitle{ "C++ drawing library" },
29 _size{ 800,600 }
30 {}
31};
32
33class SystemImp;
34class System
35{
36public:
37 using Func = void (*)(void);
40
46 void Start(std::string_view json_window,
47 std::string_view json_path = "");
48
52 void Start(const ParamWindow& param = {});
56 void SetFuncInit(Func func) { _funcInit = func; }
60 void SetFuncRun(Func func) { _funcRun = func; }
61
68
80 void SetWindowPoint(const Point& xy);
81
89 void SetWindowTitle(std::string_view str);
90
94
98 void ScreenShot(std::string_view path_name);
99
100 enum class CursorMode
101 {
102 NORMAL,
103 HIDE,
104 DISABLE
105 };
111
112 SystemImp* GetImp() { return _imp; }
113private:
114 SystemImp* _imp;
115 Func _funcInit;
116 Func _funcRun;
117
118 CursorMode _cursorMode;
119 bool _bCursorModeChange;
120};
121extern System* g_system;
122}
void SetFuncInit(Func func)
设置 初始化函数
Definition: dl_system.h:56
void Start(const ParamWindow &param={})
创建窗口 并进入 游戏循环
void SetWindowTitle(std::string_view str)
设置窗口标题
void SetFuncRun(Func func)
设置 帧函数
Definition: dl_system.h:60
void ScreenShot(std::string_view path_name)
截屏
Size GetWindowSize()
返回窗口大小
void SetWindowPoint(const Point &xy)
设置窗口位置
const RenderInfo2D & GetRenderInfo2D()
返回上一帧绘图信息
void SetWindowCenter()
设置窗口居中(以工作区大小)
SystemImp * GetImp()
Definition: dl_system.h:112
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:37
常用类型
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:24
绘图信息2d
Definition: dl_type_user.h:20
绘图信息3d
Definition: dl_type_user.h:34