-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactor.cpp
More file actions
842 lines (687 loc) · 17 KB
/
actor.cpp
File metadata and controls
842 lines (687 loc) · 17 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
/*=============================================================================
Copyright (c) 2009, Mihail Szabolcs
All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the following
conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of the Prototype2D nor the names of its contributors
may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
This file is part of Prototype2D.
==============================================================================*/
#include "actor.h"
#include "texture.h"
#include "texturemanager.h"
#include "env.h"
#include "world.h"
#include <QtCore/QDebug>
#include <QtCore/QHash>
#include <math.h>
using namespace GL;
using namespace Sys;
// Global
static Env *gEnv = &Env::getInstance();
static TextureManager *gTex = &TextureManager::getInstance();
Actor::Actor( const QString &pName, World *pWorld ) : mTexture(0),
mFlags(0),
mNumFrames(-1),
mFrame(-1),
mFrameLoop(false),
mAnimate(false),
mFrameCounter(0.0f),
mTexCoords(0),
mVertices(0),
mName(""),
mId(0),
mBlending(B_NONE),
mBody(0),
mWorld(0)
{
// no joints by defult
setHasJoints(false);
// set default offsets
setOffsets(0.0f,0.0f);
// set default position
setPos(0.0f,0.0f);
// set default size
setSize(0.0f,0.0f);
// default layer (Z)
setZOrder(0.0f);
// no set box flag by default
setFlag(S_BOX);
// default rotation
setRotation(0.0f);
// set frame rect to 0
setFrameSize(0.0f,0.0f,0.0f,0.0f);
// set density ( static by default = 0 density )
setDensity(0.0f);
// set friction
setFriction(0.5f);
// set restitution (bouncyness)
setRestituition(0.3f);
//! set default color to white
setColor(1.0f,1.0f,1.0f);
//! 100% opaque
setTransparency(0);
// set unique name and id
if( !pName.isEmpty() )
setName(pName);
// set initial number of frames
setNumFrames(1);
// store pointer to world
mWorld = pWorld;
qDebug() << "Success: [Actor] "<< mName << " created";
}
Actor::~Actor()
{
if( mBody && mWorld )
{
removeJoint(); // remove all associated joints
removePhysX(); // remove body
}
if( mTexCoords )
delete [] mTexCoords;
if( mVertices )
delete [] mVertices;
if( mTexture )
mTexture->drop();
qDebug() << "Success: [Actor] "<< mName << " destroyed";
}
void Actor::setTexture(Texture *pTex)
{
// drop the old texture
if( mTexture )
mTexture->drop();
// NULL?
if( !pTex )
{
mTexture = 0;
return;
}
// inc reference count ...
mTexture = pTex->grab();
// set initial frame rect
// the same size as the texture size
setFrameSize(0.0f,0.0f,pTex->getWidth(),pTex->getHeight());
// set the initial frames to 1 by default
setNumFrames(1);
// set initial size as the texture size
setRect(0,0,pTex->getWidth(),pTex->getHeight());
}
void Actor::setTexture(const QString &pName)
{
setTexture(gTex->find(pName));
}
void Actor::setColor(float pR, float pG, float pB)
{
mColor[0] = pR;
mColor[1] = pG;
mColor[2] = pB;
}
void Actor::setRect(float pX, float pY, float pW, float pH)
{
setPos(pX,pY);
setSize(pW,pH);
}
void Actor::setSizeFromTexture(void)
{
if( !mTexture )
return;
setSize(mTexture->getWidth(),mTexture->getHeight());
}
void Actor::setPos(float pX, float pY)
{
_setPos(pX,pY);
// set physics properties
if( mBody )
{
// screen space to world space
b2Vec2 lPos(S2W(pX,pY));
mBody->SetXForm(lPos,D2R(mRot));
}
}
// set the size of the actor
void Actor::setSize(float pW, float pH)
{
_setSize(pW,pH);
}
void Actor::setOffsets(float pX, float pY)
{
mOffsets[0] = pX;
mOffsets[1] = pY;
}
void Actor::setRotation(float pRot)
{
// FIXME: set body if physics!
_setRotation(pRot);
}
//! Center the actor around a certain point (globally)
void Actor::center(float pW, float pH)
{
setPos((pW-mSize[0])/2,(pH-mSize[1])/2);
}
void Actor::moveXY( float pDX, float pDY )
{
_setPos(mPos[0]+pDX,mPos[1]+pDY);
}
bool Actor::inRect( float pX, float pY )
{
return( (mPos[0] <= pX) && (pX <= (mPos[0]+mSize[0])) &&
(mPos[1] <= pY) && (pY <= (mPos[1]+mSize[1])) );
}
float Actor::getPosX( void ) const
{
return mPos[0];
}
float Actor::getPosY( void ) const
{
return mPos[1];
}
void Actor::getPos( t_point *pPos )
{
Q_ASSERT( pPos != 0 );
(*pPos)[0] = mPos[0];
(*pPos)[1] = mPos[1];
}
float Actor::getWidth( void ) const
{
return mSize[0];
}
float Actor::getHeight( void ) const
{
return mSize[1];
}
void Actor::getSize( t_point *pSize )
{
Q_ASSERT( pSize != 0 );
(*pSize)[0] = mSize[0];
(*pSize)[1] = mSize[1];
}
float Actor::getHWidth( void ) const
{
return mHSize[0];
}
float Actor::getHHeight( void ) const
{
return mHSize[1];
}
void Actor::getHalfSize( t_point *pHSize )
{
Q_ASSERT( pHSize != 0 );
(*pHSize)[0] = mHSize[0];
(*pHSize)[1] = mHSize[1];
}
float Actor::getRadius( void ) const
{
if( !isFlag(S_CIRCLE) )
return 0.0f;
//
if( mHSize[1] > mHSize[0] )
return mHSize[1];
return mHSize[0];
}
void Actor::setFlag( unsigned long pFlag )
{
mFlags |= pFlag;
}
bool Actor::isFlag(unsigned long pFlag) const
{
return (mFlags & pFlag);
}
void Actor::setFlags( unsigned long pFlags )
{
mFlags = pFlags;
}
void Actor::removeFlag( unsigned long pFlag )
{
mFlags &= ~pFlag;
}
unsigned long Actor::getFlags( void ) const
{
return mFlags;
}
void Actor::setZOrder(float pZ)
{
mZ = pZ;
}
float Actor::getZOrder( void ) const
{
return mZ;
}
void Actor::setNumFrames( short pNumFrames )
{
if( !mTexture && mNumFrames > 1 )
return;
// delete the existing pre-calc
if( mTexCoords )
delete [] mTexCoords;
mNumFrames = pNumFrames;
setFrame(0);
// pre-calc all texture coordinates
mTexCoords = new t_texcoords[ mNumFrames ];
if( mNumFrames == 1 )
{
// set default texture coordinates ( full texture, stretched )
_setTexCoord(0,0.0f,1.0f,P_BL);
_setTexCoord(0,1.0f,1.0f,P_BR);
_setTexCoord(0,1.0f,0.0f,P_TR);
_setTexCoord(0,0.0f,0.0f,P_TL);
return;
}
// try to guess in the correct frame width
//if( mNumFrames > 1 && (mFrameRect[2] == mTexture->getWidth() || mFrameRect[2] == 0) )
{
mFrameRect[2] = (float)(mTexture->getWidth() / mNumFrames);
}
// the height will never change
float lY = (float)(mFrameRect[3] == mTexture->getHeight())?(mFrameRect[1]):((-mFrameRect[1])+mFrameRect[3]);
float lH = (float)(lY + mFrameRect[3]);
//qDebug() << lY << " , " << mFrameRect[3];
lY /= mTexture->getHeight();
lH /= mTexture->getHeight();
// clamp
if( lY > 1.0f )
lY = 1.0f;
if( lH > 1.0f )
lH = 1.0f;
// invert V (upside down)
lY = 1.0f - lY;
lH = 1.0f - lH;
//
for(unsigned short lFrame=0; lFrame<mNumFrames; lFrame++)
{
float lX = (float)(lFrame * mFrameRect[2]);
float lW = (float)(lX + mFrameRect[2]);
lX /= mTexture->getWidth();
lW /= mTexture->getWidth();
// clamp
if( lX > 1.0f )
lX = 1.0f;
if( lW > 1.0f )
lW = 1.0f;
// animate using texture coordinates
_setTexCoord(lFrame,lX,lY,P_BL);
_setTexCoord(lFrame,lW,lY,P_BR);
_setTexCoord(lFrame,lW,lH,P_TR);
_setTexCoord(lFrame,lX,lH,P_TL);
}
}
short Actor::getNumFrames( void ) const
{
return mNumFrames;
}
void Actor::setFrame( short pFrame )
{
// same frame? no valid frame number? don't re-calc bail :|
if(pFrame > mNumFrames)
{
pFrame = 0;
return;
}
// loop or set the actual next frame ...
if( pFrame == mNumFrames )
{
if( mFrameLoop ) // go back to the 1st frame
{
mFrame = 0;
}
}
else // set the actual frame
{
mFrame = pFrame;
}
}
short Actor::getFrame( void ) const
{
return mFrame;
}
void Actor::setFrameSize(float pX,float pY,float pW,float pH)
{
mFrameRect[0] = pX;
mFrameRect[1] = pY;
mFrameRect[2] = pW;
mFrameRect[3] = pH;
}
void Actor::setAnimate( bool pAnimate, bool pLoop )
{
mAnimate = pAnimate;
mFrameLoop = pLoop;
}
/*
+-----+
| |
| |
+-----+
-x,-y // bottom left
x,-y // bottom right
x, y // top right
-x, y // top left
*/
void Actor::_draw(void)
{
glPushMatrix();
glTranslatef(mDPos[0],mDPos[1],0.0f);
glRotatef(mRot,0.0f,0.0f,1.0f);
#ifdef WORLD_VERTEX_ARRAYS
glTexCoordPointer(2,GL_FLOAT,0,mTexCoords[mFrame]);
glVertexPointer(2,GL_FLOAT,0,mVertices);
glDrawArrays(GL_TRIANGLE_FAN,0,4);
#else
glBegin(GL_TRIANGLE_FAN);
glTexCoord2fv(mTexCoords[mFrame][P_BL]); glVertex2f( -mHSize[0], -mHSize[1] );
glTexCoord2fv(mTexCoords[mFrame][P_BR]); glVertex2f( mHSize[0], -mHSize[1] );
glTexCoord2fv(mTexCoords[mFrame][P_TR]); glVertex2f( mHSize[0], mHSize[1] );
glTexCoord2fv(mTexCoords[mFrame][P_TL]); glVertex2f( -mHSize[0], mHSize[1] );
glEnd();
#endif
glPopMatrix();
}
// TODO: make this render via Vertex Arrays as well :)
void Actor::_drawDebug(void)
{
if( !isShapeSet() || !gEnv->mDebugDraw )
return;
glPushMatrix();
glTranslatef(mDPos[0],mDPos[1],0.0f);
glRotatef(mRot,0.0f,0.0f,1.0f);
glBegin(GL_LINE_LOOP);
if( float lR = getRadius() ) // draw spheres
{
for(unsigned short i=0;i<=360;i+=5)
glVertex2f(sin(D2R(i)) * lR, cos(D2R(i)) * lR);
}
else
{
for(unsigned short i=0;i<mShapeDef.vertexCount;i++)
glVertex2f(W2S(mShapeDef.vertices[i].x,mShapeDef.vertices[i].y));
}
glEnd();
glPopMatrix();
}
void Actor::_drawBlended(void)
{
if( mBlending == B_NONE )
{
_drawTextured();
return;
}
glEnable( GL_BLEND );
glBlendFunc(GL_SRC_ALPHA,mBlending);
_drawTextured();
glDisable( GL_BLEND );
}
void Actor::_drawTextured(void)
{
// no texture? draw as-is
if( !mTexture )
{
_draw();
return;
}
mTexture->enable();
_draw();
mTexture->disable();
}
void Actor::render(void)
{
// don't render if it's not visible!
if( mFlags & V_HIDDEN )
return;
// custom color with transparency
glColor4fv(mColor);
_drawBlended();
#ifdef WORLD_DEBUG_DRAW // draw an red outline in debug
glColor3fv(gEnv->mDebugColor);
_drawDebug();
#endif
}
void Actor::update(void)
{
// don't update if it was requested
if( mFlags & U_NOUPDATE )
return;
if( mBody ) // update PhysX body
{
b2Vec2 lPos = mBody->GetPosition();
_setRotation(R2D(mBody->GetAngle()));
_setPos(W2S_(lPos.x),W2S_(lPos.y));
}
if( !mAnimate ) // animation turned off?
return;
// animation delay
if( ++mFrameCounter < gEnv->mAnimFrameDelay )
return;
// reset, then move on ...
mFrameCounter = 0.0f;
if( mNumFrames >= 1 )
{
// increment by one
setFrame(mFrame+1);
}
else
{
// always show the 1st frame
setFrame(0);
}
}
void Actor::setName( const QString &pName )
{
mName = pName;
mId = qHash(pName);
}
QString &Actor::getName( void )
{
return mName;
}
unsigned int Actor::getId( void ) const
{
return mId;
}
void Actor::setShape(const t_point *pVerts, unsigned short pNumVerts)
{
Q_ASSERT( pVerts != 0 );
Q_ASSERT( pNumVerts > 0 );
//! Set only when possible
if( !(mFlags & S_CUSTOM) )
return;
// copy over the vertices
mShapeDef.vertexCount = pNumVerts;
for(unsigned short i = 0; i<pNumVerts; i++)
{
//! Convert to WORLD
float lX = S2W_((pVerts[i][0]-mOffsets[0]));
float lY = S2W_((pVerts[i][1]-mOffsets[1]));
mShapeDef.vertices[i].Set(lX,lY);
}
}
void Actor::setDensity( float pDens )
{
mShapeDef.density = pDens;
}
void Actor::setFriction( float pFric )
{
mShapeDef.friction = pFric;
}
void Actor::setRestituition( float pRest )
{
mShapeDef.restitution = pRest;
}
void Actor::applyPhysX(void)
{
Q_ASSERT( mWorld != 0 );
//! Remove the existing body
if( mBody )
removePhysX();
b2BodyDef lBodyDef;
b2World *lWorld = mWorld->getPhysicsWorld();
//! Set initial rotation
lBodyDef.angle = D2R(mRot);
//! Set initial position
lBodyDef.position.Set(S2W((mPos[0]+mHSize[0]),(mPos[1]+mHSize[1])));
mBody = lWorld->CreateBody(&lBodyDef);
if( isFlag(S_CUSTOM) )
{
if( isShapeSet() )
{
//! use the predefined shape
mBody->CreateShape(&mShapeDef);
}
else
{
qDebug() << "Warning: [Actor] Custom Shape but no vertices set";
setFlag(S_BOX); // fallback to BOX
}
}
if( isFlag(S_BOX) )
{
//! Set Shape
mShapeDef.SetAsBox(S2W((mHSize[0]-mOffsets[0]),(mHSize[1]-mOffsets[1])));
mBody->CreateShape(&mShapeDef);
}
else if( isFlag(S_CIRCLE) )
{
b2CircleDef lShapeDef;
// copy them over
lShapeDef.restitution = mShapeDef.restitution;
lShapeDef.density = mShapeDef.density;
lShapeDef.friction = mShapeDef.friction;
//! Set Shape
lShapeDef.radius = S2W_((getRadius()-mOffsets[0]));
mBody->CreateShape(&lShapeDef);
//! Fake it, not used anyway :)
mShapeDef.vertexCount = 1;
}
// auto-calc mass if density set (i.e > 0)
if( mShapeDef.density )
mBody->SetMassFromShapes();
//! Store itself as userData
mBody->SetUserData(this);
}
void Actor::removePhysX(void)
{
Q_ASSERT( mWorld != 0 );
if( mWorld->removeActorBody(this) )
mBody = 0;
}
void Actor::removeJoint(void)
{
Q_ASSERT( mWorld != 0 );
mWorld->removeJoint(this);
}
bool Actor::isFrozen(void) const
{
if( !mBody )
return false;
return mBody->IsFrozen();
}
void Actor::setHasJoints( bool pState )
{
mHasJoints = pState;
}
bool Actor::hasJoints( void ) const
{
return mHasJoints;
}
void Actor::applyForce(const float pX, const float pY, const bool pMass)
{
Q_ASSERT( mBody != 0 );
const float lM = mBody->GetMass();
const float lX = (pMass)?pX*lM:pX;
const float lY = (pMass)?pY*lM:pY;
mBody->ApplyForce(b2Vec2(lX,lY),mBody->GetWorldCenter());
}
void Actor::applyImpulse(const float pX, const float pY)
{
Q_ASSERT( mBody != 0 );
mBody->ApplyImpulse(b2Vec2(pX,pY),mBody->GetWorldCenter());
}
void Actor::applyTorque(const float pT)
{
Q_ASSERT( mBody != 0 );
mBody->ApplyTorque(pT);
}
void Actor::setBlending( t_blend pBlending )
{
mBlending = pBlending;
}
void Actor::setTransparency( float pLevel )
{
if( pLevel < 0.0f )
pLevel = 0; // fully opaque
if( pLevel > 255.0f )
pLevel = 255.0f; // full transparent
// invert ( 0 == opaque, 255 == fully transparent )
pLevel = 255 - pLevel;
// convert to 0..1 interval
mColor[3] = (float)(pLevel / 255.0f);
}
void Actor::_setTexCoord( short pFrame, t_point *pCoord, t_pos pPos )
{
_setTexCoord( pFrame, (*pCoord)[0], (*pCoord)[1], pPos );
}
void Actor::_setTexCoord( short pFrame, float pU, float pV, t_pos pPos )
{
mTexCoords[ pFrame ][ pPos ][ 0 ] = pU;
mTexCoords[ pFrame ][ pPos ][ 1 ] = pV;
}
void Actor::_setVertex( t_point *pVertex, t_pos pPos )
{
_setVertex((*pVertex)[0],(*pVertex)[1],pPos);
}
void Actor::_setVertex( float pX, float pY, t_pos pPos )
{
mVertices[ pPos ][ 0 ] = pX;
mVertices[ pPos ][ 1 ] = pY;
}
void Actor::_setPos(float pX, float pY)
{
mDPos[0] = mPos[0] = pX;
mDPos[1] = mPos[1] = pY;
_setSize(-1,-1);
}
void Actor::_setSize(float pW, float pH)
{
if( pW != -1 && pH != -1 )
{
// store initial size
mSize[0] = pW; // screen space
mSize[1] = pH; // screen space
// calculate half size
mHSize[0] = mSize[0] / 2; // screen space
mHSize[1] = mSize[1] / 2; // screen space
//! Setup Vertex Array
if( mVertices )
delete mVertices;
mVertices = new t_vertices[4];
_setVertex(-mHSize[0],-mHSize[1],P_BL);
_setVertex( mHSize[0],-mHSize[1],P_BR);
_setVertex( mHSize[0], mHSize[1],P_TR);
_setVertex(-mHSize[0], mHSize[1],P_TL);
}
if( !mBody ) // no PhysX, draw centered
{
mDPos[0] = mPos[0] + mHSize[0]; // screen space
mDPos[1] = mPos[1] + mHSize[1]; // screen space
}
}
void Actor::_setRotation(float pRot)
{
mRot = pRot;
}