MouseInRect

This commit is contained in:
James Turk 2003-09-21 03:28:53 +00:00
parent bf46b3dba6
commit 201d5dda51
3 changed files with 23 additions and 5 deletions

View File

@ -1,5 +1,5 @@
ZEngine Version Log for Version 0.8.5 ZEngine Version Log for Version 0.8.5
$Id: changelog.txt,v 1.47 2003/09/09 02:55:01 cozman Exp $ $Id: changelog.txt,v 1.48 2003/09/21 03:28:53 cozman Exp $
Changes are marked with symbols that describe them: Changes are marked with symbols that describe them:
! is code that breaks backwards compatibility (used after 0.8.0-rc1, previous versions broke compatibility) ! is code that breaks backwards compatibility (used after 0.8.0-rc1, previous versions broke compatibility)
@ -11,6 +11,7 @@ Changes are marked with symbols that describe them:
(Note: Depreciated code (that marked with a *) is likely to disappear completely at the next major version.) (Note: Depreciated code (that marked with a *) is likely to disappear completely at the next major version.)
0.8.5 0.8.5
+ ZRect overload for ZEngine::MouseInRect.
+ ZE_main as new entrypoint instead of main, ZE_main entrypoint allows ZEngine to initialize PhysFS and release itself. + ZE_main as new entrypoint instead of main, ZE_main entrypoint allows ZEngine to initialize PhysFS and release itself.
+ New Draw,DrawRotated, and DrawClipped overloads with vertex coloring parameter for advanced needs. + New Draw,DrawRotated, and DrawClipped overloads with vertex coloring parameter for advanced needs.
+ Addition of Dev-C++ project files and more Dev-C++ support. + Addition of Dev-C++ project files and more Dev-C++ support.

View File

@ -13,7 +13,7 @@
\brief Definition file for core ZEngine class. \brief Definition file for core ZEngine class.
ZEngine Game Engine core Engine definition. ZEngine Game Engine core Engine definition.
<br>$Id: ZE_ZEngine.h,v 1.48 2003/09/09 02:49:10 cozman Exp $<br> <br>$Id: ZE_ZEngine.h,v 1.49 2003/09/21 03:28:53 cozman Exp $<br>
\author James Turk \author James Turk
**/ **/
@ -35,6 +35,8 @@
namespace ZE namespace ZE
{ {
class ZRect;
/*! /*!
\brief Main ZEngine Singleton Class \brief Main ZEngine Singleton Class
@ -465,12 +467,21 @@ class ZEngine
/*! /*!
\brief Check if mouse is in given rectangle. \brief Check if mouse is in given rectangle.
Return status of mouse in current rectangle (used for buttons) Return status of mouse in current rectangle (eg. GUI buttons).
\param rect Rectangle to check if mouse is in. \param rect Rectangle to check if mouse is in.
\return true if mouse is in rectangle, false otherwise \return true if mouse is in rectangle, false otherwise
**/ **/
bool MouseInRect(SDL_Rect *rect); bool MouseInRect(SDL_Rect *rect);
/*!
\brief Check if mouse is in given rectangle.
Return status of mouse in current rectangle (eg. GUI buttons).
\param rect Rectangle to check if mouse is in.
\return true if mouse is in rectangle, false otherwise
**/
bool MouseInRect(ZRect rect);
/*! /*!
\brief Check for Activation, Window Manager, and Quit Events. \brief Check for Activation, Window Manager, and Quit Events.

View File

@ -13,11 +13,12 @@
\brief Central source file for ZEngine. \brief Central source file for ZEngine.
Actual implementation of ZEngine singleton class, the core of ZEngine. Actual implementation of ZEngine singleton class, the core of ZEngine.
<br>$Id: ZE_ZEngine.cpp,v 1.57 2003/08/08 04:03:32 cozman Exp $<br> <br>$Id: ZE_ZEngine.cpp,v 1.58 2003/09/21 03:28:53 cozman Exp $<br>
\author James Turk \author James Turk
**/ **/
#include "ZE_ZEngine.h" #include "ZE_ZEngine.h"
#include "ZE_ZRect.h"
namespace ZE namespace ZE
{ {
@ -489,6 +490,11 @@ bool ZEngine::MouseInRect(SDL_Rect *rect)
mMouseY >= rect->y && mMouseY <= rect->y+rect->h); mMouseY >= rect->y && mMouseY <= rect->y+rect->h);
} }
bool ZEngine::MouseInRect(ZRect rect)
{
return rect.Contains(static_cast<float>(mMouseX),static_cast<float>(mMouseY));
}
void ZEngine::CheckEvents() void ZEngine::CheckEvents()
{ {
SDL_Event event; SDL_Event event;