-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add viewbox class and handle some input cases (#34)
authored-by: hoangfitus <[email protected]>
- Loading branch information
Showing
6 changed files
with
108 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "ViewBox.hpp" | ||
|
||
ViewBox::ViewBox() : x(0), y(0), w(0), h(0) {} | ||
|
||
ViewBox::ViewBox(float X, float Y, float W, float H) : x(X), y(Y), w(W), h(H) {} | ||
|
||
float ViewBox::getX() const { return x; } | ||
|
||
float ViewBox::getY() const { return y; } | ||
|
||
float ViewBox::getWidth() const { return w; } | ||
|
||
float ViewBox::getHeight() const { return h; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#ifndef VIEWBOX_HPP_ | ||
#define VIEWBOX_HPP_ | ||
|
||
class ViewBox { | ||
public: | ||
/** | ||
* @brief Default constructor | ||
* | ||
* Creates a ViewBox(0, 0, 0, 0). | ||
*/ | ||
ViewBox(); | ||
|
||
/** | ||
* @brief Construct the ViewBox from its coordinates | ||
* | ||
* @param X X coordinate | ||
* @param Y Y coordinate | ||
* @param W Width | ||
* @param H Height | ||
*/ | ||
ViewBox(float X, float Y, float W, float H); | ||
|
||
/** | ||
* @brief Get the X coordinate of the ViewBox | ||
* | ||
* @return X coordinate of the ViewBox | ||
*/ | ||
float getX() const; | ||
|
||
/** | ||
* @brief Get the Y coordinate of the ViewBox | ||
* | ||
* @return Y coordinate of the ViewBox | ||
*/ | ||
float getY() const; | ||
|
||
/** | ||
* @brief Get the width of the ViewBox | ||
* | ||
* @return Width of the ViewBox | ||
*/ | ||
float getWidth() const; | ||
|
||
/** | ||
* @brief Get the height of the ViewBox | ||
* | ||
* @return Height of the ViewBox | ||
*/ | ||
float getHeight() const; | ||
|
||
private: | ||
float x; ///< X coordinate of the ViewBox | ||
float y; ///< Y coordinate of the ViewBox | ||
float w; ///< Width of the ViewBox | ||
float h; ///< Height of the ViewBox | ||
}; | ||
|
||
#endif // VIEWBOX_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters