Add project files.
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
#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;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
#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_
|
||||
Reference in New Issue
Block a user