ASYSTEM.CPP 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815
  1. //===========================================================================//
  2. // Copyright (C) Microsoft Corporation. All rights reserved. //
  3. //===========================================================================//
  4. #include "McLib.h"
  5. #include "aSystem.h"
  6. #include "packet.h"
  7. #include "afont.h"
  8. #include "paths.h"
  9. #include "userInput.h"
  10. long helpTextID = 0;
  11. long helpTextHeaderID = 0;
  12. void aObject::update()
  13. {
  14. long x = userInput->getMouseX();
  15. long y = userInput->getMouseY();
  16. if ( pointInside( x, y ) && helpID && isShowing())
  17. {
  18. helpTextID = helpID;
  19. }
  20. // call update for the children
  21. for ( int i = 0; i < pNumberOfChildren; i++ )
  22. pChildren[i]->update();
  23. }
  24. // base class aObject methods
  25. aObject::aObject()
  26. {
  27. pNumberOfChildren = 0;
  28. pParent = NULL;
  29. textureHandle = 0;
  30. memset( location, 0, sizeof ( gos_VERTEX ) * 4 );
  31. for ( int i = 0; i < 4;i++ )
  32. location[i].rhw = .5;
  33. showWindow = 1;
  34. helpID = 0;
  35. fileWidth = 0.0f;
  36. }
  37. aObject::~aObject()
  38. {
  39. destroy(); // destroy will often have been called already, so better be sure
  40. // it's safe to call twice
  41. }
  42. long aObject::init(long xPos, long yPos,long w, long h)
  43. {
  44. location[0].x = xPos;
  45. location[0].y = yPos;
  46. location[1].x = xPos;
  47. location[1].y = yPos + h;
  48. location[2].x = xPos + w;
  49. location[2].y = yPos + h;
  50. location[3].x = xPos + w;
  51. location[3].y = yPos;
  52. for ( int i = 0; i < 4; i++ )
  53. {
  54. location[i].u = 0.f;
  55. location[i].v = 0.f;
  56. location[i].z = 0.f;
  57. location[i].rhw = 0.5f;
  58. location[i].argb = 0xff000000;
  59. location[i].frgb = 0;
  60. }
  61. showWindow = TRUE;
  62. pNumberOfChildren = 0;
  63. pParent = NULL;
  64. return (NO_ERR);
  65. }
  66. void aObject::init(FitIniFile* file, const char* blockName, DWORD neverFlush)
  67. {
  68. memset( location, 0, sizeof( location ) );
  69. char fileName[256];
  70. textureHandle = 0;
  71. fileWidth = 256.;
  72. if ( NO_ERR != file->seekBlock( blockName ) )
  73. {
  74. char errBuffer[256];
  75. sprintf( errBuffer, "couldn't find static block %s", blockName );
  76. Assert( 0, 0, errBuffer );
  77. return;
  78. }
  79. long x, y, width, height;
  80. file->readIdLong( "XLocation", x );
  81. file->readIdLong( "YLocation", y );
  82. file->readIdLong( "Width", width );
  83. file->readIdLong( "Height", height );
  84. file->readIdLong( "HelpCaption", helpHeader );
  85. file->readIdLong( "HelpDesc", helpID );
  86. if ( NO_ERR == file->readIdString( "fileName", fileName, 32 ) )
  87. {
  88. bool bAlpha = 0;
  89. file->readIdBoolean( "Alpha", bAlpha );
  90. if ( !textureHandle )
  91. {
  92. char buffer[256];
  93. strcpy( buffer, artPath );
  94. strcat( buffer, fileName );
  95. _strlwr( buffer );
  96. if ( !strstr( buffer, ".tga" ) )
  97. strcat( buffer, ".tga" );
  98. int ID = mcTextureManager->loadTexture( buffer, bAlpha ? gos_Texture_Alpha : gos_Texture_Keyed, 0, 0, 0x2);
  99. textureHandle = ID;
  100. unsigned long gosID = mcTextureManager->get_gosTextureHandle( ID );
  101. TEXTUREPTR textureData;
  102. gos_LockTexture( gosID, 0, 0, &textureData );
  103. fileWidth = textureData.Width;
  104. gos_UnLockTexture( gosID );
  105. }
  106. }
  107. long u, v, uWidth, vHeight;
  108. bool bRotated = 0;
  109. file->readIdLong( "UNormal", u );
  110. file->readIdLong( "VNormal", v );
  111. file->readIdLong( "UWidth", uWidth );
  112. file->readIdLong( "VHeight", vHeight );
  113. file->readIdBoolean( "texturesRotated", bRotated );
  114. for ( int k = 0; k < 4; k++ )
  115. {
  116. location[k].argb = 0xffffffff;
  117. location[k].frgb = 0;
  118. location[k].x = x;
  119. location[k].y = y;
  120. location[k].z = 0.f;
  121. location[k].rhw = .5;
  122. if ( fileWidth )
  123. location[k].u = (float)u/(float)fileWidth + (.1f / (float)fileWidth);
  124. if ( fileWidth )
  125. location[k].v = (float)v/(float)fileWidth + (.1f / (float)fileWidth);
  126. }
  127. location[3].x = location[2].x = x + width;
  128. location[2].y = location[1].y = y + height;
  129. if ( fileWidth )
  130. location[2].u = location[3].u = ((float)(u + uWidth))/((float)fileWidth) + (.1f / (float)fileWidth);
  131. if ( fileWidth )
  132. location[1].v = location[2].v = ((float)(v + vHeight))/((float)fileWidth) + (.1f / (float)fileWidth);
  133. if ( bRotated )
  134. {
  135. location[0].u = (u + uWidth)/(float)fileWidth + (.1f / (float)fileWidth);;
  136. location[1].u = u/(float)fileWidth + (.1f / (float)fileWidth);;
  137. location[2].u = u/(float)fileWidth + (.1f / (float)fileWidth);
  138. location[3].u = (u + uWidth)/(float)fileWidth + (.1f / (float)fileWidth);
  139. location[0].v = v/(float)fileWidth + (.1f / (float)fileWidth);;
  140. location[1].v = v/(float)fileWidth + (.1f / (float)fileWidth);;
  141. location[2].v = (v + vHeight)/(float)fileWidth + (.1f / (float)fileWidth);;
  142. location[3].v = (v + vHeight)/(float)fileWidth + (.1f / (float)fileWidth);;
  143. }
  144. }
  145. void aObject::destroy()
  146. {
  147. removeAllChildren();
  148. if ( textureHandle )
  149. {
  150. int gosID = mcTextureManager->get_gosTextureHandle( textureHandle );
  151. if ( gosID && gosID != -1 )
  152. mcTextureManager->removeTexture( gosID );
  153. }
  154. if (pParent)
  155. {
  156. pParent->removeChild(this);
  157. }
  158. pParent = NULL;
  159. }
  160. bool aObject::pointInside(long mouseX, long mouseY) const
  161. {
  162. if ( (location[0].x) <= mouseX &&
  163. location[3].x >= mouseX &&
  164. location[0].y <= mouseY &&
  165. location[1].y >= mouseY )
  166. return true;
  167. return false;
  168. }
  169. bool aObject::rectIntersect(long left, long top, long right, long bottom) const
  170. {
  171. if ((right > location[0].x) && (left < location[2].x) && (bottom > location[0].y) && (top < location[2].y))
  172. return (TRUE);
  173. else
  174. return (FALSE);
  175. }
  176. bool aObject::rectIntersect(const GUI_RECT& testRect) const
  177. {
  178. if ((testRect.right > location[0].x) && (testRect.left < location[0].y) &&
  179. (testRect.bottom > location[2].y) && (testRect.top < location[2].y))
  180. return (TRUE);
  181. else
  182. return (FALSE);
  183. }
  184. aObject* aObject::findObject(long xPos, long yPos)
  185. {
  186. aObject* target;
  187. if (showWindow)
  188. {
  189. for (long i = pNumberOfChildren; i > 0; i--)
  190. {
  191. target = pChildren[i-1]->findObject(xPos,yPos);
  192. if (target)
  193. return target;
  194. }
  195. }
  196. if (showWindow && pointInside(xPos,yPos))
  197. return (this);
  198. return NULL;
  199. }
  200. void aObject::setParent(aObject* p)
  201. {
  202. pParent = p;
  203. }
  204. long aObject::numberOfChildren() const
  205. {
  206. return pNumberOfChildren;
  207. }
  208. void aObject::addChild(aObject* c)
  209. {
  210. Assert (pNumberOfChildren < MAX_CHILDREN, pNumberOfChildren+1, "Too many children!");
  211. Assert(c->getParent() == NULL || c->getParent() == this, 0, " Adding child that's someone else's ");
  212. if (!c)
  213. return;
  214. removeChild(c); // make sure this isn't already my child (Duplicate children screws up bringToFront())
  215. c->setParent(this);
  216. pChildren[pNumberOfChildren] = c;
  217. pNumberOfChildren++;
  218. c->move( x(), y() );
  219. }
  220. void aObject::removeChild(aObject* c)
  221. {
  222. if (!c) //If this is NULL, shouldn't we still remove it from the list?
  223. return;
  224. if ((c->getParent() == this) || (c->getParent() == NULL)) //Normal situation
  225. {
  226. for (long cc = 0; cc < pNumberOfChildren; cc++)
  227. {
  228. if (pChildren[cc] == c)
  229. {
  230. // found the child, remove it and shift the rest of the children up
  231. for (long sc = cc; sc < pNumberOfChildren - 1; sc++)
  232. pChildren[sc] = pChildren[sc+1];
  233. pChildren[pNumberOfChildren] = NULL;
  234. pNumberOfChildren--;
  235. c->setParent(NULL);
  236. return;
  237. }
  238. }
  239. }
  240. else
  241. {
  242. gosASSERT( 0 );
  243. }
  244. }
  245. aObject* aObject::child(long w)
  246. {
  247. if (w > pNumberOfChildren - 1)
  248. return NULL;
  249. return pChildren[w];
  250. }
  251. float aObject::width() const
  252. {
  253. return location[2].x - location[0].x;
  254. }
  255. float aObject::height() const
  256. {
  257. return location[2].y - location[0].y;
  258. }
  259. float aObject::x() const
  260. {
  261. if ( pParent )
  262. return location[0].x - pParent->globalX();
  263. else
  264. return location[0].x;
  265. }
  266. float aObject::y() const
  267. {
  268. if ( pParent )
  269. return location[0].y - pParent->y();
  270. else
  271. return location[0].y;
  272. }
  273. long aObject::globalX() const
  274. {
  275. return location[0].x;
  276. }
  277. long aObject::globalY() const
  278. {
  279. return location[0].y;
  280. }
  281. long aObject::globalRight() const
  282. {
  283. return globalX() + (long)width();
  284. }
  285. long aObject::globalBottom() const
  286. {
  287. return globalY() + (long)height();
  288. }
  289. void aObject::moveTo(long xPos, long yPos )
  290. {
  291. float offsetX = xPos - location[0].x;
  292. float offsetY = yPos - location[0].y;
  293. move( offsetX, offsetY );
  294. }
  295. void aObject::moveToNoRecurse(long xPos, long yPos )
  296. {
  297. float offsetX = xPos - location[0].x;
  298. float offsetY = yPos - location[0].y;
  299. moveNoRecurse( offsetX, offsetY );
  300. }
  301. void aObject::move( float offsetX, float offsetY )
  302. {
  303. for ( int i = 0; i < 4; i++ )
  304. {
  305. location[i].x += offsetX;
  306. location[i].y += offsetY;
  307. }
  308. for (i = 0; i < pNumberOfChildren; i++)
  309. {
  310. pChildren[i]->move( offsetX, offsetY );
  311. }
  312. }
  313. void aObject::moveNoRecurse( float offsetX, float offsetY )
  314. {
  315. for ( int i = 0; i < 4; i++ )
  316. {
  317. location[i].x += offsetX;
  318. location[i].y += offsetY;
  319. }
  320. }
  321. void aObject::resize(long w, long h)
  322. {
  323. location[2].x = location[0].x + w;
  324. location[3].x = location[0].x + w;
  325. location[1].y = location[0].y + h;
  326. location[2].y = location[0].y + h;
  327. }
  328. void aObject::render()
  329. {
  330. if ( showWindow )
  331. {
  332. unsigned long gosID = mcTextureManager->get_gosTextureHandle( textureHandle );
  333. gos_SetRenderState( gos_State_Texture, gosID );
  334. gos_SetRenderState(gos_State_Filter, gos_FilterNone);
  335. gos_SetRenderState( gos_State_AlphaMode, gos_Alpha_AlphaInvAlpha );
  336. gos_SetRenderState( gos_State_ZCompare, 0 );
  337. gos_SetRenderState( gos_State_ZWrite, 0 );
  338. gos_DrawQuads( location, 4 );
  339. for ( int i = 0; i < pNumberOfChildren; i++ )
  340. {
  341. pChildren[i]->render();
  342. }
  343. }
  344. }
  345. void aObject::render(long x, long y)
  346. {
  347. move( x, y );
  348. render();
  349. move( -x, -y );
  350. }
  351. void aObject::setTexture( const char* fileName )
  352. {
  353. if ( textureHandle )
  354. {
  355. int gosID = mcTextureManager->get_gosTextureHandle( textureHandle );
  356. if ( gosID > 0 )
  357. mcTextureManager->removeTexture( gosID );
  358. }
  359. textureHandle = mcTextureManager->loadTexture( fileName, gos_Texture_Keyed, 0, 0, 0x2);
  360. int gosID = mcTextureManager->get_gosTextureHandle( textureHandle );
  361. if ( gosID )
  362. {
  363. TEXTUREPTR textureData;
  364. gos_LockTexture( gosID, 0, 0, &textureData );
  365. fileWidth = textureData.Width;
  366. gos_UnLockTexture( gosID );
  367. }
  368. else
  369. fileWidth = 256; // guess
  370. }
  371. void aObject::setTexture(unsigned long newHandle )
  372. {
  373. //Gotta check handle. If its the same as the new one,
  374. // We don't gotta delete the old one. The texture manager already did!!
  375. if ( textureHandle && textureHandle != newHandle)
  376. {
  377. int gosID = mcTextureManager->get_gosTextureHandle( textureHandle );
  378. if ( gosID > 0 )
  379. mcTextureManager->removeTexture( gosID );
  380. }
  381. textureHandle = newHandle;
  382. if ( newHandle )
  383. {
  384. int gosID = mcTextureManager->get_gosTextureHandle( newHandle );
  385. TEXTUREPTR textureData;
  386. gos_LockTexture( gosID, 0, 0, &textureData );
  387. fileWidth = textureData.Width;
  388. gos_UnLockTexture( gosID );
  389. }
  390. }
  391. void aObject::setColor( unsigned long newColor, bool bRecurse )
  392. {
  393. for ( int i = 0; i < 4; i++ )
  394. {
  395. location[i].argb = newColor;
  396. }
  397. //set the kids?
  398. if ( bRecurse )
  399. {
  400. for ( int i = 0; i < this->pNumberOfChildren; i++ )
  401. {
  402. pChildren[i]->setColor( newColor, 1 );
  403. }
  404. }
  405. }
  406. void aObject::setUVs( float u1, float v1, float u2, float v2 )
  407. {
  408. location[0].u = location[1].u = u1/fileWidth + (.1f / (float)fileWidth);
  409. location[2].u = location[3].u = u2/fileWidth + (.1f / (float)fileWidth);
  410. location[0].v = location[3].v = v1/fileWidth + (.1f / (float)fileWidth);
  411. location[1].v = location[2].v = v2/fileWidth + (.1f / (float)fileWidth);
  412. }
  413. void aObject::removeAllChildren( bool bDelete)
  414. {
  415. for ( int i = 0; i < pNumberOfChildren; i++ )
  416. {
  417. pChildren[i]->setParent( 0 );
  418. if ( bDelete )
  419. delete pChildren[i];
  420. }
  421. memset( pChildren, 0, sizeof( aObject*)* MAX_CHILDREN );
  422. pNumberOfChildren = 0;
  423. }
  424. void aObject::copyData( const aObject& src )
  425. {
  426. if ( &src != this )
  427. {
  428. if ( src.textureHandle )
  429. textureHandle = mcTextureManager->copyTexture( src.textureHandle );
  430. for ( int i = 0; i < 4;i++ )
  431. location[i] = src.location[i];
  432. fileWidth = src.fileWidth;
  433. showWindow = src.showWindow;
  434. pNumberOfChildren = 0; // not copying the kids.
  435. ID = src.ID;
  436. }
  437. }
  438. aObject::aObject( const aObject& src )
  439. {
  440. copyData( src );
  441. }
  442. aObject& aObject::operator=( const aObject& src )
  443. {
  444. if ( &src != this )
  445. copyData( src );
  446. return *this;
  447. }
  448. /////////////////////////////////////////////////////////////
  449. aRect::aRect()
  450. {
  451. bOutline = 0;
  452. }
  453. void aRect::render()
  454. {
  455. long color = getColor();
  456. if ( isShowing() )
  457. //bOutline ? drawEmptyRect( getGUI_RECT(), color, color ) : drawRect( getGUI_RECT(), color );
  458. bOutline ? drawEmptyRect( getGlobalGUI_RECT(), color, color ) : drawRect( getGlobalGUI_RECT(), color );
  459. }
  460. void aRect::render( long x, long y )
  461. {
  462. //GUI_RECT tmpRect = getGUI_RECT();
  463. GUI_RECT tmpRect = getGlobalGUI_RECT();
  464. tmpRect.left += x;
  465. tmpRect.right += x;
  466. tmpRect.top += y;
  467. tmpRect.bottom += y;
  468. long color = getColor();
  469. bOutline ? drawEmptyRect( tmpRect, color, color ) : drawRect( tmpRect, color );
  470. }
  471. void aRect::init( FitIniFile* file, const char* blockName )
  472. {
  473. if ( NO_ERR != file->seekBlock( blockName ) )
  474. {
  475. char errorStr[256];
  476. sprintf( errorStr, "couldn't find block %s in file %s", blockName, file->getFilename() );
  477. Assert( 0, 0, errorStr );
  478. }
  479. long left;
  480. if ( NO_ERR == file->readIdLong( "left", left ) )
  481. {
  482. long right, top, bottom;
  483. file->readIdLong( "top", top );
  484. file->readIdLong( "right", right );
  485. file->readIdLong( "bottom", bottom );
  486. aObject::init(left, top, right - left, bottom - top);
  487. }
  488. else
  489. {
  490. //aObject::init(file, blockName);
  491. /*we're not using */
  492. long x, y, width, height;
  493. file->readIdLong( "XLocation", x );
  494. file->readIdLong( "YLocation", y );
  495. file->readIdLong( "Width", width );
  496. file->readIdLong( "Height", height );
  497. aObject::init(x, y, width, height);
  498. }
  499. long color = 0xff000000;
  500. file->readIdLong( "color", color );
  501. setColor(color);
  502. file->readIdBoolean( "outline", bOutline );
  503. file->readIdLong( "HelpCaption", helpHeader );
  504. file->readIdLong( "HelpDesc", helpID );
  505. }
  506. GUI_RECT aRect::getGUI_RECT()
  507. {
  508. GUI_RECT rect;
  509. rect.left = left();
  510. rect.right = right();
  511. rect.top = top();
  512. rect.bottom = bottom();
  513. if (pParent)
  514. {
  515. /* if there is a parent then we have to translate from relative to absolute coordinates */
  516. rect.left += pParent->x();
  517. rect.right += pParent->x();
  518. rect.top += pParent->top();
  519. rect.bottom += pParent->top();
  520. }
  521. return rect;
  522. }
  523. GUI_RECT aRect::getGlobalGUI_RECT()
  524. {
  525. GUI_RECT rect;
  526. rect.left = globalLeft();
  527. rect.right = globalRight();
  528. rect.top = globalTop();
  529. rect.bottom = globalBottom();
  530. return rect;
  531. }
  532. //////////////////////////////////////////////////////////
  533. aText::aText()
  534. {
  535. alignment = 0;
  536. }
  537. aText::~aText()
  538. {
  539. }
  540. void aText::init( FitIniFile* file, const char* header )
  541. {
  542. int result = file->seekBlock( header );
  543. if ( result != NO_ERR )
  544. {
  545. char errorStr[256];
  546. sprintf( errorStr, "couldn't find the text block%s", header );
  547. Assert( result == NO_ERR, 0, errorStr );
  548. return;
  549. }
  550. long lfont;
  551. file->readIdLong( "Font", lfont );
  552. font.init( lfont );
  553. long left, top, width, height;
  554. file->readIdLong( "XLocation", left );
  555. file->readIdLong( "YLocation", top );
  556. file->readIdLong( "Width", width );
  557. file->readIdLong( "Height", height );
  558. aObject::init( left, top, width, height );
  559. long color;
  560. file->readIdLong( "Color", color );
  561. for ( int i = 0; i < 4; i++ )
  562. location[i].argb = color;
  563. file->readIdLong( "Alignment", alignment );
  564. long textID;
  565. if ( NO_ERR == file->readIdLong( "TextID", textID ) )
  566. {
  567. //WAY too small. Good crash. Only crashes in profile.
  568. // cLoadString now checks buffer length and keeps game from crashing!!
  569. // -fs
  570. char tmp[1024];
  571. cLoadString( textID, tmp, 1023 );
  572. text = tmp;
  573. }
  574. file->readIdLong( "HelpCaption", helpHeader );
  575. file->readIdLong( "HelpDesc", helpID );
  576. }
  577. void aText::setText(const EString& str)
  578. {
  579. text = str;
  580. }
  581. void aText::render()
  582. {
  583. if ( showWindow )
  584. font.render( text, location[0].x, location[0].y, location[2].x - location[0].x,
  585. location[2].y - location[0].y, location[0].argb, 0, alignment );
  586. }
  587. void aText::render( long x, long y )
  588. {
  589. move( x, y );
  590. render();
  591. move( -x, -y );
  592. }
  593. void aText::setText( long resID )
  594. {
  595. char tmp[1280];
  596. cLoadString( resID, tmp, 1279 );
  597. if (tmp[0] != 0)
  598. text = tmp;
  599. else
  600. {
  601. char tmpy[1280];
  602. memset(tmpy,0,1280);
  603. sprintf( tmpy,"NULL for ID: %d",resID );
  604. text = tmpy;
  605. }
  606. }
  607. aText::aText( const aText& src )
  608. {
  609. CopyData( src );
  610. }
  611. aText& aText::operator=( const aText& src )
  612. {
  613. CopyData( src );
  614. return *this;
  615. }
  616. void aText::CopyData( const aText& src )
  617. {
  618. if ( &src != this )
  619. {
  620. text = src.text;
  621. alignment = src.alignment;
  622. font = src.font;
  623. aObject::operator=( src );
  624. }
  625. }
  626. bool aText::pointInside(long xPos, long yPos) const
  627. {
  628. if ( !width() || !height() )
  629. {
  630. long left = location[0].x;
  631. long top = location[0].y;
  632. long width = font.width( text );
  633. long height = font.height( );
  634. if ( alignment == 1 ) // right aligned
  635. {
  636. left -= width;
  637. }
  638. long mouseX = userInput->getMouseX();;
  639. long mouseY = userInput->getMouseY();
  640. if ( left <= mouseX &&
  641. left + width >= mouseX &&
  642. top <= mouseY &&
  643. top + height >= mouseY )
  644. return true;
  645. }
  646. return aObject::pointInside( xPos, yPos );
  647. }