Covellite++
Version: 2.3.2 Revision: 2584 Platform: x64 Build: 19:03 05.09.2026
Кроссплатформенный фреймворк для разработки приложений на С++
Toggle main menu visibility
Загрузка...
Поиск...
Не найдено
Simple2DGame.hpp
1
2
#pragma once
3
#include <Covellite/Covellite.hpp>
4
#include "Common.hpp"
5
6
namespace
events
7
{
8
9
class
Simple2DGame_t
10
{
11
public
:
12
enum
Id
13
{
14
Rect = 0,
15
Start,
16
Finish,
17
};
18
};
19
20
namespace
{ Simple2DGame_t Simple2DGame; }
21
22
}
// namespace events
23
24
namespace
basement
25
{
26
44
class
Simple2DGame final :
45
public
Common
46
{
47
using
WindowExpanse_t =
::covellite::expanse::IWindow
;
48
using
Events_t =
::covellite::events::Events
;
50
using
Vertex_t
=
::covellite::api::Vertex
;
52
using
VertexData_t
= ::std::vector<Vertex_t>;
53
54
public
:
55
class
Rect final
56
{
57
public
:
58
float
Left;
59
float
Top;
60
float
Right;
61
float
Bottom;
62
};
63
64
private
:
65
class
GameUnit final
66
{
67
public
:
68
class
Info
69
{
70
public
:
71
float
Position;
72
float
Size;
73
float
SpeedFactor;
74
75
public
:
76
inline
float
GetMin(
void
)
const
noexcept
{
return
Position - Size / 2.0f; }
77
inline
float
GetMax(
void
)
const
noexcept
{
return
Position + Size / 2.0f; }
78
void
Update(
float
);
79
};
80
81
public
:
82
bool
IsIntersect(
const
GameUnit &)
const
;
83
void
Update(
float
,
float
);
84
void
Update(
float
);
85
86
public
:
87
Info X, Y;
88
const
Component_t::ComponentPtr_t m_pPosition;
89
90
public
:
91
GameUnit(
float
,
float
,
float
,
float
,
float
);
92
};
93
94
private
:
95
void
AddCommonComponents
(
void
);
96
ObjectId_t
AddCamera
(
float
,
float
);
97
ObjectId_t AddBackground(
void
);
98
ObjectId_t AddClock(
void
);
99
void
AddActors(
void
);
100
GameObject_t BuildRectangle(
const
GameObject_t &,
float
,
float
,
const
String_t &);
101
GameObject_t BuildRectangle(
const
GameObject_t &,
float
,
float
,
float
,
float
,
102
float
,
float
);
103
GameObject_t BuildRectangle(
const
Rect &,
const
Rect &,
float
,
float
,
float
,
104
float
,
const
String_t &,
const
GameObject_t &);
105
GameObject_t BuildRectangle(
const
Rect &,
const
Rect &,
float
,
float
,
float
,
float
,
106
const
GameObject_t &,
const
GameObject_t &);
107
108
private
:
109
Events_t m_Events;
110
bool
m_IsTouch =
false
;
111
float
m_MouseX = 0.0f;
112
float
m_MouseY = 0.0f;
113
114
private
:
115
const
float
m_Width;
116
const
float
m_Height;
117
const
float
m_GameFieldSize;
118
119
private
:
120
ObjectId_t m_CameraId;
121
ObjectId_t m_BackGroundId;
122
ObjectId_t m_ClockId;
123
ObjectId_t m_EnemiesId;
124
ObjectId_t m_GreenSquareId;
125
ObjectId_t m_RedSquareId;
126
GameUnit m_UserUnit;
127
::std::vector<GameUnit> m_Enemies;
128
float
m_EnemiesSpeed = 0.1f;
129
float
m_BeginGameTime;
130
float
m_GameTime;
131
float
m_LastTime;
132
133
public
:
134
Simple2DGame(WindowExpanse_t &,
const
Rect &);
135
Simple2DGame(
const
Simple2DGame &) =
delete
;
136
Simple2DGame(Simple2DGame &&) =
delete
;
137
const
Simple2DGame & operator= (
const
Simple2DGame &) =
delete
;
138
Simple2DGame & operator= (Simple2DGame &&) =
delete
;
139
~Simple2DGame(
void
);
140
};
141
142
}
// namespace basement
basement
Определения
Common.hpp:10
covellite::api::Vertex
Класс входит в проект Covellite.Api Класс формата вертексного буфера.
Определения
Vertex.hpp:34
covellite::events::Events
Класс входит в проект Covellite.Events Класс для работы с событиями фреймворка.
Определения
Events.hpp:36
covellite::expanse::IWindow
Класс входит в проект Covellite.Expanse Интерфейс класса окна.
Определения
IWindow.hpp:32
basement::Simple2DGame::VertexData_t
::std::vector< Vertex_t > VertexData_t
[Vertex format]
Определения
Simple2DGame.hpp:52
basement::Simple2DGame::Vertex_t
::covellite::api::Vertex Vertex_t
[Vertex format]
Определения
Simple2DGame.hpp:50
basement::Simple2DGame::AddCommonComponents
void AddCommonComponents(void)
Определения
Simple2DGame.cpp:113
basement::Simple2DGame::AddCamera
ObjectId_t AddCamera(float, float)
Определения
Simple2DGame.cpp:267
Solution
Solution
Example
Example
Basements
Simple2DGame.hpp
Документация по Covellite++. Последние изменения:
. Создано системой
1.18.0