Clean
This commit is contained in:
@@ -1 +0,0 @@
|
|||||||
12
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
12
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
#include "cGFX.hpp"
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL2_gfxPrimitives.h>
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../VideoEngine/cRenderer.hpp"
|
|
||||||
#include "../UtilityEngine/cUtility.hpp"
|
|
||||||
|
|
||||||
using FXEngine::cGFX;
|
|
||||||
using VideoEngine::cRenderer;
|
|
||||||
using UtilityEngine::cUtility;
|
|
||||||
|
|
||||||
/*static*/ cGFX* cGFX::sp_inst = nullptr;
|
|
||||||
|
|
||||||
//private:
|
|
||||||
cGFX::cGFX()
|
|
||||||
{}
|
|
||||||
|
|
||||||
cGFX::~cGFX()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//public:
|
|
||||||
///Functions
|
|
||||||
/*static*/ cGFX& cGFX::Inst()
|
|
||||||
{
|
|
||||||
if (sp_inst == nullptr)
|
|
||||||
sp_inst = new cGFX();
|
|
||||||
return *sp_inst;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*static*/ void cGFX::Delete()
|
|
||||||
{
|
|
||||||
delete sp_inst;
|
|
||||||
sp_inst = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGFX::StringDefault( const cString& text, const SDL_Rect& pos, const SDL_Colour& colour ) const
|
|
||||||
{
|
|
||||||
if (stringRGBA(cRenderer::Inst().getRenderer(), (Sint16)pos.x, (Sint16)pos.y, text.c_str(), colour.r, colour.g, colour.b, colour.a) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to render text. stringRGBA():", __AT__, cUtility::eTypeSDL::GFX);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGFX::StringDefault( const cString& text, const SDL_Rect& pos, const SDL_Colour& colour, SDL_Texture* texture ) const
|
|
||||||
{
|
|
||||||
cRenderer::Inst().SetRenderTarget(texture);
|
|
||||||
StringDefault(text, pos, colour);
|
|
||||||
cRenderer::Inst().ResetRenderTarget();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGFX::Box(const SDL_Rect& rect, const SDL_Colour& colour) const
|
|
||||||
{
|
|
||||||
if (boxRGBA(cRenderer::Inst().getRenderer(), (Sint16)rect.x, (Sint16)rect.y, (Sint16)rect.w, (Sint16)rect.h, colour.r, colour.g, colour.b, colour.a) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to make Rounded Rectangle. boxRGBA():", __AT__, cUtility::eTypeSDL::GFX);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGFX::Box(const SDL_Rect& rect, const SDL_Colour& colour, SDL_Texture* texture) const
|
|
||||||
{
|
|
||||||
cRenderer::Inst().SetRenderTarget(texture);
|
|
||||||
Box(rect, colour);
|
|
||||||
cRenderer::Inst().ResetRenderTarget();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGFX::RoundedBox( const SDL_Rect& rect, const unsigned long int rad, const SDL_Colour& colour ) const
|
|
||||||
{
|
|
||||||
if (roundedBoxRGBA(cRenderer::Inst().getRenderer(), (Sint16)rect.x, (Sint16)rect.y, (Sint16)rect.w, (Sint16)rect.h, (Sint16)rad, colour.r, colour.g, colour.b, colour.a) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to make Rounded Rectangle. roundedBoxRGBA():", __AT__, cUtility::eTypeSDL::GFX);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGFX::RoundedBox( const SDL_Rect& rect, const unsigned long int rad, const SDL_Colour& colour, SDL_Texture* texture ) const
|
|
||||||
{
|
|
||||||
cRenderer::Inst().SetRenderTarget(texture);
|
|
||||||
RoundedBox(rect, rad, colour);
|
|
||||||
cRenderer::Inst().ResetRenderTarget();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGFX::Pixel(const unsigned long int x, const unsigned long int y, const SDL_Colour& colour) const
|
|
||||||
{
|
|
||||||
if (pixelRGBA(cRenderer::Inst().getRenderer(), (Sint16)x, (Sint16)y, colour.r, colour.g, colour.b, colour.a) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to make pixel. pixelRGBA():", __AT__, cUtility::eTypeSDL::GFX);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGFX::Pixel(const unsigned long int x, const unsigned long int y, const SDL_Colour& colour, SDL_Texture* texture) const
|
|
||||||
{
|
|
||||||
cRenderer::Inst().SetRenderTarget(texture);
|
|
||||||
Pixel(x, y, colour);
|
|
||||||
cRenderer::Inst().ResetRenderTarget();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGFX::Rectangle(const SDL_Rect& rect, const SDL_Colour& colour) const
|
|
||||||
{
|
|
||||||
if (rectangleRGBA(cRenderer::Inst().getRenderer(), (Sint16)rect.x, (Sint16)rect.y, (Sint16)rect.w, (Sint16)rect.h, colour.r, colour.g, colour.b, colour.a) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to make pixel. rectangleRGBA():", __AT__, cUtility::eTypeSDL::GFX);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGFX::Rectangle(const SDL_Rect& rect, const SDL_Colour& colour, SDL_Texture* texture) const
|
|
||||||
{
|
|
||||||
cRenderer::Inst().SetRenderTarget(texture);
|
|
||||||
Rectangle(rect, colour);
|
|
||||||
cRenderer::Inst().ResetRenderTarget();
|
|
||||||
}
|
|
||||||
@@ -1,275 +0,0 @@
|
|||||||
#include "cWindow.hpp"
|
|
||||||
|
|
||||||
#include "../UtilityEngine/cUtility.hpp"
|
|
||||||
|
|
||||||
#include "cGUI.hpp"
|
|
||||||
#include "cLabel.hpp"
|
|
||||||
#include "cLayout.hpp"
|
|
||||||
|
|
||||||
using GUIEngine::cWindow;
|
|
||||||
|
|
||||||
/*static*/ const UtilityEngine::cString cWindow::sNAME = "windows";
|
|
||||||
/*static*/ GUIHelpers::Position cWindow::sPOSITION = { 0, 0 };
|
|
||||||
/*static*/ GUIHelpers::Size cWindow::sSIZE = { 0, 0 };
|
|
||||||
/*static*/ GUIHelpers::Padding cWindow::sPADDING = { 5, 5, 5, 5 };
|
|
||||||
/*static*/ GUIHelpers::RBGA cWindow::sCOLOUR = { 100, 100, 100, 255 };
|
|
||||||
|
|
||||||
/*static*/ GUIHelpers::eAlign cWindow::sALIGN = GUIHelpers::eAlign::CENTER;
|
|
||||||
/*static*/ GUIHelpers::eLayout cWindow::sLAYOUT = GUIHelpers::eLayout::FILL_PARENT;
|
|
||||||
|
|
||||||
cWindow::cWindow(cWindow* parent /*= nullptr*/, const signed int id /*= -1*/, 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_parent(parent), GUIHelpers::cObject(id), m_align(align), m_layout(layout), m_pos(pos), m_size(size), m_content(size), m_padding(padding), m_name(name)
|
|
||||||
{
|
|
||||||
// if (mp_parent != nullptr) {
|
|
||||||
// switch (this->getType()) {
|
|
||||||
// case GUIHelpers::eType::CLABEL:
|
|
||||||
// mp_parent->AddChild((cLabel*)this);
|
|
||||||
// break;
|
|
||||||
// case GUIHelpers::eType::CLAYOUT:
|
|
||||||
// mp_parent->AddChild((cLayout*)this);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ cWindow::~cWindow()
|
|
||||||
{
|
|
||||||
m_children.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ void cWindow::Display() {
|
|
||||||
|
|
||||||
std::vector<cWindow*>::iterator it;
|
|
||||||
|
|
||||||
for (it = m_children.begin(); it < m_children.end(); it++) {
|
|
||||||
(*it)->Display();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
const bool cWindow::Inside(const MathEngine::iVector2& location) const
|
|
||||||
{
|
|
||||||
bool rtn = false;
|
|
||||||
|
|
||||||
if ((location.x >= m_pos.x) && (location.y >= m_pos.y)) {
|
|
||||||
if ((location.x <= (m_pos.x + m_size.x)) && (location.y <= (m_pos.y + m_size.y)))
|
|
||||||
rtn = true;
|
|
||||||
}
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::AddChild(cWindow* obj)
|
|
||||||
{
|
|
||||||
//m_obj = obj;
|
|
||||||
m_children.push_back(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::RemoveChild(cWindow* obj)
|
|
||||||
{
|
|
||||||
std::vector<cWindow*>::iterator it;
|
|
||||||
|
|
||||||
for (it = m_children.begin(); it < m_children.end(); it++) {
|
|
||||||
if (obj == (*it)) {
|
|
||||||
m_children.erase(it);
|
|
||||||
//break out of the for loop
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::AddSizeX(const unsigned long int x)
|
|
||||||
{
|
|
||||||
m_size.x += x;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::AddSizeY(const unsigned long int y)
|
|
||||||
{
|
|
||||||
m_size.y += y;
|
|
||||||
}
|
|
||||||
|
|
||||||
///Sets
|
|
||||||
void cWindow::setAlign( const GUIHelpers::eAlign& align /*= GUIHelpers::eAlign::CENTER*/)
|
|
||||||
{
|
|
||||||
m_align = align;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setLayout(const GUIHelpers::eLayout& layout /*= GUIHelpers::eLayout::FILL_PARENT*/)
|
|
||||||
{
|
|
||||||
m_layout = layout;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setPosition(const GUIHelpers::Position& pos /*= POSITION*/)
|
|
||||||
{
|
|
||||||
m_pos = pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setSize(const GUIHelpers::Size& size /*= SIZE*/)
|
|
||||||
{
|
|
||||||
m_size = size;
|
|
||||||
this->Resize();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setPadding(const GUIHelpers::Padding& padding/* = PADDING*/)
|
|
||||||
{
|
|
||||||
m_padding = padding;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setContentSize(const GUIHelpers::Size& content)
|
|
||||||
{
|
|
||||||
m_content = content;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setName(const cString& name /*= NAME*/)
|
|
||||||
{
|
|
||||||
m_name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void cWindow::setParent(cWindow* parent)
|
|
||||||
{
|
|
||||||
mp_parent = parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
///Gets
|
|
||||||
const GUIHelpers::eAlign& cWindow::getAlign() const
|
|
||||||
{
|
|
||||||
return m_align;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GUIHelpers::eLayout& cWindow::getLayout() const
|
|
||||||
{
|
|
||||||
if (m_layout == GUIHelpers::eLayout::MATCH_PARENT) {
|
|
||||||
if (mp_parent != nullptr)
|
|
||||||
return mp_parent->getLayout();
|
|
||||||
}
|
|
||||||
return m_layout;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GUIHelpers::Position& cWindow::getPosition() const
|
|
||||||
{
|
|
||||||
return m_pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GUIHelpers::Size& cWindow::getSize() const
|
|
||||||
{
|
|
||||||
return m_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GUIHelpers::Padding& cWindow::getPadding() const
|
|
||||||
{
|
|
||||||
return m_padding;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GUIHelpers::Size& cWindow::getContentSize() const
|
|
||||||
{
|
|
||||||
return m_content;
|
|
||||||
}
|
|
||||||
|
|
||||||
const cString& cWindow::getName() const
|
|
||||||
{
|
|
||||||
return m_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
cWindow* cWindow::getParent()
|
|
||||||
{
|
|
||||||
return mp_parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ const GUIHelpers::eType cWindow::getType() const
|
|
||||||
{
|
|
||||||
return GUIHelpers::eType::CWINDOW;
|
|
||||||
}
|
|
||||||
|
|
||||||
///Protected
|
|
||||||
|
|
||||||
/*virtual*/ void cWindow::Resize()
|
|
||||||
{
|
|
||||||
RebuildLayout(this->getLayout());
|
|
||||||
RePos();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ void cWindow::RebuildLayout(const GUIHelpers::eLayout& layout)
|
|
||||||
{
|
|
||||||
GUIHelpers::Size mySize = (0, 0);
|
|
||||||
std::vector<cWindow*>::iterator it;
|
|
||||||
|
|
||||||
switch (layout)
|
|
||||||
{
|
|
||||||
case GUIHelpers::eLayout::MATCH_PARENT:
|
|
||||||
case GUIHelpers::eLayout::FILL_PARENT:
|
|
||||||
if (mp_parent != nullptr) {
|
|
||||||
mySize = mp_parent->getSize();
|
|
||||||
mySize.x -= m_padding.x + m_padding.w;
|
|
||||||
mySize.y -= m_padding.y + m_padding.z;
|
|
||||||
} else {
|
|
||||||
mySize = GUIEngine::cGUI::Inst().DisplayArea();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_size = mySize;
|
|
||||||
|
|
||||||
for (it = m_children.begin(); it < m_children.end(); it++) {
|
|
||||||
//if ((*it)->getLayout() != GUIHelpers::eLayout::WRAP_CONTENT)
|
|
||||||
(*it)->Resize();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eLayout::WRAP_CONTENT:
|
|
||||||
GUIHelpers::Size size = { 0, 0 };
|
|
||||||
GUIHelpers::Padding pad = { 0, 0, 0, 0 };
|
|
||||||
for (it = m_children.begin(); it < m_children.end(); it++) {
|
|
||||||
(*it)->Resize();
|
|
||||||
size = (*it)->getSize();
|
|
||||||
pad = (*it)->getPadding();
|
|
||||||
size.x += pad.x + pad.w;
|
|
||||||
size.y += pad.y + pad.z;
|
|
||||||
mySize += size;
|
|
||||||
//AddSize(size.x, size.y, mySize);
|
|
||||||
}
|
|
||||||
m_size = mySize;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ void cWindow::RePos()
|
|
||||||
{
|
|
||||||
if (mp_parent != nullptr)
|
|
||||||
RebuildPos();
|
|
||||||
|
|
||||||
std::vector<cWindow*>::iterator it;
|
|
||||||
|
|
||||||
for (it = m_children.begin(); it < m_children.end(); it++) {
|
|
||||||
(*it)->RePos();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ void cWindow::RebuildPos()
|
|
||||||
{
|
|
||||||
GUIHelpers::Size prtSize = mp_parent->getSize();
|
|
||||||
GUIHelpers::Position prtCenter = { (prtSize.x / 2), (prtSize.y / 2) };
|
|
||||||
|
|
||||||
GUIHelpers::Size ourSize = this->getSize();
|
|
||||||
GUIHelpers::Position ourCenter = { (ourSize.x / 2), (ourSize.y / 2) };
|
|
||||||
|
|
||||||
GUIHelpers::Position ourSet = { 0, 0 };
|
|
||||||
|
|
||||||
switch (this->getAlign()) {
|
|
||||||
case GUIHelpers::eAlign::CENTER:
|
|
||||||
ourSet.x = prtCenter.x - ourCenter.x;
|
|
||||||
ourSet.y = prtCenter.y - ourCenter.y;
|
|
||||||
this->setPosition(ourSet);
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eAlign::TOP:
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eAlign::RIGHT:
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eAlign::BOTTOM:
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eAlign::LEFT:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<cWindow*>& cWindow::getChildren()
|
|
||||||
{
|
|
||||||
return m_children;
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
#include "cLayout.hpp"
|
|
||||||
|
|
||||||
using GUIEngine::cLayout;
|
|
||||||
|
|
||||||
/*static*/ const cString cLayout::sNAME = "layout";
|
|
||||||
/*static*/ const GUIHelpers::eOrientation cLayout::sORIENTATION = GUIHelpers::eOrientation::VERTICAL;
|
|
||||||
|
|
||||||
cLayout::cLayout(cWindow* parent, const signed int id, const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/, 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*/)
|
|
||||||
{
|
|
||||||
Create(parent, id, orientation, align, layout, pos, size, padding, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ cLayout::~cLayout()
|
|
||||||
{}
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
/*virtual*/ void cLayout::Create(cWindow* parent, const signed int id, const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/, 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, orientation, align, layout, pos, size, padding, name);
|
|
||||||
if (this->getParent() != nullptr) {
|
|
||||||
this->getParent()->AddChild(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ void cLayout::Display()
|
|
||||||
{
|
|
||||||
cWindow::Display();
|
|
||||||
}
|
|
||||||
|
|
||||||
///Set
|
|
||||||
|
|
||||||
///Get
|
|
||||||
|
|
||||||
/*virtual*/ const GUIHelpers::eType cLayout::getType() const
|
|
||||||
{
|
|
||||||
return GUIHelpers::eType::CLAYOUT;
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup>
|
|
||||||
<Filter Include="UTest">
|
|
||||||
<UniqueIdentifier>{549e0f16-9635-455e-b19a-4a887771cf5d}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="VideoEngineTest">
|
|
||||||
<UniqueIdentifier>{50a06b19-0711-478a-a15e-df325d10bebc}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="UtitlityEngineTest">
|
|
||||||
<UniqueIdentifier>{3305ea52-bd3f-4a02-a012-eb2923a77dbf}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="UTest\UTest.hpp">
|
|
||||||
<Filter>UTest</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="UtilityEngineTest\StringTest.hpp">
|
|
||||||
<Filter>UtitlityEngineTest</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="UTest\UTest.cpp">
|
|
||||||
<Filter>UTest</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="main.cpp" />
|
|
||||||
<ClCompile Include="UtilityEngineTest\StringTest.cpp">
|
|
||||||
<Filter>UtitlityEngineTest</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
#ifndef _CGFX_HPP_
|
|
||||||
#define _CGFX_HPP_
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../UtilityEngine/cString.hpp"
|
|
||||||
|
|
||||||
using UtilityEngine::cString;
|
|
||||||
|
|
||||||
namespace EXPORT_FROM_MYDLL FXEngine {
|
|
||||||
/* Singleton */
|
|
||||||
class cGFX
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
cGFX();
|
|
||||||
~cGFX();
|
|
||||||
|
|
||||||
public:
|
|
||||||
static cGFX& Inst();
|
|
||||||
static void Delete();
|
|
||||||
|
|
||||||
void StringDefault( const cString& text, const SDL_Rect& pos, const SDL_Colour& colour ) const;
|
|
||||||
void StringDefault( const cString& text, const SDL_Rect& pos, const SDL_Colour& colour, SDL_Texture* texture ) const;
|
|
||||||
|
|
||||||
void RoundedRectangle( const SDL_Rect& rect, const unsigned long int rad, const SDL_Colour& colour ) const;
|
|
||||||
void RoundedRectangle( const SDL_Rect& rect, const unsigned long int rad, const SDL_Colour& colour, SDL_Texture* texture ) const;
|
|
||||||
|
|
||||||
void Pixel( const unsigned long int x, const unsigned long int y, const SDL_Colour& colour ) const;
|
|
||||||
void Pixel( const unsigned long int x, const unsigned long int y, const SDL_Colour& colour, SDL_Texture* texture ) const;
|
|
||||||
|
|
||||||
void Rectangle( const SDL_Rect& rect, const SDL_Colour& colour ) const;
|
|
||||||
void Rectangle (const SDL_Rect& rect, const SDL_Colour& colour, SDL_Texture* texture ) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
static cGFX* sp_inst;// = nullptr
|
|
||||||
};/// END CLASS DEFINITION cGFX
|
|
||||||
}/// END NAMESPACE DEFINITION FXEngine
|
|
||||||
#endif/// END IFNDEF _CGFX_HPP_
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
#include "cPlayerDown.hpp"
|
|
||||||
|
|
||||||
using Input::cPlayerDown;
|
|
||||||
|
|
||||||
cPlayerDown::cPlayerDown( SDL_Keycode key, Equipment::cPaddle** player )
|
|
||||||
: cKey( key ), mpp_player(player)
|
|
||||||
{}
|
|
||||||
|
|
||||||
cPlayerDown::~cPlayerDown()
|
|
||||||
{}
|
|
||||||
|
|
||||||
///Funtions
|
|
||||||
void cPlayerDown::KeyPress()
|
|
||||||
{}
|
|
||||||
|
|
||||||
void cPlayerDown::KeyUP()
|
|
||||||
{
|
|
||||||
if (mpp_player != nullptr && *mpp_player != nullptr)
|
|
||||||
{
|
|
||||||
if ((*mpp_player)->getState() == Equipment::cPaddle::Down)
|
|
||||||
(*mpp_player)->setState(Equipment::cPaddle::Still);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void cPlayerDown::KeyDown()
|
|
||||||
{
|
|
||||||
if (mpp_player != nullptr && *mpp_player != nullptr)
|
|
||||||
(*mpp_player)->setState(Equipment::cPaddle::Down);
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<Layout layout="wrap_content">
|
|
||||||
<Label
|
|
||||||
text="Hello World2"
|
|
||||||
padding=""/>
|
|
||||||
<Label
|
|
||||||
text="Richard Allen2"/>
|
|
||||||
</Layout>
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
#ifndef _CCOLLISION_HPP_
|
|
||||||
#define _CCOLLISION_HPP_
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
/*** Custom Header File ***/
|
|
||||||
#include "Vector/Vector2.hpp"
|
|
||||||
#include "iVector/iVector2.hpp"
|
|
||||||
|
|
||||||
#include "Vector/Vector4.hpp"
|
|
||||||
#include "iVector/iVector4.hpp"
|
|
||||||
|
|
||||||
namespace MathEngine {
|
|
||||||
class EXPORT_FROM_MYDLL cCollision
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
cCollision();
|
|
||||||
~cCollision();
|
|
||||||
public:
|
|
||||||
///Functions
|
|
||||||
static const bool BoundingBox( const SDL_Rect& a, const SDL_Rect& b );
|
|
||||||
static const bool BoundingBox( const Vector4& a, const Vector4& b );
|
|
||||||
static const bool BoundingBox( const SDL_Rect& a, const Vector4& b );
|
|
||||||
static const bool BoundingBox( const Vector4& a, const SDL_Rect& b );
|
|
||||||
|
|
||||||
static const bool BoundingBox( const iVector4& a, const iVector4& b );
|
|
||||||
static const bool BoundingBox( const SDL_Rect& a, const iVector4& b );
|
|
||||||
static const bool BoundingBox( const iVector4& a, const SDL_Rect& b );
|
|
||||||
static const bool BoundingBox( const iVector4& a, const Vector4& b );
|
|
||||||
static const bool BoundingBox( const Vector4& a, const iVector4& b );
|
|
||||||
|
|
||||||
|
|
||||||
static const Vector2 Inside( const SDL_Rect& a, const SDL_Rect& b );
|
|
||||||
static const Vector2 Inside( const Vector4& a, const Vector4& b );
|
|
||||||
static const Vector2 Inside( const SDL_Rect& a, const Vector4& b );
|
|
||||||
static const Vector2 Inside( const Vector4& a, const SDL_Rect& b );
|
|
||||||
|
|
||||||
static const iVector2 Inside( const iVector4& a, const iVector4& b );
|
|
||||||
static const iVector2 Inside( const SDL_Rect& a, const iVector4& b );
|
|
||||||
static const iVector2 Inside( const iVector4& a, const SDL_Rect& b );
|
|
||||||
static const Vector2 Inside( const iVector4& a, const Vector4& b );
|
|
||||||
static const Vector2 Inside( const Vector4& a, const iVector4& b );
|
|
||||||
|
|
||||||
};/// END CLASS DEFINITION cCollision
|
|
||||||
}/// END NAMESPACE DEFINITION MathEngine
|
|
||||||
#endif/// END IFNDEF _CCOLLISION_HPP_
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
#ifndef _EOPTIONS_HPP_
|
|
||||||
#define _EOPTIONS_HPP_
|
|
||||||
|
|
||||||
/*** TrooperEngine DLL Header Files ***/
|
|
||||||
#include "TrooperEngine.hpp"
|
|
||||||
|
|
||||||
namespace MainMenu {
|
|
||||||
enum eOptions
|
|
||||||
{
|
|
||||||
Start,
|
|
||||||
Head,
|
|
||||||
Quit
|
|
||||||
};/// END ENUM DEFINITION eOptions
|
|
||||||
|
|
||||||
void operator++(eOptions& option);
|
|
||||||
void operator--(eOptions& option);
|
|
||||||
}/// END NAMESPACE DEFINITION MainMenu
|
|
||||||
#endif/// END IFNDEF _EOPTIONS_HPP_
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
#ifndef _CTEXT_HPP_
|
|
||||||
#define _CTEXT_HPP_
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL.h>
|
|
||||||
#include <SDL_ttf.h>
|
|
||||||
|
|
||||||
/*** VideoEngine ***/
|
|
||||||
#include "../VideoEngine/cImage.hpp"
|
|
||||||
|
|
||||||
/*** TextTypeEngine ***/
|
|
||||||
#include "cFont.hpp"
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../UtilityEngine/cString.hpp"
|
|
||||||
|
|
||||||
using UtilityEngine::cString;
|
|
||||||
|
|
||||||
namespace TextTypeEngine {
|
|
||||||
class EXPORT_FROM_MYDLL cText : public VideoEngine::cImage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum eRender: unsigned int
|
|
||||||
{
|
|
||||||
Solid = 0,
|
|
||||||
Shaded,
|
|
||||||
Blended
|
|
||||||
};
|
|
||||||
public:
|
|
||||||
cText( const cString& text, const unsigned long int size = 16 );
|
|
||||||
cText( SDL_Colour& colour, TextTypeEngine::cFont** font = nullptr, const cString& text = "", const unsigned long int size = 16, const eRender& render = eRender::Solid );
|
|
||||||
cText( TextTypeEngine::cFont** font = nullptr, const cString& text = "", const unsigned long int size = 16,
|
|
||||||
const unsigned long int red = 0, const unsigned long int green = 0, const unsigned long int blue = 0, const eRender& render = eRender::Solid );
|
|
||||||
cText( const cText& copy );
|
|
||||||
~cText();
|
|
||||||
|
|
||||||
|
|
||||||
///Function
|
|
||||||
|
|
||||||
/* Change the colour of the text to White */
|
|
||||||
void White();
|
|
||||||
/* Change the colour of the text to Black */
|
|
||||||
void Black();
|
|
||||||
/* Change the colour of the text to Blue */
|
|
||||||
void Blue();
|
|
||||||
/* Change the colour of the text to Green */
|
|
||||||
void Green();
|
|
||||||
/* Change the colour of the text to Red */
|
|
||||||
void Red();
|
|
||||||
|
|
||||||
///Sets
|
|
||||||
/* Sets the Size */
|
|
||||||
void setSize( const unsigned long int size = 16 );
|
|
||||||
void setFont( cFont** font );
|
|
||||||
/* Sets the text to be printed */
|
|
||||||
void setText( const cString& text );
|
|
||||||
/* Sets the colour of the text via SDL_Colour. */
|
|
||||||
void setColour( const SDL_Colour& colour );
|
|
||||||
/* Sets the colour of the text via RGB. Default is Black */
|
|
||||||
void setColour( const unsigned long int red = 0, const unsigned long int green = 0, const unsigned long int blue = 0, unsigned long int alpha = 255 );
|
|
||||||
/* Sets the render of the text. Default is Solid */
|
|
||||||
void setRender( const eRender& render = eRender::Solid );
|
|
||||||
|
|
||||||
///Gets
|
|
||||||
/* Gets the Size */
|
|
||||||
const unsigned long int getSize() const;
|
|
||||||
cFont* getFont() const;
|
|
||||||
/* Gets the text to be printed. */
|
|
||||||
const cString& getText() const;
|
|
||||||
/* Gets the SDL_Colour of the text */
|
|
||||||
const SDL_Colour& getColour() const;
|
|
||||||
/* Gets the RGB of the text. */
|
|
||||||
void getColour( unsigned long int& red, unsigned long int& green, unsigned long int& blue, unsigned long int& alpha ) const;
|
|
||||||
/* Gets the render of the text. */
|
|
||||||
const eRender& getRender() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void Text();
|
|
||||||
|
|
||||||
private:
|
|
||||||
TextTypeEngine::cFont** mpp_font;
|
|
||||||
cString m_text;// = ""
|
|
||||||
|
|
||||||
unsigned long int m_size;// = 16
|
|
||||||
SDL_Colour m_colour;// = nullptr
|
|
||||||
eRender m_render;// = Solid
|
|
||||||
};/// END CLASS DEFINITION cText
|
|
||||||
}/// END NAMESPACE DEFINITION TextTypeEngine
|
|
||||||
#endif/// END IFNDEF _CTEXT_HPP_
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#ifndef __STRINGTEST__
|
|
||||||
#define __STRINGTEST__
|
|
||||||
|
|
||||||
void StringTest();
|
|
||||||
|
|
||||||
#endif // __STRINGTEST__
|
|
||||||
@@ -1,151 +0,0 @@
|
|||||||
#include "cTrooperEngineCore.hpp"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../VideoEngine/cVideo.hpp"
|
|
||||||
#include "../AudioEngine/cAudio.hpp"
|
|
||||||
#include "../InputEngine/cInput.hpp"
|
|
||||||
|
|
||||||
#include "../TimingEngine/cTiming.hpp"
|
|
||||||
|
|
||||||
#include "../TextTypeEngine/cTextType.hpp"
|
|
||||||
|
|
||||||
#include "../MathEngine/cRandom.hpp"
|
|
||||||
|
|
||||||
#include "../EventEngine/cEvent.hpp"
|
|
||||||
|
|
||||||
#include "../UtilityEngine/cUtility.hpp"
|
|
||||||
|
|
||||||
#include "../GUIEngine/cGUI.hpp"
|
|
||||||
|
|
||||||
using TrooperEngineCore::cTrooperEngineCore;
|
|
||||||
|
|
||||||
/*static*/ cTrooperEngineCore* cTrooperEngineCore::sp_inst = nullptr;
|
|
||||||
|
|
||||||
cTrooperEngineCore::cTrooperEngineCore()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
cTrooperEngineCore::~cTrooperEngineCore()
|
|
||||||
{
|
|
||||||
CleanUp();
|
|
||||||
VideoEngine::cVideo::Delete();
|
|
||||||
AudioEngine::cAudio::Delete();
|
|
||||||
InputEngine::cInput::Delete();
|
|
||||||
TimingEngine::cTiming::Delete();
|
|
||||||
|
|
||||||
TextTypeEngine::cTextType::Delete();
|
|
||||||
MathEngine::cRandom::Delete();
|
|
||||||
EventEngine::cEvent::Delete();
|
|
||||||
SDL_Quit();
|
|
||||||
UtilityEngine::cUtility::Inst().Message("SDL shut down!");
|
|
||||||
UtilityEngine::cUtility::Delete();
|
|
||||||
|
|
||||||
GUIEngine::cGUI::Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
/*static*/ const char* cTrooperEngineCore::Version()
|
|
||||||
{
|
|
||||||
return __TROOPERENGINE__VERSION;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*static*/ cTrooperEngineCore& cTrooperEngineCore::Inst()
|
|
||||||
{
|
|
||||||
if (sp_inst == nullptr)
|
|
||||||
sp_inst = new cTrooperEngineCore();
|
|
||||||
return *sp_inst;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*static*/ void cTrooperEngineCore::Delete()
|
|
||||||
{
|
|
||||||
delete sp_inst;
|
|
||||||
sp_inst = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cTrooperEngineCore::VideoInit()
|
|
||||||
{
|
|
||||||
return VideoEngine::cVideo::Inst().Initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cTrooperEngineCore::AudioInit()
|
|
||||||
{
|
|
||||||
return AudioEngine::cAudio::Inst().Initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cTrooperEngineCore::InputInit()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cTrooperEngineCore::JoystickInit()
|
|
||||||
{
|
|
||||||
return InputEngine::cInput::Inst().Initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cTrooperEngineCore::TimerInit()
|
|
||||||
{
|
|
||||||
return TimingEngine::cTiming::Inst().Initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cTrooperEngineCore::TextTypeInit()
|
|
||||||
{
|
|
||||||
return TextTypeEngine::cTextType::Inst().Initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cTrooperEngineCore::EventInit()
|
|
||||||
{
|
|
||||||
return EventEngine::cEvent::Inst().Initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Print lib versions */
|
|
||||||
void cTrooperEngineCore::PrintSDLVersion() const
|
|
||||||
{
|
|
||||||
UtilityEngine::cUtility::Inst().PrintVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cTrooperEngineCore::CleanUp()
|
|
||||||
{
|
|
||||||
VideoEngine::cVideo::Inst().CleanUp();
|
|
||||||
AudioEngine::cAudio::Inst().CleanUp();
|
|
||||||
TimingEngine::cTiming::Inst().CleanUp();
|
|
||||||
TextTypeEngine::cTextType::Inst().CleanUp();
|
|
||||||
InputEngine::cInput::Inst().CleanUp();
|
|
||||||
EventEngine::cEvent::Inst().CleanUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
///Gets
|
|
||||||
const bool cTrooperEngineCore::getVideo() const
|
|
||||||
{
|
|
||||||
return VideoEngine::cVideo::Inst().IsInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cTrooperEngineCore::getAudio() const
|
|
||||||
{
|
|
||||||
return AudioEngine::cAudio::Inst().IsInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cTrooperEngineCore::getInput() const
|
|
||||||
{
|
|
||||||
return InputEngine::cInput::Inst().IsInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cTrooperEngineCore::getJoystick() const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cTrooperEngineCore::getTimer() const
|
|
||||||
{
|
|
||||||
return TimingEngine::cTiming::Inst().IsInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cTrooperEngineCore::getText() const
|
|
||||||
{
|
|
||||||
return TextTypeEngine::cTextType::Inst().IsInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cTrooperEngineCore::getEvent() const
|
|
||||||
{
|
|
||||||
return EventEngine::cEvent::Inst().IsInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
#ifndef _CESC_HPP_
|
|
||||||
#define _CESC_HPP_
|
|
||||||
|
|
||||||
/*** TrooperEngine DLL Header Files ***/
|
|
||||||
#include "TrooperEngine.hpp"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../cMainMenu.hpp"
|
|
||||||
|
|
||||||
namespace Input {
|
|
||||||
class cEsc : public InputEngine::cKey
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cEsc( SDL_Keycode key, MainMenu::cMainMenu** menu );
|
|
||||||
//cMenuUp( const cMenuUp& copy );
|
|
||||||
~cEsc();
|
|
||||||
|
|
||||||
///Funtions
|
|
||||||
/* Call if the key is pressed */
|
|
||||||
void KeyPress();
|
|
||||||
/* Call if the key is up */
|
|
||||||
void KeyUP();
|
|
||||||
/* Call if the key is down */
|
|
||||||
void KeyDown();
|
|
||||||
|
|
||||||
private:
|
|
||||||
private:
|
|
||||||
MainMenu::cMainMenu** mpp_menu;
|
|
||||||
};/// END CLASS DEFINITION cEsc
|
|
||||||
}/// END NAMESPACE DEFINITION Input
|
|
||||||
#endif/// END IFNDEF _CESC_HPP_
|
|
||||||
@@ -1,193 +0,0 @@
|
|||||||
#include "cGUI.hpp"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../VideoEngine/cVideo.hpp"
|
|
||||||
|
|
||||||
#include "../UtilityEngine/cUtility.hpp"
|
|
||||||
#include "GUIHelpers/Enums.hpp"
|
|
||||||
#include "cButton.hpp"
|
|
||||||
|
|
||||||
#include "GUIHelpers/cXMLoader.hpp"
|
|
||||||
|
|
||||||
using GUIEngine::cGUI;
|
|
||||||
using GUIEngine::cWindow;
|
|
||||||
using UtilityEngine::cUtility;
|
|
||||||
|
|
||||||
/*static*/ cGUI* cGUI::sp_inst = nullptr;
|
|
||||||
|
|
||||||
//private
|
|
||||||
cGUI::cGUI()
|
|
||||||
: mp_font(nullptr), m_inited(false)
|
|
||||||
{
|
|
||||||
setTextColour();
|
|
||||||
setPadding();
|
|
||||||
}
|
|
||||||
|
|
||||||
cGUI::~cGUI()
|
|
||||||
{
|
|
||||||
delete mp_font;
|
|
||||||
mp_font = nullptr;
|
|
||||||
|
|
||||||
m_guiObjects.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
//public:
|
|
||||||
///Functions
|
|
||||||
/*static*/ cGUI& cGUI::Inst()
|
|
||||||
{
|
|
||||||
if (sp_inst == nullptr)
|
|
||||||
sp_inst = new cGUI();
|
|
||||||
return *sp_inst;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*static*/ void cGUI::Delete()
|
|
||||||
{
|
|
||||||
delete sp_inst;
|
|
||||||
sp_inst = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cGUI::Initialize( const cString& filename, const cString& dir /*= ""*/, const unsigned long int size /*= 16*/ )
|
|
||||||
{
|
|
||||||
bool rtn = IsInit();
|
|
||||||
|
|
||||||
GUIHelpers::cXMLoader::Inst().Load(filename, dir);
|
|
||||||
// if (rtn == false) {
|
|
||||||
// setFont( filename, dir, size );
|
|
||||||
// cUtility::Inst().Message("GUI initialized.");
|
|
||||||
// }
|
|
||||||
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGUI::Event(const MathEngine::iVector2& location, const eGUIEventType& type)
|
|
||||||
{
|
|
||||||
location;
|
|
||||||
type;
|
|
||||||
// std::vector<GUIHelpers::cObject*>::iterator it;
|
|
||||||
//
|
|
||||||
// for (it = m_objects.begin(); it < m_objects.end(); it++) {
|
|
||||||
// switch ((*it)->getType()) {
|
|
||||||
// case GUIHelpers::eType::CBUTTON:
|
|
||||||
// cButton* tmp = (cButton*)(*it);
|
|
||||||
// if (tmp->InSide(location) == true)
|
|
||||||
// cUtility::Inst().Message("Button Inside!");
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
const MathEngine::iVector2 cGUI::DisplayArea() const
|
|
||||||
{
|
|
||||||
MathEngine::iVector2 rtn = { 0, 0 };
|
|
||||||
rtn.x = VideoEngine::cVideo::Inst().getWidth();
|
|
||||||
rtn.y = VideoEngine::cVideo::Inst().getHeight();
|
|
||||||
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGUI::AddObject(cWindow* obj)
|
|
||||||
{
|
|
||||||
//this->m_obj = obj;
|
|
||||||
m_guiObjects.push_back(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGUI::Display()
|
|
||||||
{
|
|
||||||
//m_obj->Display();
|
|
||||||
std::vector<cWindow*>::iterator it;
|
|
||||||
|
|
||||||
for (it = m_guiObjects.begin(); it < m_guiObjects.end(); it++) {
|
|
||||||
(*it)->Display();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///Sets
|
|
||||||
void cGUI::setFont( TextTypeEngine::cFont* font )
|
|
||||||
{
|
|
||||||
delete mp_font;
|
|
||||||
mp_font = nullptr;
|
|
||||||
|
|
||||||
mp_font = font;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGUI::setFont( const cString& filename, const cString& dir /*= ""*/, const unsigned long int size /*= 16*/)
|
|
||||||
{
|
|
||||||
delete mp_font;
|
|
||||||
mp_font = nullptr;
|
|
||||||
|
|
||||||
mp_font = new TextTypeEngine::cFont( dir, filename, size );
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGUI::setTextColour( const GUIHelpers::RGBA& colour )
|
|
||||||
{
|
|
||||||
cWindow::sCOLOUR = colour;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGUI::setTextColour( const unsigned long int red /*= 0*/, const unsigned long int green /*= 0*/, const unsigned long int blue /*= 0*/ )
|
|
||||||
{
|
|
||||||
GUIHelpers::RGBA colour = {Uint8(red), Uint8(green), Uint8(blue)};
|
|
||||||
setTextColour(colour);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGUI::setPadding( const GUIHelpers::Padding& padding )
|
|
||||||
{
|
|
||||||
cWindow::sPADDING = padding;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGUI::setPadding( const unsigned int top /*= 5*/, const unsigned int right /*= 5*/, const unsigned int bottom /*= 5*/, const unsigned int left /*= 5*/ )
|
|
||||||
{
|
|
||||||
setPadding(GUIHelpers::Padding(top, right, bottom, left));
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGUI::setAlign( const GUIHelpers::eAlign& align /*= GUIHelpers::eAlign::CENTER*/ )
|
|
||||||
{
|
|
||||||
cWindow::sALIGN = align;
|
|
||||||
}
|
|
||||||
|
|
||||||
///Gets
|
|
||||||
TextTypeEngine::cFont* cGUI::getFont()
|
|
||||||
{
|
|
||||||
return mp_font;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GUIHelpers::RGBA& cGUI::getTextColour() const
|
|
||||||
{
|
|
||||||
return cWindow::sCOLOUR;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGUI::getTextColour( unsigned long int& red, unsigned long int& green, unsigned long int& blue ) const
|
|
||||||
{
|
|
||||||
red = cWindow::sCOLOUR.r;
|
|
||||||
green = cWindow::sCOLOUR.g;
|
|
||||||
blue = cWindow::sCOLOUR.b;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GUIHelpers::Padding& cGUI::getPadding() const
|
|
||||||
{
|
|
||||||
return cWindow::sPADDING;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGUI::getPadding( unsigned int& top, unsigned int& right, unsigned int& bottom, unsigned int& left ) const
|
|
||||||
{
|
|
||||||
top = cWindow::sPADDING.x;
|
|
||||||
right = cWindow::sPADDING.y;
|
|
||||||
bottom = cWindow::sPADDING.z;
|
|
||||||
left = cWindow::sPADDING.w;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GUIHelpers::eAlign& cGUI::getAlign() const
|
|
||||||
{
|
|
||||||
return cWindow::sALIGN;
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cGUI::IsInit() const
|
|
||||||
{
|
|
||||||
bool rtn = m_inited;
|
|
||||||
|
|
||||||
if (rtn == true)
|
|
||||||
cUtility::Inst().Message("GUI is initialized.");
|
|
||||||
else
|
|
||||||
cUtility::Inst().Message("GUI is not initialized.");
|
|
||||||
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
#ifndef _CSPRITE_HPP_
|
|
||||||
#define _CSPRITE_HPP_
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "cImage.hpp"
|
|
||||||
#include "cCamera.hpp"
|
|
||||||
|
|
||||||
#include "../TextTypeEngine/cText.hpp"
|
|
||||||
#include "../MathEngine/iVector/iVector2.hpp"
|
|
||||||
#include "../MathEngine/iVector/iVector4.hpp"
|
|
||||||
|
|
||||||
#include "../UtilityEngine/cString.hpp"
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
using UtilityEngine::cString;
|
|
||||||
|
|
||||||
namespace VideoEngine {
|
|
||||||
class EXPORT_FROM_MYDLL cSprite
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cSprite( VideoEngine::cImage** image, VideoEngine::cCamera** camera = nullptr );
|
|
||||||
cSprite( const signed long int xpos = 0, const signed long int ypos = 0, const signed long int xarea = 0,
|
|
||||||
const signed long int yarea = 0, const unsigned long int warea = 0, const unsigned long int harea = 0,
|
|
||||||
VideoEngine::cImage** image = nullptr, VideoEngine::cCamera** camera = nullptr );
|
|
||||||
|
|
||||||
cSprite& operator=( const cSprite& copy );
|
|
||||||
~cSprite();
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
/* Draws the sprite to the video buffer */
|
|
||||||
void Draw();
|
|
||||||
/* Draws the sprite to the camera */
|
|
||||||
void CameraDraw();
|
|
||||||
/* Draws the sprite to a SDL_Renderer */
|
|
||||||
/*void RendererDraw( SDL_Renderer* rend );*/
|
|
||||||
/* Draws the sprite to the video buffer with out positioning it */
|
|
||||||
void DefaltDraw();
|
|
||||||
|
|
||||||
void AddPosX( const signed long int x );
|
|
||||||
void AddPosY( const signed long int y );
|
|
||||||
|
|
||||||
void SaveImage( const cString& fileName, const cString& dir = "" );
|
|
||||||
|
|
||||||
///Sets
|
|
||||||
/* Sets the X position of the sprite on the surface, camera or video buffer */
|
|
||||||
void setPosX( const signed long int x );
|
|
||||||
/* Sets the Y position of the sprite on the surface, camera or video buffer */
|
|
||||||
void setPosY( const signed long int y );
|
|
||||||
/* Sets the position of the sprite on the surface, camera or video buffer */
|
|
||||||
void setPosition( const signed long int x, const signed long int y );
|
|
||||||
/* Sets the position of the sprite on the surface, camera or video buffer */
|
|
||||||
void setPosition( const MathEngine::iVector2& position = MathEngine::iVector2(0,0) );
|
|
||||||
|
|
||||||
/* Sets the start and end of the image area */
|
|
||||||
void setImageArea( const MathEngine::iVector4& area = MathEngine::iVector4(0,0,0,0) );
|
|
||||||
/* Sets the top left of the area to take from the image */
|
|
||||||
void setStartImageArea( const signed long int x, const signed long int y ); /// Top left starting area.
|
|
||||||
/* Sets the bottom right of the area to take from the image */
|
|
||||||
void setEndImageArea( const unsigned long int w, const unsigned long int h ); /// Bottom right image ends.
|
|
||||||
|
|
||||||
/* Sets the pointer to a pointer for the image that the sprite will use */
|
|
||||||
void setImage( VideoEngine::cImage** image );
|
|
||||||
/* Sets the pointer to a pointer for the camera the sprite will be draw on */
|
|
||||||
void setCamera( VideoEngine::cCamera** camera );
|
|
||||||
|
|
||||||
///Gets
|
|
||||||
/* Gets the X position of the sprite on the surface, camera or video buffer */
|
|
||||||
const signed long int getPosX() const;
|
|
||||||
/* Gets the Y position of the sprite on the surface, camera of video buffer */
|
|
||||||
const signed long int getPosY() const;
|
|
||||||
/* Gets the position of the sprite on the surface, camera or video buffer */
|
|
||||||
void getPosition( signed long int& x, signed long int& y ) const;
|
|
||||||
/* Gets the position of the sprite on the surface, camera or video buffer */
|
|
||||||
const MathEngine::iVector4 getPosition() const;
|
|
||||||
|
|
||||||
/* Gets the top left of the area to take from the image */
|
|
||||||
void getStartImageArea( signed long int& x, signed long int& y ) const;
|
|
||||||
/* Gets the bottom right of the area to take from the image */
|
|
||||||
void getEndImageArea( unsigned long int& w, unsigned long int& h ) const;
|
|
||||||
/* Gets the area of the image */
|
|
||||||
const SDL_Rect& getImageArea() const;
|
|
||||||
|
|
||||||
/* Gets the width of the sprite */
|
|
||||||
const unsigned long int getWidth() const;
|
|
||||||
/* Gets the height of the sprite */
|
|
||||||
const unsigned long int getHeight() const;
|
|
||||||
|
|
||||||
/* Gets a pointer to the image used by the sprite */
|
|
||||||
VideoEngine::cImage* getImage() const;
|
|
||||||
/* Gets a pointer to the camera used by the sprite */
|
|
||||||
VideoEngine::cCamera* getCamera() const;
|
|
||||||
|
|
||||||
/* Gets returns true if image pointer is not null other wise returns false */
|
|
||||||
const bool getImageSetup() const;
|
|
||||||
/* Gets returns true if camera pointer is not null other wise returns false */
|
|
||||||
const bool getCameraSetup() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void setPositionEnd();
|
|
||||||
|
|
||||||
private:
|
|
||||||
///Variables
|
|
||||||
SDL_Rect m_position; /// Were the Sprite will be position on the screen (Upper Left)
|
|
||||||
|
|
||||||
SDL_Rect m_imageArea; /// What part of the image to take
|
|
||||||
|
|
||||||
VideoEngine::cImage** mpp_image;// = nullptr
|
|
||||||
VideoEngine::cCamera** mpp_camera;// = nullptr
|
|
||||||
};/// END CLASS DEFINITION cSprite
|
|
||||||
}/// END NAMESPACE DEFINITION VideoEngine
|
|
||||||
#endif/// END IFNDEF _CSPRITE_HPP_
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
#ifndef _CAUDIO_HPP_
|
|
||||||
#define _CAUDIO_HPP_
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL.h>
|
|
||||||
#include <SDL_mixer.h>
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
namespace AudioEngine {
|
|
||||||
/* Singleton */
|
|
||||||
class EXPORT_FROM_MYDLL cAudio
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
cAudio();
|
|
||||||
~cAudio();
|
|
||||||
|
|
||||||
public:
|
|
||||||
//Functions
|
|
||||||
static cAudio& Inst();
|
|
||||||
static void Delete();
|
|
||||||
|
|
||||||
const bool Initialize() const;
|
|
||||||
|
|
||||||
/* Sets up the audio */
|
|
||||||
void Setup();
|
|
||||||
/* Cleans up */
|
|
||||||
void CleanUp();
|
|
||||||
|
|
||||||
/* Plays the sounds */
|
|
||||||
void SoundPlay();
|
|
||||||
/* Plays the music */
|
|
||||||
void MusicPlay();
|
|
||||||
|
|
||||||
|
|
||||||
///Set
|
|
||||||
/* Sets the rate */
|
|
||||||
void setRate( const unsigned long int rate = 22050 );
|
|
||||||
/* Sets the audio format */
|
|
||||||
void setFormat( const unsigned long int format = AUDIO_S16 );
|
|
||||||
/* Sets the channels */
|
|
||||||
void setChannels( const unsigned long int channels = 2 );
|
|
||||||
|
|
||||||
/* Sets the buffer */
|
|
||||||
void setBuffers( const unsigned long int buffers = 4096 );
|
|
||||||
|
|
||||||
///Get
|
|
||||||
/* Gets return true if Audio was initialized */
|
|
||||||
const bool IsInit() const;
|
|
||||||
/* Gets the rate */
|
|
||||||
const unsigned long int getRate() const;
|
|
||||||
/* Gets the format */
|
|
||||||
const unsigned long int getFormat() const;
|
|
||||||
/* Gets the channels */
|
|
||||||
const unsigned long int getChannels() const;
|
|
||||||
|
|
||||||
/* Gets the buffers */
|
|
||||||
const unsigned long int getBuffers() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
private:
|
|
||||||
///Variables
|
|
||||||
unsigned long int m_rate;// = 22050;
|
|
||||||
unsigned long int m_format;// = AUDIO_S16;
|
|
||||||
unsigned long int m_channels;// = 2;
|
|
||||||
unsigned long int m_buffers;// = 4096;
|
|
||||||
|
|
||||||
static cAudio* sp_inst;// = nullptr;
|
|
||||||
};/// END CLASS DEFINITION cAudio
|
|
||||||
}/// END NAMESPACE DEFINITION AudioEngine
|
|
||||||
#endif/// END IFNDEF _CAUDIO_HPP_
|
|
||||||
@@ -1,274 +0,0 @@
|
|||||||
#include "cRenderer.hpp"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "cVideo.hpp"
|
|
||||||
#include "../UtilityEngine/cUtility.hpp"
|
|
||||||
|
|
||||||
using VideoEngine::cRenderer;
|
|
||||||
using VideoEngine::cVideo;
|
|
||||||
using UtilityEngine::cUtility;
|
|
||||||
|
|
||||||
/*static*/ cRenderer* cRenderer::sp_inst = nullptr;
|
|
||||||
|
|
||||||
//private:
|
|
||||||
cRenderer::cRenderer()
|
|
||||||
{
|
|
||||||
Setup();
|
|
||||||
}
|
|
||||||
|
|
||||||
cRenderer::~cRenderer()
|
|
||||||
{
|
|
||||||
CleanUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
//public:
|
|
||||||
///Functions
|
|
||||||
/*static*/ cRenderer& cRenderer::Inst()
|
|
||||||
{
|
|
||||||
if (sp_inst == nullptr)
|
|
||||||
sp_inst = new cRenderer();
|
|
||||||
return *sp_inst;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*static*/ void cRenderer::Delete()
|
|
||||||
{
|
|
||||||
delete sp_inst;
|
|
||||||
sp_inst = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cRenderer::Setup()
|
|
||||||
{
|
|
||||||
bool rtn = false;
|
|
||||||
if (cVideo::Inst().IsInit() == false)
|
|
||||||
cUtility::Inst().Message("Unable to setup until SDL_Video is initialized.");
|
|
||||||
else {
|
|
||||||
mp_renderer = cVideo::Inst().CreateRender();
|
|
||||||
if (mp_renderer != nullptr)
|
|
||||||
rtn = true;
|
|
||||||
}
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cRenderer::CleanUp()
|
|
||||||
{
|
|
||||||
SDL_DestroyRenderer(mp_renderer);
|
|
||||||
mp_renderer = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cRenderer::Render( SDL_Texture* texture, SDL_Rect* srcrect, SDL_Rect* dstrect )
|
|
||||||
{
|
|
||||||
cRenderer::Render(texture, srcrect, mp_renderer, dstrect);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cRenderer::Render( SDL_Surface* surface, SDL_Rect* srcrect, SDL_Rect* dstrect )
|
|
||||||
{
|
|
||||||
SDL_Texture* texture = SurfaceToTexture(surface);
|
|
||||||
Render( texture, srcrect, dstrect );
|
|
||||||
SDL_DestroyTexture(texture);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cRenderer::Render( SDL_Surface* src, const SDL_Rect* srcrect, SDL_Surface* dst, SDL_Rect* dstrect )
|
|
||||||
{
|
|
||||||
if (SDL_BlitSurface(src, srcrect, dst, dstrect) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to BlitSurface. SDL_BlitSurface():", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cRenderer::Render( SDL_Texture* src, const SDL_Rect* srcrect, SDL_Surface* dst, SDL_Rect* dstrect )
|
|
||||||
{
|
|
||||||
src;
|
|
||||||
srcrect;
|
|
||||||
dst;
|
|
||||||
dstrect;
|
|
||||||
//???????
|
|
||||||
}
|
|
||||||
|
|
||||||
void cRenderer::Render( SDL_Texture* src, const SDL_Rect* srcrect, SDL_Renderer* dst, SDL_Rect* dstrect )
|
|
||||||
{
|
|
||||||
if (SDL_RenderCopy(dst, src, srcrect, dstrect) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to copy Texture to Renderer. SDL_RenderCopy():", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cRenderer::RenderToTexture( SDL_Texture* src, SDL_Rect* srcrect, SDL_Texture* dst, SDL_Rect* dstrect )
|
|
||||||
{
|
|
||||||
SetRenderTarget(dst);
|
|
||||||
Render( src, srcrect, dstrect );
|
|
||||||
ResetRenderTarget();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cRenderer::RenderDrawColor( const SDL_Colour& colour )
|
|
||||||
{
|
|
||||||
if (SDL_SetRenderDrawColor(mp_renderer, colour.r, colour.g, colour.b, colour.a) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to set render draw colour. SDL_SetRenderDrawColor():", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cRenderer::RenderDrawRect( const SDL_Rect& rect, SDL_Texture* dst /*= nullptr */ )
|
|
||||||
{
|
|
||||||
SetRenderTarget(dst);
|
|
||||||
if (SDL_RenderFillRect(mp_renderer, &rect) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to draw rectangle. SDL_RenderFillRect():", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
ResetRenderTarget();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cRenderer::ScreenShot( const cString& filename, const cString& dir /*= ""*/ )
|
|
||||||
{
|
|
||||||
SDL_Surface* infoSurface = SDL_GetWindowSurface(VideoEngine::cVideo::Inst().getWindow());
|
|
||||||
SDL_Surface* saveSurface = NewSurface();
|
|
||||||
|
|
||||||
if (infoSurface == NULL) {
|
|
||||||
cUtility::Inst().Message("Failed to create info surface from window.\n", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
} else {
|
|
||||||
if (SDL_RenderReadPixels(mp_renderer, &infoSurface->clip_rect, infoSurface->format->format, saveSurface->pixels, infoSurface->w * infoSurface->format->BytesPerPixel) != 0)
|
|
||||||
cUtility::Inst().Message("Failed to read pixel data from SDL_Renderer object.\n", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
else
|
|
||||||
SaveSurface(saveSurface, filename, dir);
|
|
||||||
SDL_FreeSurface(infoSurface);
|
|
||||||
infoSurface = NULL;
|
|
||||||
}
|
|
||||||
SDL_FreeSurface(saveSurface);
|
|
||||||
saveSurface = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void cRenderer::SaveSurface( SDL_Surface* surface, const cString& fileName, const cString& dir /*= ""*/ )
|
|
||||||
{
|
|
||||||
cString temp = dir + fileName;
|
|
||||||
if (SDL_SaveBMP(surface, temp.c_str()) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to save Surface. SDL_SaveBMP()", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cRenderer::SaveTexture( SDL_Texture* texture, const cString& fileName, const cString& dir /*= ""*/ )
|
|
||||||
{
|
|
||||||
SDL_Surface* surface = TextureToSurface(texture);
|
|
||||||
|
|
||||||
if (surface != nullptr)
|
|
||||||
SaveSurface(surface, fileName, dir);
|
|
||||||
else
|
|
||||||
cUtility::Inst().Message("Unable to create Surface from Texture. TextureToSurface():", __AT__);
|
|
||||||
|
|
||||||
SDL_FreeSurface(surface);
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_Texture* cRenderer::SurfaceToTexture( SDL_Surface* surface )
|
|
||||||
{
|
|
||||||
SDL_Texture* rtn = nullptr;
|
|
||||||
rtn = SDL_CreateTextureFromSurface( mp_renderer, surface );
|
|
||||||
if ( rtn == nullptr)
|
|
||||||
cUtility::Inst().Message("Unable to create Texture. SDL_CreateTextureFromSurface():", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_Surface* cRenderer::TextureToSurface( SDL_Texture* texture )
|
|
||||||
{
|
|
||||||
SDL_Surface* rtn = nullptr;
|
|
||||||
|
|
||||||
int w = 0;
|
|
||||||
int h = 0;
|
|
||||||
|
|
||||||
if (SDL_QueryTexture(texture, nullptr, nullptr, &w, &h) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to Query Texture. SDL_QueryTexture():", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
|
|
||||||
rtn = NewSurface(w, h);
|
|
||||||
|
|
||||||
void* srcPixels = nullptr;
|
|
||||||
int srcPitch = 0;
|
|
||||||
|
|
||||||
//Lock texture for manipulation
|
|
||||||
if (SDL_LockTexture( texture, nullptr, &srcPixels, &srcPitch ) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to lock texture. SDL_LockTexture():", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
|
|
||||||
if (SDL_LockSurface(rtn))
|
|
||||||
cUtility::Inst().Message("Unable to lock surface rtn. SDL_LockSurface():", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
|
|
||||||
//Copy loaded/formatted surface pixels
|
|
||||||
memcpy( rtn->pixels, srcPixels, srcPitch * h );
|
|
||||||
|
|
||||||
//Unlock texture to update
|
|
||||||
SDL_UnlockSurface(rtn);
|
|
||||||
SDL_UnlockTexture( texture );
|
|
||||||
|
|
||||||
srcPixels = nullptr;
|
|
||||||
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cRenderer::CopyTexture( SDL_Texture* src, SDL_Texture* dst )
|
|
||||||
{
|
|
||||||
void* srcPixels = nullptr;
|
|
||||||
int srcPitch = 0;
|
|
||||||
|
|
||||||
void* dstPixels = nullptr;
|
|
||||||
int dstPitch = 0;
|
|
||||||
|
|
||||||
int height = 0;
|
|
||||||
|
|
||||||
if (SDL_QueryTexture( src, nullptr, nullptr, nullptr, &height ) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to query texture. SDL_QueryTexture():", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
|
|
||||||
//Lock texture for manipulation
|
|
||||||
if (SDL_LockTexture( src, nullptr, &srcPixels, &srcPitch ) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to lock texture src. SDL_LockTexture():", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
|
|
||||||
if (SDL_LockTexture( dst, nullptr, &dstPixels, &dstPitch ) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to lock texture dst. SDL_LockTexture():", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
|
|
||||||
//Copy loaded/formatted surface pixels
|
|
||||||
memcpy( dstPixels, srcPixels, srcPitch * height );
|
|
||||||
|
|
||||||
//Unlock texture to update
|
|
||||||
SDL_UnlockTexture( dst );
|
|
||||||
SDL_UnlockTexture( src );
|
|
||||||
srcPixels = nullptr;
|
|
||||||
dstPixels = nullptr;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_Surface* cRenderer::CopySurface( SDL_Surface* src )
|
|
||||||
{
|
|
||||||
return SDL_ConvertSurface( src, src->format, src->flags );
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_Surface* cRenderer::NewSurface( long int width /*= -1*/, long int height /*= -1*/ ) const
|
|
||||||
{
|
|
||||||
if (width < 0)
|
|
||||||
width = cVideo::Inst().getWidth();
|
|
||||||
if (height < 0)
|
|
||||||
height = cVideo::Inst().getHeight();
|
|
||||||
|
|
||||||
SDL_Surface* rtn = SDL_CreateRGBSurface(cVideo::Inst().getVideoSettings(), width, height, cVideo::Inst().getColour(), cVideo::Inst().getRmask(), cVideo::Inst().getGmask(), cVideo::Inst().getBmask(), cVideo::Inst().getAmask());
|
|
||||||
|
|
||||||
if (rtn == nullptr)
|
|
||||||
cUtility::Inst().Message("Unable to create surface. SDL_CreateRGBSurface():", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_Texture* cRenderer::NewTexture( long int width, long int height, const unsigned long int access /*= SDL_TEXTUREACCESS_TARGET*/ ) const
|
|
||||||
{
|
|
||||||
if (width < 0)
|
|
||||||
width = cVideo::Inst().getWidth();
|
|
||||||
if (height < 0)
|
|
||||||
height = cVideo::Inst().getHeight();
|
|
||||||
|
|
||||||
SDL_Texture* rtn = SDL_CreateTexture(mp_renderer, SDL_PIXELFORMAT_ABGR8888, access, width, height);
|
|
||||||
if (rtn == nullptr)
|
|
||||||
cUtility::Inst().Message("Unable to create texture. SDL_CreateTexture:", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cRenderer::SetRenderTarget( SDL_Texture* target /*= nullptr*/ )
|
|
||||||
{
|
|
||||||
if (SDL_SetRenderTarget(mp_renderer, target) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to set render target to dst. SDL_SetRenderTarget():", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cRenderer::ResetRenderTarget()
|
|
||||||
{
|
|
||||||
if (SDL_SetRenderTarget(mp_renderer, nullptr) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to set render target to mp_rend. SDL_SetRenderTarget():", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_Renderer* cRenderer::getRenderer()
|
|
||||||
{
|
|
||||||
return mp_renderer;
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup>
|
|
||||||
<Filter Include="UTest">
|
|
||||||
<UniqueIdentifier>{549e0f16-9635-455e-b19a-4a887771cf5d}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="VideoEngineTest">
|
|
||||||
<UniqueIdentifier>{50a06b19-0711-478a-a15e-df325d10bebc}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="UtitlityEngineTest">
|
|
||||||
<UniqueIdentifier>{3305ea52-bd3f-4a02-a012-eb2923a77dbf}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="xml">
|
|
||||||
<UniqueIdentifier>{510356f7-3573-4526-b0a4-73d691ecba95}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="UTest\UTest.hpp">
|
|
||||||
<Filter>UTest</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="UtilityEngineTest\StringTest.hpp">
|
|
||||||
<Filter>UtitlityEngineTest</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="UTest\UTest.cpp">
|
|
||||||
<Filter>UTest</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="main.cpp" />
|
|
||||||
<ClCompile Include="UtilityEngineTest\StringTest.cpp">
|
|
||||||
<Filter>UtitlityEngineTest</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Xml Include="xml\GUI.xml">
|
|
||||||
<Filter>xml</Filter>
|
|
||||||
</Xml>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,121 +0,0 @@
|
|||||||
#include "cFont.hpp"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../UtilityEngine/cUtility.hpp"
|
|
||||||
|
|
||||||
using TextTypeEngine::cFont;
|
|
||||||
using TextTypeHelpers::cFontHolder;
|
|
||||||
using UtilityEngine::cUtility;
|
|
||||||
|
|
||||||
cFont::cFont( const cString& filename /*= ""*/, const cString& dir /*= ""*/, const unsigned long int size /*= 16*/ )
|
|
||||||
: m_dir(dir), m_fileName(filename), mpp_default(nullptr)
|
|
||||||
{
|
|
||||||
setSize(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
cFont::cFont( const cFont& copy )
|
|
||||||
: m_dir(copy.getDir()), m_fileName(copy.getFileName()), mpp_default(nullptr)
|
|
||||||
{
|
|
||||||
setSize(copy.getSize());
|
|
||||||
}
|
|
||||||
|
|
||||||
cFont::~cFont()
|
|
||||||
{
|
|
||||||
UnloadFont();
|
|
||||||
}
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
///Sets
|
|
||||||
void cFont::setDir( const cString& dir )
|
|
||||||
{
|
|
||||||
m_dir = dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cFont::setFileName( const cString& filename )
|
|
||||||
{
|
|
||||||
m_fileName = filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cFont::setFileNameandDir( const cString& filename, const cString& dir /*= ""*/ )
|
|
||||||
{
|
|
||||||
setDir(dir);
|
|
||||||
setFileName(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cFont::setSize( const unsigned long int size /*= 16*/ )
|
|
||||||
{
|
|
||||||
while ((mpp_default == nullptr) || ((*mpp_default) == nullptr)) {
|
|
||||||
getFont(size);
|
|
||||||
mpp_default = (cFontHolder**)getFontHolder(size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///Gets
|
|
||||||
const cString& cFont::getDir() const
|
|
||||||
{
|
|
||||||
return m_dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
const cString& cFont::getFileName() const
|
|
||||||
{
|
|
||||||
return m_fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
const unsigned long int cFont::getSize() const
|
|
||||||
{
|
|
||||||
return (*mpp_default)->getSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
TTF_Font* cFont::getFont()
|
|
||||||
{
|
|
||||||
return (*mpp_default)->getFont();
|
|
||||||
}
|
|
||||||
|
|
||||||
TTF_Font* cFont::getFont( const unsigned long int size )
|
|
||||||
{
|
|
||||||
TTF_Font* rtn = nullptr;
|
|
||||||
|
|
||||||
rtn = getFontHolder(size)->getFont();
|
|
||||||
//We Can't find the Font in that size so we make a new one
|
|
||||||
if (rtn == nullptr) {
|
|
||||||
rtn = LoadFont(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
//private:
|
|
||||||
TTF_Font* cFont::LoadFont( const unsigned long int size )
|
|
||||||
{
|
|
||||||
TTF_Font* rtn = nullptr;
|
|
||||||
if (m_fileName != "") {
|
|
||||||
cString temp = m_dir + m_fileName;
|
|
||||||
if ((rtn = TTF_OpenFont(temp.c_str(), size)) == nullptr)
|
|
||||||
cUtility::Inst().Message("Unable to load necessary TTF file. " + temp + " TTF_OpenFont():", "", cUtility::eTypeSDL::TTF);
|
|
||||||
else {
|
|
||||||
cFontHolder* holder = new cFontHolder(rtn, size);
|
|
||||||
m_fonts.push_back(holder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
TextTypeHelpers::cFontHolder* cFont::getFontHolder(const unsigned long int size)
|
|
||||||
{
|
|
||||||
cFontHolder* rtn = nullptr;
|
|
||||||
std::vector<cFontHolder*>::iterator it;
|
|
||||||
|
|
||||||
for (it = m_fonts.begin(); it < m_fonts.end(); it++) {
|
|
||||||
if (size == (*it)->getSize()) {
|
|
||||||
rtn = (*it);
|
|
||||||
//break out of the for loop
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cFont::UnloadFont()
|
|
||||||
{
|
|
||||||
m_fonts.clear();
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
#ifndef _CMOUSE_HPP_
|
|
||||||
#define _CMOUSE_HPP_
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "cInput.hpp"
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
namespace InputEngine {
|
|
||||||
class EXPORT_FROM_MYDLL cMouse
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cMouse();
|
|
||||||
~cMouse();
|
|
||||||
};/// END CLASS DEFINITION cMouse
|
|
||||||
}/// END NAMESPACE DEFINITION InputEngine
|
|
||||||
#endif/// END IFNDEF _CMOUSE_HPP_
|
|
||||||
@@ -1,348 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup>
|
|
||||||
<Filter Include="dllExportFiles">
|
|
||||||
<UniqueIdentifier>{785f0a83-5f26-4f52-8607-42d79ef7e4a0}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="TrooperEngine">
|
|
||||||
<UniqueIdentifier>{ce87c954-26c7-497c-a5c1-ca307fa85446}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="TrooperEngine\AudioEngine">
|
|
||||||
<UniqueIdentifier>{9447735f-408f-4a4c-896b-3cb056516952}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="TrooperEngine\InputEngine">
|
|
||||||
<UniqueIdentifier>{78ca6e8e-15cd-4c35-a4c7-f718c6f2e517}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="TrooperEngine\VideoEngine">
|
|
||||||
<UniqueIdentifier>{a48949b4-948d-4bdb-a48d-a2bb08c05f43}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="TrooperEngine\TimingEngine">
|
|
||||||
<UniqueIdentifier>{fb99b84e-7997-4ebd-b3ea-dd0240ce62f6}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="TrooperEngine\NetworkEngine">
|
|
||||||
<UniqueIdentifier>{98b7ca98-2ed4-4a41-84f2-abcb3fb384aa}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="TrooperEngine\TrooperEngineCore">
|
|
||||||
<UniqueIdentifier>{aef9e043-2065-4d89-acae-33d6f5f55958}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="TrooperEngine\MathEngine">
|
|
||||||
<UniqueIdentifier>{59e0e88b-7be3-4b1d-b3ac-6477daa761c8}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="TrooperEngine\TextTypeEngine">
|
|
||||||
<UniqueIdentifier>{4aa00373-6815-4cd3-a1c7-470f34bfa3d9}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="TrooperEngine\EventEngine">
|
|
||||||
<UniqueIdentifier>{74c65105-2ee7-4bb9-8d44-ca75c80e8b9e}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="TrooperEngine\MathEngine\iVector">
|
|
||||||
<UniqueIdentifier>{5a07ee53-1695-400c-86b3-c493e8e34417}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="TrooperEngine\MathEngine\Vector">
|
|
||||||
<UniqueIdentifier>{839730ba-b9b8-40bc-a0e0-bcb2b16b83f7}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="TrooperEngine\UtilityEngine">
|
|
||||||
<UniqueIdentifier>{2b72b3ea-71a4-4c02-988e-603172b3eda3}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="TrooperEngine\GUIEngine">
|
|
||||||
<UniqueIdentifier>{4a09c4e8-7d59-490d-8049-7a52f0aed3c8}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="TrooperEngine\GUIEngine\GUIHelpers">
|
|
||||||
<UniqueIdentifier>{6d0af3ff-4b2b-4b9c-85a2-c7db41550092}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="TrooperEngine\FXEngine">
|
|
||||||
<UniqueIdentifier>{db4ff7f3-2b38-4f9d-9a92-aed4cb51f0ac}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="TrooperEngine\UtilityEngine\MSUNIX">
|
|
||||||
<UniqueIdentifier>{f6fc613b-8e1a-4df1-aee7-f37382d38981}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="dllExportFiles\dllExport.h">
|
|
||||||
<Filter>dllExportFiles</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="dllExportFiles\TrooperEngine.hpp">
|
|
||||||
<Filter>dllExportFiles</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\AudioEngine\cAudio.hpp">
|
|
||||||
<Filter>TrooperEngine\AudioEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\AudioEngine\cMusic.hpp">
|
|
||||||
<Filter>TrooperEngine\AudioEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\AudioEngine\cSound.hpp">
|
|
||||||
<Filter>TrooperEngine\AudioEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\InputEngine\cInput.hpp">
|
|
||||||
<Filter>TrooperEngine\InputEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\InputEngine\cJoystick.hpp">
|
|
||||||
<Filter>TrooperEngine\InputEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\InputEngine\cKey.hpp">
|
|
||||||
<Filter>TrooperEngine\InputEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\InputEngine\cKeyboard.hpp">
|
|
||||||
<Filter>TrooperEngine\InputEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\InputEngine\cMouse.hpp">
|
|
||||||
<Filter>TrooperEngine\InputEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\VideoEngine\cAnimatedSprite.hpp">
|
|
||||||
<Filter>TrooperEngine\VideoEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\VideoEngine\cCamera.hpp">
|
|
||||||
<Filter>TrooperEngine\VideoEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\VideoEngine\cImage.hpp">
|
|
||||||
<Filter>TrooperEngine\VideoEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\VideoEngine\cSprite.hpp">
|
|
||||||
<Filter>TrooperEngine\VideoEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\VideoEngine\cVideo.hpp">
|
|
||||||
<Filter>TrooperEngine\VideoEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\TimingEngine\cTiming.hpp">
|
|
||||||
<Filter>TrooperEngine\TimingEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\NetworkEngine\cNetwork.hpp">
|
|
||||||
<Filter>TrooperEngine\NetworkEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\TrooperEngineCore\cTrooperEngineCore.hpp">
|
|
||||||
<Filter>TrooperEngine\TrooperEngineCore</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\MathEngine\cRandom.hpp">
|
|
||||||
<Filter>TrooperEngine\MathEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\TextTypeEngine\cFont.hpp">
|
|
||||||
<Filter>TrooperEngine\TextTypeEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\TextTypeEngine\cTextType.hpp">
|
|
||||||
<Filter>TrooperEngine\TextTypeEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\TextTypeEngine\cText.hpp">
|
|
||||||
<Filter>TrooperEngine\TextTypeEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\InputEngine\cTextInput.hpp">
|
|
||||||
<Filter>TrooperEngine\InputEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="dllExportFiles\CompileSettings.h">
|
|
||||||
<Filter>dllExportFiles</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\MathEngine\cCollision.hpp">
|
|
||||||
<Filter>TrooperEngine\MathEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\EventEngine\cEvent.hpp">
|
|
||||||
<Filter>TrooperEngine\EventEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\cPanel.hpp">
|
|
||||||
<Filter>TrooperEngine\GUIEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\cButton.hpp">
|
|
||||||
<Filter>TrooperEngine\GUIEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\GUIHelpers\cObject.hpp">
|
|
||||||
<Filter>TrooperEngine\GUIEngine\GUIHelpers</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\GUIHelpers\cTexture.hpp">
|
|
||||||
<Filter>TrooperEngine\GUIEngine\GUIHelpers</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\cGUI.hpp">
|
|
||||||
<Filter>TrooperEngine\GUIEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\cBoxSizer.hpp">
|
|
||||||
<Filter>TrooperEngine\GUIEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\MathEngine\iVector\iVector4.hpp">
|
|
||||||
<Filter>TrooperEngine\MathEngine\iVector</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\MathEngine\iVector\iVector3.hpp">
|
|
||||||
<Filter>TrooperEngine\MathEngine\iVector</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\MathEngine\iVector\iVector2.hpp">
|
|
||||||
<Filter>TrooperEngine\MathEngine\iVector</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\MathEngine\Vector\Vector4.hpp">
|
|
||||||
<Filter>TrooperEngine\MathEngine\Vector</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\MathEngine\Vector\Vector3.hpp">
|
|
||||||
<Filter>TrooperEngine\MathEngine\Vector</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\MathEngine\Vector\Vector2.hpp">
|
|
||||||
<Filter>TrooperEngine\MathEngine\Vector</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\UtilityEngine\cUtility.hpp">
|
|
||||||
<Filter>TrooperEngine\UtilityEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\GUIHelpers\GUIUtility.hpp">
|
|
||||||
<Filter>TrooperEngine\GUIEngine\GUIHelpers</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\FXEngine\cGFX.hpp">
|
|
||||||
<Filter>TrooperEngine\FXEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\VideoEngine\cRenderer.hpp">
|
|
||||||
<Filter>TrooperEngine\VideoEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\TextTypeEngine\TextTypeHelpers\cFontHolder.hpp">
|
|
||||||
<Filter>TrooperEngine\TextTypeEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\UtilityEngine\cString.hpp">
|
|
||||||
<Filter>TrooperEngine\UtilityEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\GUIHelpers\Enums.hpp">
|
|
||||||
<Filter>TrooperEngine\GUIEngine\GUIHelpers</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\cLayout.hpp">
|
|
||||||
<Filter>TrooperEngine\GUIEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\cWindow.hpp">
|
|
||||||
<Filter>TrooperEngine\GUIEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\UtilityEngine\MSUNIX\msunix.hpp">
|
|
||||||
<Filter>TrooperEngine\UtilityEngine\MSUNIX</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\cLabel.hpp">
|
|
||||||
<Filter>TrooperEngine\GUIEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\cTextButton.hpp">
|
|
||||||
<Filter>TrooperEngine\GUIEngine</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="TrooperEngine\AudioEngine\cAudio.cpp">
|
|
||||||
<Filter>TrooperEngine\AudioEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\AudioEngine\cMusic.cpp">
|
|
||||||
<Filter>TrooperEngine\AudioEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\AudioEngine\cSound.cpp">
|
|
||||||
<Filter>TrooperEngine\AudioEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\InputEngine\cInput.cpp">
|
|
||||||
<Filter>TrooperEngine\InputEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\InputEngine\cJoystick.cpp">
|
|
||||||
<Filter>TrooperEngine\InputEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\InputEngine\cKey.cpp">
|
|
||||||
<Filter>TrooperEngine\InputEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\InputEngine\cKeyboard.cpp">
|
|
||||||
<Filter>TrooperEngine\InputEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\InputEngine\cMouse.cpp">
|
|
||||||
<Filter>TrooperEngine\InputEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\VideoEngine\cAnimatedSprite.cpp">
|
|
||||||
<Filter>TrooperEngine\VideoEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\VideoEngine\cCamera.cpp">
|
|
||||||
<Filter>TrooperEngine\VideoEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\VideoEngine\cImage.cpp">
|
|
||||||
<Filter>TrooperEngine\VideoEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\VideoEngine\cSprite.cpp">
|
|
||||||
<Filter>TrooperEngine\VideoEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\VideoEngine\cVideo.cpp">
|
|
||||||
<Filter>TrooperEngine\VideoEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\TimingEngine\cTiming.cpp">
|
|
||||||
<Filter>TrooperEngine\TimingEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\NetworkEngine\cNetwork.cpp">
|
|
||||||
<Filter>TrooperEngine\NetworkEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\TrooperEngineCore\cTrooperEngineCore.cpp">
|
|
||||||
<Filter>TrooperEngine\TrooperEngineCore</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\MathEngine\cRandom.cpp">
|
|
||||||
<Filter>TrooperEngine\MathEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\TextTypeEngine\cFont.cpp">
|
|
||||||
<Filter>TrooperEngine\TextTypeEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\TextTypeEngine\cTextType.cpp">
|
|
||||||
<Filter>TrooperEngine\TextTypeEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\TextTypeEngine\cText.cpp">
|
|
||||||
<Filter>TrooperEngine\TextTypeEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\InputEngine\cTextInput.cpp">
|
|
||||||
<Filter>TrooperEngine\InputEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\MathEngine\cCollision.cpp">
|
|
||||||
<Filter>TrooperEngine\MathEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\EventEngine\cEvent.cpp">
|
|
||||||
<Filter>TrooperEngine\EventEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\GUIEngine\cButton.cpp">
|
|
||||||
<Filter>TrooperEngine\GUIEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\GUIEngine\GUIHelpers\cTexture.cpp">
|
|
||||||
<Filter>TrooperEngine\GUIEngine\GUIHelpers</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\GUIEngine\cGUI.cpp">
|
|
||||||
<Filter>TrooperEngine\GUIEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\GUIEngine\GUIHelpers\cObject.cpp">
|
|
||||||
<Filter>TrooperEngine\GUIEngine\GUIHelpers</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\MathEngine\iVector\iVector4.cpp">
|
|
||||||
<Filter>TrooperEngine\MathEngine\iVector</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\MathEngine\Vector\Vector4.cpp">
|
|
||||||
<Filter>TrooperEngine\MathEngine\Vector</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\MathEngine\iVector\iVector3.cpp">
|
|
||||||
<Filter>TrooperEngine\MathEngine\iVector</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\MathEngine\iVector\iVector2.cpp">
|
|
||||||
<Filter>TrooperEngine\MathEngine\iVector</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\MathEngine\Vector\Vector2.cpp">
|
|
||||||
<Filter>TrooperEngine\MathEngine\Vector</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\MathEngine\Vector\Vector3.cpp">
|
|
||||||
<Filter>TrooperEngine\MathEngine\Vector</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\UtilityEngine\cUtility.cpp">
|
|
||||||
<Filter>TrooperEngine\UtilityEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\FXEngine\cGFX.cpp">
|
|
||||||
<Filter>TrooperEngine\FXEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\VideoEngine\cRenderer.cpp">
|
|
||||||
<Filter>TrooperEngine\VideoEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\TextTypeEngine\TextTypeHelpers\cFontHolder.cpp">
|
|
||||||
<Filter>TrooperEngine\TextTypeEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\GUIEngine\GUIHelpers\GUIUtility.cpp">
|
|
||||||
<Filter>TrooperEngine\GUIEngine\GUIHelpers</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\UtilityEngine\cString.cpp">
|
|
||||||
<Filter>TrooperEngine\UtilityEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\GUIEngine\cBoxSizer.cpp">
|
|
||||||
<Filter>TrooperEngine\GUIEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\UtilityEngine\MSUNIX\msunix.cpp">
|
|
||||||
<Filter>TrooperEngine\UtilityEngine\MSUNIX</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\GUIEngine\cWindow.cpp">
|
|
||||||
<Filter>TrooperEngine\GUIEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\GUIEngine\cLayout.cpp">
|
|
||||||
<Filter>TrooperEngine\GUIEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\GUIEngine\cLabel.cpp">
|
|
||||||
<Filter>TrooperEngine\GUIEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="TrooperEngine\GUIEngine\cTextButton.cpp">
|
|
||||||
<Filter>TrooperEngine\GUIEngine</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
#ifndef _TROOPERENGINE_HPP_
|
|
||||||
#define _TROOPERENGINE_HPP_
|
|
||||||
|
|
||||||
#define _MYDLL_
|
|
||||||
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
/*** TropperEngineCore Folder ***/
|
|
||||||
#include "../TrooperEngine/TrooperEngineCore/cTrooperEngineCore.hpp"
|
|
||||||
|
|
||||||
/*** VideoEngine Folder ***/
|
|
||||||
#include "../TrooperEngine/VideoEngine/cVideo.hpp"
|
|
||||||
#include "../TrooperEngine/VideoEngine/cRenderer.hpp"
|
|
||||||
#include "../TrooperEngine/VideoEngine/cSprite.hpp"
|
|
||||||
#include "../TrooperEngine/VideoEngine/cAnimatedSprite.hpp"
|
|
||||||
#include "../TrooperEngine/VideoEngine/cImage.hpp"
|
|
||||||
#include "../TrooperEngine/VideoEngine/cCamera.hpp"
|
|
||||||
|
|
||||||
/*** AudioEngine Folder ***/
|
|
||||||
#include "../TrooperEngine/AudioEngine/cAudio.hpp"
|
|
||||||
#include "../TrooperEngine/AudioEngine/cSound.hpp"
|
|
||||||
#include "../TrooperEngine/AudioEngine/cMusic.hpp"
|
|
||||||
|
|
||||||
/*** NetworkingEngine Folder ***/
|
|
||||||
#include "../TrooperEngine/NetworkEngine/cNetwork.hpp"
|
|
||||||
|
|
||||||
/*** InputEngine Folder ***/
|
|
||||||
#include "../TrooperEngine/InputEngine/cInput.hpp"
|
|
||||||
#include "../TrooperEngine/InputEngine/cJoystick.hpp"
|
|
||||||
#include "../TrooperEngine/InputEngine/cKeyboard.hpp"
|
|
||||||
#include "../TrooperEngine/InputEngine/cMouse.hpp"
|
|
||||||
#include "../TrooperEngine/InputEngine/cKey.hpp"
|
|
||||||
#include "../TrooperEngine/InputEngine/cTextInput.hpp"
|
|
||||||
|
|
||||||
/*** TimingEngine Folder ***/
|
|
||||||
#include "../TrooperEngine/TimingEngine/cTiming.hpp"
|
|
||||||
|
|
||||||
/*** MathEngine Folder ***/
|
|
||||||
#include "../TrooperEngine/MathEngine/Vector/Vector2.hpp"
|
|
||||||
#include "../TrooperEngine/MathEngine/Vector/Vector3.hpp"
|
|
||||||
#include "../TrooperEngine/MathEngine/Vector/Vector4.hpp"
|
|
||||||
|
|
||||||
#include "../TrooperEngine/MathEngine/iVector/iVector2.hpp"
|
|
||||||
#include "../TrooperEngine/MathEngine/iVector/iVector3.hpp"
|
|
||||||
#include "../TrooperEngine/MathEngine/iVector/iVector4.hpp"
|
|
||||||
|
|
||||||
#include "../TrooperEngine/MathEngine/cCollision.hpp"
|
|
||||||
#include "../TrooperEngine/MathEngine/cRandom.hpp"
|
|
||||||
|
|
||||||
/*** TextTypeEngine ***/
|
|
||||||
#include "../TrooperEngine/TextTypeEngine/cTextType.hpp"
|
|
||||||
#include "../TrooperEngine/TextTypeEngine/cFont.hpp"
|
|
||||||
#include "../TrooperEngine/TextTypeEngine/cText.hpp"
|
|
||||||
|
|
||||||
/*** EventEngine ***/
|
|
||||||
#include "../TrooperEngine/EventEngine/cEvent.hpp"
|
|
||||||
|
|
||||||
/*** GUIEngine ***/
|
|
||||||
#include "../TrooperEngine/GUIEngine/cGUI.hpp"
|
|
||||||
#include "../TrooperEngine/GUIEngine/cWindow.hpp"
|
|
||||||
#include "../TrooperEngine/GUIEngine/cLayout.hpp"
|
|
||||||
#include "../TrooperEngine/GUIEngine/cLabel.hpp"
|
|
||||||
#include "../TrooperEngine/GUIEngine/cButton.hpp"
|
|
||||||
#include "../TrooperEngine/GUIEngine/cTextButton.hpp"
|
|
||||||
#include "../TrooperEngine/GUIEngine/cBoxSizer.hpp"
|
|
||||||
|
|
||||||
/*** GUIHelper ***/
|
|
||||||
#include "../TrooperEngine/GUIEngine/GUIHelpers/GUIUtility.hpp"
|
|
||||||
#include "../TrooperEngine/GUIEngine/GUIHelpers/Enums.hpp"
|
|
||||||
#include "../TrooperEngine/GUIEngine/GUIHelpers/cObject.hpp"
|
|
||||||
#include "../TrooperEngine/GUIEngine/GUIHelpers/cTexture.hpp"
|
|
||||||
|
|
||||||
/*** UtilityEngine ***/
|
|
||||||
#include "../TrooperEngine/UtilityEngine/cUtility.hpp"
|
|
||||||
#include "../TrooperEngine/UtilityEngine/cString.hpp"
|
|
||||||
|
|
||||||
/*** FXEngine ***/
|
|
||||||
#include "../TrooperEngine/FXEngine/cGFX.hpp"
|
|
||||||
|
|
||||||
#endif/// END IFNDEF _TROOPERENGINE_HPP_
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#ifndef _CSCOREBOARD_HPP_
|
|
||||||
#define _CSCOREBOARD_HPP_
|
|
||||||
|
|
||||||
/*** TrooperEngine DLL Header Files ***/
|
|
||||||
#include "TrooperEngine.hpp"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
|
|
||||||
using UtilityEngine::cString;
|
|
||||||
|
|
||||||
namespace Equipment {
|
|
||||||
class cScoreBoard
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cScoreBoard();
|
|
||||||
~cScoreBoard();
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
void Score( const unsigned long int player = 1 );
|
|
||||||
|
|
||||||
private:
|
|
||||||
private:
|
|
||||||
unsigned long int m_player1Score;// = 0
|
|
||||||
unsigned long int m_player2Score;// = 0
|
|
||||||
};/// END CLASS DEFINITION cScoreBoard
|
|
||||||
}/// END NAMESPACE DEFINITION Equipment
|
|
||||||
#endif/// END IFNDEF _CSCOREBOARD_HPP_
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
#ifndef _CBUILDMAINMENU_HPP_
|
|
||||||
#define _CBUILDMAINMENU_HPP_
|
|
||||||
|
|
||||||
/*** TrooperEngine DLL Header Files ***/
|
|
||||||
#include "TrooperEngine.hpp"
|
|
||||||
|
|
||||||
/*** TinyXML Header File ***/
|
|
||||||
#include "C:\Users\Laptop\programming\tinyxml2-master\tinyxml2.h"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "cMainMenu.hpp"
|
|
||||||
|
|
||||||
using UtilityEngine::cString;
|
|
||||||
using tinyxml2::XMLElement;
|
|
||||||
|
|
||||||
namespace MainMenu {
|
|
||||||
class cBuildMainMenu
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cBuildMainMenu();
|
|
||||||
~cBuildMainMenu();
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
cMainMenu* ReadXML();
|
|
||||||
|
|
||||||
///Sets
|
|
||||||
///Gets
|
|
||||||
|
|
||||||
private:
|
|
||||||
void GetOptions( const XMLElement* element, const cString name );
|
|
||||||
const char* GetAttribute( const XMLElement* element, const cString attribute ) const;
|
|
||||||
const unsigned long int HexToInt( const cString str ) const;
|
|
||||||
const SDL_Colour IntToSDLColour( const unsigned long int colour ) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
cString m_langSettings;// = ""
|
|
||||||
cString m_lang;// = ""
|
|
||||||
|
|
||||||
cString m_ttf;// = ""
|
|
||||||
cString m_dir;// = ""
|
|
||||||
|
|
||||||
cMainMenu* mp_mainMenu;// = new cMainMenu()
|
|
||||||
};/// END CLASS DEFINITION cBuildMainMenu
|
|
||||||
}/// END NAMESPACE DEFINITION MainMenu
|
|
||||||
#endif/// END IFNDEF _CBUILDMAINMENU_HPP_
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
#ifndef _DLLEXPORT_H_
|
|
||||||
#define _DLLEXPORT_H_
|
|
||||||
|
|
||||||
#include "CompileSettings.h"
|
|
||||||
|
|
||||||
#if _STATIC_LIB_ == 0
|
|
||||||
# ifdef _MYDLL_
|
|
||||||
# define EXPORT_FROM_MYDLL __declspec(dllimport)
|
|
||||||
# define EXPIMP_TEMPLATE extern
|
|
||||||
# else
|
|
||||||
# define EXPORT_FROM_MYDLL __declspec(dllexport)
|
|
||||||
# define EXPIMP_TEMPLATE
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
# define EXPORT_FROM_MYDLL
|
|
||||||
# define EXPIMP_TEMPLATE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif/// END IFNDEF _DLLEXPORT_H_
|
|
||||||
Binary file not shown.
@@ -1,34 +0,0 @@
|
|||||||
#include "cMenuSelect.hpp"
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include "SDL.h"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../cMainMenu.hpp"
|
|
||||||
|
|
||||||
using Input::cMenuSelect;
|
|
||||||
|
|
||||||
cMenuSelect::cMenuSelect( SDL_Keycode key, MainMenu::cMainMenu** menu )
|
|
||||||
: cKey(key), mpp_menu(menu)
|
|
||||||
{}
|
|
||||||
|
|
||||||
/*cMenuSelect::cMenuSelect( const cMenuSelect& copy )
|
|
||||||
{}*/
|
|
||||||
|
|
||||||
cMenuSelect::~cMenuSelect()
|
|
||||||
{}
|
|
||||||
|
|
||||||
///Funtions
|
|
||||||
void cMenuSelect::KeyPress()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMenuSelect::KeyUP()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMenuSelect::KeyDown()
|
|
||||||
{
|
|
||||||
if (mpp_menu != nullptr && *mpp_menu != nullptr)
|
|
||||||
(*mpp_menu)->OptionSelect();
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#ifndef _COMPILESETTINGS_H_
|
|
||||||
#define _COMPILESETTINGS_H_
|
|
||||||
|
|
||||||
#define _STATIC_LIB_ 1
|
|
||||||
#define _DEBUG_ 0
|
|
||||||
|
|
||||||
#endif/// END IFNDEF _COMPILESETTINGS_H_
|
|
||||||
Binary file not shown.
@@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<GUI
|
|
||||||
orientation="vertical"
|
|
||||||
align="center"
|
|
||||||
layout="fill_parent"
|
|
||||||
padding="10, 10, 10, 10"
|
|
||||||
debug="2">
|
|
||||||
<Layout
|
|
||||||
orientation="HORIZONTAL">
|
|
||||||
<Label
|
|
||||||
text="Hello World"
|
|
||||||
padding=""/>
|
|
||||||
<Label
|
|
||||||
text="Richard Allen"/>
|
|
||||||
</Layout>
|
|
||||||
</GUI>
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
#ifndef _IVECTOR3_HPP_
|
|
||||||
#define _IVECTOR3_HPP_
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
/*** Custom Header File ***/
|
|
||||||
#include "iVector2.hpp"
|
|
||||||
|
|
||||||
namespace MathEngine {
|
|
||||||
struct Vector3;
|
|
||||||
|
|
||||||
struct EXPORT_FROM_MYDLL iVector3 : public iVector2
|
|
||||||
{
|
|
||||||
iVector3( const int X = 0, const int Y = 0, const int Z = 0);
|
|
||||||
|
|
||||||
iVector3( const iVector2& copy );
|
|
||||||
|
|
||||||
iVector3( const SDL_Rect& copy );
|
|
||||||
|
|
||||||
iVector3& operator=( const SDL_Rect& copy );
|
|
||||||
|
|
||||||
bool operator==( const SDL_Rect& other ) const;
|
|
||||||
|
|
||||||
iVector3( const Vector3& copy );
|
|
||||||
|
|
||||||
iVector3& operator=( const Vector3& copy );
|
|
||||||
|
|
||||||
bool operator==( const iVector3& other ) const;
|
|
||||||
|
|
||||||
int z;
|
|
||||||
};/// END STRUCT DEFINITION iVector3
|
|
||||||
}/// END NAMESPACE DEFINITION MathEngine
|
|
||||||
#endif/// END IFNDEF _IVECTOR3_HPP_
|
|
||||||
@@ -1,126 +0,0 @@
|
|||||||
#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*/)
|
|
||||||
: cWindow(parent, id, align, layout, pos, size, padding, name)
|
|
||||||
{
|
|
||||||
mp_text = new TextTypeEngine::cText(label);
|
|
||||||
//Create(parent, id, label, align, layout, pos, size, padding, name);
|
|
||||||
if (this->getParent() != nullptr) {
|
|
||||||
this->getParent()->AddChild(this);
|
|
||||||
}
|
|
||||||
setText(label);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*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(parent, id, align, layout, pos, size, padding, name);
|
|
||||||
this->getParent()->AddChild(this);
|
|
||||||
setText(label);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ void cLabel::Display()
|
|
||||||
{
|
|
||||||
GenerateTexture();
|
|
||||||
|
|
||||||
cSprite::setPosition(cWindow::getPosition());
|
|
||||||
cSprite::Draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cLabel::GenerateTexture()
|
|
||||||
{
|
|
||||||
this->setImage((VideoEngine::cImage**)(&mp_text));
|
|
||||||
|
|
||||||
this->setImageArea(mp_text->getWH());
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//this->setTransparent();
|
|
||||||
//this->setPosition()
|
|
||||||
}
|
|
||||||
|
|
||||||
//Sets
|
|
||||||
void cLabel::setFontColour(const GUIHelpers::RBGA& 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::RBGA& 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*/ void cLabel::Resize()
|
|
||||||
{
|
|
||||||
RebuildLayout(this->getLayout());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ void cLabel::RebuildLayout(const GUIHelpers::eLayout& layout)
|
|
||||||
{
|
|
||||||
GUIHelpers::Size mySize = (0, 0);
|
|
||||||
switch (layout)
|
|
||||||
{
|
|
||||||
case GUIHelpers::eLayout::MATCH_PARENT:
|
|
||||||
case GUIHelpers::eLayout::FILL_PARENT:
|
|
||||||
cWindow::RebuildLayout(layout);
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
@@ -1,55 +0,0 @@
|
|||||||
#ifndef _CXMLOADER_HPP_
|
|
||||||
#define _CXMLOADER_HPP_
|
|
||||||
|
|
||||||
/*** TinyXML Header File ***/
|
|
||||||
#include "tinyxml2.h"
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "GUIUtility.hpp"
|
|
||||||
|
|
||||||
#include "../cWindow.hpp"
|
|
||||||
#include "../cLayout.hpp"
|
|
||||||
#include "../cLabel.hpp"
|
|
||||||
|
|
||||||
#include "../../UtilityEngine/cString.hpp"
|
|
||||||
|
|
||||||
using UtilityEngine::cString;
|
|
||||||
|
|
||||||
namespace GUIHelpers {
|
|
||||||
class EXPORT_FROM_MYDLL cXMLoader
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
cXMLoader();
|
|
||||||
~cXMLoader();
|
|
||||||
|
|
||||||
public:
|
|
||||||
///Functions
|
|
||||||
static cXMLoader& Inst();
|
|
||||||
static void Delete();
|
|
||||||
|
|
||||||
void Load( const cString& filename, const cString& dir = "" );
|
|
||||||
|
|
||||||
private:
|
|
||||||
void GetNode( tinyxml2::XMLElement* element, GUIEngine::cWindow* parent = nullptr );
|
|
||||||
const char* GetAttribute(const tinyxml2::XMLElement* element, const cString& attribute) const;
|
|
||||||
|
|
||||||
GUIEngine::cLayout* LayoutBuild( tinyxml2::XMLElement* element, GUIEngine::cWindow* parent );
|
|
||||||
GUIEngine::cLabel* LabelBuild( tinyxml2::XMLElement* element, GUIEngine::cWindow* parent );
|
|
||||||
|
|
||||||
const signed long int getID(tinyxml2::XMLElement* element);
|
|
||||||
const GUIHelpers::eOrientation getOrientation(tinyxml2::XMLElement* element);
|
|
||||||
const GUIHelpers::eAlign getAlign(tinyxml2::XMLElement* element);
|
|
||||||
const GUIHelpers::eLayout getLayout(tinyxml2::XMLElement* element);
|
|
||||||
const GUIHelpers::Position getPosition(tinyxml2::XMLElement* element);
|
|
||||||
const GUIHelpers::Size getSize(tinyxml2::XMLElement* element);
|
|
||||||
const GUIHelpers::Padding getPadding(tinyxml2::XMLElement* element);
|
|
||||||
const cString getText(tinyxml2::XMLElement* element);
|
|
||||||
|
|
||||||
private:
|
|
||||||
static cXMLoader* sp_inst;// = nullptr
|
|
||||||
};/// END CLASS DEFINITION cObject
|
|
||||||
}/// END NAMESPACE DEFINITION GUIHelpers
|
|
||||||
#endif/// END IFNDEF _CXMLOADER_HPP_
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
// Static Model
|
|
||||||
#include "cNetwork.hpp"
|
|
||||||
|
|
||||||
using NetworkEngine::cNetwork;
|
|
||||||
|
|
||||||
cNetwork::cNetwork()
|
|
||||||
{}
|
|
||||||
|
|
||||||
cNetwork::~cNetwork()
|
|
||||||
{}
|
|
||||||
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
#ifndef __UTEST__
|
|
||||||
#define __UTEST__
|
|
||||||
|
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
#define __UTest_VERSION "1.0.0"
|
|
||||||
|
|
||||||
class UTest {
|
|
||||||
private:
|
|
||||||
UTest( UTest & ); // no copy constructor
|
|
||||||
UTest operator = ( UTest & ); // no assignment operator
|
|
||||||
UTest(){}
|
|
||||||
public:
|
|
||||||
static const char * version() { return __UTest_VERSION; }
|
|
||||||
|
|
||||||
UTest( const char * );
|
|
||||||
void init( const char * );
|
|
||||||
void test( const char * description, const int flag );
|
|
||||||
void report() const;
|
|
||||||
|
|
||||||
static void OverAllReport();
|
|
||||||
|
|
||||||
private:
|
|
||||||
unsigned long int m_pass = 0;
|
|
||||||
unsigned long int m_fail = 0;
|
|
||||||
|
|
||||||
const char * mp_tstr = nullptr;
|
|
||||||
|
|
||||||
const static char * sp_pstr; /*= "pass";*/
|
|
||||||
const static char * sp_fstr; /*= "fail";*/
|
|
||||||
|
|
||||||
static unsigned long int s_pass;
|
|
||||||
static unsigned long int s_fail;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // __UTEST__
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
#include "cTexture.hpp"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../../VideoEngine/cRenderer.hpp"
|
|
||||||
#include "../../FXEngine/cGFX.hpp"
|
|
||||||
#include "GUIUtility.hpp"
|
|
||||||
|
|
||||||
using GUIHelpers::cTexture;
|
|
||||||
|
|
||||||
cTexture::cTexture()
|
|
||||||
{}
|
|
||||||
|
|
||||||
cTexture::~cTexture()
|
|
||||||
{}
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
|
|
||||||
//private
|
|
||||||
SDL_Texture* cTexture::GenerateTexture( const SDL_Rect& dimensions, TextTypeEngine::cText* text /*= nullptr*/ )
|
|
||||||
{
|
|
||||||
SDL_Rect t = text->getWH();
|
|
||||||
SDL_Rect centerText = { 0, 0, 0, 0 };
|
|
||||||
SDL_Rect centerButton = { 0, 0, 0, 0 };
|
|
||||||
SDL_Rect dim = dimensions;
|
|
||||||
|
|
||||||
///Find the min padding around the text.
|
|
||||||
// if (dim.w < (t.w + GUIHelpers::default::text::PADDING.x + GUIHelpers::default::text::PADDING.w) )
|
|
||||||
// dim.w += (t.w + GUIHelpers::default::text::PADDING.x + GUIHelpers::default::text::PADDING.w);
|
|
||||||
//
|
|
||||||
// if (dim.h < (t.h + GUIHelpers::default::text::PADDING.y + GUIHelpers::default::text::PADDING.z) )
|
|
||||||
// dim.h += (t.h + GUIHelpers::default::text::PADDING.y + GUIHelpers::default::text::PADDING.z);
|
|
||||||
|
|
||||||
///Find the center of the button
|
|
||||||
centerButton.x = dim.w / 2;
|
|
||||||
centerButton.y = dim.h / 2;
|
|
||||||
|
|
||||||
///Find the center of the text
|
|
||||||
centerText.x = t.w / 2;
|
|
||||||
centerText.y = t.h / 2;
|
|
||||||
|
|
||||||
if (centerText.x < centerButton.x)
|
|
||||||
t.x = centerButton.x - centerText.x;
|
|
||||||
|
|
||||||
if (centerText.y < centerButton.y)
|
|
||||||
t.y = centerButton.y - centerText.y;
|
|
||||||
|
|
||||||
SDL_Texture* temptext = VideoEngine::cRenderer::Inst().NewTexture(dim.w, dim.h, SDL_TEXTUREACCESS_TARGET );
|
|
||||||
|
|
||||||
GUIHelpers::RGBA colour = { 100, 100, 100, 255 };
|
|
||||||
|
|
||||||
FXEngine::cGFX::Inst().RoundedBox(dim, 0, colour, temptext);
|
|
||||||
|
|
||||||
|
|
||||||
VideoEngine::cRenderer::Inst().RenderToTexture(text->getImage(), nullptr, temptext, &t);
|
|
||||||
|
|
||||||
|
|
||||||
//cRenderer::Inst().Render(temptext, nullptr, nullptr);
|
|
||||||
|
|
||||||
//cRenderer::Inst().RenderToTexture(temptext, nullptr, text->getImage(), nullptr);
|
|
||||||
|
|
||||||
/*SDL_Surface* tempsurface = SDL_CreateRGBSurface(cVideo::Inst().getVideoSettings(), dimensions.w, dimensions.h, cVideo::Inst().getColour(),
|
|
||||||
0, 0, 0, 0);
|
|
||||||
|
|
||||||
SDL_FillRect(tempsurface, nullptr, SDL_MapRGB(tempsurface->format, 0, 255, 0));
|
|
||||||
|
|
||||||
/*if (roundedBoxRGBA(tempsurface, dimensions.x, dimensions.y, dimensions.w, dimensions.h, 10, 255, 255, 0, 255) != 0)
|
|
||||||
cerr << "Unable to generate GUI Texture." << endl << SDL_GetError() << endl;*/
|
|
||||||
|
|
||||||
|
|
||||||
/*if (text != nullptr) {
|
|
||||||
SDL_Rect srcrect, dstrect = dimensions;
|
|
||||||
cVideo::Inst().Render(text->getImage(), &srcrect, temptext, &dstrect);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->setImage(temptext);
|
|
||||||
this->setTransparent();*/
|
|
||||||
|
|
||||||
setImage(temptext);
|
|
||||||
|
|
||||||
return temptext;
|
|
||||||
}
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
#ifndef _CANIMATEDSPRITE_HPP_
|
|
||||||
#define _CANIMATEDSPRITE_HPP_
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "cSprite.hpp"
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
namespace VideoEngine {
|
|
||||||
class EXPORT_FROM_MYDLL cAnimatedSprite : public cSprite
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cAnimatedSprite( const unsigned long int x = 0, const unsigned long int y = 0, const unsigned long int fps = 16 );
|
|
||||||
/* Copy constructor */
|
|
||||||
cAnimatedSprite( const cAnimatedSprite& copy );
|
|
||||||
~cAnimatedSprite();
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
/* Runs down the image */
|
|
||||||
void UptoDown();
|
|
||||||
/* Runs up the image */
|
|
||||||
void DowntoUp();
|
|
||||||
/* Runs right of the image */
|
|
||||||
void LefttoRight();
|
|
||||||
/* Runs Left of the image */
|
|
||||||
void RighttoLeft();
|
|
||||||
|
|
||||||
///Sets
|
|
||||||
/* Sets the x increment */
|
|
||||||
void setXIncrement( const unsigned long int x );
|
|
||||||
/* Sets the y increment */
|
|
||||||
void setYIncrement( const unsigned long int y );
|
|
||||||
/* Sets the how fare the sprite should move along the image */
|
|
||||||
void setIncrement( const unsigned long int x, const unsigned long int y );
|
|
||||||
/* Sets the speed of going from one frame to the next */
|
|
||||||
void setFPS( const unsigned long int fps = 16 );
|
|
||||||
|
|
||||||
///Gets
|
|
||||||
/* Gets the x increment */
|
|
||||||
const unsigned long int getXIncrement() const;
|
|
||||||
/* Gets the y increment */
|
|
||||||
const unsigned long int getYIncrement() const;
|
|
||||||
/* Gets how fare the sprite should move along the image */
|
|
||||||
void getIncrement( unsigned long int& x, unsigned long int& y ) const;
|
|
||||||
|
|
||||||
/* Gets the speed of going from one frame to the next */
|
|
||||||
const unsigned long int getFPS() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
const unsigned long int TimeLeft();
|
|
||||||
void AddTimeandRate();
|
|
||||||
|
|
||||||
private:
|
|
||||||
///Variables
|
|
||||||
unsigned long int m_xIncrement;// = 0
|
|
||||||
unsigned long int m_yIncrement;// = 0
|
|
||||||
|
|
||||||
unsigned long int m_fps;// = 16
|
|
||||||
|
|
||||||
unsigned long int m_nextTime;// = 0
|
|
||||||
|
|
||||||
unsigned long int m_RATE;// = 0
|
|
||||||
|
|
||||||
};/// END CLASS DEFINITION cAnimatedSprite
|
|
||||||
}/// END NAMESPACE DEFINITION VideoEngine
|
|
||||||
#endif/// END IFNDEF _CANIMATEDSPRITE_HPP_
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
#include "cScoreBoard.hpp"
|
|
||||||
|
|
||||||
using Equipment::cScoreBoard;
|
|
||||||
|
|
||||||
cScoreBoard::cScoreBoard()
|
|
||||||
: m_player1Score(0), m_player2Score(0)
|
|
||||||
{}
|
|
||||||
|
|
||||||
cScoreBoard::~cScoreBoard()
|
|
||||||
{}
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
void cScoreBoard::Score( const unsigned long int player /*= 1*/ )
|
|
||||||
{
|
|
||||||
if (player == 1)
|
|
||||||
++m_player1Score;
|
|
||||||
if (player == 2)
|
|
||||||
++m_player2Score;
|
|
||||||
}
|
|
||||||
@@ -1,113 +0,0 @@
|
|||||||
#include "cLayout.hpp"
|
|
||||||
|
|
||||||
using GUIEngine::cLayout;
|
|
||||||
|
|
||||||
/*static*/ const cString cLayout::sNAME = "layout";
|
|
||||||
/*static*/ const GUIHelpers::eOrientation cLayout::sORIENTATION = GUIHelpers::eOrientation::VERTICAL;
|
|
||||||
|
|
||||||
cLayout::cLayout(cWindow* parent, const signed int id, const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/, 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(parent, id, align, layout, pos, size, padding, name)
|
|
||||||
{
|
|
||||||
//Create(parent, id, orientation, align, layout, pos, size, padding, name);
|
|
||||||
if (this->getParent() != nullptr) {
|
|
||||||
this->getParent()->AddChild(this);
|
|
||||||
}
|
|
||||||
setOrientation(orientation);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ cLayout::~cLayout()
|
|
||||||
{}
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
void cLayout::Create(cWindow* parent, const signed int id, const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/, 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(parent, id, align, layout, pos, size, padding, name);
|
|
||||||
this->getParent()->AddChild(this);
|
|
||||||
setOrientation(orientation);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ void cLayout::Display()
|
|
||||||
{
|
|
||||||
cWindow::Display();
|
|
||||||
}
|
|
||||||
|
|
||||||
///Set
|
|
||||||
void cLayout::setOrientation(const GUIHelpers::eOrientation& orientation /*= GUIHelpers::eOrientation::VERTICAL*/)
|
|
||||||
{
|
|
||||||
m_orientation = orientation;
|
|
||||||
}
|
|
||||||
|
|
||||||
///Get
|
|
||||||
const GUIHelpers::eOrientation& cLayout::getOrientation() const
|
|
||||||
{
|
|
||||||
return m_orientation;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ const GUIHelpers::eType cLayout::getType() const
|
|
||||||
{
|
|
||||||
return GUIHelpers::eType::CLAYOUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ void cLayout::Resize()
|
|
||||||
{
|
|
||||||
RebuildLayout(this->getLayout());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ void cLayout::RebuildLayout(const GUIHelpers::eLayout& layout)
|
|
||||||
{
|
|
||||||
GUIHelpers::Size mySize = (0, 0);
|
|
||||||
switch (layout)
|
|
||||||
{
|
|
||||||
case GUIHelpers::eLayout::MATCH_PARENT:
|
|
||||||
case GUIHelpers::eLayout::FILL_PARENT:
|
|
||||||
cWindow::RebuildLayout(layout);
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eLayout::WRAP_CONTENT:
|
|
||||||
std::vector<cWindow*> children = this->getChildren();
|
|
||||||
std::vector<cWindow*>::iterator it;
|
|
||||||
|
|
||||||
for (it = children.begin(); it < children.end(); it++) {
|
|
||||||
(*it)->Resize();
|
|
||||||
GUIHelpers::Size size = (*it)->getSize();
|
|
||||||
GUIHelpers::Padding pad = (*it)->getPadding();
|
|
||||||
size.x += pad.x + pad.w;
|
|
||||||
size.y += pad.y + pad.z;
|
|
||||||
AddSize(size.x, size.y, mySize);
|
|
||||||
}
|
|
||||||
this->setSize(mySize);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// /*virtual*/ void cLayout::RebuildPos()
|
|
||||||
// {
|
|
||||||
// cWindow::RebuildPos();
|
|
||||||
// }
|
|
||||||
|
|
||||||
///Private
|
|
||||||
/*virtual*/ void cLayout::AddSize(int x, int y, GUIHelpers::Size& mySize) const
|
|
||||||
{
|
|
||||||
int& addFrom = x;
|
|
||||||
int& largestFrom = y;
|
|
||||||
|
|
||||||
int& addTo = mySize.x;
|
|
||||||
int& largestTo = mySize.y;
|
|
||||||
|
|
||||||
if (m_orientation == GUIHelpers::eOrientation::HORIZONTAL) {
|
|
||||||
addFrom = y;
|
|
||||||
largestFrom = x;
|
|
||||||
|
|
||||||
addTo = mySize.y;
|
|
||||||
largestTo = mySize.x;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*We do the real work here.*/
|
|
||||||
if (largestTo > largestFrom)
|
|
||||||
largestTo = largestFrom;
|
|
||||||
|
|
||||||
addTo += addFrom;
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
#include "cBoxSizer.hpp"
|
|
||||||
|
|
||||||
using GUIEngine::cBoxSizer;
|
|
||||||
|
|
||||||
/*static*/ const cString cBoxSizer::sNAME = "boxsizer";
|
|
||||||
|
|
||||||
cBoxSizer::cBoxSizer( cWindow* parent, const signed int id, 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*/ )
|
|
||||||
{
|
|
||||||
Create(parent, id, align, layout, pos, size, padding, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ cBoxSizer::~cBoxSizer()
|
|
||||||
{}
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
void cBoxSizer::Create( cWindow* parent, const signed int id, 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ const GUIHelpers::eType cBoxSizer::getType() const
|
|
||||||
{
|
|
||||||
return GUIHelpers::eType::CBOXSIZER;
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
#ifndef _CEVENT_HPP_
|
|
||||||
#define _CEVENT_HPP_
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
namespace EventEngine {
|
|
||||||
/* Singleton */
|
|
||||||
class EXPORT_FROM_MYDLL cEvent
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
cEvent();
|
|
||||||
~cEvent();
|
|
||||||
|
|
||||||
public:
|
|
||||||
static cEvent& Inst();
|
|
||||||
static void Delete();
|
|
||||||
|
|
||||||
//Functions
|
|
||||||
const bool Initialize() const;
|
|
||||||
|
|
||||||
const bool Setup();
|
|
||||||
void CleanUp();
|
|
||||||
|
|
||||||
/* Checks for Events */
|
|
||||||
void CheckEvents();
|
|
||||||
|
|
||||||
|
|
||||||
///Sets
|
|
||||||
|
|
||||||
///Gets
|
|
||||||
/* Gets return true if Event was initialized */
|
|
||||||
const bool IsInit() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
SDL_Event m_event;
|
|
||||||
|
|
||||||
static cEvent* sp_inst;// = nullptr
|
|
||||||
};/// END CLASS DEFINITION cEvent
|
|
||||||
}/// END NAMESPACE DEFINITION EventEngine
|
|
||||||
#endif/// END IFNDEF _CEVENT_HPP_
|
|
||||||
Binary file not shown.
@@ -1,105 +0,0 @@
|
|||||||
#ifndef _CGUI_HPP_
|
|
||||||
#define _CGUI_HPP_
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../TextTypeEngine/cFont.hpp"
|
|
||||||
#include "../MathEngine/iVector/iVector4.hpp"
|
|
||||||
|
|
||||||
#include "cWindow.hpp"
|
|
||||||
//#include "cPanel.hpp"
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../UtilityEngine/cString.hpp"
|
|
||||||
#include "../MathEngine/iVector/iVector2.hpp"
|
|
||||||
|
|
||||||
using UtilityEngine::cString;
|
|
||||||
|
|
||||||
namespace GUIEngine {
|
|
||||||
/* Singleton */
|
|
||||||
class EXPORT_FROM_MYDLL cGUI
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
cGUI();
|
|
||||||
~cGUI();
|
|
||||||
|
|
||||||
public:
|
|
||||||
enum EXPORT_FROM_MYDLL eGUIEventType: unsigned int
|
|
||||||
{
|
|
||||||
MouseButton1 = 0,
|
|
||||||
MouseButton2,
|
|
||||||
MouseButton3,
|
|
||||||
Keyboard
|
|
||||||
};
|
|
||||||
///Functions
|
|
||||||
static cGUI& Inst();
|
|
||||||
static void Delete();
|
|
||||||
|
|
||||||
const bool Initialize( const cString& filename, const cString& dir = "", const unsigned long int size = 16 );
|
|
||||||
|
|
||||||
void Event( const MathEngine::iVector2& location, const eGUIEventType& type );
|
|
||||||
const MathEngine::iVector2 DisplayArea() const;
|
|
||||||
|
|
||||||
void AddObject( GUIEngine::cWindow* obj );
|
|
||||||
|
|
||||||
std::vector<GUIEngine::cWindow*>& GetObjects();
|
|
||||||
|
|
||||||
void Display();
|
|
||||||
|
|
||||||
///Sets
|
|
||||||
void setDebugLevel( const unsigned long int debugLevel );
|
|
||||||
|
|
||||||
void setFont( TextTypeEngine::cFont* font );
|
|
||||||
void setFont( const cString& filename, const cString& dir = "", const unsigned long int size = 16 );
|
|
||||||
|
|
||||||
void setTextColour( const GUIHelpers::RGBA& colour );
|
|
||||||
void setTextColour( const unsigned long int red = 0, const unsigned long int green = 0, const unsigned long int blue = 0 );
|
|
||||||
|
|
||||||
void setPadding( const GUIHelpers::Padding& padding );
|
|
||||||
void setPadding( const unsigned int top = 5, const unsigned int right = 5, const unsigned int bottom = 5, const unsigned int left = 5 );
|
|
||||||
|
|
||||||
void setAlign( const GUIHelpers::eAlign& align = GUIHelpers::eAlign::CENTER );
|
|
||||||
|
|
||||||
///Gets
|
|
||||||
const unsigned long int getDebugLevel() const;
|
|
||||||
|
|
||||||
TextTypeEngine::cFont* getFont();
|
|
||||||
|
|
||||||
const GUIHelpers::RGBA& getTextColour() const;
|
|
||||||
void getTextColour( unsigned long int& red, unsigned long int& green, unsigned long int& blue ) const;
|
|
||||||
|
|
||||||
const GUIHelpers::Padding& getPadding() const;
|
|
||||||
void getPadding( unsigned int& top, unsigned int& right, unsigned int& bottom, unsigned int& left ) const;
|
|
||||||
|
|
||||||
const GUIHelpers::eAlign& getAlign() const;
|
|
||||||
|
|
||||||
const bool IsInit() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
static cGUI* sp_inst;// = nullptr
|
|
||||||
|
|
||||||
unsigned long int m_debugLevel;// = 0
|
|
||||||
|
|
||||||
bool m_inited;// = false
|
|
||||||
|
|
||||||
/* default GUI font */
|
|
||||||
TextTypeEngine::cFont* mp_font;// = nullptr
|
|
||||||
|
|
||||||
/* default GUI text colour black*/
|
|
||||||
//GUIHelpers::RBGA m_textColour;// = { 0, 0, 0 }
|
|
||||||
|
|
||||||
/* default GUI padding */
|
|
||||||
//GUIHelpers::Padding m_padding;// = { 5, 5, 5, 5 }
|
|
||||||
|
|
||||||
/* default GUI align */
|
|
||||||
//GUIHelpers::eAlign m_align;// = GUIHelpers::eAlign::CENTER
|
|
||||||
|
|
||||||
std::vector<GUIEngine::cWindow*> m_children;
|
|
||||||
};/// END CLASS DEFINITION cGUI
|
|
||||||
}/// END NAMESPACE DEFINITION GUIEngine
|
|
||||||
#endif/// END IFNDEF _CGUI_HPP_
|
|
||||||
@@ -1,222 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="UTest|Win32">
|
|
||||||
<Configuration>UTest</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup Label="Globals">
|
|
||||||
<ProjectGuid>{B6513FAA-8BDE-45AA-9F1E-326BCBE5D2E8}</ProjectGuid>
|
|
||||||
<RootNamespace>TrooperEngineDLL</RootNamespace>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
<UseOfMfc>false</UseOfMfc>
|
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='UTest|Win32'">
|
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
||||||
<ImportGroup Label="ExtensionSettings">
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<PropertyGroup Label="UserMacros" />
|
|
||||||
<PropertyGroup>
|
|
||||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
|
||||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
|
||||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
|
||||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
|
||||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
|
||||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
|
||||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<AdditionalIncludeDirectories>$(TINYXML);$(SDL2_gfx);dllExportFiles;$(SDL2_net)\include;$(SDL2_ttf)\include;$(SDL2_mixer)\include;$(SDL2_image)\include;$(SDL2)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
<MinimalRebuild>false</MinimalRebuild>
|
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
|
||||||
<WarningLevel>Level4</WarningLevel>
|
|
||||||
<TreatWarningAsError>false</TreatWarningAsError>
|
|
||||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
|
||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
|
||||||
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<AdditionalDependencies>sdl.lib;sdlmain.lib;sdl_image.lib;sdl_ttf.lib;sdl_mixer.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
|
|
||||||
<AdditionalLibraryDirectories>../Debug;$(SDL)\SDL_ttf-2.0.9\lib;$(SDL)\SDL_mixer-1.2.11\lib;$(SDL)\SDL_image-1.2.10\lib;$(SDL)\SDL-1.2.14\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<SubSystem>NotSet</SubSystem>
|
|
||||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
|
||||||
<DataExecutionPrevention>
|
|
||||||
</DataExecutionPrevention>
|
|
||||||
<ImportLibrary>
|
|
||||||
</ImportLibrary>
|
|
||||||
<TargetMachine>MachineX86</TargetMachine>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<Optimization>Full</Optimization>
|
|
||||||
<AdditionalIncludeDirectories>../LinkListDLLProject/dllExportFiles;dllExportFiles;$(SDL)\SDL_ttf-2.0.9\include;$(SDL)\SDL_mixer-1.2.8\include;$(SDL)\SDL_image-1.2.7\include;$(SDL)\SDL-1.2.13\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
|
||||||
<WarningLevel>Level4</WarningLevel>
|
|
||||||
<TreatWarningAsError>true</TreatWarningAsError>
|
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<AdditionalDependencies>sdl.lib;sdlmain.lib;sdl_image.lib;sdl_ttf.lib;sdl_mixer.lib;LinkList.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<OutputFile>$(OutDir)TrooperEngine.dll</OutputFile>
|
|
||||||
<AdditionalLibraryDirectories>../Release;$(SDL)\SDL_ttf-2.0.9\lib;$(SDL)\SDL_mixer-1.2.8\lib;$(SDL)\SDL_image-1.2.7\lib;$(SDL)\SDL-1.2.13\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
|
||||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
|
||||||
<DataExecutionPrevention>
|
|
||||||
</DataExecutionPrevention>
|
|
||||||
<TargetMachine>MachineX86</TargetMachine>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='UTest|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<AdditionalIncludeDirectories>$(SDL2_gfx);dllExportFiles;$(SDL2_net)\include;$(SDL2_ttf)\include;$(SDL2_mixer)\include;$(SDL2_image)\include;$(SDL2)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="dllExportFiles\CompileSettings.h" />
|
|
||||||
<ClInclude Include="dllExportFiles\dllExport.h" />
|
|
||||||
<ClInclude Include="dllExportFiles\TrooperEngine.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\AudioEngine\cAudio.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\AudioEngine\cMusic.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\AudioEngine\cSound.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\EventEngine\cEvent.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\FXEngine\cGFX.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\cBoxSizer.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\cButton.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\cGUI.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\cLayout.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\cPanel.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\cLabel.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\cTextButton.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\cWindow.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\GUIHelpers\cTexture.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\GUIHelpers\cObject.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\GUIHelpers\cXMLoader.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\GUIHelpers\Enums.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\GUIEngine\GUIHelpers\GUIUtility.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\InputEngine\cInput.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\InputEngine\cJoystick.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\InputEngine\cKey.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\InputEngine\cKeyboard.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\InputEngine\cMouse.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\InputEngine\cTextInput.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\MathEngine\cCollision.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\MathEngine\iVector\iVector2.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\MathEngine\iVector\iVector3.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\MathEngine\iVector\iVector4.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\MathEngine\Vector\Vector2.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\MathEngine\Vector\Vector3.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\MathEngine\Vector\Vector4.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\TextTypeEngine\cFont.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\TextTypeEngine\cText.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\TextTypeEngine\cTextType.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\TextTypeEngine\TextTypeHelpers\cFontHolder.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\UtilityEngine\cString.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\UtilityEngine\cUtility.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\UtilityEngine\MSUNIX\msunix.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\VideoEngine\cAnimatedSprite.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\VideoEngine\cCamera.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\VideoEngine\cImage.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\VideoEngine\cRenderer.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\VideoEngine\cSprite.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\VideoEngine\cVideo.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\TimingEngine\cTiming.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\NetworkEngine\cNetwork.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\TrooperEngineCore\cTrooperEngineCore.hpp" />
|
|
||||||
<ClInclude Include="TrooperEngine\MathEngine\cRandom.hpp" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="TrooperEngine\AudioEngine\cAudio.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\AudioEngine\cMusic.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\AudioEngine\cSound.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\EventEngine\cEvent.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\FXEngine\cGFX.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\GUIEngine\cBoxSizer.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\GUIEngine\cButton.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\GUIEngine\cGUI.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\GUIEngine\cLayout.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\GUIEngine\cLabel.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\GUIEngine\cTextButton.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\GUIEngine\cWindow.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\GUIEngine\GUIHelpers\cObject.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\GUIEngine\GUIHelpers\cTexture.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\GUIEngine\GUIHelpers\cXMLoader.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\GUIEngine\GUIHelpers\GUIUtility.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\InputEngine\cInput.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\InputEngine\cJoystick.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\InputEngine\cKey.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\InputEngine\cKeyboard.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\InputEngine\cMouse.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\InputEngine\cTextInput.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\MathEngine\cCollision.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\MathEngine\iVector\iVector2.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\MathEngine\iVector\iVector3.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\MathEngine\iVector\iVector4.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\MathEngine\Vector\Vector2.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\MathEngine\Vector\Vector3.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\MathEngine\Vector\Vector4.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\TextTypeEngine\cFont.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\TextTypeEngine\cText.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\TextTypeEngine\cTextType.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\TextTypeEngine\TextTypeHelpers\cFontHolder.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\UtilityEngine\cString.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\UtilityEngine\cUtility.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\UtilityEngine\MSUNIX\msunix.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\VideoEngine\cAnimatedSprite.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\VideoEngine\cCamera.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\VideoEngine\cImage.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\VideoEngine\cRenderer.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\VideoEngine\cSprite.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\VideoEngine\cVideo.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\TimingEngine\cTiming.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\NetworkEngine\cNetwork.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\TrooperEngineCore\cTrooperEngineCore.cpp" />
|
|
||||||
<ClCompile Include="TrooperEngine\MathEngine\cRandom.cpp" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
||||||
<ImportGroup Label="ExtensionTargets">
|
|
||||||
</ImportGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
#ifndef _CBUILDMAINMENU_HPP_
|
|
||||||
#define _CBUILDMAINMENU_HPP_
|
|
||||||
|
|
||||||
/*** TrooperEngine DLL Header Files ***/
|
|
||||||
#include "TrooperEngine.hpp"
|
|
||||||
|
|
||||||
/*** TinyXML Header File ***/
|
|
||||||
#include "tinyxml2.h"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "cMainMenu.hpp"
|
|
||||||
|
|
||||||
using UtilityEngine::cString;
|
|
||||||
using tinyxml2::XMLElement;
|
|
||||||
|
|
||||||
namespace MainMenu {
|
|
||||||
class cBuildMainMenu
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cBuildMainMenu();
|
|
||||||
~cBuildMainMenu();
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
cMainMenu* ReadXML();
|
|
||||||
|
|
||||||
///Sets
|
|
||||||
///Gets
|
|
||||||
|
|
||||||
private:
|
|
||||||
void GetOptions( const XMLElement* element, const cString name );
|
|
||||||
const char* GetAttribute( const XMLElement* element, const cString attribute ) const;
|
|
||||||
const unsigned long int HexToInt( const cString str ) const;
|
|
||||||
const SDL_Colour IntToSDLColour( const unsigned long int colour ) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
cString m_langSettings;// = ""
|
|
||||||
cString m_lang;// = ""
|
|
||||||
|
|
||||||
cString m_ttf;// = ""
|
|
||||||
cString m_dir;// = ""
|
|
||||||
|
|
||||||
cMainMenu* mp_mainMenu;// = new cMainMenu()
|
|
||||||
};/// END CLASS DEFINITION cBuildMainMenu
|
|
||||||
}/// END NAMESPACE DEFINITION MainMenu
|
|
||||||
#endif/// END IFNDEF _CBUILDMAINMENU_HPP_
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
<?xml version="1.0" ?>
|
|
||||||
<SDLPongCPP>
|
|
||||||
<Settings lang="EN"/>
|
|
||||||
<MainMenu lang="EN" colour="FF0000" selectcolour="0000FF" titlecolour="FFFF00" ttf="FreeSansBold.ttf" soundeffect="menu-opt.wav" dir="">
|
|
||||||
<Title x="40" y="0" size="80">
|
|
||||||
SDL Pong C
|
|
||||||
</Title>
|
|
||||||
<SinglePlayer x="60" y="100" size="40">
|
|
||||||
Single Player
|
|
||||||
</SinglePlayer>
|
|
||||||
<HeadToHead x="60" y="150" size="40">
|
|
||||||
Head to Head
|
|
||||||
</HeadToHead>
|
|
||||||
<Options x="60" y="200" size="40">
|
|
||||||
Options
|
|
||||||
<OptionMenu>
|
|
||||||
<Language>
|
|
||||||
Language
|
|
||||||
<LanOption lang="EN">
|
|
||||||
English
|
|
||||||
</LanOption>
|
|
||||||
<LanOption lang="FR">
|
|
||||||
French
|
|
||||||
</LanOption>
|
|
||||||
</Language>
|
|
||||||
</OptionMenu>
|
|
||||||
</Options>
|
|
||||||
<Quit x="60" y="200" size="40">
|
|
||||||
Quit
|
|
||||||
</Quit>
|
|
||||||
</MainMenu>
|
|
||||||
</SDLPongCPP>
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
#ifndef _CQUITBUTTON_HPP_
|
|
||||||
#define _CQUITBUTTON_HPP_
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include "SDL.h"
|
|
||||||
|
|
||||||
/*** TrooperEngine DLL Header Files ***/
|
|
||||||
#include "TrooperEngine.hpp"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../cCourt.hpp"
|
|
||||||
|
|
||||||
namespace Input {
|
|
||||||
class cQuitButton : public InputEngine::cKey
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cQuitButton( SDL_Keycode key, Equipment::cCourt** court);
|
|
||||||
virtual ~cQuitButton();
|
|
||||||
|
|
||||||
///Funtions
|
|
||||||
/* Call if the key is pressed */
|
|
||||||
void KeyPress();
|
|
||||||
/* Call if the key is up */
|
|
||||||
void KeyUP();
|
|
||||||
/* Call if the key is down */
|
|
||||||
void KeyDown();
|
|
||||||
|
|
||||||
private:
|
|
||||||
private:
|
|
||||||
Equipment::cCourt** mpp_court;//
|
|
||||||
};/// END CLASS DEFINITION cQuitButton
|
|
||||||
}/// END NAMESPACE DEFINITION Input
|
|
||||||
#endif/// END IFNDEF _CQUITBUTTON_HPP_
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
#include "cEsc.hpp"
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include "SDL.h"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../cMainMenu.hpp"
|
|
||||||
#include "../eOptions.hpp"
|
|
||||||
|
|
||||||
using Input::cEsc;
|
|
||||||
|
|
||||||
using MainMenu::eOptions;
|
|
||||||
|
|
||||||
cEsc::cEsc( SDL_Keycode key, MainMenu::cMainMenu** menu )
|
|
||||||
: cKey(key), mpp_menu(menu)
|
|
||||||
{}
|
|
||||||
|
|
||||||
/*cEsc::cEsc( const cEsc& copy )
|
|
||||||
{}*/
|
|
||||||
|
|
||||||
cEsc::~cEsc()
|
|
||||||
{}
|
|
||||||
|
|
||||||
///Funtions
|
|
||||||
void cEsc::KeyPress()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void cEsc::KeyUP()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void cEsc::KeyDown()
|
|
||||||
{
|
|
||||||
if (mpp_menu != nullptr && *mpp_menu != nullptr)
|
|
||||||
{
|
|
||||||
(*mpp_menu)->setOption(eOptions::Quit);
|
|
||||||
(*mpp_menu)->OptionSelect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
#include "cBoxSizer.hpp"
|
|
||||||
|
|
||||||
using GUIEngine::cBoxSizer;
|
|
||||||
|
|
||||||
/*static*/ const cString cBoxSizer::sNAME = "boxsizer";
|
|
||||||
|
|
||||||
cBoxSizer::cBoxSizer( cWindow* parent, const signed int id, 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(parent, id, align, layout, pos, size, padding, name)
|
|
||||||
{
|
|
||||||
//Create(parent, id, align, layout, pos, size, padding, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ cBoxSizer::~cBoxSizer()
|
|
||||||
{}
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
void cBoxSizer::Create( cWindow* parent, const signed int id, 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(parent, id, align, layout, pos, size, padding, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ const GUIHelpers::eType cBoxSizer::getType() const
|
|
||||||
{
|
|
||||||
return GUIHelpers::eType::CBOXSIZER;
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
#ifndef _CMENUSELECT_HPP_
|
|
||||||
#define _CMENUSELECT_HPP_
|
|
||||||
|
|
||||||
/*** TrooperEngine DLL Header Files ***/
|
|
||||||
#include "TrooperEngine.hpp"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../cMainMenu.hpp"
|
|
||||||
|
|
||||||
namespace Input {
|
|
||||||
class cMenuSelect : public InputEngine::cKey
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cMenuSelect( SDL_Keycode key, MainMenu::cMainMenu** menu );
|
|
||||||
//cMenuSelect( const cMenuSelect& copy );
|
|
||||||
~cMenuSelect();
|
|
||||||
|
|
||||||
///Funtions
|
|
||||||
/* Call if the key is pressed */
|
|
||||||
void KeyPress();
|
|
||||||
/* Call if the key is up */
|
|
||||||
void KeyUP();
|
|
||||||
/* Call if the key is down */
|
|
||||||
void KeyDown();
|
|
||||||
|
|
||||||
private:
|
|
||||||
private:
|
|
||||||
MainMenu::cMainMenu** mpp_menu;
|
|
||||||
};/// END CLASS DEFINITION cMenuSelect
|
|
||||||
}/// END NAMESPACE DEFINITION Input
|
|
||||||
#endif/// END IFNDEF _CMENUSELECT_HPP_
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
#ifndef _CTEXTBUTTON_HPP_
|
|
||||||
#define _CTEXTBUTTON_HPP_
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "cButton.hpp"
|
|
||||||
#include "cLabel.hpp"
|
|
||||||
|
|
||||||
#include "GUIHelpers/Enums.hpp"
|
|
||||||
#include "GUIHelpers/GUIUtility.hpp"
|
|
||||||
#include "../VideoEngine/cSprite.hpp"
|
|
||||||
#include "../VideoEngine/cImage.hpp"
|
|
||||||
#include "../MathEngine/iVector/iVector2.hpp"
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../UtilityEngine/cString.hpp"
|
|
||||||
|
|
||||||
using UtilityEngine::cString;
|
|
||||||
|
|
||||||
namespace GUIEngine {
|
|
||||||
class EXPORT_FROM_MYDLL cTextButton : public cButton
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static const cString sNAME; /*= "button";*/
|
|
||||||
|
|
||||||
cTextButton(cWindow* parent, const signed int id, const cString& text, const GUIHelpers::eAlign& align = GUIHelpers::eAlign::CENTER,
|
|
||||||
const GUIHelpers::eLayout& layout = GUIHelpers::eLayout::FILL_PARENT, const GUIHelpers::Position& pos = sPOSITION,
|
|
||||||
const GUIHelpers::Size& size = sSIZE, const GUIHelpers::Padding& padding = sPADDING, const cString& name = sNAME);
|
|
||||||
virtual ~cTextButton();
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
void Create(cWindow* parent, const signed int id, const cString& text, const GUIHelpers::eAlign& align = GUIHelpers::eAlign::CENTER,
|
|
||||||
const GUIHelpers::eLayout& layout = GUIHelpers::eLayout::FILL_PARENT, const GUIHelpers::Position& pos = sPOSITION,
|
|
||||||
const GUIHelpers::Size& size = sSIZE, const GUIHelpers::Padding& padding = sPADDING, const cString& name = sNAME);
|
|
||||||
|
|
||||||
//Sets
|
|
||||||
void setText( const cString& text );
|
|
||||||
void setTextColour( const GUIHelpers::RBGA& colour );
|
|
||||||
void setTextSize( const unsigned long int size );
|
|
||||||
|
|
||||||
///Gets
|
|
||||||
const cString getText() const;
|
|
||||||
const GUIHelpers::RBGA getTextColour();
|
|
||||||
const unsigned long int getTextSize();
|
|
||||||
|
|
||||||
virtual const GUIHelpers::eType getType() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void CreateLabel();
|
|
||||||
void GenerateImage();
|
|
||||||
void GenerateTexture();
|
|
||||||
|
|
||||||
private:
|
|
||||||
cLabel m_label;// = nullptr
|
|
||||||
};/// END CLASS DEFINITION cButton
|
|
||||||
}/// END NAMESPACE DEFINITION GUIEngine
|
|
||||||
#endif/// END IFNDEF _CBUTTON_HPP_
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
#include "cEvent.hpp"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../InputEngine/cInput.hpp"
|
|
||||||
#include "../MathEngine/iVector/iVector2.hpp"
|
|
||||||
#include "../GUIEngine/cGUI.hpp"
|
|
||||||
|
|
||||||
using EventEngine::cEvent;
|
|
||||||
using MathEngine::iVector2;
|
|
||||||
|
|
||||||
/*static*/ cEvent* cEvent::sp_inst = nullptr;
|
|
||||||
|
|
||||||
//Private
|
|
||||||
cEvent::cEvent()
|
|
||||||
{}
|
|
||||||
|
|
||||||
cEvent::~cEvent()
|
|
||||||
{
|
|
||||||
CleanUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Public
|
|
||||||
/*static*/ cEvent& cEvent::Inst()
|
|
||||||
{
|
|
||||||
if (sp_inst == nullptr)
|
|
||||||
sp_inst = new cEvent();
|
|
||||||
return *sp_inst;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*static*/ void cEvent::Delete()
|
|
||||||
{
|
|
||||||
delete sp_inst;
|
|
||||||
sp_inst = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Functions
|
|
||||||
const bool cEvent::Initialize() const
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cEvent::Setup()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cEvent::CleanUp()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Checks for Events */
|
|
||||||
void cEvent::CheckEvents()
|
|
||||||
{
|
|
||||||
while ( SDL_PollEvent(&m_event)) {
|
|
||||||
iVector2 location = { 0, 0 };
|
|
||||||
switch (m_event.type)
|
|
||||||
{
|
|
||||||
case SDL_KEYUP:
|
|
||||||
case SDL_KEYDOWN:
|
|
||||||
case SDL_JOYAXISMOTION:
|
|
||||||
case SDL_JOYBALLMOTION:
|
|
||||||
case SDL_JOYHATMOTION:
|
|
||||||
case SDL_JOYBUTTONDOWN:
|
|
||||||
case SDL_JOYBUTTONUP:
|
|
||||||
InputEngine::cInput::Inst().CheckInputs(m_event);
|
|
||||||
break;
|
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
|
||||||
|
|
||||||
SDL_GetMouseState(&location.x, &location.y);
|
|
||||||
GUIEngine::cGUI::Inst().Event(location, GUIEngine::cGUI::eGUIEventType::MouseButton1);
|
|
||||||
break;
|
|
||||||
case SDL_MOUSEBUTTONUP:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///Sets
|
|
||||||
|
|
||||||
///Gets
|
|
||||||
/* Gets return true if Event was initialized */
|
|
||||||
const bool cEvent::IsInit() const
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio 14
|
|
||||||
VisualStudioVersion = 14.0.23107.0
|
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TrooperEngineDLL", "TrooperEngineDLL\TrooperEngineDLL.vcxproj", "{B6513FAA-8BDE-45AA-9F1E-326BCBE5D2E8}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TrooperEngineTest", "TrooperEngineTest\TrooperEngineTest.vcxproj", "{9225E043-EE77-43AA-A140-C9C2F85B1013}"
|
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
|
||||||
{B6513FAA-8BDE-45AA-9F1E-326BCBE5D2E8} = {B6513FAA-8BDE-45AA-9F1E-326BCBE5D2E8}
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDLPongCPP", "SDLPongCPP\SDLPongCPP.vcxproj", "{D0670630-6CBB-4894-BAC6-35FD775E8D8E}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SubversionScc) = preSolution
|
|
||||||
Svn-Managed = True
|
|
||||||
Manager = AnkhSVN - Subversion Support for Visual Studio
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Win32 = Debug|Win32
|
|
||||||
Debug|x64 = Debug|x64
|
|
||||||
Release|Win32 = Release|Win32
|
|
||||||
Release|x64 = Release|x64
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{B6513FAA-8BDE-45AA-9F1E-326BCBE5D2E8}.Debug|Win32.ActiveCfg = Debug|Win32
|
|
||||||
{B6513FAA-8BDE-45AA-9F1E-326BCBE5D2E8}.Debug|Win32.Build.0 = Debug|Win32
|
|
||||||
{B6513FAA-8BDE-45AA-9F1E-326BCBE5D2E8}.Debug|x64.ActiveCfg = Debug|Win32
|
|
||||||
{B6513FAA-8BDE-45AA-9F1E-326BCBE5D2E8}.Release|Win32.ActiveCfg = Release|Win32
|
|
||||||
{B6513FAA-8BDE-45AA-9F1E-326BCBE5D2E8}.Release|Win32.Build.0 = Release|Win32
|
|
||||||
{B6513FAA-8BDE-45AA-9F1E-326BCBE5D2E8}.Release|x64.ActiveCfg = Release|Win32
|
|
||||||
{9225E043-EE77-43AA-A140-C9C2F85B1013}.Debug|Win32.ActiveCfg = Debug|Win32
|
|
||||||
{9225E043-EE77-43AA-A140-C9C2F85B1013}.Debug|Win32.Build.0 = Debug|Win32
|
|
||||||
{9225E043-EE77-43AA-A140-C9C2F85B1013}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{9225E043-EE77-43AA-A140-C9C2F85B1013}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{9225E043-EE77-43AA-A140-C9C2F85B1013}.Release|Win32.ActiveCfg = Release|Win32
|
|
||||||
{9225E043-EE77-43AA-A140-C9C2F85B1013}.Release|Win32.Build.0 = Release|Win32
|
|
||||||
{9225E043-EE77-43AA-A140-C9C2F85B1013}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{9225E043-EE77-43AA-A140-C9C2F85B1013}.Release|x64.Build.0 = Release|x64
|
|
||||||
{D0670630-6CBB-4894-BAC6-35FD775E8D8E}.Debug|Win32.ActiveCfg = Debug|Win32
|
|
||||||
{D0670630-6CBB-4894-BAC6-35FD775E8D8E}.Debug|Win32.Build.0 = Debug|Win32
|
|
||||||
{D0670630-6CBB-4894-BAC6-35FD775E8D8E}.Debug|x64.ActiveCfg = Debug|Win32
|
|
||||||
{D0670630-6CBB-4894-BAC6-35FD775E8D8E}.Release|Win32.ActiveCfg = Release|Win32
|
|
||||||
{D0670630-6CBB-4894-BAC6-35FD775E8D8E}.Release|Win32.Build.0 = Release|Win32
|
|
||||||
{D0670630-6CBB-4894-BAC6-35FD775E8D8E}.Release|x64.ActiveCfg = Release|Win32
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
||||||
@@ -1,507 +0,0 @@
|
|||||||
#include "cWindow.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
#include "../FXEngine/cGFX.hpp"
|
|
||||||
#include "../UtilityEngine/cUtility.hpp"
|
|
||||||
|
|
||||||
#include "cGUI.hpp"
|
|
||||||
#include "cLabel.hpp"
|
|
||||||
#include "cLayout.hpp"
|
|
||||||
|
|
||||||
using GUIEngine::cWindow;
|
|
||||||
|
|
||||||
/*static*/ const UtilityEngine::cString cWindow::sNAME = "windows";
|
|
||||||
/*static*/ GUIHelpers::Position cWindow::sPOSITION = { 0, 0 };
|
|
||||||
/*static*/ GUIHelpers::Size cWindow::sSIZE = { 0, 0 };
|
|
||||||
/*static*/ GUIHelpers::Padding cWindow::sPADDING = { 5, 5, 5, 5 };
|
|
||||||
/*static*/ GUIHelpers::RGBA cWindow::sCOLOUR = { 100, 100, 100, 255 };
|
|
||||||
|
|
||||||
/*static*/ GUIHelpers::eAlign cWindow::sALIGN = GUIHelpers::eAlign::CENTER;
|
|
||||||
/*static*/ GUIHelpers::eLayout cWindow::sLAYOUT = GUIHelpers::eLayout::FILL_PARENT;
|
|
||||||
/*static*/ GUIHelpers::eOrientation cWindow::sORIENTATION = GUIHelpers::eOrientation::NONE;
|
|
||||||
|
|
||||||
cWindow::cWindow( cWindow* parent /*= nullptr*/, const signed int id /*= -1*/, const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/, 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*/ )
|
|
||||||
: cObject(id)
|
|
||||||
{
|
|
||||||
Create(parent, id, orientation, align, layout, pos, size, padding, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ cWindow::~cWindow()
|
|
||||||
{
|
|
||||||
for (unsigned int i = 0; i < m_children.size(); ++i) {
|
|
||||||
delete m_children[i];
|
|
||||||
m_children[i] = nullptr;
|
|
||||||
}
|
|
||||||
m_children.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ void cWindow::Create( cWindow* parent /*= nullptr*/, const signed int id /*= -1*/, const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/, 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_parent = parent;
|
|
||||||
cObject::setID(id);
|
|
||||||
setOrientation(orientation);
|
|
||||||
setAlign(align);
|
|
||||||
setLayout(layout);
|
|
||||||
setPosition(pos);
|
|
||||||
setSize(size);
|
|
||||||
setPadding(padding);
|
|
||||||
m_name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ void cWindow::Display() {
|
|
||||||
|
|
||||||
std::vector<cWindow*>::iterator it;
|
|
||||||
|
|
||||||
for (it = m_children.begin(); it < m_children.end(); it++) {
|
|
||||||
(*it)->Display();
|
|
||||||
}
|
|
||||||
|
|
||||||
DebugDisplay();
|
|
||||||
}
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
const bool cWindow::Inside( const MathEngine::iVector2& location ) const
|
|
||||||
{
|
|
||||||
bool rtn = false;
|
|
||||||
|
|
||||||
if ((location.x >= m_pos.x) && (location.y >= m_pos.y)) {
|
|
||||||
if ((location.x <= (m_pos.x + m_size.x)) && (location.y <= (m_pos.y + m_size.y)))
|
|
||||||
rtn = true;
|
|
||||||
}
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::AddChild( cWindow* obj )
|
|
||||||
{
|
|
||||||
m_children.push_back(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::RemoveChild( cWindow* obj )
|
|
||||||
{
|
|
||||||
std::vector<cWindow*>::iterator it;
|
|
||||||
|
|
||||||
for (it = m_children.begin(); it < m_children.end(); it++) {
|
|
||||||
if (obj == (*it)) {
|
|
||||||
m_children.erase(it);
|
|
||||||
//break out of the for loop
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///Sets
|
|
||||||
/*static*/ void cWindow::PositionDefault( const GUIHelpers::Position& pos )
|
|
||||||
{
|
|
||||||
if (pos.x >= 0)
|
|
||||||
sPOSITION = pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*static*/ void cWindow::SizeDefault( const GUIHelpers::Size& size )
|
|
||||||
{
|
|
||||||
if (size.x >= 0)
|
|
||||||
sSIZE = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*static*/ void cWindow::PaddingDefault( const GUIHelpers::Padding& pad )
|
|
||||||
{
|
|
||||||
if (pad.x >= 0)
|
|
||||||
sPADDING = pad;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*static*/ void cWindow::AlignDefault( const GUIHelpers::eAlign& align )
|
|
||||||
{
|
|
||||||
if (align != GUIHelpers::eAlign::DEFAULT_ALIGN)
|
|
||||||
sALIGN = align;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*static*/ void cWindow::LayoutDefault( const GUIHelpers::eLayout& layout )
|
|
||||||
{
|
|
||||||
if (layout != GUIHelpers::eLayout::DEFAULT_LAYOUT)
|
|
||||||
sLAYOUT = layout;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*static*/ void cWindow::OrientationDefault( const GUIHelpers::eOrientation& orientation )
|
|
||||||
{
|
|
||||||
if (orientation != GUIHelpers::eOrientation::DEFAULT_ORIENTATION)
|
|
||||||
sORIENTATION = orientation;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setOrientation( const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/ )
|
|
||||||
{
|
|
||||||
if (orientation == GUIHelpers::eOrientation::DEFAULT_ORIENTATION)
|
|
||||||
m_orientation = cWindow::sORIENTATION;
|
|
||||||
else
|
|
||||||
m_orientation = orientation;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setAlign( const GUIHelpers::eAlign& align /*= sALIGN*/ )
|
|
||||||
{
|
|
||||||
if (align == GUIHelpers::eAlign::DEFAULT_ALIGN)
|
|
||||||
m_align = cWindow::sALIGN;
|
|
||||||
else
|
|
||||||
m_align = align;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setLayout( const GUIHelpers::eLayout& layout /*= sLAYOUT*/ )
|
|
||||||
{
|
|
||||||
if (layout == GUIHelpers::eLayout::DEFAULT_LAYOUT)
|
|
||||||
m_layout = cWindow::sLAYOUT;
|
|
||||||
else
|
|
||||||
m_layout = layout;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setPosition( const GUIHelpers::Position& pos /*= POSITION*/ )
|
|
||||||
{
|
|
||||||
if (pos.x < 0)
|
|
||||||
m_pos = cWindow::sPOSITION;
|
|
||||||
else
|
|
||||||
m_pos = pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setSize( const GUIHelpers::Size& size /*= sSIZE*/ )
|
|
||||||
{
|
|
||||||
if (size.x < 0)
|
|
||||||
m_size = cWindow::sSIZE;
|
|
||||||
else
|
|
||||||
m_size = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setPadding( const GUIHelpers::Padding& padding /*= PADDING*/ )
|
|
||||||
{
|
|
||||||
if (padding.x < 0)
|
|
||||||
m_padding = cWindow::sPADDING;
|
|
||||||
else
|
|
||||||
m_padding = padding;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setContentSize( const GUIHelpers::Size& content )
|
|
||||||
{
|
|
||||||
m_content = content;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setName( const cString& name /*= NAME*/ )
|
|
||||||
{
|
|
||||||
m_name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setParent( cWindow* parent )
|
|
||||||
{
|
|
||||||
mp_parent = parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
///Gets
|
|
||||||
const GUIHelpers::Position cWindow::getCenter( const bool pad /*= true*/ ) const
|
|
||||||
{
|
|
||||||
GUIHelpers::Position rtn = { 0, 0 };
|
|
||||||
rtn.x = (m_size.x / 2) + m_pos.x;
|
|
||||||
rtn.y = (m_size.y / 2) + m_pos.y;
|
|
||||||
if (pad == true) {
|
|
||||||
rtn.x += (m_padding.x - m_padding.w);
|
|
||||||
rtn.y += (m_padding.y - m_padding.z);
|
|
||||||
}
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GUIHelpers::eOrientation& cWindow::getOrientation() const
|
|
||||||
{
|
|
||||||
return m_orientation;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GUIHelpers::eAlign& cWindow::getAlign() const
|
|
||||||
{
|
|
||||||
return m_align;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GUIHelpers::eLayout& cWindow::getLayout() const
|
|
||||||
{
|
|
||||||
if (m_layout == GUIHelpers::eLayout::MATCH_PARENT) {
|
|
||||||
if (mp_parent != nullptr)
|
|
||||||
return mp_parent->getLayout();
|
|
||||||
}
|
|
||||||
return m_layout;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GUIHelpers::Position cWindow::getPosition( const bool pad /*= true*/ ) const
|
|
||||||
{
|
|
||||||
GUIHelpers::Position rtn = m_pos;
|
|
||||||
|
|
||||||
if (pad == false) {
|
|
||||||
rtn.x -= m_padding.x;
|
|
||||||
rtn.y -= m_padding.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GUIHelpers::Size cWindow::getSize( const bool pad /*= true*/ ) const
|
|
||||||
{
|
|
||||||
GUIHelpers::Size rtn = m_size;
|
|
||||||
|
|
||||||
if (pad == true) {
|
|
||||||
rtn.x += m_padding.x + m_padding.w;
|
|
||||||
rtn.y += m_padding.y + m_padding.z;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GUIHelpers::Padding& cWindow::getPadding() const
|
|
||||||
{
|
|
||||||
return m_padding;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GUIHelpers::Size& cWindow::getContentSize() const
|
|
||||||
{
|
|
||||||
return m_content;
|
|
||||||
}
|
|
||||||
|
|
||||||
const cString& cWindow::getName() const
|
|
||||||
{
|
|
||||||
return m_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
cWindow* cWindow::getParent()
|
|
||||||
{
|
|
||||||
return mp_parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ const GUIHelpers::eType cWindow::getType() const
|
|
||||||
{
|
|
||||||
return GUIHelpers::eType::CWINDOW;
|
|
||||||
}
|
|
||||||
|
|
||||||
///Protected
|
|
||||||
|
|
||||||
/*virtual*/ void cWindow::Resize()
|
|
||||||
{
|
|
||||||
RebuildLayout(this->getLayout());
|
|
||||||
RePos();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ void cWindow::RebuildLayout( const GUIHelpers::eLayout& layout )
|
|
||||||
{
|
|
||||||
GUIHelpers::Size mySize = { 0, 0 };
|
|
||||||
std::vector<cWindow*>::iterator it;
|
|
||||||
|
|
||||||
switch (layout)
|
|
||||||
{
|
|
||||||
case GUIHelpers::eLayout::MATCH_PARENT:
|
|
||||||
case GUIHelpers::eLayout::FILL_PARENT:
|
|
||||||
if (mp_parent != nullptr) {
|
|
||||||
GUIHelpers::Position myPos = mp_parent->getPosition(false);
|
|
||||||
myPos.x += m_padding.x;
|
|
||||||
myPos.y += m_padding.y;
|
|
||||||
mySize = mp_parent->getSize(false);
|
|
||||||
mySize.x -= m_padding.x + m_padding.w;
|
|
||||||
mySize.y -= m_padding.y + m_padding.z;
|
|
||||||
m_pos = myPos;
|
|
||||||
m_size = mySize;
|
|
||||||
}
|
|
||||||
for (it = m_children.begin(); it < m_children.end(); it++) {
|
|
||||||
(*it)->Resize();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eLayout::WRAP_CONTENT:
|
|
||||||
GUIHelpers::Size size = { 0, 0 };
|
|
||||||
if (m_children.size() > 0) {
|
|
||||||
for (it = m_children.begin(); it < m_children.end(); it++) {
|
|
||||||
(*it)->Resize();
|
|
||||||
size = (*it)->getSize();
|
|
||||||
AddSize(size.x, size.y, mySize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (mp_parent != nullptr)
|
|
||||||
m_pos = mp_parent->getCenter();
|
|
||||||
}
|
|
||||||
m_size = mySize;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ void cWindow::RePos()
|
|
||||||
{
|
|
||||||
std::vector<cWindow*>::iterator it;
|
|
||||||
|
|
||||||
for (it = m_children.begin(); it < m_children.end(); it++) {
|
|
||||||
(*it)->RePos();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->getType() == GUIHelpers::eType::CLAYOUT) {
|
|
||||||
GUIHelpers::Position prtCenter = getCenter();
|
|
||||||
GUIHelpers::Position ourSet = prtCenter;
|
|
||||||
GUIHelpers::Size totalSize = { 0, 0 };
|
|
||||||
GUIHelpers::Position totalCenter = { 0, 0 };
|
|
||||||
|
|
||||||
for (it = m_children.begin(); it < m_children.end(); it++) {
|
|
||||||
totalSize += (*it)->getSize();
|
|
||||||
}
|
|
||||||
totalCenter.x = totalSize.x / 2;
|
|
||||||
totalCenter.y = totalSize.y / 2;
|
|
||||||
|
|
||||||
ourSet.x -= totalCenter.x;
|
|
||||||
ourSet.y -= totalCenter.y;
|
|
||||||
|
|
||||||
|
|
||||||
GUIHelpers::Position posSet = ourSet;
|
|
||||||
GUIHelpers::Position posNext = posSet;
|
|
||||||
for (it = m_children.begin(); it < m_children.end(); it++) {
|
|
||||||
posSet = posNext;
|
|
||||||
GUIHelpers::Padding pad = (*it)->getPadding();
|
|
||||||
GUIHelpers::Size size = (*it)->getSize(false);
|
|
||||||
if (m_orientation == GUIHelpers::eOrientation::HORIZONTAL) {
|
|
||||||
posSet.x += pad.x;
|
|
||||||
posSet.y = (pad.y - pad.z - (size.y / 2)) + prtCenter.y;
|
|
||||||
|
|
||||||
posNext = posSet;
|
|
||||||
|
|
||||||
posNext.x += size.x + pad.w;
|
|
||||||
//posNext.y = ourSet.y;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
posSet.x = (pad.x - pad.w - (size.x / 2)) + prtCenter.x;
|
|
||||||
posSet.y += pad.y;
|
|
||||||
|
|
||||||
posNext = posSet;
|
|
||||||
|
|
||||||
//posNext.x = ourSet.x;
|
|
||||||
posNext.y += size.y + pad.z;
|
|
||||||
}
|
|
||||||
|
|
||||||
(*it)->setPosition(posSet);
|
|
||||||
(*it)->RebuildPos();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ void cWindow::RebuildPos()
|
|
||||||
{
|
|
||||||
if (this->getAlign() != GUIHelpers::eAlign::CENTER) {
|
|
||||||
GUIHelpers::Position prtPos = mp_parent->getPosition();
|
|
||||||
GUIHelpers::Size prtSize = mp_parent->getSize();
|
|
||||||
|
|
||||||
GUIHelpers::Position pos = this->getPosition();
|
|
||||||
GUIHelpers::Size size = this->getSize();
|
|
||||||
|
|
||||||
GUIHelpers::Padding pad = this->getPadding();
|
|
||||||
|
|
||||||
if (mp_parent->getOrientation() == GUIHelpers::eOrientation::HORIZONTAL) {
|
|
||||||
switch (this->getAlign()) {
|
|
||||||
case GUIHelpers::eAlign::BOTTOM:
|
|
||||||
pos.y = prtSize.y - size.y;
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eAlign::TOP:
|
|
||||||
pos.y = prtPos.y + pad.y;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
switch (this->getAlign()) {
|
|
||||||
case GUIHelpers::eAlign::RIGHT:
|
|
||||||
pos.x = prtSize.x - size.x;
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eAlign::LEFT:
|
|
||||||
pos.x = prtPos.x + pad.x;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this->setPosition(pos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ const GUIHelpers::RGBA cWindow::getDebugColour() const
|
|
||||||
{
|
|
||||||
return GUIHelpers::WHITE;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<cWindow*>& cWindow::getChildren()
|
|
||||||
{
|
|
||||||
return m_children;
|
|
||||||
}
|
|
||||||
|
|
||||||
//private
|
|
||||||
void cWindow::AddSize( int x, int y, GUIHelpers::Size& mySize ) const
|
|
||||||
{
|
|
||||||
int& addFrom = x;
|
|
||||||
int& largestFrom = y;
|
|
||||||
|
|
||||||
int& addTo = mySize.x;
|
|
||||||
int& largestTo = mySize.y;
|
|
||||||
|
|
||||||
if (m_orientation == GUIHelpers::eOrientation::HORIZONTAL) {
|
|
||||||
addFrom = y;
|
|
||||||
largestFrom = x;
|
|
||||||
|
|
||||||
addTo = mySize.y;
|
|
||||||
largestTo = mySize.x;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*We do the real work here.*/
|
|
||||||
if (largestTo < largestFrom)
|
|
||||||
largestTo = largestFrom;
|
|
||||||
|
|
||||||
addTo += addFrom;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::DebugDisplay() const
|
|
||||||
{
|
|
||||||
unsigned long int debugLvl = GUIEngine::cGUI::Inst().getDebugLevel();
|
|
||||||
if (debugLvl > 0) {
|
|
||||||
SDL_Rect rect;
|
|
||||||
rect.x = m_pos.x;
|
|
||||||
rect.y = m_pos.y;
|
|
||||||
rect.w = m_pos.x + m_size.x;
|
|
||||||
rect.h = m_pos.y + m_size.y;
|
|
||||||
|
|
||||||
GUIHelpers::Position strPos = getCenter();
|
|
||||||
|
|
||||||
GUIHelpers::RGBA colour = getDebugColour();
|
|
||||||
FXEngine::cGFX::Inst().Pixel(strPos.x, strPos.y, colour);
|
|
||||||
|
|
||||||
cString str = "";
|
|
||||||
str.format("X: %d Y: %d", strPos.x, strPos.y);
|
|
||||||
FXEngine::cGFX::Inst().StringDefault(str, { strPos.x + 2, strPos.y + 2, 0, 0 }, colour);
|
|
||||||
|
|
||||||
if (debugLvl > 1) {
|
|
||||||
SDL_Rect typePos = { 2, 2, 0, 0 };
|
|
||||||
cString type = "";
|
|
||||||
switch (getType()) {
|
|
||||||
case GUIHelpers::eType::CPANEL:
|
|
||||||
type = "Panel";
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eType::CLAYOUT:
|
|
||||||
type = "Layout";
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eType::CLABEL:
|
|
||||||
typePos = { -10, -10, 0, 0 };
|
|
||||||
type = "Label";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
type = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
typePos.x += m_pos.x;
|
|
||||||
typePos.y += m_pos.y;
|
|
||||||
|
|
||||||
FXEngine::cGFX::Inst().StringDefault(type, typePos, colour);
|
|
||||||
|
|
||||||
// if (debugLvl > 2) {
|
|
||||||
// GUIHelpers::Position pos = getPosPPad();
|
|
||||||
// //GUIHelpers::Size size = getSizePPad();
|
|
||||||
// SDL_Rect box{ 0, 0, 0, 0 };
|
|
||||||
// box.x += pos.x;
|
|
||||||
// box.y += pos.y;
|
|
||||||
// box.h += pos.y + m_size.y + m_padding.y + m_padding.z;
|
|
||||||
// box.w += pos.x + m_padding.x;
|
|
||||||
//
|
|
||||||
// FXEngine::cGFX::Inst().Box(box, colour);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
FXEngine::cGFX::Inst().Rectangle(rect, colour);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#ifndef __MSUNIX__
|
|
||||||
#define __MSUNIX__
|
|
||||||
|
|
||||||
#define _MSUNIX_VERSION "1.0.0"
|
|
||||||
|
|
||||||
#include <cstdio>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <cstdarg>
|
|
||||||
|
|
||||||
int vasprintf(char ** ret, const char * format, va_list ap);
|
|
||||||
//int snprintf(char * str, size_t size, const char * format, ...);
|
|
||||||
int setenv(const char *name, const char *value, int overwrite);
|
|
||||||
|
|
||||||
#endif // __MSUNIX__
|
|
||||||
Binary file not shown.
@@ -1,47 +0,0 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio 14
|
|
||||||
VisualStudioVersion = 14.0.23107.0
|
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TrooperEngineDLL", "TrooperEngineDLL\TrooperEngineDLL.vcxproj", "{B6513FAA-8BDE-45AA-9F1E-326BCBE5D2E8}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TrooperEngineTest", "TrooperEngineTest\TrooperEngineTest.vcxproj", "{9225E043-EE77-43AA-A140-C9C2F85B1013}"
|
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
|
||||||
{B6513FAA-8BDE-45AA-9F1E-326BCBE5D2E8} = {B6513FAA-8BDE-45AA-9F1E-326BCBE5D2E8}
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDLPongCPP", "SDLPongCPP\SDLPongCPP.vcxproj", "{D0670630-6CBB-4894-BAC6-35FD775E8D8E}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Win32 = Debug|Win32
|
|
||||||
Debug|x64 = Debug|x64
|
|
||||||
Release|Win32 = Release|Win32
|
|
||||||
Release|x64 = Release|x64
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{B6513FAA-8BDE-45AA-9F1E-326BCBE5D2E8}.Debug|Win32.ActiveCfg = Debug|Win32
|
|
||||||
{B6513FAA-8BDE-45AA-9F1E-326BCBE5D2E8}.Debug|Win32.Build.0 = Debug|Win32
|
|
||||||
{B6513FAA-8BDE-45AA-9F1E-326BCBE5D2E8}.Debug|x64.ActiveCfg = Debug|Win32
|
|
||||||
{B6513FAA-8BDE-45AA-9F1E-326BCBE5D2E8}.Release|Win32.ActiveCfg = Release|Win32
|
|
||||||
{B6513FAA-8BDE-45AA-9F1E-326BCBE5D2E8}.Release|Win32.Build.0 = Release|Win32
|
|
||||||
{B6513FAA-8BDE-45AA-9F1E-326BCBE5D2E8}.Release|x64.ActiveCfg = Release|Win32
|
|
||||||
{9225E043-EE77-43AA-A140-C9C2F85B1013}.Debug|Win32.ActiveCfg = Debug|Win32
|
|
||||||
{9225E043-EE77-43AA-A140-C9C2F85B1013}.Debug|Win32.Build.0 = Debug|Win32
|
|
||||||
{9225E043-EE77-43AA-A140-C9C2F85B1013}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{9225E043-EE77-43AA-A140-C9C2F85B1013}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{9225E043-EE77-43AA-A140-C9C2F85B1013}.Release|Win32.ActiveCfg = Release|Win32
|
|
||||||
{9225E043-EE77-43AA-A140-C9C2F85B1013}.Release|Win32.Build.0 = Release|Win32
|
|
||||||
{9225E043-EE77-43AA-A140-C9C2F85B1013}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{9225E043-EE77-43AA-A140-C9C2F85B1013}.Release|x64.Build.0 = Release|x64
|
|
||||||
{D0670630-6CBB-4894-BAC6-35FD775E8D8E}.Debug|Win32.ActiveCfg = Debug|Win32
|
|
||||||
{D0670630-6CBB-4894-BAC6-35FD775E8D8E}.Debug|Win32.Build.0 = Debug|Win32
|
|
||||||
{D0670630-6CBB-4894-BAC6-35FD775E8D8E}.Debug|x64.ActiveCfg = Debug|Win32
|
|
||||||
{D0670630-6CBB-4894-BAC6-35FD775E8D8E}.Release|Win32.ActiveCfg = Release|Win32
|
|
||||||
{D0670630-6CBB-4894-BAC6-35FD775E8D8E}.Release|Win32.Build.0 = Release|Win32
|
|
||||||
{D0670630-6CBB-4894-BAC6-35FD775E8D8E}.Release|x64.ActiveCfg = Release|Win32
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
#ifndef _CWINDOW_HPP_
|
|
||||||
#define _CWINDOW_HPP_
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "GUIHelpers/cObject.hpp"
|
|
||||||
#include "GUIHelpers/Enums.hpp"
|
|
||||||
#include "GUIHelpers/GUIUtility.hpp"
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../UtilityEngine/cString.hpp"
|
|
||||||
|
|
||||||
using UtilityEngine::cString;
|
|
||||||
|
|
||||||
namespace GUIEngine {
|
|
||||||
class EXPORT_FROM_MYDLL cWindow : public GUIHelpers::cObject
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static const UtilityEngine::cString sNAME; /*= "windows";*/
|
|
||||||
static GUIHelpers::Position sPOSITION; /*= Position(0, 0);*/
|
|
||||||
static GUIHelpers::Size sSIZE; /*= Size(0, 0);*/
|
|
||||||
static GUIHelpers::Padding sPADDING; /*= Padding(5, 5, 5, 5);*/
|
|
||||||
static GUIHelpers::RBGA sCOLOUR; /*= { 100, 100, 100, 255 };*/
|
|
||||||
|
|
||||||
static GUIHelpers::eAlign sALIGN; /*= GUIHelpers::eAlign::CENTER;*/
|
|
||||||
static GUIHelpers::eLayout sLAYOUT; /*= FILL_PARENT*/
|
|
||||||
static GUIHelpers::eOrientation sORIENTATION; /*= GUIHelpers::eOrientation::NONE;*/
|
|
||||||
|
|
||||||
protected:
|
|
||||||
cWindow( cWindow* parent = nullptr, const signed int id = -1, const GUIHelpers::eOrientation& orientation = sORIENTATION, 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 );
|
|
||||||
virtual ~cWindow();
|
|
||||||
|
|
||||||
virtual void Create(cWindow* parent = nullptr, const signed int id = -1, const GUIHelpers::eOrientation& orientation = sORIENTATION, 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);
|
|
||||||
|
|
||||||
public:
|
|
||||||
///Functions
|
|
||||||
virtual void Display();
|
|
||||||
|
|
||||||
const bool Inside( const MathEngine::iVector2& location ) const;
|
|
||||||
|
|
||||||
void AddChild( cWindow* obj );
|
|
||||||
|
|
||||||
void RemoveChild( cWindow* obj );
|
|
||||||
|
|
||||||
///Sets
|
|
||||||
void setOrientation( const GUIHelpers::eOrientation& orientation = sORIENTATION );
|
|
||||||
void setAlign( const GUIHelpers::eAlign& align = sALIGN );
|
|
||||||
void setLayout( const GUIHelpers::eLayout& layout = sLAYOUT );
|
|
||||||
void setPosition( const GUIHelpers::Position& pos = sPOSITION );
|
|
||||||
void setSize( const GUIHelpers::Size& size = sSIZE );
|
|
||||||
void setPadding(const GUIHelpers::Padding& padding = sPADDING);
|
|
||||||
void setContentSize( const GUIHelpers::Size& content );
|
|
||||||
void setName( const cString& name = sNAME );
|
|
||||||
|
|
||||||
void setParent( cWindow* parent );
|
|
||||||
|
|
||||||
///Gets
|
|
||||||
const GUIHelpers::eOrientation& getOrientation() const;
|
|
||||||
const GUIHelpers::eAlign& getAlign() const;
|
|
||||||
const GUIHelpers::eLayout& getLayout() const;
|
|
||||||
const GUIHelpers::Position& getPosition() const;
|
|
||||||
const GUIHelpers::Size& getSize() const;
|
|
||||||
const GUIHelpers::Padding& getPadding() const;
|
|
||||||
const GUIHelpers::Size& getContentSize() const;
|
|
||||||
const cString& getName() const;
|
|
||||||
|
|
||||||
cWindow* getParent();
|
|
||||||
|
|
||||||
virtual const GUIHelpers::eType getType() const;
|
|
||||||
|
|
||||||
virtual void Resize();
|
|
||||||
virtual void RebuildLayout(const GUIHelpers::eLayout& layout);
|
|
||||||
|
|
||||||
virtual void RePos();
|
|
||||||
virtual void RebuildPos();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
std::vector<cWindow*>& getChildren();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void Rebuild( cWindow* const parent, const GUIHelpers::eLayout& layout );
|
|
||||||
|
|
||||||
void AddSize(int x, int y, GUIHelpers::Size& mySize) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
GUIHelpers::eOrientation m_orientation;// = GUIHelper::eOrientation::NONE;
|
|
||||||
GUIHelpers::eAlign m_align;// = GUIHelper::eAlign::CENTER;
|
|
||||||
GUIHelpers::eLayout m_layout;// = GUIHelper::eLayout::FILL_PARENT;
|
|
||||||
GUIHelpers::Position m_pos;// = POSITION;
|
|
||||||
GUIHelpers::Size m_size;// = SIZE;
|
|
||||||
GUIHelpers::Padding m_padding;// = PADDING;
|
|
||||||
GUIHelpers::Size m_content;// = m_size;
|
|
||||||
cString m_name;// = NAME;
|
|
||||||
|
|
||||||
std::vector<cWindow*> m_children;
|
|
||||||
cWindow* mp_parent;// = nullptr;
|
|
||||||
};/// END CLASS DEFINITION cBoxSizer
|
|
||||||
}/// END NAMESPACE DEFINITION GUIEngine
|
|
||||||
#endif/// END IFNDEF _CBOXSIZER_HPP_
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
#ifndef _IVECTOR4_HPP_
|
|
||||||
#define _IVECTOR4_HPP_
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
/*** Custom Header File ***/
|
|
||||||
#include "iVector3.hpp"
|
|
||||||
|
|
||||||
namespace MathEngine {
|
|
||||||
struct Vector4;
|
|
||||||
|
|
||||||
struct EXPORT_FROM_MYDLL iVector4 : public iVector3
|
|
||||||
{
|
|
||||||
iVector4( const int X = 0, const int Y = 0, const int Z = 0, const int W = 0 );
|
|
||||||
|
|
||||||
iVector4( const iVector2& copy );
|
|
||||||
|
|
||||||
iVector4( const iVector3& copy );
|
|
||||||
|
|
||||||
iVector4( const SDL_Rect& copy );
|
|
||||||
|
|
||||||
iVector4& operator=( const SDL_Rect& copy );
|
|
||||||
|
|
||||||
bool operator==( const SDL_Rect& other ) const;
|
|
||||||
|
|
||||||
iVector4( const Vector4& copy );
|
|
||||||
|
|
||||||
iVector4& operator=( const Vector4& copy );
|
|
||||||
|
|
||||||
bool operator==( const iVector4& other ) const;
|
|
||||||
|
|
||||||
int w;
|
|
||||||
};/// END STRUCT DEFINITION iVector4
|
|
||||||
}/// END NAMESPACE DEFINITION MathEngine
|
|
||||||
#endif/// END IFNDEF _IVECTOR4_HPP_
|
|
||||||
@@ -1,393 +0,0 @@
|
|||||||
#include "cString.hpp"
|
|
||||||
|
|
||||||
/*** ANSI C Header Files ***/
|
|
||||||
#include <stdlib.h> /* strtol */
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
// disable _s warnings
|
|
||||||
# define _CRT_SECURE_NO_WARNINGS
|
|
||||||
// disable pragma warnings
|
|
||||||
# pragma warning( disable : 4068 )
|
|
||||||
# pragma warning( disable : 4996 )
|
|
||||||
# include "MSUNIX/msunix.hpp"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using UtilityEngine::cString;
|
|
||||||
|
|
||||||
cString::cString()
|
|
||||||
{
|
|
||||||
clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
cString::cString(const char* s)
|
|
||||||
{
|
|
||||||
copy_str(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
cString::cString(const cString& copy)
|
|
||||||
{
|
|
||||||
copy_str(copy);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
cString::~cString()
|
|
||||||
{
|
|
||||||
clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* cString::alloc_str(size_t sz)
|
|
||||||
{
|
|
||||||
if (mp_str)
|
|
||||||
clear();
|
|
||||||
m_len = (sz > __cString__MAX_LEN) ? __cString__MAX_LEN : sz;
|
|
||||||
mp_str = (char *)calloc(1, m_len + 1);
|
|
||||||
return mp_str;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cString::clear()
|
|
||||||
{
|
|
||||||
if (mp_str)
|
|
||||||
free((void *)mp_str);
|
|
||||||
mp_str = nullptr;
|
|
||||||
m_len = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* cString::c_str() const
|
|
||||||
{
|
|
||||||
return mp_str;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* cString::copy_str(const char* copy)
|
|
||||||
{
|
|
||||||
if (copy) {
|
|
||||||
size_t len = strnlen(copy, __cString__MAX_LEN);
|
|
||||||
alloc_str(len);
|
|
||||||
strncpy((char *)mp_str, copy, len);
|
|
||||||
m_len = len;
|
|
||||||
}
|
|
||||||
return mp_str;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cString::have_value() const
|
|
||||||
{
|
|
||||||
if (mp_str)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t cString::length() const
|
|
||||||
{
|
|
||||||
return m_len;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t cString::size() const
|
|
||||||
{
|
|
||||||
return m_len;
|
|
||||||
}
|
|
||||||
|
|
||||||
// string format
|
|
||||||
cString& cString::format(const char* format, ...)
|
|
||||||
{
|
|
||||||
char * buffer;
|
|
||||||
|
|
||||||
va_list args;
|
|
||||||
va_start(args, format);
|
|
||||||
|
|
||||||
vasprintf(&buffer, format, args);
|
|
||||||
copy_str(buffer);
|
|
||||||
free(buffer);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
// trim leading and trailing spaces
|
|
||||||
cString& cString::trim()
|
|
||||||
{
|
|
||||||
const static char * whitespace = "\x20\x1b\t\r\n\v\b\f\a";
|
|
||||||
|
|
||||||
if (!have_value())
|
|
||||||
return *this; // make sure we have a string
|
|
||||||
|
|
||||||
size_t begin = 0;
|
|
||||||
size_t end = length() - 1;
|
|
||||||
|
|
||||||
for (begin = 0; begin <= end; ++begin) {
|
|
||||||
if (strchr(whitespace, mp_str[begin]) == nullptr) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (; end > begin; --end) {
|
|
||||||
if (strchr(whitespace, mp_str[end]) == nullptr) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
mp_str[end] = '\0';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (begin) {
|
|
||||||
for (size_t i = 0; mp_str[i]; ++i) {
|
|
||||||
mp_str[i] = mp_str[begin++];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_len = strlen(mp_str);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
cString cString::lower() const
|
|
||||||
{
|
|
||||||
cString rs = *this;
|
|
||||||
for (size_t i = 0; rs.mp_str[i]; ++i) {
|
|
||||||
rs.mp_str[i] = (char)tolower(rs.mp_str[i]);
|
|
||||||
}
|
|
||||||
return rs;
|
|
||||||
}
|
|
||||||
|
|
||||||
cString cString::upper() const
|
|
||||||
{
|
|
||||||
cString rs = *this;
|
|
||||||
for (size_t i = 0; rs.mp_str[i]; ++i) {
|
|
||||||
rs.mp_str[i] = (char)toupper(rs.mp_str[i]);
|
|
||||||
}
|
|
||||||
return rs;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char & cString::last_char() const
|
|
||||||
{
|
|
||||||
return mp_str[length() - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
// non-destructive split
|
|
||||||
const std::vector<cString> cString::split(const char match) const
|
|
||||||
{
|
|
||||||
const char match_s[2] = { match, 0 };
|
|
||||||
return split(match_s, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::vector<cString> cString::split(const char* match) const
|
|
||||||
{
|
|
||||||
return split(match, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::vector<cString> cString::split(const char* match, int max_split) const
|
|
||||||
{
|
|
||||||
std::vector<cString> rv;
|
|
||||||
if (length() < 1)
|
|
||||||
return rv;
|
|
||||||
size_t match_len = strnlen(match, __cString__MAX_LEN);
|
|
||||||
if (match_len >= __cString__MAX_LEN)
|
|
||||||
return rv;
|
|
||||||
|
|
||||||
char * mi; // match index
|
|
||||||
char * pstr = mp_str; // string pointer
|
|
||||||
mi = strstr(pstr, match);
|
|
||||||
while ((mi) && (max_split < 0 || --max_split)) {
|
|
||||||
if (mi != pstr) {
|
|
||||||
size_t lhsz = mi - pstr;
|
|
||||||
char * cslhs = (char *)malloc(lhsz + 1);
|
|
||||||
cslhs[lhsz] = '\0'; // strncpy doesn't terminate it
|
|
||||||
rv.emplace_back(strncpy(cslhs, pstr, lhsz)); // calls BWString copy ctor
|
|
||||||
pstr += lhsz;
|
|
||||||
free(cslhs);
|
|
||||||
}
|
|
||||||
pstr += match_len;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*pstr != '\0') {
|
|
||||||
rv.emplace_back(pstr);
|
|
||||||
}
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
const cString& cString::char_repl(const char& match, const char& repl)
|
|
||||||
{
|
|
||||||
for (size_t i = 0; mp_str[i]; ++i) {
|
|
||||||
if (mp_str[i] == match) mp_str[i] = repl;
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
long int cString::char_find(const char& match) const
|
|
||||||
{
|
|
||||||
for (size_t i = 0; mp_str[i]; ++i) {
|
|
||||||
if (mp_str[i] == match)
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
cString cString::substr(size_t start, size_t length) const
|
|
||||||
{
|
|
||||||
cString rs;
|
|
||||||
char * buf;
|
|
||||||
if ((length + 1) > __cString__MAX_LEN)
|
|
||||||
return rs;
|
|
||||||
if ((start + length) > __cString__MAX_LEN)
|
|
||||||
return rs;
|
|
||||||
if (length > m_len - start)
|
|
||||||
return rs;
|
|
||||||
if (!mp_str)
|
|
||||||
return rs;
|
|
||||||
|
|
||||||
buf = (char *)calloc(sizeof(char), length + 1);
|
|
||||||
memcpy(buf, mp_str + start, length);
|
|
||||||
rs = buf;
|
|
||||||
return rs;
|
|
||||||
}
|
|
||||||
|
|
||||||
long int cString::find(const cString& match)
|
|
||||||
{
|
|
||||||
char * pos = strstr(mp_str, match.c_str());
|
|
||||||
if (pos)
|
|
||||||
return (long)(pos - mp_str);
|
|
||||||
else
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
const cString cString::replace(const cString& match, const cString& repl)
|
|
||||||
{
|
|
||||||
cString rs;
|
|
||||||
long f1 = find(match);
|
|
||||||
if (f1 >= 0) {
|
|
||||||
size_t pos1 = (size_t)f1;
|
|
||||||
size_t pos2 = pos1 + match.length();
|
|
||||||
cString s1 = pos1 > 0 ? substr(0, pos1) : "";
|
|
||||||
cString s2 = substr(pos2, length() - pos2);
|
|
||||||
rs = s1 + repl + s2;
|
|
||||||
}
|
|
||||||
return rs;
|
|
||||||
}
|
|
||||||
|
|
||||||
const long int cString::ToInt() const
|
|
||||||
{
|
|
||||||
return strtol(mp_str, NULL, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
cString& cString::operator = (const char* rhs)
|
|
||||||
{
|
|
||||||
copy_str(rhs);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
cString& cString::operator = (const cString& rhs)
|
|
||||||
{
|
|
||||||
copy_str(rhs.c_str());
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
cString& cString::operator += (const char rhs)
|
|
||||||
{
|
|
||||||
operator+=(&rhs);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
cString& cString::operator += (const char* rhs)
|
|
||||||
{
|
|
||||||
if (rhs) {
|
|
||||||
size_t newlen = m_len + strnlen(rhs, __cString__MAX_LEN);
|
|
||||||
if (newlen > __cString__MAX_LEN)
|
|
||||||
newlen = __cString__MAX_LEN;
|
|
||||||
char * buf = (char *)calloc(1, newlen + 1);
|
|
||||||
if (!buf)
|
|
||||||
return *this;
|
|
||||||
|
|
||||||
if (mp_str && m_len)
|
|
||||||
strncpy(buf, mp_str, m_len);
|
|
||||||
strncpy(buf + m_len, rhs, newlen - m_len);
|
|
||||||
|
|
||||||
buf[newlen] = '\0';
|
|
||||||
copy_str(buf);
|
|
||||||
free(buf);
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
cString& cString::operator += (const cString& rhs)
|
|
||||||
{
|
|
||||||
operator+=(rhs.c_str());
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cString::operator == (const char* rhs) const
|
|
||||||
{
|
|
||||||
if (std::strncmp(this->c_str(), rhs, __cString__MAX_LEN) == 0)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cString::operator == (const cString & rhs) const
|
|
||||||
{
|
|
||||||
if (std::strncmp(this->c_str(), rhs.c_str(), __cString__MAX_LEN) == 0)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cString::operator != (const char* rhs) const
|
|
||||||
{
|
|
||||||
if (std::strncmp(this->c_str(), rhs, __cString__MAX_LEN) != 0)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cString::operator != (const cString & rhs) const
|
|
||||||
{
|
|
||||||
if (std::strncmp(this->c_str(), rhs.c_str(), __cString__MAX_LEN) != 0)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cString::operator > (const cString & rhs) const
|
|
||||||
{
|
|
||||||
if (std::strncmp(this->c_str(), rhs.c_str(), __cString__MAX_LEN) > 0)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cString::operator < (const cString & rhs) const
|
|
||||||
{
|
|
||||||
if (std::strncmp(this->c_str(), rhs.c_str(), __cString__MAX_LEN) < 0)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cString::operator >= (const cString & rhs) const
|
|
||||||
{
|
|
||||||
if (std::strncmp(this->c_str(), rhs.c_str(), __cString__MAX_LEN) >= 0)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cString::operator <= (const cString & rhs) const
|
|
||||||
{
|
|
||||||
if (std::strncmp(this->c_str(), rhs.c_str(), __cString__MAX_LEN) <= 0)
|
|
||||||
return true;
|
|
||||||
else return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
cString::operator const char* () const
|
|
||||||
{
|
|
||||||
return c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
cString::operator std::string () const
|
|
||||||
{
|
|
||||||
return std::string(c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
cString operator + (const cString& lhs, const cString& rhs)
|
|
||||||
{
|
|
||||||
cString rs = lhs;
|
|
||||||
rs += rhs;
|
|
||||||
return rs;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,325 +0,0 @@
|
|||||||
#include "GUIXMLTest.hpp"
|
|
||||||
|
|
||||||
void GUIXMLTest()
|
|
||||||
{
|
|
||||||
// cString
|
|
||||||
printf("\nTesting GUI XML Test -----\n\n");
|
|
||||||
|
|
||||||
GUIXMLDefaultTest();
|
|
||||||
|
|
||||||
GUIXMLPositionTest();
|
|
||||||
|
|
||||||
GUIXMLAlignTest();
|
|
||||||
|
|
||||||
// GUIXMLAlignTest(GUIHelpers::eAlign::LEFT, GUIHelpers::eAlign::LEFT, GUIHelpers::eAlign::LEFT);
|
|
||||||
// GUIXMLAlignTest(GUIHelpers::eAlign::CENTER, GUIHelpers::eAlign::LEFT, GUIHelpers::eAlign::LEFT);
|
|
||||||
// GUIXMLAlignTest(GUIHelpers::eAlign::RIGHT, GUIHelpers::eAlign::LEFT, GUIHelpers::eAlign::LEFT);
|
|
||||||
//
|
|
||||||
// GUIXMLAlignTest(GUIHelpers::eAlign::LEFT, GUIHelpers::eAlign::LEFT, GUIHelpers::eAlign::LEFT);
|
|
||||||
// GUIXMLAlignTest(GUIHelpers::eAlign::CENTER, GUIHelpers::eAlign::CENTER, GUIHelpers::eAlign::LEFT);
|
|
||||||
// GUIXMLAlignTest(GUIHelpers::eAlign::RIGHT, GUIHelpers::eAlign::RIGHT, GUIHelpers::eAlign::LEFT);
|
|
||||||
//
|
|
||||||
// GUIXMLAlignTest(GUIHelpers::eAlign::LEFT, GUIHelpers::eAlign::LEFT, GUIHelpers::eAlign::LEFT);
|
|
||||||
// GUIXMLAlignTest(GUIHelpers::eAlign::CENTER, GUIHelpers::eAlign::CENTER, GUIHelpers::eAlign::CENTER);
|
|
||||||
// GUIXMLAlignTest(GUIHelpers::eAlign::RIGHT, GUIHelpers::eAlign::RIGHT, GUIHelpers::eAlign::RIGHT);
|
|
||||||
//
|
|
||||||
// //////////////////////////////////////////////////////////////////////////
|
|
||||||
// GUIXMLAlignTest(GUIHelpers::eAlign::LEFT, GUIHelpers::eAlign::LEFT, GUIHelpers::eAlign::LEFT);
|
|
||||||
// GUIXMLAlignTest(GUIHelpers::eAlign::LEFT, GUIHelpers::eAlign::LEFT, GUIHelpers::eAlign::CENTER);
|
|
||||||
// GUIXMLAlignTest(GUIHelpers::eAlign::LEFT, GUIHelpers::eAlign::LEFT, GUIHelpers::eAlign::RIGHT);
|
|
||||||
//
|
|
||||||
// GUIXMLAlignTest(GUIHelpers::eAlign::LEFT, GUIHelpers::eAlign::LEFT, GUIHelpers::eAlign::LEFT);
|
|
||||||
// GUIXMLAlignTest(GUIHelpers::eAlign::LEFT, GUIHelpers::eAlign::CENTER, GUIHelpers::eAlign::CENTER);
|
|
||||||
// GUIXMLAlignTest(GUIHelpers::eAlign::LEFT, GUIHelpers::eAlign::RIGHT, GUIHelpers::eAlign::RIGHT);
|
|
||||||
|
|
||||||
GUIXMLAlignTest(GUIHelpers::eAlign::TOP, GUIHelpers::eAlign::TOP, GUIHelpers::TOP, GUIHelpers::eOrientation::HORIZONTAL);
|
|
||||||
GUIXMLAlignTest(GUIHelpers::eAlign::CENTER, GUIHelpers::eAlign::TOP, GUIHelpers::TOP, GUIHelpers::eOrientation::HORIZONTAL);
|
|
||||||
GUIXMLAlignTest(GUIHelpers::eAlign::BOTTOM, GUIHelpers::eAlign::TOP, GUIHelpers::TOP, GUIHelpers::eOrientation::HORIZONTAL);
|
|
||||||
|
|
||||||
GUIXMLAlignTest(GUIHelpers::eAlign::TOP, GUIHelpers::eAlign::TOP, GUIHelpers::TOP, GUIHelpers::eOrientation::HORIZONTAL);
|
|
||||||
GUIXMLAlignTest(GUIHelpers::eAlign::CENTER, GUIHelpers::eAlign::CENTER, GUIHelpers::TOP, GUIHelpers::eOrientation::HORIZONTAL);
|
|
||||||
GUIXMLAlignTest(GUIHelpers::eAlign::BOTTOM, GUIHelpers::eAlign::BOTTOM, GUIHelpers::TOP, GUIHelpers::eOrientation::HORIZONTAL);
|
|
||||||
|
|
||||||
GUIXMLAlignTest(GUIHelpers::eAlign::TOP, GUIHelpers::eAlign::TOP, GUIHelpers::TOP, GUIHelpers::eOrientation::HORIZONTAL);
|
|
||||||
GUIXMLAlignTest(GUIHelpers::eAlign::CENTER, GUIHelpers::eAlign::CENTER, GUIHelpers::CENTER, GUIHelpers::eOrientation::HORIZONTAL);
|
|
||||||
GUIXMLAlignTest(GUIHelpers::eAlign::BOTTOM, GUIHelpers::eAlign::BOTTOM, GUIHelpers::BOTTOM, GUIHelpers::eOrientation::HORIZONTAL);
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
GUIXMLAlignTest(GUIHelpers::eAlign::TOP, GUIHelpers::eAlign::TOP, GUIHelpers::TOP, GUIHelpers::eOrientation::HORIZONTAL);
|
|
||||||
GUIXMLAlignTest(GUIHelpers::eAlign::TOP, GUIHelpers::eAlign::TOP, GUIHelpers::CENTER, GUIHelpers::eOrientation::HORIZONTAL);
|
|
||||||
GUIXMLAlignTest(GUIHelpers::eAlign::TOP, GUIHelpers::eAlign::TOP, GUIHelpers::BOTTOM, GUIHelpers::eOrientation::HORIZONTAL);
|
|
||||||
|
|
||||||
GUIXMLAlignTest(GUIHelpers::eAlign::TOP, GUIHelpers::eAlign::TOP, GUIHelpers::TOP, GUIHelpers::eOrientation::HORIZONTAL);
|
|
||||||
GUIXMLAlignTest(GUIHelpers::eAlign::TOP, GUIHelpers::eAlign::CENTER, GUIHelpers::CENTER, GUIHelpers::eOrientation::HORIZONTAL);
|
|
||||||
GUIXMLAlignTest(GUIHelpers::eAlign::TOP, GUIHelpers::eAlign::BOTTOM, GUIHelpers::BOTTOM, GUIHelpers::eOrientation::HORIZONTAL);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void GUIXMLDefaultTest()
|
|
||||||
{
|
|
||||||
UTest u("GUI XML Default");
|
|
||||||
|
|
||||||
LoadFile("GUIXMLDefaultTest.xml");
|
|
||||||
|
|
||||||
std::vector<GUIEngine::cWindow*> objects = GUIEngine::cGUI::Inst().GetObjects();
|
|
||||||
|
|
||||||
GUIEngine::cPanel* panel = (GUIEngine::cPanel*)objects[0];
|
|
||||||
|
|
||||||
Settings sets;
|
|
||||||
sets.pos = { 0, 0 };
|
|
||||||
sets.size = { 200, 200 };
|
|
||||||
sets.pad = { 0, 0, 0, 0 };
|
|
||||||
sets.center = { 100, 100 };
|
|
||||||
|
|
||||||
cWindowTest("Panel", u, panel, sets);
|
|
||||||
|
|
||||||
GUIEngine::cLayout* layout = (GUIEngine::cLayout*)panel->getChildren()[0];
|
|
||||||
|
|
||||||
sets.pos = { 5, 5 };
|
|
||||||
sets.size = { 190, 190 };
|
|
||||||
sets.pad = { 5, 5, 5, 5 };
|
|
||||||
|
|
||||||
|
|
||||||
cWindowTest("Layout", u, layout, sets);
|
|
||||||
|
|
||||||
GUIEngine::cLabel* label = (GUIEngine::cLabel*)layout->getChildren()[0];
|
|
||||||
|
|
||||||
|
|
||||||
sets.pos = { 56, 96 };
|
|
||||||
sets.size = { 88, 8 };
|
|
||||||
|
|
||||||
cWindowTest("Label", u, label, sets);
|
|
||||||
|
|
||||||
u.report();
|
|
||||||
|
|
||||||
GUIEngine::cGUI::Inst().Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GUIXMLPositionTest()
|
|
||||||
{
|
|
||||||
UTest u("GUI XML Position");
|
|
||||||
|
|
||||||
LoadFile("GUIXMLPositionTest.xml");
|
|
||||||
|
|
||||||
std::vector<GUIEngine::cWindow*> objects = GUIEngine::cGUI::Inst().GetObjects();
|
|
||||||
|
|
||||||
|
|
||||||
GUIEngine::cPanel* panel = (GUIEngine::cPanel*)objects[0];
|
|
||||||
|
|
||||||
Settings sets;
|
|
||||||
sets.pos = { 20, 20 };
|
|
||||||
sets.size = { 200, 200 };
|
|
||||||
sets.pad = { 0, 0, 0, 0 };
|
|
||||||
sets.center = { 120, 120 };
|
|
||||||
|
|
||||||
cWindowTest("Panel", u, panel, sets);
|
|
||||||
|
|
||||||
|
|
||||||
GUIEngine::cLayout* layout = (GUIEngine::cLayout*)panel->getChildren()[0];
|
|
||||||
|
|
||||||
sets.pos = { 25, 25 };
|
|
||||||
sets.size = { 190, 190 };
|
|
||||||
sets.pad = { 5, 5, 5, 5 };
|
|
||||||
|
|
||||||
cWindowTest("Layout", u, layout, sets);
|
|
||||||
|
|
||||||
|
|
||||||
GUIEngine::cLabel* label = (GUIEngine::cLabel*)layout->getChildren()[0];
|
|
||||||
|
|
||||||
sets.pos = { 76, 116 };
|
|
||||||
sets.size = { 88, 8 };
|
|
||||||
|
|
||||||
cWindowTest("Label", u, label, sets);
|
|
||||||
|
|
||||||
u.report();
|
|
||||||
|
|
||||||
GUIEngine::cGUI::Inst().Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GUIXMLAlignTest( const GUIHelpers::eAlign one /*= GUIHelpers::eAlign::DEFAULT_ALIGN*/, const GUIHelpers::eAlign two /*= GUIHelpers::eAlign::DEFAULT_ALIGN*/,
|
|
||||||
const GUIHelpers::eAlign three /*= GUIHelpers::eAlign::DEFAULT_ALIGN*/, const GUIHelpers::eOrientation orientation /*= GUIHelpers::eOrientation::DEFAULT_ORIENTATION*/ )
|
|
||||||
{
|
|
||||||
UTest u("GUI XML Align");
|
|
||||||
|
|
||||||
LoadFile("GUIXMLAlignTest.xml");
|
|
||||||
|
|
||||||
std::vector<GUIEngine::cWindow*> objects = GUIEngine::cGUI::Inst().GetObjects();
|
|
||||||
|
|
||||||
GUIEngine::cPanel* panel = (GUIEngine::cPanel*)objects[0];
|
|
||||||
|
|
||||||
Settings sets;
|
|
||||||
sets.pos = { 0, 0 };
|
|
||||||
sets.size = { 400, 400 };
|
|
||||||
sets.pad = { 0, 0, 0, 0 };
|
|
||||||
sets.center = { 200, 200 };
|
|
||||||
|
|
||||||
cWindowTest("Panel", u, panel, sets);
|
|
||||||
|
|
||||||
GUIEngine::cLayout* layout = (GUIEngine::cLayout*)panel->getChildren()[0];
|
|
||||||
|
|
||||||
if (orientation != GUIHelpers::eOrientation::DEFAULT_ORIENTATION)
|
|
||||||
layout->setOrientation(orientation);
|
|
||||||
|
|
||||||
sets.pos = { 5, 5 };
|
|
||||||
sets.size = { 390, 390 };
|
|
||||||
sets.pad = { 5, 5, 5, 5 };
|
|
||||||
|
|
||||||
cWindowTest("Layout", u, layout, sets);
|
|
||||||
|
|
||||||
GUIEngine::cLabel* label = (GUIEngine::cLabel*)layout->getChildren()[0];
|
|
||||||
|
|
||||||
cString msg = "";
|
|
||||||
|
|
||||||
if (one != GUIHelpers::eAlign::DEFAULT_ALIGN)
|
|
||||||
label->setAlign(one);
|
|
||||||
|
|
||||||
switch (label->getAlign()) {
|
|
||||||
case GUIHelpers::eAlign::TOP:
|
|
||||||
msg = "Top";
|
|
||||||
sets.pos = { 10, 10 };
|
|
||||||
sets.center = { 74, 14};
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eAlign::BOTTOM:
|
|
||||||
msg = "Bottom";
|
|
||||||
sets.pos = { 10, 382 };
|
|
||||||
sets.center = { 74, 386 };
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eAlign::LEFT:
|
|
||||||
msg = "Left";
|
|
||||||
sets.pos = { 10, 178 };
|
|
||||||
sets.center = { 74, 182 };
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eAlign::CENTER:
|
|
||||||
msg = "Center";
|
|
||||||
sets.pos = { 136, 178 };
|
|
||||||
sets.center = { 200, 182 };
|
|
||||||
if (layout->getOrientation() == GUIHelpers::eOrientation::HORIZONTAL) {
|
|
||||||
sets.pos = { 10, 196 };
|
|
||||||
sets.center = { 74, 200 };
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eAlign::RIGHT:
|
|
||||||
msg = "Right";
|
|
||||||
sets.pos = { 262, 178 };
|
|
||||||
sets.center = { 326, 182 };
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
sets.size = { 128, 8 };
|
|
||||||
|
|
||||||
cWindowTest("Label 'Hello world One' " + msg, u, label, sets);
|
|
||||||
|
|
||||||
label = (GUIEngine::cLabel*)layout->getChildren()[1];
|
|
||||||
|
|
||||||
if (two != GUIHelpers::eAlign::DEFAULT_ALIGN)
|
|
||||||
label->setAlign(two);
|
|
||||||
|
|
||||||
switch (label->getAlign()) {
|
|
||||||
case GUIHelpers::eAlign::TOP:
|
|
||||||
msg = "Top";
|
|
||||||
sets.pos = { 128, 10 };
|
|
||||||
sets.center = { 200, 14 };
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eAlign::BOTTOM:
|
|
||||||
msg = "Bottom";
|
|
||||||
sets.pos = { 128, 382 };
|
|
||||||
sets.center = { 200, 386 };
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eAlign::LEFT:
|
|
||||||
msg = "Left";
|
|
||||||
sets.pos = { 10, 196 };
|
|
||||||
sets.center = { 82, 200 };
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eAlign::CENTER:
|
|
||||||
msg = "Center";
|
|
||||||
sets.pos = { 128, 196 };
|
|
||||||
sets.center = { 200, 200 };
|
|
||||||
if (layout->getOrientation() == GUIHelpers::eOrientation::HORIZONTAL) {
|
|
||||||
sets.pos = { 128, 196 };
|
|
||||||
sets.center = { 200, 200 };
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eAlign::RIGHT:
|
|
||||||
msg = "Right";
|
|
||||||
sets.pos = { 246, 196 };
|
|
||||||
sets.center = { 318, 200 };
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
sets.size = { 144, 8 };
|
|
||||||
|
|
||||||
cWindowTest("Label 'Hello world Two' " + msg, u, label, sets);
|
|
||||||
|
|
||||||
label = (GUIEngine::cLabel*)layout->getChildren()[2];
|
|
||||||
|
|
||||||
if (three != GUIHelpers::eAlign::DEFAULT_ALIGN)
|
|
||||||
label->setAlign(three);
|
|
||||||
|
|
||||||
switch (label->getAlign()) {
|
|
||||||
case GUIHelpers::eAlign::TOP:
|
|
||||||
msg = "Top";
|
|
||||||
sets.pos = { 254, 10 };
|
|
||||||
sets.center = { 322, 14 };
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eAlign::BOTTOM:
|
|
||||||
msg = "Bottom";
|
|
||||||
sets.pos = { 254, 382 };
|
|
||||||
sets.center = { 322, 386 };
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eAlign::LEFT:
|
|
||||||
msg = "Left";
|
|
||||||
sets.pos = { 10, 214 };
|
|
||||||
sets.center = { 78, 218 };
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eAlign::CENTER:
|
|
||||||
msg = "Center";
|
|
||||||
sets.pos = { 132, 214 };
|
|
||||||
sets.center = { 200, 218 };
|
|
||||||
if (layout->getOrientation() == GUIHelpers::eOrientation::HORIZONTAL) {
|
|
||||||
sets.pos = { 254, 196 };
|
|
||||||
sets.center = { 322, 200 };
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eAlign::RIGHT:
|
|
||||||
msg = "Right";
|
|
||||||
sets.pos = { 254, 214 };
|
|
||||||
sets.center = { 322, 218 };
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
sets.size = { 136, 8 };
|
|
||||||
|
|
||||||
cWindowTest("Label 'Hello world Three' " + msg, u, label, sets);
|
|
||||||
|
|
||||||
u.report();
|
|
||||||
|
|
||||||
GUIEngine::cGUI::Inst().Display();
|
|
||||||
|
|
||||||
GUIEngine::cGUI::Inst().Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
void LoadFile( const cString& filename, const bool show /*= false*/ )
|
|
||||||
{
|
|
||||||
GUIEngine::cGUI::Inst().Delete();
|
|
||||||
GUIEngine::cGUI::Inst().Initialize(filename, "xml/");
|
|
||||||
printf(cString("\nUsing " + filename + " file.\n").c_str());
|
|
||||||
|
|
||||||
if (show == true)
|
|
||||||
GUIEngine::cGUI::Inst().Display();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindowTest(const cString& msg, UTest& u, GUIEngine::cWindow* win, const Settings sets)
|
|
||||||
{
|
|
||||||
cWindowTest(msg, u, win, sets.pos, sets.size, sets.pad, sets.center);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindowTest( const cString& msg, UTest& u, GUIEngine::cWindow* win, const GUIHelpers::Position& pos,
|
|
||||||
const GUIHelpers::Size& size, const GUIHelpers::Padding& pad, const GUIHelpers::Position& center)
|
|
||||||
{
|
|
||||||
u.test(msg + " Position", win->getPosition() == pos);
|
|
||||||
|
|
||||||
u.test(msg + " Size", win->getSize(false) == size);
|
|
||||||
|
|
||||||
u.test(msg + " Padding", win->getPadding() == pad);
|
|
||||||
|
|
||||||
u.test(msg + " Center", win->getCenter() == center);
|
|
||||||
}
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
#ifndef _CBUTTON_HPP_
|
|
||||||
#define _CBUTTON_HPP_
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "cWindow.hpp"
|
|
||||||
|
|
||||||
#include "GUIHelpers/Enums.hpp"
|
|
||||||
#include "GUIHelpers/GUIUtility.hpp"
|
|
||||||
#include "../VideoEngine/cSprite.hpp"
|
|
||||||
#include "../VideoEngine/cImage.hpp"
|
|
||||||
#include "../MathEngine/iVector/iVector2.hpp"
|
|
||||||
|
|
||||||
#include "cPanel.hpp"
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../UtilityEngine/cString.hpp"
|
|
||||||
|
|
||||||
using UtilityEngine::cString;
|
|
||||||
|
|
||||||
namespace GUIEngine {
|
|
||||||
class EXPORT_FROM_MYDLL cButton : public cWindow, public VideoEngine::cSprite
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static const cString sNAME; /*= "button";*/
|
|
||||||
|
|
||||||
cButton();
|
|
||||||
cButton( cWindow* parent, const signed int id, 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, VideoEngine::cImage** image = nullptr );
|
|
||||||
virtual ~cButton();
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
void Create( cWindow* parent, const signed int id, 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, VideoEngine::cImage** image = nullptr );
|
|
||||||
|
|
||||||
virtual void Press();
|
|
||||||
|
|
||||||
//Sets
|
|
||||||
|
|
||||||
///Gets
|
|
||||||
virtual const GUIHelpers::eType getType() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void CreateLabel();
|
|
||||||
void GenerateImage();
|
|
||||||
void GenerateTexture();
|
|
||||||
|
|
||||||
private:
|
|
||||||
VideoEngine::cImage* mp_texture;// = nullptr
|
|
||||||
VideoEngine::cImage* mp_texturePress;// = nullptr
|
|
||||||
|
|
||||||
//Pointer to the image that will be displayed on the button.
|
|
||||||
VideoEngine::cImage** mpp_image;// = nullptr
|
|
||||||
};/// END CLASS DEFINITION cButton
|
|
||||||
}/// END NAMESPACE DEFINITION GUIEngine
|
|
||||||
#endif/// END IFNDEF _CBUTTON_HPP_
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
#include "cGFX.hpp"
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL2_gfxPrimitives.h>
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../VideoEngine/cRenderer.hpp"
|
|
||||||
#include "../UtilityEngine/cUtility.hpp"
|
|
||||||
|
|
||||||
using FXEngine::cGFX;
|
|
||||||
using VideoEngine::cRenderer;
|
|
||||||
using UtilityEngine::cUtility;
|
|
||||||
|
|
||||||
/*static*/ cGFX* cGFX::sp_inst = nullptr;
|
|
||||||
|
|
||||||
//private:
|
|
||||||
cGFX::cGFX()
|
|
||||||
{}
|
|
||||||
|
|
||||||
cGFX::~cGFX()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//public:
|
|
||||||
///Functions
|
|
||||||
/*static*/ cGFX& cGFX::Inst()
|
|
||||||
{
|
|
||||||
if (sp_inst == nullptr)
|
|
||||||
sp_inst = new cGFX();
|
|
||||||
return *sp_inst;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*static*/ void cGFX::Delete()
|
|
||||||
{
|
|
||||||
delete sp_inst;
|
|
||||||
sp_inst = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGFX::StringDefault( const cString& text, const SDL_Rect& pos, const SDL_Colour& colour ) const
|
|
||||||
{
|
|
||||||
if (stringRGBA(cRenderer::Inst().getRenderer(), (Sint16)pos.x, (Sint16)pos.y, text.c_str(), colour.r, colour.g, colour.b, colour.a) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to render text. stringRGBA():", __AT__, cUtility::eTypeSDL::GFX);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGFX::StringDefault( const cString& text, const SDL_Rect& pos, const SDL_Colour& colour, SDL_Texture* texture ) const
|
|
||||||
{
|
|
||||||
cRenderer::Inst().SetRenderTarget(texture);
|
|
||||||
StringDefault(text, pos, colour);
|
|
||||||
cRenderer::Inst().ResetRenderTarget();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGFX::RoundedRectangle( const SDL_Rect& rect, const unsigned long int rad, const SDL_Colour& colour ) const
|
|
||||||
{
|
|
||||||
if (roundedBoxRGBA(cRenderer::Inst().getRenderer(), (Sint16)rect.x, (Sint16)rect.y, (Sint16)rect.w, (Sint16)rect.h, (Sint16)rad, colour.r, colour.g, colour.b, colour.a) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to make Rounded Rectangle. roundedRectangleRGBA():", __AT__, cUtility::eTypeSDL::GFX);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGFX::RoundedRectangle( const SDL_Rect& rect, const unsigned long int rad, const SDL_Colour& colour, SDL_Texture* texture ) const
|
|
||||||
{
|
|
||||||
cRenderer::Inst().SetRenderTarget(texture);
|
|
||||||
RoundedRectangle(rect, rad, colour);
|
|
||||||
cRenderer::Inst().ResetRenderTarget();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGFX::Pixel(const unsigned long int x, const unsigned long int y, const SDL_Colour& colour) const
|
|
||||||
{
|
|
||||||
if (pixelRGBA(cRenderer::Inst().getRenderer(), (Sint16)x, (Sint16)y, colour.r, colour.g, colour.b, colour.a) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to make pixel. pixelRGBA():", __AT__, cUtility::eTypeSDL::GFX);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGFX::Pixel(const unsigned long int x, const unsigned long int y, const SDL_Colour& colour, SDL_Texture* texture) const
|
|
||||||
{
|
|
||||||
cRenderer::Inst().SetRenderTarget(texture);
|
|
||||||
Pixel(x, y, colour);
|
|
||||||
cRenderer::Inst().ResetRenderTarget();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGFX::Rectangle(const SDL_Rect& rect, const SDL_Colour& colour) const
|
|
||||||
{
|
|
||||||
if (rectangleRGBA(cRenderer::Inst().getRenderer(), (Sint16)rect.x, (Sint16)rect.y, (Sint16)rect.w, (Sint16)rect.h, colour.r, colour.g, colour.b, colour.a) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to make pixel. rectangleRGBA():", __AT__, cUtility::eTypeSDL::GFX);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGFX::Rectangle(const SDL_Rect& rect, const SDL_Colour& colour, SDL_Texture* texture) const
|
|
||||||
{
|
|
||||||
cRenderer::Inst().SetRenderTarget(texture);
|
|
||||||
Rectangle(rect, colour);
|
|
||||||
cRenderer::Inst().ResetRenderTarget();
|
|
||||||
}
|
|
||||||
@@ -1,129 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup>
|
|
||||||
<Filter Include="Main">
|
|
||||||
<UniqueIdentifier>{813fe0d0-021e-4a7a-81f6-8c257531e86f}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Game">
|
|
||||||
<UniqueIdentifier>{b1e548f9-e924-4aeb-b70c-45e0149e8ff3}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Game\Equipment">
|
|
||||||
<UniqueIdentifier>{7010506c-0310-40f7-a3ea-6e9e99ecdb81}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Game\Equipment\Input">
|
|
||||||
<UniqueIdentifier>{9e5916e8-437a-4c0d-800a-5ea486c57b97}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Game\MainMenu">
|
|
||||||
<UniqueIdentifier>{d393f48f-a4c2-4a35-a524-e78235977f9e}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Game\MainMenu\Input">
|
|
||||||
<UniqueIdentifier>{cf62df37-481f-445c-834d-74549b98aaa4}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Game\PongStart">
|
|
||||||
<UniqueIdentifier>{d381fec8-ab66-45a6-b6b9-96e5d5a4bfdb}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="Main\main.cpp">
|
|
||||||
<Filter>Main</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Game\Equipment\cBall.cpp">
|
|
||||||
<Filter>Game\Equipment</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Game\Equipment\cCourt.cpp">
|
|
||||||
<Filter>Game\Equipment</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Game\Equipment\cPaddle.cpp">
|
|
||||||
<Filter>Game\Equipment</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Game\Equipment\Input\cPlayerDown.cpp">
|
|
||||||
<Filter>Game\Equipment\Input</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Game\Equipment\Input\cPlayerUp.cpp">
|
|
||||||
<Filter>Game\Equipment\Input</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Game\Equipment\Input\cQuitButton.cpp">
|
|
||||||
<Filter>Game\Equipment\Input</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Game\MainMenu\cMainMenu.cpp">
|
|
||||||
<Filter>Game\MainMenu</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Game\MainMenu\eOptions.cpp">
|
|
||||||
<Filter>Game\MainMenu</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Game\MainMenu\Input\cMenuDown.cpp">
|
|
||||||
<Filter>Game\MainMenu\Input</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Game\MainMenu\Input\cMenuSelect.cpp">
|
|
||||||
<Filter>Game\MainMenu\Input</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Game\MainMenu\Input\cMenuUp.cpp">
|
|
||||||
<Filter>Game\MainMenu\Input</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Game\PongStart\cPongStart.cpp">
|
|
||||||
<Filter>Game\PongStart</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Game\MainMenu\Input\cEsc.cpp">
|
|
||||||
<Filter>Game\MainMenu\Input</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Game\MainMenu\cBuildMainMenu.cpp">
|
|
||||||
<Filter>Game\MainMenu</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Game\Equipment\cScoreBoard.cpp">
|
|
||||||
<Filter>Game\Equipment</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="Game\Equipment\cPlayer.cpp">
|
|
||||||
<Filter>Game\Equipment</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="Game\Equipment\cBall.hpp">
|
|
||||||
<Filter>Game\Equipment</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Game\Equipment\cCourt.hpp">
|
|
||||||
<Filter>Game\Equipment</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Game\Equipment\cPaddle.hpp">
|
|
||||||
<Filter>Game\Equipment</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Game\Equipment\Input\cPlayerDown.hpp">
|
|
||||||
<Filter>Game\Equipment\Input</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Game\Equipment\Input\cPlayerUp.hpp">
|
|
||||||
<Filter>Game\Equipment\Input</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Game\Equipment\Input\cQuitButton.hpp">
|
|
||||||
<Filter>Game\Equipment\Input</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Game\MainMenu\cMainMenu.hpp">
|
|
||||||
<Filter>Game\MainMenu</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Game\MainMenu\eOptions.hpp">
|
|
||||||
<Filter>Game\MainMenu</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Game\MainMenu\Input\cMenuDown.hpp">
|
|
||||||
<Filter>Game\MainMenu\Input</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Game\MainMenu\Input\cMenuSelect.hpp">
|
|
||||||
<Filter>Game\MainMenu\Input</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Game\MainMenu\Input\cMenuUp.hpp">
|
|
||||||
<Filter>Game\MainMenu\Input</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Game\PongStart\cPongStart.hpp">
|
|
||||||
<Filter>Game\PongStart</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Game\MainMenu\Input\cEsc.hpp">
|
|
||||||
<Filter>Game\MainMenu\Input</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Game\MainMenu\cBuildMainMenu.hpp">
|
|
||||||
<Filter>Game\MainMenu</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Game\Equipment\cScoreBoard.hpp">
|
|
||||||
<Filter>Game\Equipment</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Game\Equipment\cPlayer.hpp">
|
|
||||||
<Filter>Game\Equipment</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
#ifndef _CBOXSIZER_HPP_
|
|
||||||
#define _CBOXSIZER_HPP_
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "cPanel.hpp"
|
|
||||||
#include "GUIHelpers/cObject.hpp"
|
|
||||||
#include "GUIHelpers/Enums.hpp"
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "cWindow.hpp"
|
|
||||||
|
|
||||||
#include "../UtilityEngine/cString.hpp"
|
|
||||||
|
|
||||||
using UtilityEngine::cString;
|
|
||||||
|
|
||||||
namespace GUIEngine {
|
|
||||||
class EXPORT_FROM_MYDLL cBoxSizer : public cWindow
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static const cString sNAME; /*= "boxsizer";*/
|
|
||||||
|
|
||||||
cBoxSizer( cWindow* parent, const signed int id, 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 );
|
|
||||||
virtual ~cBoxSizer();
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
void Create( cWindow* parent, const signed int id, 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 );
|
|
||||||
|
|
||||||
virtual const GUIHelpers::eType getType() const;
|
|
||||||
private:
|
|
||||||
private:
|
|
||||||
};/// END CLASS DEFINITION cBoxSizer
|
|
||||||
}/// END NAMESPACE DEFINITION GUIEngine
|
|
||||||
#endif/// END IFNDEF _CBOXSIZER_HPP_
|
|
||||||
@@ -1,226 +0,0 @@
|
|||||||
#include "cMainMenu.hpp"
|
|
||||||
|
|
||||||
using MainMenu::cMainMenu;
|
|
||||||
using MainMenu::eOptions;
|
|
||||||
using MainMenu::operator ++;
|
|
||||||
using MainMenu::operator --;
|
|
||||||
|
|
||||||
cMainMenu::cMainMenu()
|
|
||||||
: mp_camera(nullptr), mp_font(nullptr), mp_titleText(nullptr), mp_singleText(nullptr), mp_headText(nullptr), mp_quitText(nullptr), m_option(Start), m_run(true)
|
|
||||||
{
|
|
||||||
mp_camera = new VideoEngine::cCamera();
|
|
||||||
|
|
||||||
m_titleSprite.setCamera(&mp_camera);
|
|
||||||
m_singleSprite.setCamera(&mp_camera);
|
|
||||||
m_headSprite.setCamera(&mp_camera);
|
|
||||||
m_quitSprite.setCamera(&mp_camera);
|
|
||||||
|
|
||||||
m_colour.r = 255;
|
|
||||||
m_colour.g = 0;
|
|
||||||
m_colour.b = 0;
|
|
||||||
|
|
||||||
m_selectColour.r = 0;
|
|
||||||
m_selectColour.g = 0;
|
|
||||||
m_selectColour.b = 255;
|
|
||||||
|
|
||||||
m_titleColour.r = 255;
|
|
||||||
m_titleColour.g = 255;
|
|
||||||
m_titleColour.b = 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
cMainMenu::~cMainMenu()
|
|
||||||
{
|
|
||||||
delete mp_camera;
|
|
||||||
mp_camera = nullptr;
|
|
||||||
|
|
||||||
delete mp_font;
|
|
||||||
mp_font = nullptr;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
const eOptions cMainMenu::ShowMenu()
|
|
||||||
{
|
|
||||||
SingleSelect();
|
|
||||||
while (m_run == true) {
|
|
||||||
Display();
|
|
||||||
Input();
|
|
||||||
}
|
|
||||||
|
|
||||||
return m_option;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMainMenu::OptionUp()
|
|
||||||
{
|
|
||||||
--m_option;
|
|
||||||
PlaySound();
|
|
||||||
switch (m_option)
|
|
||||||
{
|
|
||||||
case Start:
|
|
||||||
SingleSelect();
|
|
||||||
break;
|
|
||||||
case Head:
|
|
||||||
HeadSelect();
|
|
||||||
break;
|
|
||||||
case Quit:
|
|
||||||
QuitSelect();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMainMenu::OptionDown()
|
|
||||||
{
|
|
||||||
++m_option;
|
|
||||||
PlaySound();
|
|
||||||
switch (m_option)
|
|
||||||
{
|
|
||||||
case Start:
|
|
||||||
SingleSelect();
|
|
||||||
break;
|
|
||||||
case Head:
|
|
||||||
HeadSelect();
|
|
||||||
break;
|
|
||||||
case Quit:
|
|
||||||
QuitSelect();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMainMenu::OptionSelect()
|
|
||||||
{
|
|
||||||
m_run = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMainMenu::setOption( const eOptions option /*= eOptions::Start*/ )
|
|
||||||
{
|
|
||||||
m_option = option;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMainMenu::setSound( const cString dir, const cString filename )
|
|
||||||
{
|
|
||||||
m_menuSound.setFileNameandDir(filename, dir);
|
|
||||||
m_menuSound.setLoops(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMainMenu::setColour( const SDL_Colour colour )
|
|
||||||
{
|
|
||||||
m_colour = colour;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMainMenu::setSelectColour( const SDL_Colour selectcolour )
|
|
||||||
{
|
|
||||||
m_selectColour = selectcolour;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMainMenu::setTitleColour( const SDL_Colour titlecolour )
|
|
||||||
{
|
|
||||||
m_titleColour = titlecolour;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMainMenu::setFont( const cString dir, const cString filename )
|
|
||||||
{
|
|
||||||
delete mp_font;
|
|
||||||
mp_font = nullptr;
|
|
||||||
|
|
||||||
mp_font = new TextTypeEngine::cFont(dir, filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMainMenu::setTitleText( const cString text, const long int size, const long int x, const long int y )
|
|
||||||
{
|
|
||||||
mp_titleText = new TextTypeEngine::cText(m_titleColour, &mp_font, text, size);
|
|
||||||
|
|
||||||
m_titleSprite.setPosition(x, y);
|
|
||||||
m_titleSprite.setImage((VideoEngine::cImage**)(&mp_titleText));
|
|
||||||
m_titleSprite.setImageArea();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMainMenu::setSingleText( const cString text, const long int size, const long int x, const long int y )
|
|
||||||
{
|
|
||||||
mp_singleText = new TextTypeEngine::cText(m_colour, &mp_font, text, size);
|
|
||||||
|
|
||||||
m_singleSprite.setPosition(x, y);
|
|
||||||
m_singleSprite.setImage((VideoEngine::cImage**)(&mp_singleText));
|
|
||||||
m_singleSprite.setImageArea();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMainMenu::setHeadText( const cString text, const long int size, const long int x, const long int y )
|
|
||||||
{
|
|
||||||
mp_headText = new TextTypeEngine::cText(m_colour, &mp_font, text, size);
|
|
||||||
|
|
||||||
m_headSprite.setPosition(x, y);
|
|
||||||
m_headSprite.setImage((VideoEngine::cImage**)(&mp_headText));
|
|
||||||
m_headSprite.setImageArea();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMainMenu::setQuitText( const cString text, const long int size, const long int x, const long int y )
|
|
||||||
{
|
|
||||||
mp_quitText = new TextTypeEngine::cText(m_colour, &mp_font, text, size);
|
|
||||||
|
|
||||||
m_quitSprite.setPosition(x, y);
|
|
||||||
m_quitSprite.setImage((VideoEngine::cImage**)(&mp_quitText));
|
|
||||||
m_quitSprite.setImageArea();
|
|
||||||
}
|
|
||||||
|
|
||||||
///Private
|
|
||||||
void cMainMenu::ResetTextColour()
|
|
||||||
{
|
|
||||||
if (mp_singleText != nullptr)
|
|
||||||
mp_singleText->setColour(m_colour);
|
|
||||||
|
|
||||||
if (mp_headText != nullptr)
|
|
||||||
mp_headText->setColour(m_colour);
|
|
||||||
|
|
||||||
if (mp_quitText != nullptr)
|
|
||||||
mp_quitText->setColour(m_colour);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMainMenu::Display()
|
|
||||||
{
|
|
||||||
mp_camera->Draw();
|
|
||||||
VideoEngine::cVideo::Inst().Display();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMainMenu::Redraw()
|
|
||||||
{
|
|
||||||
m_titleSprite.CameraDraw();
|
|
||||||
m_singleSprite.CameraDraw();
|
|
||||||
m_headSprite.CameraDraw();
|
|
||||||
m_quitSprite.CameraDraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMainMenu::PlaySound()
|
|
||||||
{
|
|
||||||
m_menuSound.PlaySound();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMainMenu::Input()
|
|
||||||
{
|
|
||||||
EventEngine::cEvent::Inst().CheckEvents();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMainMenu::SingleSelect()
|
|
||||||
{
|
|
||||||
if (mp_singleText == nullptr)
|
|
||||||
return;
|
|
||||||
ResetTextColour();
|
|
||||||
mp_singleText->setColour(m_selectColour);
|
|
||||||
Redraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMainMenu::HeadSelect()
|
|
||||||
{
|
|
||||||
if (mp_headText == nullptr)
|
|
||||||
return;
|
|
||||||
ResetTextColour();
|
|
||||||
mp_headText->setColour(m_selectColour);
|
|
||||||
Redraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMainMenu::QuitSelect()
|
|
||||||
{
|
|
||||||
if (mp_quitText == nullptr)
|
|
||||||
return;
|
|
||||||
ResetTextColour();
|
|
||||||
mp_quitText->setColour(m_selectColour);
|
|
||||||
Redraw();
|
|
||||||
}
|
|
||||||
@@ -1,132 +0,0 @@
|
|||||||
#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::RePos();
|
|
||||||
// }
|
|
||||||
|
|
||||||
/*virtual*/ void cLabel::RebuildLayout(const GUIHelpers::eLayout& layout)
|
|
||||||
{
|
|
||||||
switch (layout)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
case GUIHelpers::eLayout::MATCH_PARENT:
|
|
||||||
case GUIHelpers::eLayout::FILL_PARENT:
|
|
||||||
//break;
|
|
||||||
case GUIHelpers::eLayout::WRAP_CONTENT:
|
|
||||||
long int y = mp_text->getSize();
|
|
||||||
long int x = (mp_text->getText().length() * y);
|
|
||||||
|
|
||||||
GUIHelpers::Size size = { x, y };
|
|
||||||
// size.x += this->getPadding().x + this->getPadding().w;
|
|
||||||
// size.y += this->getPadding().y + this->getPadding().z;
|
|
||||||
this->setSize(size);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
#include "cLayout.hpp"
|
|
||||||
|
|
||||||
using GUIEngine::cLayout;
|
|
||||||
|
|
||||||
/*static*/ const cString cLayout::sNAME = "layout";
|
|
||||||
/*static*/ const GUIHelpers::eOrientation cLayout::sORIENTATION = GUIHelpers::eOrientation::VERTICAL;
|
|
||||||
|
|
||||||
cLayout::cLayout(cWindow* parent, const signed int id, const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/, 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*/)
|
|
||||||
{
|
|
||||||
Create(parent, id, orientation, align, layout, pos, size, padding, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ cLayout::~cLayout()
|
|
||||||
{}
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
/*virtual*/ void cLayout::Create(cWindow* parent, const signed int id, const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/, 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, orientation, align, layout, pos, size, padding, name);
|
|
||||||
if (this->getParent() != nullptr) {
|
|
||||||
this->getParent()->AddChild(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ void cLayout::Display()
|
|
||||||
{
|
|
||||||
cWindow::Display();
|
|
||||||
}
|
|
||||||
|
|
||||||
///Set
|
|
||||||
|
|
||||||
///Get
|
|
||||||
|
|
||||||
/*virtual*/ const GUIHelpers::eType cLayout::getType() const
|
|
||||||
{
|
|
||||||
return GUIHelpers::eType::CLAYOUT;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ const GUIHelpers::RGBA cLayout::getDebugColour() const
|
|
||||||
{
|
|
||||||
return GUIHelpers::RED;
|
|
||||||
}
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
#ifndef _CSTRING_HPP_
|
|
||||||
#define _CSTRING_HPP_
|
|
||||||
|
|
||||||
/*** C++ STL Files ***/
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
/*#pragma warning (disable : 4231)*/
|
|
||||||
EXPIMP_TEMPLATE template class EXPORT_FROM_MYDLL std::allocator<char>;
|
|
||||||
EXPIMP_TEMPLATE template class EXPORT_FROM_MYDLL std::basic_string<char>;
|
|
||||||
/*#pragma warning (default : 4231)*/
|
|
||||||
|
|
||||||
#define __cString__MAX_LEN 65535
|
|
||||||
|
|
||||||
namespace UtilityEngine {
|
|
||||||
class EXPORT_FROM_MYDLL cString
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cString(); // default constructor
|
|
||||||
cString(const char* s);
|
|
||||||
cString(const cString& copy); // copy constructor
|
|
||||||
~cString();
|
|
||||||
|
|
||||||
const char * alloc_str(size_t sz); // smart alloc string
|
|
||||||
void clear(); // frees the string
|
|
||||||
const char * c_str() const; // getter
|
|
||||||
const char * copy_str(const char* copy); // alloc & copy
|
|
||||||
|
|
||||||
// utility methods
|
|
||||||
bool have_value() const;
|
|
||||||
size_t length() const;
|
|
||||||
size_t size() const;
|
|
||||||
cString & format(const char * format, ...);
|
|
||||||
cString & trim();
|
|
||||||
cString lower() const;
|
|
||||||
cString upper() const;
|
|
||||||
const char & last_char() const;
|
|
||||||
const std::vector<cString> split(const char match) const;
|
|
||||||
const std::vector<cString> split(const char * match) const;
|
|
||||||
const std::vector<cString> split(const char * match, int max_split) const;
|
|
||||||
long int char_find(const char& match) const;
|
|
||||||
const cString & char_repl(const char & match, const char & repl);
|
|
||||||
cString substr(size_t start, size_t length) const;
|
|
||||||
long int find(const cString & match);
|
|
||||||
const cString replace(const cString & match, const cString & repl);
|
|
||||||
|
|
||||||
const long int ToInt() const;
|
|
||||||
|
|
||||||
// operators
|
|
||||||
cString& operator = (const char* rhs); // assignment operator
|
|
||||||
cString& operator = (const cString& rhs); // assignment operator
|
|
||||||
cString& operator += (const char rhs);
|
|
||||||
cString& operator += (const char* rhs); // concatenation operator
|
|
||||||
cString& operator += (const cString& rhs); // concatenation operator
|
|
||||||
|
|
||||||
bool operator == (const char* rhs) const; // comparisons
|
|
||||||
bool operator == (const cString& rhs) const;
|
|
||||||
bool operator != (const char* rhs) const;
|
|
||||||
bool operator != (const cString& rhs) const;
|
|
||||||
bool operator > (const cString& rhs) const;
|
|
||||||
bool operator < (const cString& rhs) const;
|
|
||||||
bool operator >= (const cString& rhs) const;
|
|
||||||
bool operator <= (const cString& rhs) const;
|
|
||||||
|
|
||||||
// conversion operators
|
|
||||||
operator const char * () const; // c-string type
|
|
||||||
operator std::string () const; // c++ string class
|
|
||||||
|
|
||||||
private:
|
|
||||||
char * mp_str = nullptr;
|
|
||||||
size_t m_len = 0;
|
|
||||||
|
|
||||||
};/// END CLASS DEFINITION cString
|
|
||||||
// function overloads
|
|
||||||
}/// END NAMESPACE DEFINITION UtilityEngine
|
|
||||||
UtilityEngine::cString operator + (const UtilityEngine::cString& lhs, const UtilityEngine::cString& rhs);
|
|
||||||
#endif/// END IFNDEF _CSTRING_HPP_
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Panel size="200,200">
|
|
||||||
<debug/>
|
|
||||||
<Layout>
|
|
||||||
<Label text="Hello world" />
|
|
||||||
</Layout>
|
|
||||||
</Panel>
|
|
||||||
@@ -1,269 +0,0 @@
|
|||||||
#include "cVideo.hpp"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "cRenderer.hpp"
|
|
||||||
#include "../UtilityEngine/cUtility.hpp"
|
|
||||||
|
|
||||||
using VideoEngine::cVideo;
|
|
||||||
using VideoEngine::cRenderer;
|
|
||||||
using UtilityEngine::cUtility;
|
|
||||||
|
|
||||||
/*static*/ cVideo* cVideo::sp_inst = nullptr;
|
|
||||||
|
|
||||||
cVideo::cVideo()
|
|
||||||
: m_xPos(100), m_yPos(100), m_width(640), m_height(480), m_colour(32),
|
|
||||||
m_hardwareVideo(false), m_fullscreen(false), m_vsync(false),
|
|
||||||
m_videoSettings(SDL_RENDERER_SOFTWARE), mp_window(nullptr),
|
|
||||||
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
|
||||||
m_rmask(0xff000000),
|
|
||||||
m_gmask(0x00ff0000),
|
|
||||||
m_bmask(0x0000ff00),
|
|
||||||
m_amask(0x000000ff)
|
|
||||||
#else
|
|
||||||
m_rmask(0x000000ff),
|
|
||||||
m_gmask(0x0000ff00),
|
|
||||||
m_bmask(0x00ff0000),
|
|
||||||
m_amask(0xff000000)
|
|
||||||
#endif
|
|
||||||
{}
|
|
||||||
|
|
||||||
cVideo::~cVideo()
|
|
||||||
{
|
|
||||||
CleanUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
/*static*/ cVideo& cVideo::Inst()
|
|
||||||
{
|
|
||||||
if (sp_inst == nullptr)
|
|
||||||
sp_inst = new cVideo();
|
|
||||||
return *sp_inst;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*static*/ void cVideo::Delete()
|
|
||||||
{
|
|
||||||
delete sp_inst;
|
|
||||||
sp_inst = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cVideo::Initialize() const
|
|
||||||
{
|
|
||||||
bool rtn = IsInit();
|
|
||||||
|
|
||||||
if (rtn == false) {
|
|
||||||
if(SDL_InitSubSystem(SDL_INIT_VIDEO) == 0) {
|
|
||||||
cUtility::Inst().Message("Video Initialized.");
|
|
||||||
rtn = true;
|
|
||||||
} else
|
|
||||||
cUtility::Inst().Message("Could not initialize Video. SDL_InitSubSystem():", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
}
|
|
||||||
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cVideo::Setup()
|
|
||||||
{
|
|
||||||
bool rtn = false;
|
|
||||||
CleanUp();
|
|
||||||
VideoSettings();
|
|
||||||
|
|
||||||
mp_window = SDL_CreateWindow("Hello World!", 100, 100, m_width, m_height, SDL_WINDOW_SHOWN);
|
|
||||||
if (mp_window == nullptr)
|
|
||||||
cUtility::Inst().Message("Unable to set Window. SDL_CreateWindow():", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
else
|
|
||||||
rtn = true;
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cVideo::CleanUp()
|
|
||||||
{
|
|
||||||
SDL_DestroyWindow(mp_window);
|
|
||||||
mp_window = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cVideo::Display()
|
|
||||||
{
|
|
||||||
SDL_RenderPresent(cRenderer::Inst().getRenderer());
|
|
||||||
}
|
|
||||||
|
|
||||||
void cVideo::ScreenShot( const cString& filename, const cString& dir /*= ""*/ )
|
|
||||||
{
|
|
||||||
VideoEngine::cRenderer::Inst().ScreenShot(filename, dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_Renderer* cVideo::CreateRender()
|
|
||||||
{
|
|
||||||
SDL_Renderer* rtn = nullptr;
|
|
||||||
if (mp_window != nullptr)
|
|
||||||
rtn = SDL_CreateRenderer(mp_window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE);
|
|
||||||
|
|
||||||
if (rtn == nullptr)
|
|
||||||
cUtility::Inst().Message("Unable to set Renderer. SDL_CreateRenderer():", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void cVideo::VideoSettings()
|
|
||||||
{
|
|
||||||
m_videoSettings = 0;
|
|
||||||
|
|
||||||
if (m_hardwareVideo == true)
|
|
||||||
{
|
|
||||||
m_videoSettings = (m_videoSettings | SDL_RENDERER_ACCELERATED);
|
|
||||||
if (m_vsync == true)
|
|
||||||
m_videoSettings = (m_videoSettings | SDL_RENDERER_PRESENTVSYNC);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_videoSettings = (m_videoSettings | SDL_RENDERER_SOFTWARE);
|
|
||||||
m_vsync = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_fullscreen == true)
|
|
||||||
m_videoSettings = (m_videoSettings | SDL_WINDOW_FULLSCREEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
///Set's
|
|
||||||
void cVideo::setWidth( const unsigned long int width /*= 640*/ )
|
|
||||||
{
|
|
||||||
m_width = width;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cVideo::setHeight( const unsigned long int height /*= 480*/ )
|
|
||||||
{
|
|
||||||
m_height = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cVideo::setColour( const unsigned long int colour /*= 32*/ )
|
|
||||||
{
|
|
||||||
m_colour = colour;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cVideo::setCaption( const cString& caption /*= ""*/ )
|
|
||||||
{
|
|
||||||
if (mp_window != nullptr)
|
|
||||||
SDL_SetWindowTitle(mp_window, caption.c_str());
|
|
||||||
else
|
|
||||||
cUtility::Inst().Message("No window to set caption to.");
|
|
||||||
}
|
|
||||||
|
|
||||||
void cVideo::setHardwareVideo( const bool hardware /*= false*/ )
|
|
||||||
{
|
|
||||||
m_hardwareVideo = hardware;
|
|
||||||
VideoSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cVideo::setFullScreen( const bool fullscreen /*= false*/ )
|
|
||||||
{
|
|
||||||
m_fullscreen = fullscreen;
|
|
||||||
VideoSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cVideo::setVSync( const bool vsync /*= false*/ )
|
|
||||||
{
|
|
||||||
m_vsync = vsync;
|
|
||||||
VideoSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cVideo::setDisplayMode( const SDL_DisplayMode& mode )
|
|
||||||
{
|
|
||||||
if (SDL_SetWindowDisplayMode(mp_window, &mode) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to set display mode. SDL_SetWindowDisplayMode()", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
}
|
|
||||||
|
|
||||||
///Gets
|
|
||||||
const bool cVideo::IsInit() const
|
|
||||||
{
|
|
||||||
bool rtn = false;
|
|
||||||
|
|
||||||
if (SDL_WasInit(SDL_INIT_VIDEO) != 0) {
|
|
||||||
cUtility::Inst().Message("Video is initialized.");
|
|
||||||
rtn = true;
|
|
||||||
} else
|
|
||||||
cUtility::Inst().Message("Video is not initialized.");
|
|
||||||
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
const unsigned long int cVideo::getWidth() const
|
|
||||||
{
|
|
||||||
return m_width;
|
|
||||||
}
|
|
||||||
|
|
||||||
const unsigned long int cVideo::getHeight() const
|
|
||||||
{
|
|
||||||
return m_height;
|
|
||||||
}
|
|
||||||
|
|
||||||
const unsigned long int cVideo::getColour() const
|
|
||||||
{
|
|
||||||
return m_colour;
|
|
||||||
}
|
|
||||||
|
|
||||||
const cString cVideo::getCaption() const
|
|
||||||
{
|
|
||||||
cString rtn = "";
|
|
||||||
|
|
||||||
if (mp_window != nullptr)
|
|
||||||
rtn = SDL_GetWindowTitle(mp_window);
|
|
||||||
else
|
|
||||||
cUtility::Inst().Message("No window to get caption from.");
|
|
||||||
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cVideo::getHardwareVideo() const
|
|
||||||
{
|
|
||||||
return m_hardwareVideo;
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cVideo::getFullScreen() const
|
|
||||||
{
|
|
||||||
return m_fullscreen;
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cVideo::getVSync() const
|
|
||||||
{
|
|
||||||
return m_vsync;
|
|
||||||
}
|
|
||||||
|
|
||||||
const unsigned long int cVideo::getVideoSettings() const
|
|
||||||
{
|
|
||||||
return m_videoSettings;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_Window* cVideo::getWindow()
|
|
||||||
{
|
|
||||||
return mp_window;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_DisplayMode cVideo::getDisplayMode() const
|
|
||||||
{
|
|
||||||
SDL_DisplayMode display;
|
|
||||||
|
|
||||||
if (SDL_GetWindowDisplayMode(mp_window, &display) < 0 )
|
|
||||||
cUtility::Inst().Message("Could not get display mode. SDL_GetWindowDisplayMode():", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
|
|
||||||
return display;
|
|
||||||
}
|
|
||||||
|
|
||||||
const unsigned long int cVideo::getRmask() const
|
|
||||||
{
|
|
||||||
return m_rmask;
|
|
||||||
}
|
|
||||||
|
|
||||||
const unsigned long int cVideo::getGmask() const
|
|
||||||
{
|
|
||||||
return m_gmask;
|
|
||||||
}
|
|
||||||
|
|
||||||
const unsigned long int cVideo::getBmask() const
|
|
||||||
{
|
|
||||||
return m_bmask;
|
|
||||||
}
|
|
||||||
|
|
||||||
const unsigned long int cVideo::getAmask() const
|
|
||||||
{
|
|
||||||
return m_amask;
|
|
||||||
}
|
|
||||||
@@ -1,123 +0,0 @@
|
|||||||
#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();
|
|
||||||
|
|
||||||
cSprite::setPosition(cWindow::getPosition());
|
|
||||||
cSprite::Draw();
|
|
||||||
cSprite::SaveImage("test.bmp", "xml/");
|
|
||||||
}
|
|
||||||
|
|
||||||
void cLabel::GenerateTexture()
|
|
||||||
{
|
|
||||||
this->setImage((VideoEngine::cImage**)(&mp_text));
|
|
||||||
|
|
||||||
this->setImageArea(mp_text->getWH());
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//this->setTransparent();
|
|
||||||
//this->setPosition()
|
|
||||||
}
|
|
||||||
|
|
||||||
//Sets
|
|
||||||
void cLabel::setFontColour(const GUIHelpers::RBGA& 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::RBGA& 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*/ 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
#include "cKeyboard.hpp"
|
|
||||||
|
|
||||||
using InputEngine::cKeyboard;
|
|
||||||
|
|
||||||
cKeyboard::cKeyboard( const cString& label )
|
|
||||||
: m_label(label)
|
|
||||||
{}
|
|
||||||
|
|
||||||
cKeyboard::cKeyboard( const cKeyboard& copy )
|
|
||||||
:m_label(copy.getLabel())
|
|
||||||
{}
|
|
||||||
|
|
||||||
/*virtual*/ cKeyboard::~cKeyboard()
|
|
||||||
{
|
|
||||||
DeleteAllKeys();
|
|
||||||
}
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
/*virtual*/ void cKeyboard::KeyboardCheck( const SDL_Event& event )
|
|
||||||
{
|
|
||||||
SDL_Keycode key = event.key.keysym.sym;
|
|
||||||
|
|
||||||
std::vector<InputEngine::cKey*>::iterator it;
|
|
||||||
|
|
||||||
for ( it = m_keys.begin() ; it < m_keys.end(); it++ ) {
|
|
||||||
if (key == (*it)->getKey()) {
|
|
||||||
switch( event.type )
|
|
||||||
{
|
|
||||||
case SDL_KEYUP:
|
|
||||||
(*it)->KeyUP();
|
|
||||||
break;
|
|
||||||
case SDL_KEYDOWN:
|
|
||||||
(*it)->KeyDown();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//break out of the for loop
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void cKeyboard::AddKey( InputEngine::cKey* key )
|
|
||||||
{
|
|
||||||
m_keys.push_back(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cKeyboard::DeleteKey( const SDL_Keycode& key )
|
|
||||||
{
|
|
||||||
std::vector<InputEngine::cKey*>::iterator it;
|
|
||||||
|
|
||||||
for ( it = m_keys.begin() ; it < m_keys.end(); it++ ) {
|
|
||||||
if (key == (*it)->getKey()) {
|
|
||||||
InputEngine::cKey* temp = (*it);
|
|
||||||
delete temp;
|
|
||||||
temp = nullptr;
|
|
||||||
m_keys.erase(it);
|
|
||||||
//break out of the for loop
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void cKeyboard::DeleteAllKeys()
|
|
||||||
{
|
|
||||||
m_keys.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
///Sets
|
|
||||||
const cString& cKeyboard::getLabel() const
|
|
||||||
{
|
|
||||||
return m_label;
|
|
||||||
}
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
#ifndef _CRENDERER_HPP_
|
|
||||||
#define _CRENDERER_HPP_
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../UtilityEngine/cString.hpp"
|
|
||||||
|
|
||||||
using UtilityEngine::cString;
|
|
||||||
|
|
||||||
namespace VideoEngine {
|
|
||||||
/* Singleton */
|
|
||||||
class EXPORT_FROM_MYDLL cRenderer
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
cRenderer();
|
|
||||||
~cRenderer();
|
|
||||||
|
|
||||||
public:
|
|
||||||
static cRenderer& Inst();
|
|
||||||
static void Delete();
|
|
||||||
|
|
||||||
/* Creates the Renderer */
|
|
||||||
const bool Setup();
|
|
||||||
/* Uses */
|
|
||||||
void CleanUp();
|
|
||||||
|
|
||||||
void Render( SDL_Texture* texture, SDL_Rect* srcrect, SDL_Rect* dstrect );
|
|
||||||
void Render( SDL_Surface* surface, SDL_Rect* srcrect, SDL_Rect* dstrect );
|
|
||||||
void Render( SDL_Surface* src, const SDL_Rect* srcrect, SDL_Surface* dst, SDL_Rect* dstrect );
|
|
||||||
void Render( SDL_Texture* src, const SDL_Rect* srcrect, SDL_Surface* dst, SDL_Rect* dstrect );
|
|
||||||
void Render( SDL_Texture* src, const SDL_Rect* srcrect, SDL_Renderer* dst, SDL_Rect* dstrect );
|
|
||||||
|
|
||||||
void RenderToTexture( SDL_Texture* src, SDL_Rect* srcrect, SDL_Texture* dst, SDL_Rect* dstrect );
|
|
||||||
|
|
||||||
void RenderDrawColor( const SDL_Colour& colour );
|
|
||||||
void RenderDrawRect( const SDL_Rect& rect, SDL_Texture* dst = nullptr );
|
|
||||||
|
|
||||||
void SaveSurface( SDL_Surface* surface, const cString& fileName, const cString& dir = "" );
|
|
||||||
void SaveTexture( SDL_Texture* texture, const cString& fileName, const cString& dir = "" );
|
|
||||||
|
|
||||||
SDL_Texture* SurfaceToTexture( SDL_Surface* surface );
|
|
||||||
SDL_Surface* TextureToSurface( SDL_Texture* texture );
|
|
||||||
|
|
||||||
void CopyTexture( SDL_Texture* src, SDL_Texture* dst );
|
|
||||||
|
|
||||||
SDL_Surface* CopySurface( SDL_Surface* src );
|
|
||||||
|
|
||||||
SDL_Surface* NewSurface( const unsigned long int width, const unsigned long int height ) const;
|
|
||||||
SDL_Texture* NewTexture( const unsigned long int width, const unsigned long int height, const unsigned long int access = SDL_TEXTUREACCESS_TARGET ) const;
|
|
||||||
|
|
||||||
void SetRenderTarget( SDL_Texture* target = nullptr );
|
|
||||||
void ResetRenderTarget();
|
|
||||||
|
|
||||||
///Sets
|
|
||||||
|
|
||||||
///Gets
|
|
||||||
SDL_Renderer* getRenderer();
|
|
||||||
|
|
||||||
private:
|
|
||||||
SDL_Renderer* mp_renderer;
|
|
||||||
|
|
||||||
static cRenderer* sp_inst;// = nullptr
|
|
||||||
};/// END CLASS DEFINITION cRenderer
|
|
||||||
}/// END NAMESPACE DEFINITION VideoEngine
|
|
||||||
#endif/// END IFNDEF _CRENDERER_HPP_
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
#ifndef _CPLAYERDOWN_HPP_
|
|
||||||
#define _CPLAYERDOWN_HPP_
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include "SDL.h"
|
|
||||||
|
|
||||||
/*** TrooperEngine DLL Header Files ***/
|
|
||||||
#include "TrooperEngine.hpp"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../cPaddle.hpp"
|
|
||||||
|
|
||||||
namespace Input {
|
|
||||||
class cPlayerDown : public InputEngine::cKey
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cPlayerDown( SDL_Keycode key, Equipment::cPaddle** player );
|
|
||||||
~cPlayerDown();
|
|
||||||
|
|
||||||
///Funtions
|
|
||||||
/* Call if the key is pressed */
|
|
||||||
void KeyPress();
|
|
||||||
/* Call if the key is up */
|
|
||||||
void KeyUP();
|
|
||||||
/* Call if the key is down */
|
|
||||||
void KeyDown();
|
|
||||||
|
|
||||||
private:
|
|
||||||
private:
|
|
||||||
Equipment::cPaddle** mpp_player;
|
|
||||||
};/// END CLASS DEFINITION cPlayerDown
|
|
||||||
}/// END NAMESPACE DEFINITION Input
|
|
||||||
#endif/// END IFNDEF _CPLAYERDOWN_HPP_
|
|
||||||
@@ -1,130 +0,0 @@
|
|||||||
#include "cBuildMainMenu.hpp"
|
|
||||||
|
|
||||||
/*** ANSI C Header Files ***/
|
|
||||||
#include <stdlib.h> /* strtol */
|
|
||||||
|
|
||||||
using MainMenu::cBuildMainMenu;
|
|
||||||
using MainMenu::cMainMenu;
|
|
||||||
using UtilityEngine::cUtility;
|
|
||||||
|
|
||||||
using tinyxml2::XMLDocument;
|
|
||||||
using tinyxml2::XMLNode;
|
|
||||||
using tinyxml2::XMLVisitor;
|
|
||||||
using tinyxml2::XMLElement;
|
|
||||||
|
|
||||||
cBuildMainMenu::cBuildMainMenu()
|
|
||||||
: m_ttf(""), m_dir(""), m_lang(""), m_langSettings(""), mp_mainMenu(new cMainMenu())
|
|
||||||
{}
|
|
||||||
|
|
||||||
cBuildMainMenu::~cBuildMainMenu()
|
|
||||||
{}
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
cMainMenu* cBuildMainMenu::ReadXML()
|
|
||||||
{
|
|
||||||
cString file = "xml/SDLPongCPP.xml";
|
|
||||||
XMLDocument doc;
|
|
||||||
|
|
||||||
if ( doc.LoadFile(file.c_str()) == false ) {
|
|
||||||
//cUtility::Inst().Message("Could not load file." + file + " Error='" + doc.GetErrorStr1 + "'.");
|
|
||||||
} else {
|
|
||||||
XMLNode* node = doc.FirstChildElement( "SDLPongCPP" );
|
|
||||||
|
|
||||||
if (node == nullptr) {
|
|
||||||
cUtility::Inst().Message("No <SDLPongCPP tag found.");
|
|
||||||
} else {
|
|
||||||
XMLElement* settingsElement = node->FirstChildElement( "Settings" );
|
|
||||||
if (settingsElement == nullptr) {
|
|
||||||
cUtility::Inst().Message("No <Settings> tag found.");
|
|
||||||
} else {
|
|
||||||
m_langSettings = GetAttribute(settingsElement, "lang");
|
|
||||||
}
|
|
||||||
XMLElement* mainmenuElement = node->FirstChildElement( "MainMenu" );
|
|
||||||
while (m_langSettings != m_lang) {
|
|
||||||
if (mainmenuElement == nullptr) {
|
|
||||||
cUtility::Inst().Message("No <MainMenu> tag found.");
|
|
||||||
} else {
|
|
||||||
m_lang = GetAttribute(mainmenuElement, "lang");
|
|
||||||
/* if the language is the same as the one specified in the settings we read the menu settings */
|
|
||||||
if (m_lang == m_langSettings) {
|
|
||||||
const char* colour = GetAttribute(mainmenuElement, "colour");
|
|
||||||
mp_mainMenu->setColour(IntToSDLColour(HexToInt(colour)));
|
|
||||||
|
|
||||||
const char* selectcolour = GetAttribute(mainmenuElement, "selectcolour");
|
|
||||||
mp_mainMenu->setSelectColour(IntToSDLColour(HexToInt(selectcolour)));
|
|
||||||
|
|
||||||
const char* titlecolour = GetAttribute(mainmenuElement, "titlecolour");
|
|
||||||
mp_mainMenu->setTitleColour(IntToSDLColour(HexToInt(titlecolour)));
|
|
||||||
|
|
||||||
m_ttf = GetAttribute(mainmenuElement, "ttf");
|
|
||||||
|
|
||||||
const char* soundeffect = GetAttribute(mainmenuElement, "soundeffect");
|
|
||||||
|
|
||||||
m_dir = GetAttribute(mainmenuElement, "dir");
|
|
||||||
|
|
||||||
if (m_ttf != "")
|
|
||||||
mp_mainMenu->setFont(m_dir + "ttf/", m_ttf);
|
|
||||||
|
|
||||||
mp_mainMenu->setSound(m_dir + "snd/", cString(soundeffect));
|
|
||||||
|
|
||||||
GetOptions( mainmenuElement, "Title" );
|
|
||||||
GetOptions( mainmenuElement, "SinglePlayer" );
|
|
||||||
GetOptions( mainmenuElement, "HeadToHead" );
|
|
||||||
GetOptions( mainmenuElement, "Quit" );
|
|
||||||
} else {
|
|
||||||
mainmenuElement = mainmenuElement->NextSiblingElement();
|
|
||||||
}
|
|
||||||
}/* end else */
|
|
||||||
}/* end while */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return mp_mainMenu;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cBuildMainMenu::GetOptions( const XMLElement* element, const cString name )
|
|
||||||
{
|
|
||||||
const XMLElement* titleElement = element->FirstChildElement( name.c_str() );
|
|
||||||
if (titleElement == nullptr) {
|
|
||||||
cUtility::Inst().Message("Error no tag <" + name + "> found.");
|
|
||||||
} else {
|
|
||||||
const char* x = GetAttribute(titleElement, "x");
|
|
||||||
const char* y = GetAttribute(titleElement, "y");
|
|
||||||
const char* size = GetAttribute(titleElement, "size");
|
|
||||||
const char* text = titleElement->GetText();
|
|
||||||
|
|
||||||
if (name == "Title")
|
|
||||||
mp_mainMenu->setTitleText(text, atoi(size), atoi(x), atoi(y));
|
|
||||||
if (name == "SinglePlayer")
|
|
||||||
mp_mainMenu->setSingleText(text, atoi(size), atoi(x), atoi(y));
|
|
||||||
if (name == "HeadToHead")
|
|
||||||
mp_mainMenu->setHeadText(text, atoi(size), atoi(x), atoi(y));
|
|
||||||
if (name == "Quit")
|
|
||||||
mp_mainMenu->setQuitText(text, atoi(size), atoi(x), atoi(y));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* cBuildMainMenu::GetAttribute( const XMLElement* element, const cString attribute ) const
|
|
||||||
{
|
|
||||||
const char* rtn = element->Attribute(attribute.c_str());
|
|
||||||
if (rtn == nullptr) {
|
|
||||||
cUtility::Inst().Message("Error no attribute: " + attribute + " found in tag <" + element->Value() + ">");
|
|
||||||
rtn = "";
|
|
||||||
}
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
const unsigned long int cBuildMainMenu::HexToInt( const cString str ) const
|
|
||||||
{
|
|
||||||
return strtol(str.c_str(), NULL, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
const SDL_Colour cBuildMainMenu::IntToSDLColour( const unsigned long int colour ) const
|
|
||||||
{
|
|
||||||
SDL_Colour rtn = {255, 255, 255};
|
|
||||||
|
|
||||||
rtn.r = Uint8(colour >> 16);
|
|
||||||
rtn.g = Uint8(colour >> 8);
|
|
||||||
rtn.b = Uint8(colour);
|
|
||||||
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
#ifndef _ENUMS_HPP_
|
|
||||||
#define _ENUMS_HPP_
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
namespace GUIHelpers {
|
|
||||||
enum EXPORT_FROM_MYDLL eLayout: unsigned int
|
|
||||||
{
|
|
||||||
FILL_PARENT = 0,
|
|
||||||
MATCH_PARENT,
|
|
||||||
WRAP_CONTENT
|
|
||||||
};/// END enum DEFINITION eLayout
|
|
||||||
|
|
||||||
enum EXPORT_FROM_MYDLL eType: unsigned int
|
|
||||||
{
|
|
||||||
COBJECT = 0,
|
|
||||||
CWINDOW,
|
|
||||||
CLAYOUT,
|
|
||||||
CBOXSIZER,
|
|
||||||
CBUTTON,
|
|
||||||
CTEXTBUTTON,
|
|
||||||
CLABEL,
|
|
||||||
CPANEL
|
|
||||||
};/// END enum DEFINITION eType
|
|
||||||
|
|
||||||
enum EXPORT_FROM_MYDLL eOrientation: unsigned int
|
|
||||||
{
|
|
||||||
VERTICAL = 0,
|
|
||||||
HORIZONTAL
|
|
||||||
};/// END enum DEFINITION eOrientation
|
|
||||||
|
|
||||||
enum EXPORT_FROM_MYDLL eAlign: unsigned int
|
|
||||||
{
|
|
||||||
CENTER = 0,
|
|
||||||
TOP,
|
|
||||||
RIGHT,
|
|
||||||
BOTTOM,
|
|
||||||
LEFT
|
|
||||||
};/// END enum DEFINITION eAlign
|
|
||||||
}/// END NAMESPACE DEFINITION GUIEngine
|
|
||||||
#endif/// END IFNDEF _ENUMS_HPP_
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
#ifndef _ENUMS_HPP_
|
|
||||||
#define _ENUMS_HPP_
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
namespace GUIHelpers {
|
|
||||||
enum EXPORT_FROM_MYDLL eLayout: unsigned int
|
|
||||||
{
|
|
||||||
DEFAULT_LAYOUT = 0,
|
|
||||||
FILL_PARENT,
|
|
||||||
MATCH_PARENT,
|
|
||||||
WRAP_CONTENT
|
|
||||||
};/// END enum DEFINITION eLayout
|
|
||||||
|
|
||||||
enum EXPORT_FROM_MYDLL eType: unsigned int
|
|
||||||
{
|
|
||||||
COBJECT,
|
|
||||||
CWINDOW,
|
|
||||||
CLAYOUT,
|
|
||||||
CBOXSIZER,
|
|
||||||
CBUTTON,
|
|
||||||
CTEXTBUTTON,
|
|
||||||
CLABEL,
|
|
||||||
CPANEL
|
|
||||||
};/// END enum DEFINITION eType
|
|
||||||
|
|
||||||
enum EXPORT_FROM_MYDLL eOrientation: unsigned int
|
|
||||||
{
|
|
||||||
DEFAULT_ORIENTATION = 0,
|
|
||||||
NONE,
|
|
||||||
VERTICAL,
|
|
||||||
HORIZONTAL
|
|
||||||
};/// END enum DEFINITION eOrientation
|
|
||||||
|
|
||||||
enum EXPORT_FROM_MYDLL eAlign: unsigned int
|
|
||||||
{
|
|
||||||
DEFAULT_ALIGN = 0,
|
|
||||||
CENTER,
|
|
||||||
TOP,
|
|
||||||
RIGHT,
|
|
||||||
BOTTOM,
|
|
||||||
LEFT
|
|
||||||
};/// END enum DEFINITION eAlign
|
|
||||||
}/// END NAMESPACE DEFINITION GUIEngine
|
|
||||||
#endif/// END IFNDEF _ENUMS_HPP_
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
#ifndef _CMENUDOWN_HPP_
|
|
||||||
#define _CMENUDOWN_HPP_
|
|
||||||
|
|
||||||
/*** TrooperEngine DLL Header Files ***/
|
|
||||||
#include "TrooperEngine.hpp"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../cMainMenu.hpp"
|
|
||||||
|
|
||||||
namespace Input {
|
|
||||||
class cMenuDown : public InputEngine::cKey
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cMenuDown( SDL_Keycode key, MainMenu::cMainMenu** menu );
|
|
||||||
//cMenuUp( const cMenuDown& copy );
|
|
||||||
~cMenuDown();
|
|
||||||
|
|
||||||
///Funtions
|
|
||||||
/* Call if the key is pressed */
|
|
||||||
void KeyPress();
|
|
||||||
/* Call if the key is up */
|
|
||||||
void KeyUP();
|
|
||||||
/* Call if the key is down */
|
|
||||||
void KeyDown();
|
|
||||||
|
|
||||||
private:
|
|
||||||
private:
|
|
||||||
MainMenu::cMainMenu** mpp_menu;
|
|
||||||
};/// END CLASS DEFINITION cMenuDown
|
|
||||||
}/// END NAMESPACE DEFINITION Input
|
|
||||||
#endif/// END IFNDEF _CMENUDOWN_HPP_
|
|
||||||
@@ -1,162 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|x64">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="UTest|Win32">
|
|
||||||
<Configuration>UTest</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="UTest|x64">
|
|
||||||
<Configuration>UTest</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup Label="Globals">
|
|
||||||
<ProjectGuid>{9225E043-EE77-43AA-A140-C9C2F85B1013}</ProjectGuid>
|
|
||||||
<RootNamespace>TrooperEngineTest</RootNamespace>
|
|
||||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='UTest|Win32'">
|
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='UTest|x64'">
|
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
||||||
<ImportGroup Label="ExtensionSettings">
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="Shared">
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<PropertyGroup Label="UserMacros" />
|
|
||||||
<PropertyGroup />
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level4</WarningLevel>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<AdditionalIncludeDirectories>$(SDL2_gfx);../TrooperEngineDLL/dllExportFiles;$(SDL2_net)\include;$(SDL2_ttf)\include;$(SDL2_mixer)\include;$(SDL2_image)\include;$(SDL2)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<AdditionalDependencies>odbc32.lib;odbccp32.lib;sdl2.lib;sdl2main.lib;sdl2_image.lib;sdl2_ttf.lib;sdl2_mixer.lib;sdl2_net.lib;tinyxml2.lib;TrooperEngineDLL.lib;sdl2_gfx.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<AdditionalLibraryDirectories>$(SDL2)\VisualC\Win32\Release;$(SDL2_gfx)\Win32\Release;../Debug;$(SDL2_ttf)\lib\x86;$(SDL2_mixer)\lib\x86;$(SDL2_image)\lib\x86;$(SDL2_net)\lib\x86;$(SDL2)\lib\x86;$(TINYXML)\tinyxml2\bin\Win32-Debug-Lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='UTest|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<AdditionalIncludeDirectories>$(SDL2_gfx);dllExportFiles;$(SDL2_net)\include;$(SDL2_ttf)\include;$(SDL2_mixer)\include;$(SDL2_image)\include;$(SDL2)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<AdditionalDependencies>odbc32.lib;odbccp32.lib;sdl2.lib;sdl2main.lib;sdl2_image.lib;sdl2_ttf.lib;sdl2_mixer.lib;sdl2_net.lib;tinyxml2.lib;TrooperEngineDLL.lib;sdl2_gfx.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<AdditionalLibraryDirectories>$(SDL2_gfx)\Win32\Release;../Debug;$(SDL2_ttf)\lib\x86;$(SDL2_mixer)\lib\x86;$(SDL2_image)\lib\x86;$(SDL2_net)\lib\x86;$(SDL2)\lib\x86;$(TINYXML)\tinyxml2\bin\Win32-Debug-Lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="main.cpp" />
|
|
||||||
<ClCompile Include="UTest\UTest.cpp" />
|
|
||||||
<ClCompile Include="UtilityEngineTest\StringTest.cpp" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="UTest\UTest.hpp" />
|
|
||||||
<ClInclude Include="UtilityEngineTest\StringTest.hpp" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Xml Include="xml\GUI.xml" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
||||||
<ImportGroup Label="ExtensionTargets">
|
|
||||||
</ImportGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
#ifndef _CMAINMENU_HPP_
|
|
||||||
#define _CMAINMENU_HPP_
|
|
||||||
|
|
||||||
/*** TrooperEngine DLL Header Files ***/
|
|
||||||
#include "TrooperEngine.hpp"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "eOptions.hpp"
|
|
||||||
|
|
||||||
using UtilityEngine::cString;
|
|
||||||
|
|
||||||
namespace MainMenu {
|
|
||||||
class cMainMenu
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cMainMenu();
|
|
||||||
~cMainMenu();
|
|
||||||
|
|
||||||
const eOptions ShowMenu();
|
|
||||||
|
|
||||||
void OptionUp();
|
|
||||||
void OptionDown();
|
|
||||||
void OptionSelect();
|
|
||||||
|
|
||||||
//Sets
|
|
||||||
void setOption( const eOptions option = eOptions::Start );
|
|
||||||
|
|
||||||
void setSound( const cString dir, const cString filename );
|
|
||||||
|
|
||||||
void setColour( const SDL_Colour colour );
|
|
||||||
void setSelectColour( const SDL_Colour selectcolour );
|
|
||||||
void setTitleColour( const SDL_Colour titlecolour );
|
|
||||||
|
|
||||||
void setFont( const cString dir, const cString filename );
|
|
||||||
|
|
||||||
void setTitleText( const cString text, const long int size, const long int x, const long int y );
|
|
||||||
void setSingleText( const cString text, const long int size, const long int x, const long int y );
|
|
||||||
void setHeadText( const cString text, const long int size, const long int x, const long int y );
|
|
||||||
void setQuitText( const cString text, const long int size, const long int x, const long int y );
|
|
||||||
|
|
||||||
private:
|
|
||||||
void ResetTextColour();
|
|
||||||
|
|
||||||
void Display();
|
|
||||||
void Redraw();
|
|
||||||
void PlaySound();
|
|
||||||
void Input();
|
|
||||||
|
|
||||||
void SingleSelect();
|
|
||||||
void HeadSelect();
|
|
||||||
void QuitSelect();
|
|
||||||
|
|
||||||
private:
|
|
||||||
VideoEngine::cCamera* mp_camera;// = nullptr
|
|
||||||
|
|
||||||
VideoEngine::cSprite m_titleSprite;
|
|
||||||
VideoEngine::cSprite m_singleSprite;
|
|
||||||
VideoEngine::cSprite m_headSprite;
|
|
||||||
VideoEngine::cSprite m_quitSprite;
|
|
||||||
|
|
||||||
AudioEngine::cSound m_menuSound;
|
|
||||||
|
|
||||||
SDL_Colour m_colour;// = {255, 0, 0}
|
|
||||||
SDL_Colour m_selectColour;// = {0, 0, 255}
|
|
||||||
SDL_Colour m_titleColour;// = {255, 255, 255}
|
|
||||||
|
|
||||||
TextTypeEngine::cFont* mp_font;// = nullptr
|
|
||||||
|
|
||||||
TextTypeEngine::cText* mp_titleText;// = nullptr;
|
|
||||||
TextTypeEngine::cText* mp_singleText;// = nullptr;
|
|
||||||
TextTypeEngine::cText* mp_headText;// = nullptr;
|
|
||||||
TextTypeEngine::cText* mp_quitText;// = nullptr;
|
|
||||||
|
|
||||||
eOptions m_option;// = Start;
|
|
||||||
bool m_run;// = true;
|
|
||||||
};/// END CLASS DEFINITION cMainMenu
|
|
||||||
}/// END NAMESPACE DEFINITION MainMenu
|
|
||||||
#endif/// END IFNDEF _CMAINMENU_HPP_
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
#ifndef _ENUMS_HPP_
|
|
||||||
#define _ENUMS_HPP_
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
namespace GUIHelpers {
|
|
||||||
enum EXPORT_FROM_MYDLL eLayout: unsigned int
|
|
||||||
{
|
|
||||||
DEFAULT_LAYOUT = 0,
|
|
||||||
FILL_PARENT,
|
|
||||||
MATCH_PARENT,
|
|
||||||
WRAP_CONTENT
|
|
||||||
};/// END enum DEFINITION eLayout
|
|
||||||
|
|
||||||
enum EXPORT_FROM_MYDLL eType: unsigned int
|
|
||||||
{
|
|
||||||
COBJECT,
|
|
||||||
CWINDOW,
|
|
||||||
CPANEL,
|
|
||||||
CLAYOUT,
|
|
||||||
CBOXSIZER,
|
|
||||||
CBUTTON,
|
|
||||||
CTEXTBUTTON,
|
|
||||||
CLABEL,
|
|
||||||
};/// END enum DEFINITION eType
|
|
||||||
|
|
||||||
enum EXPORT_FROM_MYDLL eOrientation: unsigned int
|
|
||||||
{
|
|
||||||
DEFAULT_ORIENTATION = 0,
|
|
||||||
NONE,
|
|
||||||
VERTICAL,
|
|
||||||
HORIZONTAL
|
|
||||||
};/// END enum DEFINITION eOrientation
|
|
||||||
|
|
||||||
enum EXPORT_FROM_MYDLL eAlign: unsigned int
|
|
||||||
{
|
|
||||||
DEFAULT_ALIGN = 0,
|
|
||||||
CENTER,
|
|
||||||
TOP,
|
|
||||||
RIGHT,
|
|
||||||
BOTTOM,
|
|
||||||
LEFT
|
|
||||||
};/// END enum DEFINITION eAlign
|
|
||||||
}/// END NAMESPACE DEFINITION GUIEngine
|
|
||||||
#endif/// END IFNDEF _ENUMS_HPP_
|
|
||||||
@@ -1,169 +0,0 @@
|
|||||||
#include "cPongStart.hpp"
|
|
||||||
|
|
||||||
/*** TrooperEngine DLL Header Files ***/
|
|
||||||
#include "TrooperEngine.hpp"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../MainMenu/Input/cMenuUp.hpp"
|
|
||||||
#include "../MainMenu/Input/cMenuDown.hpp"
|
|
||||||
#include "../MainMenu/Input/cMenuSelect.hpp"
|
|
||||||
#include "../MainMenu/Input/cEsc.hpp"
|
|
||||||
#include "../MainMenu/cBuildMainMenu.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
#include "../Equipment/cCourt.hpp"
|
|
||||||
#include "../Equipment/cPaddle.hpp"
|
|
||||||
|
|
||||||
#include "../Equipment/Input/cPlayerUp.hpp"
|
|
||||||
#include "../Equipment/Input/cPlayerDown.hpp"
|
|
||||||
#include "../Equipment/Input/cQuitButton.hpp"
|
|
||||||
|
|
||||||
using PongStart::cPongStart;
|
|
||||||
|
|
||||||
cPongStart::cPongStart()
|
|
||||||
: mp_menu(nullptr), m_option(MainMenu::Start)
|
|
||||||
{
|
|
||||||
TrooperEngineCore::cTrooperEngineCore& core = TrooperEngineCore::cTrooperEngineCore::Inst();
|
|
||||||
core.TimerInit();
|
|
||||||
core.VideoInit();
|
|
||||||
core.AudioInit();
|
|
||||||
core.TextTypeInit();
|
|
||||||
|
|
||||||
if (core.getVideo())
|
|
||||||
VideoEngine::cVideo::Inst().Setup();
|
|
||||||
if (core.getAudio())
|
|
||||||
AudioEngine::cAudio::Inst().Setup();
|
|
||||||
if (core.getTimer())
|
|
||||||
TimingEngine::cTiming::Inst().Setup();
|
|
||||||
if (core.getText())
|
|
||||||
TextTypeEngine::cTextType::Inst().Setup();
|
|
||||||
|
|
||||||
TrooperEngineCore::cTrooperEngineCore::Inst().PrintSDLVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
cPongStart::~cPongStart()
|
|
||||||
{
|
|
||||||
TrooperEngineCore::cTrooperEngineCore::Inst().Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cPongStart::Main()
|
|
||||||
{
|
|
||||||
//GUIHelpers::cTexture* temp = new GUIHelpers::cTexture();
|
|
||||||
//SDL_Rect rec = {0,0,25,25};
|
|
||||||
//temp->GenerateTexture(rec);
|
|
||||||
//TextTypeEngine::cText* txt = new TextTypeEngine::cText("Hello akjfdklajfdlkjfkljdfalkajdlkfjakljflkjafdlkjflkajdlkfjalkdjflkajdlkfajlkfdjafkljdfkljasdfalk");
|
|
||||||
//VideoEngine::cSprite* sprt = new VideoEngine::cSprite((VideoEngine::cImage**)(&txt));
|
|
||||||
//sprt->Draw();
|
|
||||||
// GUIEngine::cButton* but = new GUIEngine::cButton(0, "button2");
|
|
||||||
// but->Draw();
|
|
||||||
|
|
||||||
//GUIEngine::cWindow* win = new GUIEngine::cWindow();
|
|
||||||
GUIEngine::cLayout* lay = new GUIEngine::cLayout();
|
|
||||||
GUIEngine::cLabel* lbl = new GUIEngine::cLabel(lay, 22, "Hello world");
|
|
||||||
|
|
||||||
|
|
||||||
lay->Resize();
|
|
||||||
lay->Display();
|
|
||||||
|
|
||||||
|
|
||||||
//GUIEngine::cGUI::Inst().AddObject(win);
|
|
||||||
|
|
||||||
//GUIEngine::cGUI::Inst().Display();
|
|
||||||
|
|
||||||
//while (true) {
|
|
||||||
EventEngine::cEvent::Inst().CheckEvents();
|
|
||||||
/*SDL_Colour col = { 255, 255, 255, 255};
|
|
||||||
SDL_Rect re= { 0, 0, 100, 100};
|
|
||||||
FXEngine::cGFX::Inst().RoundedRectangle(re, 4, col);*/
|
|
||||||
VideoEngine::cVideo::Inst().Display();
|
|
||||||
//break;
|
|
||||||
//}
|
|
||||||
system("pause");
|
|
||||||
/*MainMenu();
|
|
||||||
switch (m_option)
|
|
||||||
{
|
|
||||||
case MainMenu::Start:
|
|
||||||
Start();
|
|
||||||
break;
|
|
||||||
case MainMenu::Head:
|
|
||||||
HeadtoHead();
|
|
||||||
break;
|
|
||||||
case MainMenu::Quit:
|
|
||||||
default:
|
|
||||||
Quit();
|
|
||||||
break;
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
///private
|
|
||||||
void cPongStart::MainMenu()
|
|
||||||
{
|
|
||||||
MainMenu::cBuildMainMenu temp;
|
|
||||||
mp_menu = temp.ReadXML();
|
|
||||||
|
|
||||||
Input::cMenuUp* menuup = new Input::cMenuUp(SDLK_a, &mp_menu);
|
|
||||||
Input::cMenuDown* menudown = new Input::cMenuDown(SDLK_z, &mp_menu);
|
|
||||||
Input::cMenuSelect* menuselect = new Input::cMenuSelect(SDLK_x, &mp_menu);
|
|
||||||
Input::cEsc* esc = new Input::cEsc(SDLK_ESCAPE, &mp_menu);
|
|
||||||
|
|
||||||
InputEngine::cKeyboard* menukeyboard = new InputEngine::cKeyboard("MenuKeyboard");
|
|
||||||
|
|
||||||
menukeyboard->AddKey(menuup);
|
|
||||||
menukeyboard->AddKey(menudown);
|
|
||||||
menukeyboard->AddKey(menuselect);
|
|
||||||
menukeyboard->AddKey(esc);
|
|
||||||
|
|
||||||
InputEngine::cInput::Inst().AddKeyboard(menukeyboard);
|
|
||||||
|
|
||||||
m_option = mp_menu->ShowMenu();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cPongStart::Start()
|
|
||||||
{
|
|
||||||
VideoEngine::cImage* p_image = new VideoEngine::cImage("img/", "Equipment.png", true, 0, 0, 0);
|
|
||||||
VideoEngine::cImage* p_court = new VideoEngine::cImage("img/", "Court.png");
|
|
||||||
|
|
||||||
Equipment::cBall* ball = new Equipment::cBall(400, 400, 17, 65, 12, 12, &p_image);
|
|
||||||
Equipment::cPaddle* paddle = new Equipment::cPaddle(0, 0, 0, 0, 16, 77, &p_image);
|
|
||||||
Equipment::cPaddle* paddle2 = new Equipment::cPaddle(0, 200, 29, 0, 16, 77, &p_image);
|
|
||||||
|
|
||||||
Equipment::cCourt* court = new Equipment::cCourt(ball, paddle, paddle2, &p_court);
|
|
||||||
|
|
||||||
InputEngine::cTextInput text;// = new InputEngine::cTextInput();
|
|
||||||
|
|
||||||
TimingEngine::cTiming::Inst().setFTP(30);
|
|
||||||
|
|
||||||
while (court->isPause() == false) {
|
|
||||||
ball->Move();
|
|
||||||
paddle->Move();
|
|
||||||
paddle2->Move();
|
|
||||||
|
|
||||||
court->CheckCollision();
|
|
||||||
|
|
||||||
court->Draw();
|
|
||||||
|
|
||||||
ball->Draw();
|
|
||||||
paddle->Draw();
|
|
||||||
paddle2->Draw();
|
|
||||||
|
|
||||||
TimingEngine::cTiming::Inst().Time();
|
|
||||||
VideoEngine::cVideo::Inst().Display();
|
|
||||||
}
|
|
||||||
|
|
||||||
delete p_image;
|
|
||||||
p_image = nullptr;
|
|
||||||
|
|
||||||
delete p_court;
|
|
||||||
p_court;
|
|
||||||
|
|
||||||
delete court;
|
|
||||||
court = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cPongStart::HeadtoHead()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void cPongStart::Quit()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup>
|
|
||||||
<Filter Include="UTest">
|
|
||||||
<UniqueIdentifier>{549e0f16-9635-455e-b19a-4a887771cf5d}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="VideoEngineTest">
|
|
||||||
<UniqueIdentifier>{50a06b19-0711-478a-a15e-df325d10bebc}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="UtitlityEngineTest">
|
|
||||||
<UniqueIdentifier>{3305ea52-bd3f-4a02-a012-eb2923a77dbf}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="xml">
|
|
||||||
<UniqueIdentifier>{510356f7-3573-4526-b0a4-73d691ecba95}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="GUIEngineTest">
|
|
||||||
<UniqueIdentifier>{380e8810-ed24-4a4d-b569-b7c37e3647c6}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="UTest\UTest.hpp">
|
|
||||||
<Filter>UTest</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="UtilityEngineTest\StringTest.hpp">
|
|
||||||
<Filter>UtitlityEngineTest</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="GUIEngineTest\GUIXMLTest.hpp">
|
|
||||||
<Filter>GUIEngineTest</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="UTest\UTest.cpp">
|
|
||||||
<Filter>UTest</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="main.cpp" />
|
|
||||||
<ClCompile Include="UtilityEngineTest\StringTest.cpp">
|
|
||||||
<Filter>UtitlityEngineTest</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="GUIEngineTest\GUIXMLTest.cpp">
|
|
||||||
<Filter>GUIEngineTest</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Xml Include="xml\GUI.xml">
|
|
||||||
<Filter>xml</Filter>
|
|
||||||
</Xml>
|
|
||||||
<Xml Include="xml\include.xml">
|
|
||||||
<Filter>xml</Filter>
|
|
||||||
</Xml>
|
|
||||||
<Xml Include="xml\GUIXMLDefaultTest.xml">
|
|
||||||
<Filter>xml</Filter>
|
|
||||||
</Xml>
|
|
||||||
<Xml Include="xml\GUIXMLPositionTest.xml">
|
|
||||||
<Filter>xml</Filter>
|
|
||||||
</Xml>
|
|
||||||
<Xml Include="xml\GUIXMLAlignTest.xml">
|
|
||||||
<Filter>xml</Filter>
|
|
||||||
</Xml>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
#include "cTexture.hpp"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../../VideoEngine/cRenderer.hpp"
|
|
||||||
#include "../../FXEngine/cGFX.hpp"
|
|
||||||
#include "GUIUtility.hpp"
|
|
||||||
|
|
||||||
using GUIHelpers::cTexture;
|
|
||||||
|
|
||||||
cTexture::cTexture()
|
|
||||||
{}
|
|
||||||
|
|
||||||
cTexture::~cTexture()
|
|
||||||
{}
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
|
|
||||||
//private
|
|
||||||
SDL_Texture* cTexture::GenerateTexture( const SDL_Rect& dimensions, TextTypeEngine::cText* text /*= nullptr*/ )
|
|
||||||
{
|
|
||||||
SDL_Rect t = text->getWH();
|
|
||||||
SDL_Rect centerText = { 0, 0, 0, 0 };
|
|
||||||
SDL_Rect centerButton = { 0, 0, 0, 0 };
|
|
||||||
SDL_Rect dim = dimensions;
|
|
||||||
|
|
||||||
///Find the min padding around the text.
|
|
||||||
// if (dim.w < (t.w + GUIHelpers::default::text::PADDING.x + GUIHelpers::default::text::PADDING.w) )
|
|
||||||
// dim.w += (t.w + GUIHelpers::default::text::PADDING.x + GUIHelpers::default::text::PADDING.w);
|
|
||||||
//
|
|
||||||
// if (dim.h < (t.h + GUIHelpers::default::text::PADDING.y + GUIHelpers::default::text::PADDING.z) )
|
|
||||||
// dim.h += (t.h + GUIHelpers::default::text::PADDING.y + GUIHelpers::default::text::PADDING.z);
|
|
||||||
|
|
||||||
///Find the center of the button
|
|
||||||
centerButton.x = dim.w / 2;
|
|
||||||
centerButton.y = dim.h / 2;
|
|
||||||
|
|
||||||
///Find the center of the text
|
|
||||||
centerText.x = t.w / 2;
|
|
||||||
centerText.y = t.h / 2;
|
|
||||||
|
|
||||||
if (centerText.x < centerButton.x)
|
|
||||||
t.x = centerButton.x - centerText.x;
|
|
||||||
|
|
||||||
if (centerText.y < centerButton.y)
|
|
||||||
t.y = centerButton.y - centerText.y;
|
|
||||||
|
|
||||||
SDL_Texture* temptext = VideoEngine::cRenderer::Inst().NewTexture(dim.w, dim.h, SDL_TEXTUREACCESS_TARGET );
|
|
||||||
|
|
||||||
GUIHelpers::RBGA colour = { 100, 100, 100, 255 };
|
|
||||||
|
|
||||||
FXEngine::cGFX::Inst().RoundedRectangle(dim, 0, colour, temptext);
|
|
||||||
|
|
||||||
|
|
||||||
VideoEngine::cRenderer::Inst().RenderToTexture(text->getImage(), nullptr, temptext, &t);
|
|
||||||
|
|
||||||
|
|
||||||
//cRenderer::Inst().Render(temptext, nullptr, nullptr);
|
|
||||||
|
|
||||||
//cRenderer::Inst().RenderToTexture(temptext, nullptr, text->getImage(), nullptr);
|
|
||||||
|
|
||||||
/*SDL_Surface* tempsurface = SDL_CreateRGBSurface(cVideo::Inst().getVideoSettings(), dimensions.w, dimensions.h, cVideo::Inst().getColour(),
|
|
||||||
0, 0, 0, 0);
|
|
||||||
|
|
||||||
SDL_FillRect(tempsurface, nullptr, SDL_MapRGB(tempsurface->format, 0, 255, 0));
|
|
||||||
|
|
||||||
/*if (roundedBoxRGBA(tempsurface, dimensions.x, dimensions.y, dimensions.w, dimensions.h, 10, 255, 255, 0, 255) != 0)
|
|
||||||
cerr << "Unable to generate GUI Texture." << endl << SDL_GetError() << endl;*/
|
|
||||||
|
|
||||||
|
|
||||||
/*if (text != nullptr) {
|
|
||||||
SDL_Rect srcrect, dstrect = dimensions;
|
|
||||||
cVideo::Inst().Render(text->getImage(), &srcrect, temptext, &dstrect);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->setImage(temptext);
|
|
||||||
this->setTransparent();*/
|
|
||||||
|
|
||||||
setImage(temptext);
|
|
||||||
|
|
||||||
return temptext;
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
#ifndef _CPLAYERUP_HPP_
|
|
||||||
#define _CPLAYERUP_HPP_
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include "SDL.h"
|
|
||||||
|
|
||||||
/*** TrooperEngine DLL Header Files ***/
|
|
||||||
#include "TrooperEngine.hpp"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../cPaddle.hpp"
|
|
||||||
|
|
||||||
namespace Input {
|
|
||||||
class cPlayerUp : public InputEngine::cKey
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cPlayerUp( SDL_Keycode key, Equipment::cPaddle** player );
|
|
||||||
~cPlayerUp();
|
|
||||||
|
|
||||||
///Funtions
|
|
||||||
/* Call if the key is pressed */
|
|
||||||
void KeyPress();
|
|
||||||
/* Call if the key is up */
|
|
||||||
void KeyUP();
|
|
||||||
/* Call if the key is down */
|
|
||||||
void KeyDown();
|
|
||||||
|
|
||||||
private:
|
|
||||||
private:
|
|
||||||
Equipment::cPaddle** mpp_player;
|
|
||||||
};/// END CLASS DEFINITION cPlayerUp
|
|
||||||
}/// END NAMESPACE DEFINITION Input
|
|
||||||
#endif/// END IFNDEF _CPLAYERUP_HPP_
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
#include "cMenuDown.hpp"
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include "SDL.h"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../cMainMenu.hpp"
|
|
||||||
|
|
||||||
using Input::cMenuDown;
|
|
||||||
|
|
||||||
cMenuDown::cMenuDown( SDL_Keycode key, MainMenu::cMainMenu** menu )
|
|
||||||
: cKey(key), mpp_menu(menu)
|
|
||||||
{}
|
|
||||||
|
|
||||||
/*cMenuDown::cMenuDown( const cMenuDown& copy )
|
|
||||||
{}*/
|
|
||||||
|
|
||||||
cMenuDown::~cMenuDown()
|
|
||||||
{}
|
|
||||||
|
|
||||||
///Funtions
|
|
||||||
void cMenuDown::KeyPress()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMenuDown::KeyUP()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void cMenuDown::KeyDown()
|
|
||||||
{
|
|
||||||
if (mpp_menu != nullptr && *mpp_menu != nullptr)
|
|
||||||
(*mpp_menu)->OptionDown();
|
|
||||||
}
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
#include "cBall.hpp"
|
|
||||||
|
|
||||||
using Equipment::cBall;
|
|
||||||
|
|
||||||
cBall::cBall( const signed long int xpos /*= 0*/, const signed long int ypos /*= 0*/, const signed long int xarea /*= 0*/,
|
|
||||||
const signed long int yarea /*= 0*/, const unsigned long int warea /*= 0*/, const unsigned long int harea /*= 0*/,
|
|
||||||
VideoEngine::cImage** image /*= nullptr*/, VideoEngine::cCamera** camera /*= nullptr*/ )
|
|
||||||
: cSprite(xpos, ypos, xarea, yarea, warea, harea, image, camera),
|
|
||||||
m_pause(false), m_ballState(Serve), m_speed(-10.0, -10.0), m_maxSpeed(10), m_minSpeed(5), m_boucedAllReady(false)
|
|
||||||
{}
|
|
||||||
|
|
||||||
cBall::~cBall()
|
|
||||||
{}
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
void cBall::Move()
|
|
||||||
{
|
|
||||||
if (m_pause == false)
|
|
||||||
{
|
|
||||||
float frameTime = TimingEngine::cTiming::Inst().getFrameTime();
|
|
||||||
|
|
||||||
AddPosX(long int(m_speed.x * frameTime));
|
|
||||||
AddPosY(long int(m_speed.y * frameTime));
|
|
||||||
|
|
||||||
m_boucedAllReady = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cBall::isPaused()
|
|
||||||
{
|
|
||||||
return m_pause;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cBall::Pause()
|
|
||||||
{
|
|
||||||
m_pause = !m_pause;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cBall::BounceX()
|
|
||||||
{
|
|
||||||
float rand = MathEngine::cRandom::Inst().Rand(m_maxSpeed, m_minSpeed);
|
|
||||||
|
|
||||||
m_speed.x = -m_speed.x;
|
|
||||||
m_speed.y = rand;
|
|
||||||
|
|
||||||
AddPosX((long)m_speed.x);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cBall::BounceY()
|
|
||||||
{
|
|
||||||
float rand = MathEngine::cRandom::Inst().Rand(m_maxSpeed, m_minSpeed);
|
|
||||||
|
|
||||||
m_speed.x = rand;
|
|
||||||
m_speed.y = -m_speed.y;
|
|
||||||
|
|
||||||
AddPosY((long)m_speed.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cBall::Reset( const int delay )
|
|
||||||
{
|
|
||||||
delay;
|
|
||||||
m_ballState = Serve;
|
|
||||||
}
|
|
||||||
|
|
||||||
///Sets
|
|
||||||
void cBall::setSpeed( const float x /*= -10*/, const float y /*= -10*/ )
|
|
||||||
{
|
|
||||||
m_speed.x = x;
|
|
||||||
m_speed.y = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cBall::setMaxSpeed( const float max /*= 10*/ )
|
|
||||||
{
|
|
||||||
m_maxSpeed = max;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cBall::setMinSpeed( const float min /*= 5*/ )
|
|
||||||
{
|
|
||||||
m_minSpeed = min;
|
|
||||||
}
|
|
||||||
|
|
||||||
///Gets
|
|
||||||
const MathEngine::Vector2 cBall::getSpeed() const
|
|
||||||
{
|
|
||||||
return m_speed;
|
|
||||||
}
|
|
||||||
|
|
||||||
const float cBall::getMaxSpeed() const
|
|
||||||
{
|
|
||||||
return m_maxSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
const float cBall::getMinSpeed() const
|
|
||||||
{
|
|
||||||
return m_minSpeed;
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#ifndef __STRINGTEST__
|
|
||||||
#define __STRINGTEST__
|
|
||||||
|
|
||||||
void StringTest();
|
|
||||||
|
|
||||||
#endif // __STRINGTEST__
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
#include "cTextInput.hpp"
|
|
||||||
|
|
||||||
using InputEngine::cTextInput;
|
|
||||||
|
|
||||||
cTextInput::cTextInput()
|
|
||||||
: cKeyboard("TextInput"), m_text(""), m_caps(false), m_shift(false), INTERNATIONAL_MASK(0xFF80), UNICODE_MASK(0x7F)
|
|
||||||
{
|
|
||||||
/*if (SDL_EnableUNICODE(SDL_QUERY) != SDL_ENABLE) {
|
|
||||||
SDL_EnableUNICODE(SDL_ENABLE);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
cTextInput::cTextInput( const cTextInput& copy )
|
|
||||||
: cKeyboard(copy), m_text(copy.getText()), m_caps(false), m_shift(false), INTERNATIONAL_MASK(0xFF80), UNICODE_MASK(0x7F)
|
|
||||||
{
|
|
||||||
/*if (SDL_EnableUNICODE(SDL_QUERY) != SDL_ENABLE) {
|
|
||||||
SDL_EnableUNICODE(SDL_ENABLE);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ cTextInput::~cTextInput()
|
|
||||||
{}
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
/* */
|
|
||||||
/*virtual*/ void cTextInput::KeyboardCheck( const SDL_Event& event )
|
|
||||||
{
|
|
||||||
switch(event.key.keysym.sym)
|
|
||||||
{
|
|
||||||
case SDLK_BACKSPACE:
|
|
||||||
case SDLK_DELETE:
|
|
||||||
if(m_text.size() == 0)
|
|
||||||
//m_text.erase(m_text.end() - 1);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
char key = UnicodeValue(event);
|
|
||||||
|
|
||||||
if(key != 0)
|
|
||||||
m_text += key;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clears out the Text */
|
|
||||||
void cTextInput::ClearText()
|
|
||||||
{
|
|
||||||
m_text = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
///Sets
|
|
||||||
void cTextInput::setText( const cString& text )
|
|
||||||
{
|
|
||||||
m_text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
///Gets
|
|
||||||
const cString& cTextInput::getText() const
|
|
||||||
{
|
|
||||||
return m_text;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Private
|
|
||||||
const char cTextInput::UnicodeValue( const SDL_Event& event )
|
|
||||||
{
|
|
||||||
event;
|
|
||||||
/* if (SDL_EnableUNICODE(SDL_QUERY) != SDL_ENABLE)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
unsigned long int uni = event.key.keysym.unicode;
|
|
||||||
|
|
||||||
if( uni == 0 ) // not translatable key (like up or down arrows)
|
|
||||||
{
|
|
||||||
// probably not useful as string input
|
|
||||||
// we could optionally use this to get some value
|
|
||||||
// for it: SDL_GetKeyName( key );
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else if( ( uni & INTERNATIONAL_MASK ) == 0 )
|
|
||||||
{
|
|
||||||
return static_cast<char>(uni & UNICODE_MASK);
|
|
||||||
}
|
|
||||||
else // we have a funky international character. one we can't read :(
|
|
||||||
{
|
|
||||||
// we could do nothing, or we can just show some sign of input, like so:
|
|
||||||
return 0;
|
|
||||||
}*/
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
#include "cPaddle.hpp"
|
|
||||||
|
|
||||||
using Equipment::cPaddle;
|
|
||||||
|
|
||||||
cPaddle::cPaddle( const signed long int xpos /*= 0*/, const signed long int ypos /*= 0*/, const signed long int xarea /*= 0*/,
|
|
||||||
const signed long int yarea /*= 0*/, const unsigned long int warea /*= 0*/, const unsigned long int harea /*= 0*/,
|
|
||||||
VideoEngine::cImage** image /*= nullptr*/, VideoEngine::cCamera** camera /*= nullptr*/ )
|
|
||||||
: cSprite( xpos, ypos, xarea, yarea, warea, harea, image, camera ), m_speed(0.0), m_pause(false), m_state(Still)
|
|
||||||
{}
|
|
||||||
|
|
||||||
cPaddle::~cPaddle()
|
|
||||||
{}
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
void cPaddle::Move()
|
|
||||||
{
|
|
||||||
if (m_pause == false)
|
|
||||||
{
|
|
||||||
float frameTime = TimingEngine::cTiming::Inst().getFrameTime();
|
|
||||||
|
|
||||||
AddPosY((signed long int)(m_speed * frameTime));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void cPaddle::Pause()
|
|
||||||
{
|
|
||||||
m_pause = !m_pause;
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool cPaddle::isPaused()
|
|
||||||
{
|
|
||||||
return m_pause;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cPaddle::Reset()
|
|
||||||
{}
|
|
||||||
|
|
||||||
///Sets
|
|
||||||
void cPaddle::setSpeed( const double speed /*= 0.0*/ )
|
|
||||||
{
|
|
||||||
m_speed = speed;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cPaddle::setState( const eState state /*= eState::Still*/ )
|
|
||||||
{
|
|
||||||
m_state = state;
|
|
||||||
switch (m_state)
|
|
||||||
{
|
|
||||||
case Up:
|
|
||||||
m_speed = -25.0;
|
|
||||||
break;
|
|
||||||
case Still:
|
|
||||||
m_speed = 0.0;
|
|
||||||
break;
|
|
||||||
case Down:
|
|
||||||
m_speed = 25.0;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const cPaddle::eState cPaddle::getState() const
|
|
||||||
{
|
|
||||||
return m_state;
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
#ifndef _CGFX_HPP_
|
|
||||||
#define _CGFX_HPP_
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../UtilityEngine/cString.hpp"
|
|
||||||
|
|
||||||
using UtilityEngine::cString;
|
|
||||||
|
|
||||||
namespace EXPORT_FROM_MYDLL FXEngine {
|
|
||||||
/* Singleton */
|
|
||||||
class cGFX
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
cGFX();
|
|
||||||
~cGFX();
|
|
||||||
|
|
||||||
public:
|
|
||||||
static cGFX& Inst();
|
|
||||||
static void Delete();
|
|
||||||
|
|
||||||
void StringDefault( const cString& text, const SDL_Rect& pos, const SDL_Colour& colour ) const;
|
|
||||||
void StringDefault( const cString& text, const SDL_Rect& pos, const SDL_Colour& colour, SDL_Texture* texture ) const;
|
|
||||||
|
|
||||||
void RoundedRectangle( const SDL_Rect& rect, const unsigned long int rad, const SDL_Colour& colour ) const;
|
|
||||||
void RoundedRectangle( const SDL_Rect& rect, const unsigned long int rad, const SDL_Colour& colour, SDL_Texture* texture ) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
static cGFX* sp_inst;// = nullptr
|
|
||||||
};/// END CLASS DEFINITION cGFX
|
|
||||||
}/// END NAMESPACE DEFINITION FXEngine
|
|
||||||
#endif/// END IFNDEF _CGFX_HPP_
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
#ifndef _CKEYBOARD_HPP_
|
|
||||||
#define _CKEYBOARD_HPP_
|
|
||||||
|
|
||||||
/*** C++ STL Files ***/
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "cKey.hpp"
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../UtilityEngine/cString.hpp"
|
|
||||||
|
|
||||||
using UtilityEngine::cString;
|
|
||||||
|
|
||||||
/*#pragma warning (disable : 4231)*/
|
|
||||||
EXPIMP_TEMPLATE template class EXPORT_FROM_MYDLL std::allocator<InputEngine::cKey*>;
|
|
||||||
EXPIMP_TEMPLATE template class EXPORT_FROM_MYDLL std::vector<InputEngine::cKey*, std::allocator<InputEngine::cKey*> >;
|
|
||||||
/*#pragma warning (default : 4231)*/
|
|
||||||
|
|
||||||
namespace InputEngine {
|
|
||||||
/* Singleton */
|
|
||||||
class EXPORT_FROM_MYDLL cKeyboard
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cKeyboard( const cString& label );
|
|
||||||
cKeyboard( const cKeyboard& copy );
|
|
||||||
virtual ~cKeyboard();
|
|
||||||
|
|
||||||
///Funtions
|
|
||||||
|
|
||||||
//Used when looking for keys that have been add to the check list
|
|
||||||
virtual void KeyboardCheck( const SDL_Event& event );
|
|
||||||
|
|
||||||
void AddKey( InputEngine::cKey* key );
|
|
||||||
void DeleteKey( const SDL_Keycode& key );
|
|
||||||
|
|
||||||
void DeleteAllKeys();
|
|
||||||
|
|
||||||
///Sets
|
|
||||||
///Gets
|
|
||||||
const cString& getLabel() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
cString m_label;// = ""
|
|
||||||
|
|
||||||
std::vector<InputEngine::cKey*> m_keys;
|
|
||||||
};/// END CLASS DEFINITION cKeyboard
|
|
||||||
}/// END NAMESPACE DEFINITION InputEngine
|
|
||||||
#endif/// END IFNDEF _CKEYBOARD_HPP_
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
#include "cGFX.hpp"
|
|
||||||
|
|
||||||
/*** SDL Header Files ***/
|
|
||||||
#include <SDL2_gfxPrimitives.h>
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "../VideoEngine/cRenderer.hpp"
|
|
||||||
#include "../UtilityEngine/cUtility.hpp"
|
|
||||||
|
|
||||||
using FXEngine::cGFX;
|
|
||||||
using VideoEngine::cRenderer;
|
|
||||||
using UtilityEngine::cUtility;
|
|
||||||
|
|
||||||
/*static*/ cGFX* cGFX::sp_inst = nullptr;
|
|
||||||
|
|
||||||
//private:
|
|
||||||
cGFX::cGFX()
|
|
||||||
{}
|
|
||||||
|
|
||||||
cGFX::~cGFX()
|
|
||||||
{}
|
|
||||||
|
|
||||||
//public:
|
|
||||||
///Functions
|
|
||||||
/*static*/ cGFX& cGFX::Inst()
|
|
||||||
{
|
|
||||||
if (sp_inst == nullptr)
|
|
||||||
sp_inst = new cGFX();
|
|
||||||
return *sp_inst;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*static*/ void cGFX::Delete()
|
|
||||||
{
|
|
||||||
delete sp_inst;
|
|
||||||
sp_inst = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGFX::StringDefault( const cString& text, const SDL_Rect& pos, const SDL_Colour& colour ) const
|
|
||||||
{
|
|
||||||
if (stringRGBA(cRenderer::Inst().getRenderer(), (Sint16)pos.x, (Sint16)pos.y, text.c_str(), colour.r, colour.g, colour.b, colour.a) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to render text. stringRGBA():", __AT__, cUtility::eTypeSDL::GFX);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGFX::StringDefault( const cString& text, const SDL_Rect& pos, const SDL_Colour& colour, SDL_Texture* texture ) const
|
|
||||||
{
|
|
||||||
cRenderer::Inst().SetRenderTarget(texture);
|
|
||||||
StringDefault(text, pos, colour);
|
|
||||||
cRenderer::Inst().ResetRenderTarget();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGFX::RoundedRectangle( const SDL_Rect& rect, const unsigned long int rad, const SDL_Colour& colour ) const
|
|
||||||
{
|
|
||||||
if (roundedBoxRGBA(cRenderer::Inst().getRenderer(), (Sint16)rect.x, (Sint16)rect.y, (Sint16)rect.w, (Sint16)rect.h, (Sint16)rad, colour.r, colour.g, colour.b, colour.a) < 0)
|
|
||||||
cUtility::Inst().Message("Unable to make Rounded Rectangle. roundedRectangleRGBA():", __AT__, cUtility::eTypeSDL::GFX);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cGFX::RoundedRectangle( const SDL_Rect& rect, const unsigned long int rad, const SDL_Colour& colour, SDL_Texture* texture ) const
|
|
||||||
{
|
|
||||||
cRenderer::Inst().SetRenderTarget(texture);
|
|
||||||
RoundedRectangle(rect, rad, colour);
|
|
||||||
cRenderer::Inst().ResetRenderTarget();
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.1 KiB |
@@ -1,516 +0,0 @@
|
|||||||
#include "cWindow.hpp"
|
|
||||||
|
|
||||||
|
|
||||||
#include "../FXEngine/cGFX.hpp"
|
|
||||||
#include "../UtilityEngine/cUtility.hpp"
|
|
||||||
|
|
||||||
#include "cGUI.hpp"
|
|
||||||
#include "cLabel.hpp"
|
|
||||||
#include "cLayout.hpp"
|
|
||||||
|
|
||||||
using GUIEngine::cWindow;
|
|
||||||
|
|
||||||
/*static*/ const UtilityEngine::cString cWindow::sNAME = "windows";
|
|
||||||
/*static*/ GUIHelpers::Position cWindow::sPOSITION = { 0, 0 };
|
|
||||||
/*static*/ GUIHelpers::Size cWindow::sSIZE = { 0, 0 };
|
|
||||||
/*static*/ GUIHelpers::Padding cWindow::sPADDING = { 5, 5, 5, 5 };
|
|
||||||
/*static*/ GUIHelpers::RGBA cWindow::sCOLOUR = { 100, 100, 100, 255 };
|
|
||||||
|
|
||||||
/*static*/ GUIHelpers::eAlign cWindow::sALIGN = GUIHelpers::eAlign::CENTER;
|
|
||||||
/*static*/ GUIHelpers::eLayout cWindow::sLAYOUT = GUIHelpers::eLayout::FILL_PARENT;
|
|
||||||
/*static*/ GUIHelpers::eOrientation cWindow::sORIENTATION = GUIHelpers::eOrientation::NONE;
|
|
||||||
|
|
||||||
cWindow::cWindow( cWindow* parent /*= nullptr*/, const signed int id /*= -1*/, const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/, 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*/ )
|
|
||||||
: cObject(id)
|
|
||||||
{
|
|
||||||
Create(parent, id, orientation, align, layout, pos, size, padding, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ cWindow::~cWindow()
|
|
||||||
{
|
|
||||||
for (unsigned int i = 0; i < m_children.size(); ++i) {
|
|
||||||
delete m_children[i];
|
|
||||||
m_children[i] = nullptr;
|
|
||||||
}
|
|
||||||
m_children.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ void cWindow::Create( cWindow* parent /*= nullptr*/, const signed int id /*= -1*/, const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/, 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_parent = parent;
|
|
||||||
cObject::setID(id);
|
|
||||||
setOrientation(orientation);
|
|
||||||
setAlign(align);
|
|
||||||
setLayout(layout);
|
|
||||||
setPosition(pos);
|
|
||||||
setSize(size);
|
|
||||||
setPadding(padding);
|
|
||||||
m_name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ void cWindow::Display() {
|
|
||||||
|
|
||||||
std::vector<cWindow*>::iterator it;
|
|
||||||
|
|
||||||
for (it = m_children.begin(); it < m_children.end(); it++) {
|
|
||||||
(*it)->Display();
|
|
||||||
}
|
|
||||||
|
|
||||||
DebugDisplay();
|
|
||||||
}
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
const bool cWindow::Inside( const MathEngine::iVector2& location ) const
|
|
||||||
{
|
|
||||||
bool rtn = false;
|
|
||||||
|
|
||||||
if ((location.x >= m_pos.x) && (location.y >= m_pos.y)) {
|
|
||||||
if ((location.x <= (m_pos.x + m_size.x)) && (location.y <= (m_pos.y + m_size.y)))
|
|
||||||
rtn = true;
|
|
||||||
}
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::AddChild( cWindow* obj )
|
|
||||||
{
|
|
||||||
m_children.push_back(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::RemoveChild( cWindow* obj )
|
|
||||||
{
|
|
||||||
std::vector<cWindow*>::iterator it;
|
|
||||||
|
|
||||||
for (it = m_children.begin(); it < m_children.end(); it++) {
|
|
||||||
if (obj == (*it)) {
|
|
||||||
m_children.erase(it);
|
|
||||||
//break out of the for loop
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///Sets
|
|
||||||
/*static*/ void cWindow::PositionDefault( const GUIHelpers::Position& pos )
|
|
||||||
{
|
|
||||||
if (pos.x >= 0)
|
|
||||||
sPOSITION = pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*static*/ void cWindow::SizeDefault( const GUIHelpers::Size& size )
|
|
||||||
{
|
|
||||||
if (size.x >= 0)
|
|
||||||
sSIZE = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*static*/ void cWindow::PaddingDefault( const GUIHelpers::Padding& pad )
|
|
||||||
{
|
|
||||||
if (pad.x >= 0)
|
|
||||||
sPADDING = pad;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*static*/ void cWindow::AlignDefault( const GUIHelpers::eAlign& align )
|
|
||||||
{
|
|
||||||
if (align != GUIHelpers::eAlign::DEFAULT_ALIGN)
|
|
||||||
sALIGN = align;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*static*/ void cWindow::LayoutDefault( const GUIHelpers::eLayout& layout )
|
|
||||||
{
|
|
||||||
if (layout != GUIHelpers::eLayout::DEFAULT_LAYOUT)
|
|
||||||
sLAYOUT = layout;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*static*/ void cWindow::OrientationDefault( const GUIHelpers::eOrientation& orientation )
|
|
||||||
{
|
|
||||||
if (orientation != GUIHelpers::eOrientation::DEFAULT_ORIENTATION)
|
|
||||||
sORIENTATION = orientation;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setOrientation( const GUIHelpers::eOrientation& orientation /*= sORIENTATION*/ )
|
|
||||||
{
|
|
||||||
if (orientation == GUIHelpers::eOrientation::DEFAULT_ORIENTATION)
|
|
||||||
m_orientation = cWindow::sORIENTATION;
|
|
||||||
else
|
|
||||||
m_orientation = orientation;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setAlign( const GUIHelpers::eAlign& align /*= sALIGN*/ )
|
|
||||||
{
|
|
||||||
if (align == GUIHelpers::eAlign::DEFAULT_ALIGN)
|
|
||||||
m_align = cWindow::sALIGN;
|
|
||||||
else
|
|
||||||
m_align = align;
|
|
||||||
RebuildPos();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setLayout( const GUIHelpers::eLayout& layout /*= sLAYOUT*/ )
|
|
||||||
{
|
|
||||||
if (layout == GUIHelpers::eLayout::DEFAULT_LAYOUT)
|
|
||||||
m_layout = cWindow::sLAYOUT;
|
|
||||||
else
|
|
||||||
m_layout = layout;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setPosition( const GUIHelpers::Position& pos /*= POSITION*/ )
|
|
||||||
{
|
|
||||||
if (pos.x < 0)
|
|
||||||
m_pos = cWindow::sPOSITION;
|
|
||||||
else
|
|
||||||
m_pos = pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setSize( const GUIHelpers::Size& size /*= sSIZE*/ )
|
|
||||||
{
|
|
||||||
if (size.x < 0)
|
|
||||||
m_size = cWindow::sSIZE;
|
|
||||||
else
|
|
||||||
m_size = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setPadding( const GUIHelpers::Padding& padding /*= PADDING*/ )
|
|
||||||
{
|
|
||||||
if (padding.x < 0)
|
|
||||||
m_padding = cWindow::sPADDING;
|
|
||||||
else
|
|
||||||
m_padding = padding;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setContentSize( const GUIHelpers::Size& content )
|
|
||||||
{
|
|
||||||
m_content = content;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setName( const cString& name /*= NAME*/ )
|
|
||||||
{
|
|
||||||
m_name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::setParent( cWindow* parent )
|
|
||||||
{
|
|
||||||
mp_parent = parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
///Gets
|
|
||||||
const GUIHelpers::Position cWindow::getCenter( const bool pad /*= true*/ ) const
|
|
||||||
{
|
|
||||||
GUIHelpers::Position rtn = { 0, 0 };
|
|
||||||
rtn.x = (m_size.x / 2) + m_pos.x;
|
|
||||||
rtn.y = (m_size.y / 2) + m_pos.y;
|
|
||||||
if (pad == true) {
|
|
||||||
rtn.x += (m_padding.x - m_padding.w);
|
|
||||||
rtn.y += (m_padding.y - m_padding.z);
|
|
||||||
}
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GUIHelpers::eOrientation& cWindow::getOrientation() const
|
|
||||||
{
|
|
||||||
return m_orientation;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GUIHelpers::eAlign& cWindow::getAlign() const
|
|
||||||
{
|
|
||||||
return m_align;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GUIHelpers::eLayout& cWindow::getLayout() const
|
|
||||||
{
|
|
||||||
if (m_layout == GUIHelpers::eLayout::MATCH_PARENT) {
|
|
||||||
if (mp_parent != nullptr)
|
|
||||||
return mp_parent->getLayout();
|
|
||||||
}
|
|
||||||
return m_layout;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GUIHelpers::Position cWindow::getPosition( const bool pad /*= true*/ ) const
|
|
||||||
{
|
|
||||||
GUIHelpers::Position rtn = m_pos;
|
|
||||||
|
|
||||||
if (pad == false) {
|
|
||||||
rtn.x -= m_padding.x;
|
|
||||||
rtn.y -= m_padding.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GUIHelpers::Size cWindow::getSize( const bool pad /*= true*/ ) const
|
|
||||||
{
|
|
||||||
GUIHelpers::Size rtn = m_size;
|
|
||||||
|
|
||||||
if (pad == true) {
|
|
||||||
rtn.x += m_padding.x + m_padding.w;
|
|
||||||
rtn.y += m_padding.y + m_padding.z;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rtn;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GUIHelpers::Padding& cWindow::getPadding() const
|
|
||||||
{
|
|
||||||
return m_padding;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GUIHelpers::Size& cWindow::getContentSize() const
|
|
||||||
{
|
|
||||||
return m_content;
|
|
||||||
}
|
|
||||||
|
|
||||||
const cString& cWindow::getName() const
|
|
||||||
{
|
|
||||||
return m_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
cWindow* cWindow::getParent()
|
|
||||||
{
|
|
||||||
return mp_parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ const GUIHelpers::eType cWindow::getType() const
|
|
||||||
{
|
|
||||||
return GUIHelpers::eType::CWINDOW;
|
|
||||||
}
|
|
||||||
|
|
||||||
///Protected
|
|
||||||
|
|
||||||
/*virtual*/ void cWindow::Resize()
|
|
||||||
{
|
|
||||||
RebuildLayout(this->getLayout());
|
|
||||||
RePos();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ void cWindow::RebuildLayout( const GUIHelpers::eLayout& layout )
|
|
||||||
{
|
|
||||||
GUIHelpers::Size mySize = { 0, 0 };
|
|
||||||
std::vector<cWindow*>::iterator it;
|
|
||||||
|
|
||||||
switch (layout)
|
|
||||||
{
|
|
||||||
case GUIHelpers::eLayout::MATCH_PARENT:
|
|
||||||
case GUIHelpers::eLayout::FILL_PARENT:
|
|
||||||
if (mp_parent != nullptr) {
|
|
||||||
GUIHelpers::Position myPos = mp_parent->getPosition(false);
|
|
||||||
myPos.x += m_padding.x;
|
|
||||||
myPos.y += m_padding.y;
|
|
||||||
mySize = mp_parent->getSize(false);
|
|
||||||
mySize.x -= m_padding.x + m_padding.w;
|
|
||||||
mySize.y -= m_padding.y + m_padding.z;
|
|
||||||
m_pos = myPos;
|
|
||||||
m_size = mySize;
|
|
||||||
}
|
|
||||||
for (it = m_children.begin(); it < m_children.end(); it++) {
|
|
||||||
(*it)->Resize();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eLayout::WRAP_CONTENT:
|
|
||||||
GUIHelpers::Size size = { 0, 0 };
|
|
||||||
if (m_children.size() > 0) {
|
|
||||||
for (it = m_children.begin(); it < m_children.end(); it++) {
|
|
||||||
(*it)->Resize();
|
|
||||||
size = (*it)->getSize();
|
|
||||||
AddSize(size.x, size.y, mySize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (mp_parent != nullptr)
|
|
||||||
m_pos = mp_parent->getCenter();
|
|
||||||
}
|
|
||||||
m_size = mySize;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ void cWindow::RePos()
|
|
||||||
{
|
|
||||||
std::vector<cWindow*>::iterator it;
|
|
||||||
|
|
||||||
for (it = m_children.begin(); it < m_children.end(); it++) {
|
|
||||||
(*it)->RePos();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->getType() == GUIHelpers::eType::CLAYOUT) {
|
|
||||||
GUIHelpers::Position prtCenter = getCenter();
|
|
||||||
GUIHelpers::Position ourSet = prtCenter;
|
|
||||||
GUIHelpers::Size totalSize = { 0, 0 };
|
|
||||||
GUIHelpers::Position totalCenter = { 0, 0 };
|
|
||||||
|
|
||||||
for (it = m_children.begin(); it < m_children.end(); it++) {
|
|
||||||
totalSize += (*it)->getSize();
|
|
||||||
}
|
|
||||||
totalCenter.x = totalSize.x / 2;
|
|
||||||
totalCenter.y = totalSize.y / 2;
|
|
||||||
|
|
||||||
ourSet.x -= totalCenter.x;
|
|
||||||
ourSet.y -= totalCenter.y;
|
|
||||||
|
|
||||||
|
|
||||||
GUIHelpers::Position posSet = ourSet;
|
|
||||||
GUIHelpers::Position posNext = posSet;
|
|
||||||
for (it = m_children.begin(); it < m_children.end(); it++) {
|
|
||||||
posSet = posNext;
|
|
||||||
GUIHelpers::Padding pad = (*it)->getPadding();
|
|
||||||
GUIHelpers::Size size = (*it)->getSize(false);
|
|
||||||
if (m_orientation == GUIHelpers::eOrientation::HORIZONTAL) {
|
|
||||||
posSet.x += pad.x;
|
|
||||||
posSet.y = (pad.y - pad.z - (size.y / 2)) + prtCenter.y;
|
|
||||||
|
|
||||||
posNext = posSet;
|
|
||||||
|
|
||||||
posNext.x += size.x + pad.w;
|
|
||||||
//posNext.y = ourSet.y;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
posSet.x = (pad.x - pad.w - (size.x / 2)) + prtCenter.x;
|
|
||||||
posSet.y += pad.y;
|
|
||||||
|
|
||||||
posNext = posSet;
|
|
||||||
|
|
||||||
//posNext.x = ourSet.x;
|
|
||||||
posNext.y += size.y + pad.z;
|
|
||||||
}
|
|
||||||
|
|
||||||
(*it)->setPosition(posSet);
|
|
||||||
(*it)->RebuildPos();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ void cWindow::RebuildPos()
|
|
||||||
{
|
|
||||||
if ((mp_parent != nullptr) && (mp_parent->getOrientation() != GUIHelpers::eOrientation::NONE)) {
|
|
||||||
GUIHelpers::Position prtPos = mp_parent->getPosition();
|
|
||||||
GUIHelpers::Size prtSize = mp_parent->getSize();
|
|
||||||
|
|
||||||
GUIHelpers::Position pos = this->getPosition();
|
|
||||||
GUIHelpers::Size size = this->getSize();
|
|
||||||
|
|
||||||
GUIHelpers::Padding pad = this->getPadding();
|
|
||||||
|
|
||||||
if (mp_parent->getOrientation() == GUIHelpers::eOrientation::HORIZONTAL) {
|
|
||||||
switch (this->getAlign()) {
|
|
||||||
default:
|
|
||||||
case GUIHelpers::eAlign::CENTER:
|
|
||||||
pos.y = mp_parent->getCenter().y - (this->getSize(false).y / 2);
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eAlign::BOTTOM:
|
|
||||||
pos.y = prtSize.y - size.y;
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eAlign::TOP:
|
|
||||||
pos.y = prtPos.y + pad.y;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mp_parent->getOrientation() == GUIHelpers::eOrientation::VERTICAL) {
|
|
||||||
switch (this->getAlign()) {
|
|
||||||
default:
|
|
||||||
case GUIHelpers::eAlign::CENTER:
|
|
||||||
pos.x = mp_parent->getCenter().x - (this->getSize(false).x / 2);
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eAlign::RIGHT:
|
|
||||||
pos.x = prtSize.x - size.x;
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eAlign::LEFT:
|
|
||||||
pos.x = prtPos.x + pad.x;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this->setPosition(pos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ const GUIHelpers::RGBA cWindow::getDebugColour() const
|
|
||||||
{
|
|
||||||
return GUIHelpers::WHITE;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<cWindow*>& cWindow::getChildren()
|
|
||||||
{
|
|
||||||
return m_children;
|
|
||||||
}
|
|
||||||
|
|
||||||
//private
|
|
||||||
void cWindow::AddSize( int x, int y, GUIHelpers::Size& mySize ) const
|
|
||||||
{
|
|
||||||
int& addFrom = x;
|
|
||||||
int& largestFrom = y;
|
|
||||||
|
|
||||||
int& addTo = mySize.x;
|
|
||||||
int& largestTo = mySize.y;
|
|
||||||
|
|
||||||
if (m_orientation == GUIHelpers::eOrientation::HORIZONTAL) {
|
|
||||||
addFrom = y;
|
|
||||||
largestFrom = x;
|
|
||||||
|
|
||||||
addTo = mySize.y;
|
|
||||||
largestTo = mySize.x;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*We do the real work here.*/
|
|
||||||
if (largestTo < largestFrom)
|
|
||||||
largestTo = largestFrom;
|
|
||||||
|
|
||||||
addTo += addFrom;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cWindow::DebugDisplay() const
|
|
||||||
{
|
|
||||||
unsigned long int debugLvl = GUIEngine::cGUI::Inst().getDebugLevel();
|
|
||||||
if (debugLvl > 0) {
|
|
||||||
SDL_Rect rect;
|
|
||||||
rect.x = m_pos.x;
|
|
||||||
rect.y = m_pos.y;
|
|
||||||
rect.w = m_pos.x + m_size.x;
|
|
||||||
rect.h = m_pos.y + m_size.y;
|
|
||||||
|
|
||||||
GUIHelpers::Position strPos = getCenter();
|
|
||||||
|
|
||||||
GUIHelpers::RGBA colour = getDebugColour();
|
|
||||||
FXEngine::cGFX::Inst().Pixel(strPos.x, strPos.y, colour);
|
|
||||||
|
|
||||||
cString str = "";
|
|
||||||
str.format("X: %d Y: %d", strPos.x, strPos.y);
|
|
||||||
FXEngine::cGFX::Inst().StringDefault(str, { strPos.x + 2, strPos.y + 2, 0, 0 }, colour);
|
|
||||||
|
|
||||||
if (debugLvl > 1) {
|
|
||||||
SDL_Rect typePos = { 2, 2, 0, 0 };
|
|
||||||
cString type = "";
|
|
||||||
switch (getType()) {
|
|
||||||
case GUIHelpers::eType::CPANEL:
|
|
||||||
type = "Panel";
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eType::CLAYOUT:
|
|
||||||
type = "Layout";
|
|
||||||
break;
|
|
||||||
case GUIHelpers::eType::CLABEL:
|
|
||||||
typePos = { -10, -10, 0, 0 };
|
|
||||||
type = "Label";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
type = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
typePos.x += m_pos.x;
|
|
||||||
typePos.y += m_pos.y;
|
|
||||||
|
|
||||||
FXEngine::cGFX::Inst().StringDefault(type, typePos, colour);
|
|
||||||
|
|
||||||
// if (debugLvl > 2) {
|
|
||||||
// GUIHelpers::Position pos = getPosPPad();
|
|
||||||
// //GUIHelpers::Size size = getSizePPad();
|
|
||||||
// SDL_Rect box{ 0, 0, 0, 0 };
|
|
||||||
// box.x += pos.x;
|
|
||||||
// box.y += pos.y;
|
|
||||||
// box.h += pos.y + m_size.y + m_padding.y + m_padding.z;
|
|
||||||
// box.w += pos.x + m_padding.x;
|
|
||||||
//
|
|
||||||
// FXEngine::cGFX::Inst().Box(box, colour);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
FXEngine::cGFX::Inst().Rectangle(rect, colour);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
#ifndef _COBJECT_HPP_
|
|
||||||
#define _COBJECT_HPP_
|
|
||||||
|
|
||||||
/*** Custom Header Files ***/
|
|
||||||
#include "Enums.hpp"
|
|
||||||
|
|
||||||
/*** DLL Header File ***/
|
|
||||||
#include "dllExport.h"
|
|
||||||
|
|
||||||
namespace GUIHelpers {
|
|
||||||
class EXPORT_FROM_MYDLL cObject
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
cObject( const signed int id );
|
|
||||||
virtual ~cObject();
|
|
||||||
|
|
||||||
bool operator == (const cObject& other);
|
|
||||||
|
|
||||||
///Functions
|
|
||||||
|
|
||||||
///Sets
|
|
||||||
|
|
||||||
///Gets
|
|
||||||
const signed int getID() const;
|
|
||||||
virtual const GUIHelpers::eType getType() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
signed int m_id;// = 0
|
|
||||||
};/// END CLASS DEFINITION cObject
|
|
||||||
}/// END NAMESPACE DEFINITION GUIEngine
|
|
||||||
#endif/// END IFNDEF _COBJECT_HPP_
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user