Add project files.

This commit is contained in:
2018-06-25 21:48:45 -04:00
parent b04a25689b
commit 3c1b7d28e8
425 changed files with 35333 additions and 0 deletions
@@ -0,0 +1,40 @@
#ifndef _CTEXTTYPE_HPP_
#define _CTEXTTYPE_HPP_
/*** SDL Header Files ***/
#include <SDL.h>
#include <SDL_ttf.h>
/*** DLL Header File ***/
#include "dllExport.h"
namespace TextTypeEngine {
/* Singleton */
class EXPORT_FROM_MYDLL cTextType
{
private:
cTextType();
~cTextType();
public:
///Functions
static cTextType& Inst();
static void Delete();
const bool Initialize() const;
const bool Setup();
void CleanUp();
void PrintVersion() const;
///Sets
///Gets
/* Gets return true if Text was initialized */
const bool IsInit() const;
private:
static cTextType* sp_inst;// = nullptr
};/// END CLASS DEFINITION cTextType
}/// END NAMESPACE DEFINITION TextTypeEngine
#endif/// END IFNDEF _CTEXTTYPE_HPP_
@@ -0,0 +1,43 @@
#include "Vector3.hpp"
/*** Custom Header File ***/
#include "../iVector/iVector3.hpp"
using MathEngine::Vector3;
using MathEngine::iVector3;
Vector3::Vector3( const float X /*= 0.0f*/, const float Y /*= 0.0f*/, const float Z /*= 0.0f*/ )
: Vector2( X, Y ), z(Z)
{}
Vector3::Vector3( const SDL_Rect& copy )
{
x = float(copy.x);
y = float(copy.y);
z = float(copy.w);
}
Vector3& Vector3::operator=( const SDL_Rect& copy )
{
x = float(copy.x);
y = float(copy.y);
z = float(copy.w);
return *this;
}
Vector3::Vector3( const iVector3& copy )
{
x = float(copy.x);
y = float(copy.y);
z = float(copy.z);
}
Vector3& Vector3::operator=( const iVector3& copy )
{
x = float(copy.x);
y = float(copy.y);
z = float(copy.z);
return *this;
}
@@ -0,0 +1,129 @@
#include "cLabel.hpp"
using GUIEngine::cLabel;
/*static*/ const cString cLabel::sNAME = "label";
/*static*/ const GUIHelpers::eLayout cLabel::sLAYOUT = GUIHelpers::eLayout::WRAP_CONTENT;
cLabel::cLabel(cWindow* parent, const signed int id, const cString& label /*= ""*/, const GUIHelpers::eAlign& align /*= sALIGN*/,
const GUIHelpers::eLayout& layout /*= sLAYOUT*/, const GUIHelpers::Position& pos /*= sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/,
const GUIHelpers::Padding& padding /*= sPADDING*/, const cString& name /*= sNAME*/)
{
mp_text = new TextTypeEngine::cText(label);
Create(parent, id, label, align, layout, pos, size, padding, name);
}
/*virtual*/ cLabel::~cLabel()
{
delete mp_text;
mp_text = nullptr;
}
///Functions
void cLabel::Create(cWindow* parent, const signed int id, const cString& label /*= ""*/, const GUIHelpers::eAlign& align /*= sALIGN*/,
const GUIHelpers::eLayout& layout /*= sLAYOUT*/, const GUIHelpers::Position& pos /*= sPOSITION*/, const GUIHelpers::Size& size /*= sSIZE*/,
const GUIHelpers::Padding& padding /*= sPADDING*/, const cString& name /*= sNAME*/)
{
cWindow::Create(parent, id, sORIENTATION, align, layout, pos, size, padding, name);
if (this->getParent() != nullptr) {
this->getParent()->AddChild(this);
}
setText(label);
}
/*virtual*/ void cLabel::Display()
{
GenerateTexture();
m_sprite.setPosition(cWindow::getPosition());
m_sprite.Draw();
//cSprite::SaveImage("test.bmp", "xml/");
cWindow::Display();
}
void cLabel::GenerateTexture()
{
m_sprite.setImage((VideoEngine::cImage**)(&mp_text));
m_sprite.setImageArea(mp_text->getWH());
//this->setTransparent();
//this->setPosition()
}
//Sets
void cLabel::setFontColour(const GUIHelpers::RGBA& colour)
{
mp_text->setColour(colour);
}
void cLabel::setFontSize(const unsigned long int size)
{
mp_text->setSize(size);
}
void cLabel::setText(const cString& text)
{
mp_text->setText(text);
}
void cLabel::setFont(const TextTypeEngine::cFont* font)
{
mp_text->setFont((TextTypeEngine::cFont**)(&font));
}
///Gets
const GUIHelpers::RGBA& cLabel::getFontColour() const
{
return mp_text->getColour();
}
const unsigned long int cLabel::getFontSize() const
{
return mp_text->getSize();
}
const TextTypeEngine::cFont* cLabel::getFont() const
{
return mp_text->getFont();
}
const cString& cLabel::getText() const
{
return mp_text->getText();
}
/*virtual*/ const GUIHelpers::eType cLabel::getType() const
{
return GUIHelpers::eType::CLABEL;
}
/*virtual*/ const GUIHelpers::RGBA cLabel::getDebugColour() const
{
return GUIHelpers::GREEN;
}
/*virtual*/ void cLabel::Resize()
{
RebuildLayout(this->getLayout());
cWindow::Resize();
}
/*virtual*/ void cLabel::RebuildLayout(const GUIHelpers::eLayout& layout)
{
switch (layout)
{
case GUIHelpers::eLayout::MATCH_PARENT:
case GUIHelpers::eLayout::FILL_PARENT:
//break;
case GUIHelpers::eLayout::WRAP_CONTENT:
long int x = (mp_text->getText().length() * mp_text->getSize());
GUIHelpers::Size size = { x, 8 };
// size.x += this->getPadding().x + this->getPadding().w;
// size.y += this->getPadding().y + this->getPadding().z;
this->setSize(size);
break;
}
}