Add project files.

This commit is contained in:
2018-06-25 21:48:45 -04:00
parent b04a25689b
commit 3c1b7d28e8
425 changed files with 35333 additions and 0 deletions
@@ -0,0 +1,6 @@
#ifndef __STRINGTEST__
#define __STRINGTEST__
void StringTest();
#endif // __STRINGTEST__
@@ -0,0 +1,90 @@
#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;
}
@@ -0,0 +1,66 @@
#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;
}
@@ -0,0 +1,37 @@
#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_
@@ -0,0 +1,55 @@
#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_
@@ -0,0 +1,62 @@
#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();
}