[WIP] Frames

This commit is contained in:
Tobias Dahl
2014-03-13 20:59:25 +01:00
parent 53c7609e11
commit 8f18fc87e3
5 changed files with 103 additions and 28 deletions
+77 -14
View File
@@ -3,51 +3,74 @@
GUI::Frame::Frame()
{
rectangle = new Rectangle();
texture = nullptr;
}
int GUI::Frame::GetWidth()
{
return rectangle;
return rectangle->Width();
}
int GUI::Frame::GetHeight()
{
return rectangle.Height();
return rectangle->Height();
}
int GUI::Frame::GetX()
{
return rectangle;
return rectangle->X();
}
int GUI::Frame::GetY()
{
return rectangle.Y();
return rectangle->Y();
}
void GUI::Frame::SetWidth(int wid)
int GUI::Frame::GetRight()
{
rectangle.width(wid);
return rectangle->Right();
}
void GUI::Frame::SetHeight(int hei)
int GUI::Frame::GetLeft()
{
rectangle.height(hei);
return rectangle->Left();
}
void GUI::Frame::SetX(int xcord)
int GUI::Frame::GetBottom()
{
rectangle.X(xcord)
return rectangle->Bottom();
}
void GUI::Frame::SetY(int ycord)
int GUI::Frame::GetTop()
{
rectangle.Y(ycord)
return rectangle->Right();
}
void GUI::Frame::SetWidth(int _width)
{
rectangle->Width(_width);
}
void GUI::Frame::SetHeight(int _height)
{
rectangle->Height(_height);
}
void GUI::Frame::SetX(int _x)
{
rectangle->X(_x);
}
void GUI::Frame::SetY(int _y)
{
rectangle->Y(_y);
}
Rectangle GUI::Frame::AbsouluteRectangle()
{
}
bool GUI::Frame::Visible()
@@ -85,8 +108,48 @@ void GUI::Frame::Update(double dt)
}
void AddChild(GUI::Frame childFrame)
{
childFrame.Parent = this;
if (!Children.Contains(childFrame))
Children.Add(childFrame);
}
/// <summary>
/// Remove a child frame from the frame.
/// </summary>
/// <param name="childFrame">The child frame to remove.</param>
void RemoveChild(GUI::Frame childFrame)
{
if (Children.Contains(childFrame))
Children.Remove(childFrame);
}
/// <summary>
/// Destroys the frame and all its children.
/// </summary>
void Destroy()
{
if (Parent != null)
Parent.RemoveChild(this);
Manager.Remove(this);
}
void GUI::Frame::SetTexture(std::string fileName)
{
//texture == någonTextureIDunno;
}
void GUI::Frame::Draw()
{
if (Visible)
{
if (texture != nullptr)
{
//Drawshit
}
}
}
*/
+14 -9
View File
@@ -1,4 +1,4 @@
/*#ifndef Frame_h__
#ifndef Frame_h__
#define Frame_h__
#include <map>
@@ -7,7 +7,7 @@
#include "GUIManager.h"
#include "Texture.h"
#include "Color.h"
//#include "Camera.h"
#include "Camera.h"
namespace GUI
{
@@ -22,14 +22,19 @@ public:
int GetHeight();
int GetX();
int GetY();
void SetWidth(int wid);
void SetHeight(int hei);
void SetX( int xcord);
void SetY(int ycord);
int GetRight();
int GetLeft();
int GetBottom();
int GetTop();
void SetWidth(int _width);
void SetHeight(int _height);
void SetX( int _x);
void SetY(int _y);
void SetTexture(std::string fileName);
Rectangle *rectangle;
Rectangle AbsouluteRectangle();
Texture texture;
Color color;
Texture* texture;
Color* color;
bool _Visible;
bool Visible();
int layer;
@@ -48,4 +53,4 @@ protected:
};
}
#endif*/
#endif
+2 -2
View File
@@ -2,7 +2,7 @@
int GUI::GUIManager::Add(Frame frame)
{
//Frame.Add(frame);
//return CreateUID();
Frame.Add(frame);
return CreateUID();
}
*/
+2 -3
View File
@@ -1,4 +1,4 @@
/*#ifndef GUIManager_h__
#ifndef GUIManager_h__
#define GUIManager_h__
#include "Frame.h"
@@ -18,9 +18,8 @@ private:
static int uidIndex;
};
}
#endif */
#endif
+8
View File
@@ -22,6 +22,14 @@ public:
int Y() const { return y; }
void Y(int val) { y = val; }
int Left() const { return x; }
int Right() const { return x+width; }
int Top() const { return y; }
int Bottom() const { return y+height; }
};
Rectangle::Rectangle()