/*---------------------------------------------------------------------------* Copyright (C) 2010-2012 Nintendo. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. *---------------------------------------------------------------------------*/ #ifndef __DEMOWIN_PERIPHERAL_H_ #define __DEMOWIN_PERIPHERAL_H_ extern bool gIgnoreBounds; struct Peripheral { // Draw calls virtual void DrawWindowQuad(CVec2 position, CVec2 size, bool active, bool enabled, CVec3 color, const char* title) = 0; virtual void DrawText(const char* text, CVec3 position, CVec2 size, CVec4 color) = 0; virtual void DrawTextCenter(const char* text, CVec3 position, CVec2 size, CVec4 color) = 0; virtual void DrawTextRight(const char* text, CVec3 position, CVec2 size, CVec4 color) = 0; virtual void DrawMultiLineText(const char* text, CVec3 position, CVec2 size, CVec4 color) = 0; virtual void DrawBox(CVec3 position, CVec2 size, CVec4 color, CVec4 color1 = CVec4(0, 0, 0, 1.0)) = 0; virtual void DrawLine(CVec3 position, CVec2 size, CVec4 color) = 0; virtual void DrawFastLine(CVec3 position, CVec2 size, CVec4 color) = 0; virtual void DrawQuad(CVec3 position, CVec2 size, CVec4 color) = 0; virtual void DrawTexQuad(GX2Texture* tex, CVec3 position, CVec2 size, CVec4 color) = 0; virtual void DrawBoxQuad(CVec3 position, CVec2 size, CVec4 color) = 0; // Input calls virtual bool AnyPressed() = 0; virtual bool LeftPressed() = 0; virtual bool RightPressed() = 0; virtual bool UpPressed() = 0; virtual bool DownPressed() = 0; virtual bool PositivePressed() = 0; virtual bool NegativePressed() = 0; virtual bool LeftTriggered() = 0; virtual bool RightTriggered() = 0; virtual bool UpTriggered() = 0; virtual bool DownTriggered() = 0; virtual bool PositiveTriggered() = 0; virtual bool NegativeTriggered() = 0; virtual bool TabLeftTriggered() = 0; virtual bool TabRightTriggered() = 0; virtual bool PauseTriggered() = 0; virtual bool HomeTriggered() = 0; virtual bool& UsingPad() = 0; virtual bool& UsingWiimote() {dummyBool = false; return dummyBool;} virtual float& CursorX() = 0; virtual float& CursorY() = 0; // The best structure that knows about the cursor's location is the peripheral! bool CursorColliding(Window* window, float x, float y, float width, float height, bool ignoreBounds = false) { if (!window->manager->canBeOver) return false; x += window->GetX(); y += window->GetY(); // If we are outside the window, we are not colliding! if (!gIgnoreBounds && !ignoreBounds && (CursorX() < window->GetLeft() || CursorX() > window->GetRight() || CursorY() > window->GetTop() || CursorY() < window->GetBottom())) return false; return (CursorX() >= x - width / 2 && CursorX() <= x + width / 2 && CursorY() >= y - height / 2 && CursorY() <= y + height / 2); } // The best structure that knows about the cursor's location is the peripheral! bool CursorColliding(float x, float y, float width, float height) { return (CursorX() >= x - width / 2 && CursorX() <= x + width / 2 && CursorY() >= y - height / 2 && CursorY() <= y + height / 2); } private: // Should always be false bool dummyBool; }; #endif