/*---------------------------------------------------------------------------* Project: Horizon File: demo_RenderData.h Copyright (C)2009-2012 Nintendo Co., Ltd. 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. $Rev: 46365 $ *---------------------------------------------------------------------------*/ #ifndef DEMO_RENDER_DATA_H_ #define DEMO_RENDER_DATA_H_ #include #include namespace demo { /*! :private @brief Gets the width of the LCD. @param[in] display Target LCD (NN_GX_DISPLAY0 or NN_GX_DISPLAY1) @return LCD width */ f32 GetLcdWidth(const s32 display); /*! :private @brief Gets the height of the LCD. @param[in] display Target LCD (NN_GX_DISPLAY0 or NN_GX_DISPLAY1) @return LCD height */ f32 GetLcdHeight(const s32 display); /*! :private @brief Base class for the rendering data. */ class RenderData : private nn::util::NonCopyable { public: /*! :private @brief Constructor. */ RenderData(void); /*! :private @brief Destructor. */ virtual ~RenderData(void); public: /*! :private @brief Initializes the rendering data. */ virtual void Initialize(void); /*! :private @brief Finalizes the rendering data. */ virtual void Finalize(void); public: /*! :private @brief Performs rendering using the rendering data. */ virtual void Draw(void) = 0; public: /*! :private @brief Sets the window size to convert from the normalized device coordinate system to the window coordinate system. @param[in] windowWidth Window width @param[in] windowHeight Window height */ virtual void SetWindowSize(const f32 windowWidth, const f32 windowHeight); public: /*! :private @brief Converts provided window coordinates to normalized device coordinates. @param[in] windowCoordinateX X-coordinate for the window coordinates @param[in] windowCoordinateY Y-coordinate for the window coordinates @param[out] normalizedDeviceCoordinateX X-coordinate for the normalized device coordinates @param[out] normalizedDeviceCoordinateY Y-coordinate for the normalized device coordinates */ virtual void GetNormalizedDeviceCoordinateXY(const f32 windowCoordinateX, const f32 windowCoordinateY, f32& normalizedDeviceCoordinateX, f32& normalizedDeviceCoordinateY); /*! :private @brief Converts the Y-coordinate for the provided window coordinates to an X-coordinate for the normalized device coordinates. @param[in] windowCoordinateY Y-coordinate for the window coordinates @return X-coordinate for the normalized device coordinates */ virtual f32 GetNormalizedDeviceCoordinateX(const f32 windowCoordinateY); /*! :private @brief Converts the X-coordinate for the provided window coordinates to a Y-coordinate for the normalized device coordinates. @param[in] windowCoordinateX X-coordinate for the window coordinates @return Y-coordinate for the normalized device coordinates */ virtual f32 GetNormalizedDeviceCoordinateY(const f32 windowCoordinateX); protected: virtual void CalculateInverseWindowSize(void); protected: s32 m_RenderTarget; f32 m_WindowWidth; f32 m_WindowHeight; f32 m_InverseWindowWidth; f32 m_InverseWindowHeight; }; } #endif