-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCoreObject.cpp
More file actions
48 lines (40 loc) · 965 Bytes
/
CoreObject.cpp
File metadata and controls
48 lines (40 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "stdafx.h"
#include "CoreObject.h"
#include "GObjectHandler.h"
using namespace LarasEngine;
LarasEngine::CoreObjectSimple::CoreObjectSimple (const std::string& _typId)
: typId (_typId)
{
}
double CoreObject::CalculateXViaRotation (int s, double r)
{
double tanA = tan (std::fabs (r) * PI / 180);
return tanA * std::fabs (s);
}
CoreObject::CoreObject (const TypId& _typId)
: deleteMe (false)
, CoreObjectSimple (_typId)
, rotation (0.f)
{
const QRect& screenGeo = LE_OH.GetPrimaryScreenGeometry ();
screenW = screenGeo.width ();
screenH = screenGeo.height ();
position.setX (0.f);
position.setY (0.f);
}
QRectF LarasEngine::CoreObject::GetCollisionRect () const
{
QRectF tmp = collisionRect;
tmp.moveTopLeft (position);
return tmp;
}
std::vector<QRectF> LarasEngine::CoreObject::GetCollisionBoxVec () const
{
std::vector<QRectF> vec;
for (auto i : collisionBoxVec)
{
i.translate (position);
vec.push_back (i);
}
return vec;
}