Add project files.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#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);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#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_
|
||||
@@ -0,0 +1,29 @@
|
||||
#include "cPlayerUp.hpp"
|
||||
|
||||
using Input::cPlayerUp;
|
||||
|
||||
cPlayerUp::cPlayerUp( SDL_Keycode key, Equipment::cPaddle** player )
|
||||
: cKey( key ), mpp_player(player)
|
||||
{}
|
||||
|
||||
cPlayerUp::~cPlayerUp()
|
||||
{}
|
||||
|
||||
///Funtions
|
||||
void cPlayerUp::KeyPress()
|
||||
{}
|
||||
|
||||
void cPlayerUp::KeyUP()
|
||||
{
|
||||
if (mpp_player != nullptr && *mpp_player != nullptr)
|
||||
{
|
||||
if ((*mpp_player)->getState() == Equipment::cPaddle::Up)
|
||||
(*mpp_player)->setState(Equipment::cPaddle::Still);
|
||||
}
|
||||
}
|
||||
|
||||
void cPlayerUp::KeyDown()
|
||||
{
|
||||
if (mpp_player != nullptr && *mpp_player != nullptr)
|
||||
(*mpp_player)->setState(Equipment::cPaddle::Up);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#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_
|
||||
@@ -0,0 +1,23 @@
|
||||
#include "cQuitButton.hpp"
|
||||
|
||||
using Input::cQuitButton;
|
||||
|
||||
cQuitButton::cQuitButton( SDL_Keycode key, Equipment::cCourt** court )
|
||||
: cKey( key ), mpp_court(court)
|
||||
{}
|
||||
|
||||
cQuitButton::~cQuitButton()
|
||||
{}
|
||||
|
||||
///Funtions
|
||||
void cQuitButton::KeyPress()
|
||||
{}
|
||||
|
||||
void cQuitButton::KeyUP()
|
||||
{}
|
||||
|
||||
void cQuitButton::KeyDown()
|
||||
{
|
||||
if (mpp_court != nullptr && *mpp_court != nullptr)
|
||||
(*mpp_court)->Quit();
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#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_
|
||||
@@ -0,0 +1,96 @@
|
||||
#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;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
#ifndef _CBALL_HPP_
|
||||
#define _CBALL_HPP_
|
||||
|
||||
/*** TrooperEngine DLL Header Files ***/
|
||||
#include "TrooperEngine.hpp"
|
||||
|
||||
namespace Equipment {
|
||||
class cBall : public VideoEngine::cSprite
|
||||
{
|
||||
public:
|
||||
enum eBallState
|
||||
{
|
||||
OnCourt,
|
||||
LeftOffCourt,
|
||||
RightOffCourt,
|
||||
Serve
|
||||
};
|
||||
|
||||
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 );
|
||||
~cBall();
|
||||
|
||||
///Functions
|
||||
void Move();
|
||||
const bool isPaused();
|
||||
void Pause();
|
||||
|
||||
void BounceX();
|
||||
void BounceY();
|
||||
|
||||
void Reset( const int delay );
|
||||
|
||||
///Sets
|
||||
void setSpeed( const float x = -10, const float y = -10 );
|
||||
void setMaxSpeed( const float max = 10 );
|
||||
void setMinSpeed( const float min = 5 );
|
||||
|
||||
///Gets
|
||||
const MathEngine::Vector2 getSpeed() const;
|
||||
const float getMaxSpeed() const;
|
||||
const float getMinSpeed() const;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
private:
|
||||
float m_maxSpeed;
|
||||
float m_minSpeed;
|
||||
|
||||
bool m_boucedAllReady;// = false;
|
||||
|
||||
MathEngine::Vector2 m_speed;
|
||||
|
||||
eBallState m_ballState;
|
||||
|
||||
bool m_pause;// = false
|
||||
};/// END CLASS DEFINITION cBall
|
||||
}/// END NAMESPACE DEFINITION Equipment
|
||||
#endif/// END IFNDEF _CBALL_HPP_
|
||||
@@ -0,0 +1,145 @@
|
||||
#include "cCourt.hpp"
|
||||
|
||||
using Equipment::cCourt;
|
||||
using Equipment::cBall;
|
||||
using Equipment::cPaddle;
|
||||
|
||||
using MathEngine::cCollision;
|
||||
using MathEngine::Vector4;
|
||||
using MathEngine::Vector2;
|
||||
|
||||
cCourt::cCourt( cBall* ball /*= nullptr*/, cPaddle* player1 /*= nullptr*/, cPaddle* player2 /*= nullptr*/, VideoEngine::cImage** image /*= nullptr*/ )
|
||||
: cSprite( 0, 0, 0, 0, 640, 480, image), mp_ball(ball), m_pause(false)
|
||||
{
|
||||
m_topWall.x = 0.0f;
|
||||
m_topWall.y = 0.0f;
|
||||
m_topWall.z = 640.0f;
|
||||
m_topWall.w = 14.0f;
|
||||
|
||||
m_bottomWall.x = 0.0f;
|
||||
m_bottomWall.y = 464.0f;
|
||||
m_bottomWall.z = 640.0f;
|
||||
m_bottomWall.w = 14.0f;
|
||||
|
||||
m_leftOff.x = 0.0f;
|
||||
m_leftOff.y = 0.0f;
|
||||
m_leftOff.z = 480.0f;
|
||||
m_leftOff.w = 1.0f;
|
||||
|
||||
m_rightOff.x = 640.0f;
|
||||
m_rightOff.y = 0.0f;
|
||||
m_rightOff.z = 480.0f;
|
||||
m_rightOff.w = 1.0f;
|
||||
|
||||
m_court.x = 0.0f;
|
||||
m_court.y = 15.0f;
|
||||
m_court.z = 640.0f;
|
||||
m_court.w = 450.0f;
|
||||
|
||||
mp_player[0] = player1;
|
||||
mp_player[1] = player2;
|
||||
|
||||
setImageArea();
|
||||
}
|
||||
|
||||
cCourt::~cCourt()
|
||||
{}
|
||||
|
||||
///Functions
|
||||
void cCourt::CheckCollision()
|
||||
{
|
||||
if (m_pause == false)
|
||||
{
|
||||
CheckPaddles();
|
||||
CheckWalls();
|
||||
CheckOffCourt();
|
||||
}
|
||||
}
|
||||
|
||||
void cCourt::Quit()
|
||||
{
|
||||
}
|
||||
|
||||
const bool cCourt::isPause() const
|
||||
{
|
||||
return m_pause;
|
||||
}
|
||||
|
||||
void cCourt::Pause()
|
||||
{
|
||||
m_pause = !m_pause;
|
||||
|
||||
mp_ball->Pause();
|
||||
mp_player[0]->Pause();
|
||||
mp_player[1]->Pause();
|
||||
}
|
||||
|
||||
//private:
|
||||
//Checks to see if the ball has hit a paddles and then if the paddles have hit a wall.
|
||||
void cCourt::CheckPaddles()
|
||||
{
|
||||
for (int count = 0; count <= 1; ++count)
|
||||
{
|
||||
//Check to see if the ball hit the Paddles.
|
||||
if (cCollision::BoundingBox(mp_player[count]->getPosition(), mp_ball->getPosition()) == true)
|
||||
mp_ball->BounceX();
|
||||
|
||||
//Check to see if the Paddles hit the top wall.
|
||||
if (cCollision::BoundingBox(mp_player[count]->getPosition(), m_topWall) == true)
|
||||
mp_player[count]->setPosY((long)m_topWall.w + 1);
|
||||
|
||||
//Check to see if the Paddles hit the bottom wall.
|
||||
if (cCollision::BoundingBox(mp_player[count]->getPosition(), m_bottomWall) == true)
|
||||
mp_player[count]->setPosY((long)m_bottomWall.y - 1);
|
||||
}
|
||||
}
|
||||
|
||||
//Cheaks to see if the ball has hit the provide wall.
|
||||
void cCourt::CheckWall(const Vector4& wall)
|
||||
{
|
||||
if (cCollision::BoundingBox(mp_ball->getPosition(), wall) == true)
|
||||
mp_ball->BounceY();
|
||||
}
|
||||
|
||||
//Cheaks to see if the ball has hit the wall.
|
||||
void cCourt::CheckWalls()
|
||||
{
|
||||
CheckWall(m_topWall);
|
||||
CheckWall(m_bottomWall);
|
||||
}
|
||||
|
||||
//Checks to see if the ball is off the provide side of the court.
|
||||
const bool cCourt::CheckOffCourt(const Vector4& offside)
|
||||
{
|
||||
bool rtn = false;
|
||||
|
||||
if (cCollision::BoundingBox(mp_ball->getPosition(), offside) == true)
|
||||
{
|
||||
mp_ball->setSpeed(0,0);
|
||||
rtn = true;
|
||||
}
|
||||
|
||||
return rtn;
|
||||
}
|
||||
|
||||
//Checks to see if the ball is off the court
|
||||
void cCourt::CheckOffCourt()
|
||||
{
|
||||
MathEngine::Vector2 mov = cCollision::Inside(m_court, mp_ball->getPosition());
|
||||
|
||||
if (mov.x != 0.0f)
|
||||
{
|
||||
// if (mov.x > 0.0f);
|
||||
// //point to player 1
|
||||
// if (mov.x < 0.0f);
|
||||
// //point to player 2
|
||||
}
|
||||
|
||||
if (mov.y != 0.0f)
|
||||
mp_ball->AddPosY((long)mov.y);
|
||||
|
||||
//if (CheckOffCourt(m_leftOff) == true)
|
||||
// ;
|
||||
//if (CheckOffCourt(m_rightOff) == true)
|
||||
// ;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
#ifndef _CCOURT_HPP_
|
||||
#define _CCOURT_HPP_
|
||||
|
||||
/*** SDL Header Files ***/
|
||||
#include <SDL.h>
|
||||
|
||||
/*** TrooperEngine DLL Header Files ***/
|
||||
#include "TrooperEngine.hpp"
|
||||
|
||||
/*** Custom Header Files ***/
|
||||
#include "cBall.hpp"
|
||||
#include "cPaddle.hpp"
|
||||
|
||||
namespace Equipment {
|
||||
class cCourt : public VideoEngine::cSprite
|
||||
{
|
||||
public:
|
||||
cCourt( cBall* ball = nullptr, cPaddle* player1 = nullptr, cPaddle* player2 = nullptr, VideoEngine::cImage** image = nullptr );
|
||||
~cCourt();
|
||||
|
||||
///Functions
|
||||
void CheckCollision();
|
||||
void Quit();
|
||||
|
||||
const bool isPause() const;
|
||||
void Pause();
|
||||
|
||||
void Reset();
|
||||
|
||||
private:
|
||||
void CheckPaddles();
|
||||
|
||||
void CheckWall(const MathEngine::Vector4& wall);
|
||||
void CheckWalls();
|
||||
|
||||
const bool CheckOffCourt(const MathEngine::Vector4& offside);
|
||||
void CheckOffCourt();
|
||||
|
||||
private:
|
||||
MathEngine::Vector4 m_topWall;
|
||||
MathEngine::Vector4 m_bottomWall;
|
||||
|
||||
MathEngine::Vector4 m_leftOff;
|
||||
MathEngine::Vector4 m_rightOff;
|
||||
|
||||
MathEngine::Vector4 m_court;
|
||||
|
||||
cBall* mp_ball;// = nullptr;
|
||||
cPaddle* mp_player[2];// = nullptr;
|
||||
//cPaddle* mp_player2;// = nullptr;
|
||||
|
||||
bool m_pause;// = false
|
||||
};/// END CLASS DEFINITION cCourt
|
||||
}/// END NAMESPACE DEFINITION Equipment
|
||||
#endif/// END IFNDEF _CCOURT_HPP_
|
||||
@@ -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,49 @@
|
||||
#ifndef _CPADDLE_HPP_
|
||||
#define _CPADDLE_HPP_
|
||||
|
||||
/*** TrooperEngine DLL Header Files ***/
|
||||
#include "TrooperEngine.hpp"
|
||||
|
||||
/*** Custom Header Files ***/
|
||||
#include "eBallState.hpp"
|
||||
|
||||
namespace Equipment {
|
||||
class cPaddle : public VideoEngine::cSprite
|
||||
{
|
||||
public:
|
||||
enum eState {
|
||||
Up = 0,
|
||||
Still,
|
||||
Down
|
||||
};
|
||||
|
||||
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 );
|
||||
~cPaddle();
|
||||
|
||||
///Functions
|
||||
void Move();
|
||||
const bool isPaused();
|
||||
void Pause();
|
||||
|
||||
void Reset();
|
||||
|
||||
///Sets
|
||||
void setSpeed( const double speed = 0.0 );
|
||||
void setState( const eState state = eState::Still );
|
||||
|
||||
///Gets
|
||||
const eState getState() const;
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
double m_speed;
|
||||
|
||||
bool m_pause;// = false
|
||||
|
||||
eState m_state;// = Still
|
||||
};/// END CLASS DEFINITION cPaddle
|
||||
}/// END NAMESPACE DEFINITION Equipment
|
||||
#endif/// END IFNDEF _CPADDLE_HPP_
|
||||
@@ -0,0 +1,16 @@
|
||||
#include "cPlayer.hpp"
|
||||
|
||||
using Equipment::cPlayer;
|
||||
|
||||
cPlayer::cPlayer( const cString name )
|
||||
: m_name(name)
|
||||
{}
|
||||
|
||||
cPlayer::~cPlayer()
|
||||
{}
|
||||
|
||||
///Functions
|
||||
void cPlayer::Score( const unsigned long int score /*= 1*/ )
|
||||
{
|
||||
m_score += score;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef _CPLAYER_HPP_
|
||||
#define _CPLAYER_HPP_
|
||||
|
||||
/*** TrooperEngine DLL Header Files ***/
|
||||
#include "TrooperEngine.hpp"
|
||||
|
||||
/*** Custom Header Files ***/
|
||||
|
||||
using UtilityEngine::cString;
|
||||
|
||||
namespace Equipment {
|
||||
class cPlayer
|
||||
{
|
||||
public:
|
||||
cPlayer( const cString name );
|
||||
~cPlayer();
|
||||
|
||||
///Functions
|
||||
void Score( const unsigned long int score = 1 );
|
||||
|
||||
///Sets
|
||||
void setName( const cString name );
|
||||
|
||||
///Gets
|
||||
const unsigned long int getScore() const;
|
||||
const cString getName() const;
|
||||
|
||||
private:
|
||||
private:
|
||||
unsigned long int m_score;// = 0
|
||||
|
||||
cString m_name;
|
||||
};/// END CLASS DEFINITION cPlayer
|
||||
}/// END NAMESPACE DEFINITION Equipment
|
||||
#endif/// END IFNDEF _CPLAYER_HPP_
|
||||
@@ -0,0 +1,19 @@
|
||||
#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;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#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_
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef _EBALLSTATE_HPP_
|
||||
#define _EBALLSTATE_HPP_
|
||||
|
||||
/*** TrooperEngine DLL Header Files ***/
|
||||
#include "TrooperEngine.hpp"
|
||||
|
||||
namespace Equipment {
|
||||
enum eBallState
|
||||
{
|
||||
OnCourt,
|
||||
LeftOffCourt,
|
||||
RightOffCourt,
|
||||
Serve
|
||||
};/// END ENUM DEFINITION eBallState
|
||||
}/// END NAMESPACE DEFINITION Equipment
|
||||
#endif/// END IFNDEF _EBALLSTATE_HPP_
|
||||
@@ -0,0 +1,40 @@
|
||||
#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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#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_
|
||||
@@ -0,0 +1,34 @@
|
||||
#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();
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#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_
|
||||
@@ -0,0 +1,34 @@
|
||||
#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();
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#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_
|
||||
@@ -0,0 +1,34 @@
|
||||
#include "cMenuUp.hpp"
|
||||
|
||||
/*** SDL Header Files ***/
|
||||
#include "SDL.h"
|
||||
|
||||
/*** Custom Header Files ***/
|
||||
#include "../cMainMenu.hpp"
|
||||
|
||||
using Input::cMenuUp;
|
||||
|
||||
cMenuUp::cMenuUp( SDL_Keycode key, MainMenu::cMainMenu** menu )
|
||||
: cKey(key), mpp_menu(menu)
|
||||
{}
|
||||
|
||||
/*cMenuUp::cMenuUp( const cMenuUp& copy )
|
||||
{}*/
|
||||
|
||||
cMenuUp::~cMenuUp()
|
||||
{}
|
||||
|
||||
///Funtions
|
||||
void cMenuUp::KeyPress()
|
||||
{
|
||||
}
|
||||
|
||||
void cMenuUp::KeyUP()
|
||||
{
|
||||
}
|
||||
|
||||
void cMenuUp::KeyDown()
|
||||
{
|
||||
if (mpp_menu != nullptr && *mpp_menu != nullptr)
|
||||
(*mpp_menu)->OptionUp();
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef _CMENUUP_HPP_
|
||||
#define _CMENUUP_HPP_
|
||||
|
||||
/*** TrooperEngine DLL Header Files ***/
|
||||
#include "TrooperEngine.hpp"
|
||||
|
||||
/*** Custom Header Files ***/
|
||||
#include "../cMainMenu.hpp"
|
||||
|
||||
namespace Input {
|
||||
class cMenuUp : public InputEngine::cKey
|
||||
{
|
||||
public:
|
||||
cMenuUp( SDL_Keycode key, MainMenu::cMainMenu** menu );
|
||||
//cMenuUp( const cMenuUp& copy );
|
||||
~cMenuUp();
|
||||
|
||||
///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 cMenuUp
|
||||
}/// END NAMESPACE DEFINITION Input
|
||||
#endif/// END IFNDEF _CMENUUP_HPP_
|
||||
@@ -0,0 +1,130 @@
|
||||
#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;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
#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_
|
||||
@@ -0,0 +1,226 @@
|
||||
#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::cEventControl::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();
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
#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_
|
||||
@@ -0,0 +1,35 @@
|
||||
#include "eOptions.hpp"
|
||||
|
||||
using MainMenu::eOptions;
|
||||
|
||||
void MainMenu::operator++(eOptions& option)
|
||||
{
|
||||
switch (option)
|
||||
{
|
||||
case Start:
|
||||
option = Head;
|
||||
break;
|
||||
case Head:
|
||||
option = Quit;
|
||||
break;
|
||||
case Quit:
|
||||
option = Start;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MainMenu::operator--(eOptions& option)
|
||||
{
|
||||
switch (option)
|
||||
{
|
||||
case Start:
|
||||
option = Quit;
|
||||
break;
|
||||
case Head:
|
||||
option = Start;
|
||||
break;
|
||||
case Quit:
|
||||
option = Head;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#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_
|
||||
@@ -0,0 +1,172 @@
|
||||
#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::cGUI::Inst().Initialize("GUI.xml", "xml/");
|
||||
GUIEngine::cGUI::Inst().Display();
|
||||
// GUIEngine::cLayout* lay = new GUIEngine::cLayout();
|
||||
// GUIEngine::cLabel* lbl = new GUIEngine::cLabel(lay, 22, "Hello world");
|
||||
//
|
||||
// lbl->setAlign(GUIHelpers::eAlign::RIGHT);
|
||||
// //lbl->Resize();
|
||||
// lay->Resize();
|
||||
// lay->Display();
|
||||
|
||||
|
||||
//GUIEngine::cGUI::Inst().AddObject(win);
|
||||
|
||||
//GUIEngine::cGUI::Inst().Display();
|
||||
|
||||
//while (true) {
|
||||
EventEngine::cEventControl::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()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef _CPONGSTART_HPP_
|
||||
#define _CPONGSTART_HPP_
|
||||
|
||||
/*** Custom Header Files ***/
|
||||
#include "../MainMenu/cMainMenu.hpp"
|
||||
#include "../MainMenu/eOptions.hpp"
|
||||
|
||||
namespace PongStart {
|
||||
class cPongStart
|
||||
{
|
||||
public:
|
||||
cPongStart();
|
||||
~cPongStart();
|
||||
|
||||
///Functions
|
||||
/* main loop of the game */
|
||||
void Main();
|
||||
|
||||
private:
|
||||
void MainMenu();
|
||||
|
||||
void Start();
|
||||
void HeadtoHead();
|
||||
void Quit();
|
||||
|
||||
void MenuKeyboard();
|
||||
|
||||
private:
|
||||
MainMenu::cMainMenu* mp_menu;
|
||||
MainMenu::eOptions m_option;
|
||||
};/// END CLASS DEFINITION cPongStart
|
||||
}/// END NAMESPACE DEFINITION PongStart
|
||||
#endif/// END IFNDEF _CPONGSTART_HPP_
|
||||
@@ -0,0 +1,32 @@
|
||||
/* Copyright (C) 2010 Richard W. Allen
|
||||
Program Name: SDL Pong C++
|
||||
Author: Richard W. Allen
|
||||
Version: V1.0
|
||||
Date Started: August 24, 2009
|
||||
Date End:
|
||||
Webpage: http://www.richardallenonline.com
|
||||
IDE: Visual Studio 2010
|
||||
Compiler: C\C++ 2010
|
||||
Langage: C++
|
||||
License: GNU GENERAL PUBLIC LICENSE Version 2
|
||||
see license.txt for details
|
||||
|
||||
SDL Pong C++ Copyright (C) 2010 Richard W. Allen DEATH VALLEY
|
||||
Comes with ABSOLUTELY NO WARRANTY;
|
||||
SDL Pong C++ is licensed under the GNU GENERAL PUBLIC LICENSE Version 2.
|
||||
for details see the license.txt include with this program.
|
||||
*/
|
||||
|
||||
/*** SDL Header Files ***/
|
||||
#include "SDL.h"
|
||||
|
||||
#include "../Game/PongStart/cPongStart.hpp"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argc, argv;
|
||||
|
||||
PongStart::cPongStart pong;
|
||||
pong.Main();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.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>{D0670630-6CBB-4894-BAC6-35FD775E8D8E}</ProjectGuid>
|
||||
<RootNamespace>SDLPongCPP</RootNamespace>
|
||||
<ProjectName>SDLPongCPP</ProjectName>
|
||||
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='UTest|Win32'">
|
||||
<PlatformToolset>v141</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>
|
||||
<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>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(TINYXML);$(SDL2_gfx);../TrooperEngineDLL/dllExportFiles;$(SDL2_net)\include;$(SDL2_ttf)\include;$(SDL2_mixer)\include;$(SDL2_image)\include;$(SDL2)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</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)\VisualC\Win32\Debug;$(SDL2_gfx)\Win32\Debug;../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>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Full</Optimization>
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>../LinkListDLLProject/dllExportFiles;../TrooperEngineDLLProject/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>
|
||||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>odbc32.lib;odbccp32.lib;sdl.lib;sdlmain.lib;sdl_image.lib;sdl_ttf.lib;sdl_mixer.lib;TrooperEngine.lib;LinkList.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<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>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<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>
|
||||
<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="Game\Equipment\cPlayer.cpp" />
|
||||
<ClCompile Include="Game\Equipment\cScoreBoard.cpp" />
|
||||
<ClCompile Include="Game\MainMenu\cBuildMainMenu.cpp" />
|
||||
<ClCompile Include="Game\MainMenu\Input\cEsc.cpp" />
|
||||
<ClCompile Include="Main\main.cpp" />
|
||||
<ClCompile Include="Game\Equipment\cBall.cpp" />
|
||||
<ClCompile Include="Game\Equipment\cCourt.cpp" />
|
||||
<ClCompile Include="Game\Equipment\cPaddle.cpp" />
|
||||
<ClCompile Include="Game\Equipment\Input\cPlayerDown.cpp" />
|
||||
<ClCompile Include="Game\Equipment\Input\cPlayerUp.cpp" />
|
||||
<ClCompile Include="Game\Equipment\Input\cQuitButton.cpp" />
|
||||
<ClCompile Include="Game\MainMenu\cMainMenu.cpp" />
|
||||
<ClCompile Include="Game\MainMenu\eOptions.cpp" />
|
||||
<ClCompile Include="Game\MainMenu\Input\cMenuDown.cpp" />
|
||||
<ClCompile Include="Game\MainMenu\Input\cMenuSelect.cpp" />
|
||||
<ClCompile Include="Game\MainMenu\Input\cMenuUp.cpp" />
|
||||
<ClCompile Include="Game\PongStart\cPongStart.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Game\Equipment\cBall.hpp" />
|
||||
<ClInclude Include="Game\Equipment\cCourt.hpp" />
|
||||
<ClInclude Include="Game\Equipment\cPaddle.hpp" />
|
||||
<ClInclude Include="Game\Equipment\cPlayer.hpp" />
|
||||
<ClInclude Include="Game\Equipment\cScoreBoard.hpp" />
|
||||
<ClInclude Include="Game\Equipment\eBallState.hpp" />
|
||||
<ClInclude Include="Game\Equipment\Input\cPlayerDown.hpp" />
|
||||
<ClInclude Include="Game\Equipment\Input\cPlayerUp.hpp" />
|
||||
<ClInclude Include="Game\Equipment\Input\cQuitButton.hpp" />
|
||||
<ClInclude Include="Game\MainMenu\cBuildMainMenu.hpp" />
|
||||
<ClInclude Include="Game\MainMenu\cMainMenu.hpp" />
|
||||
<ClInclude Include="Game\MainMenu\eOptions.hpp" />
|
||||
<ClInclude Include="Game\MainMenu\Input\cEsc.hpp" />
|
||||
<ClInclude Include="Game\MainMenu\Input\cMenuDown.hpp" />
|
||||
<ClInclude Include="Game\MainMenu\Input\cMenuSelect.hpp" />
|
||||
<ClInclude Include="Game\MainMenu\Input\cMenuUp.hpp" />
|
||||
<ClInclude Include="Game\PongStart\cPongStart.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TrooperEngineDLL\TrooperEngineDLL.vcxproj">
|
||||
<Project>{b6513faa-8bde-45aa-9f1e-326bcbe5d2e8}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Xml Include="xml\GUI.xml" />
|
||||
<Xml Include="xml\SDLPongCPP - Copy.xml" />
|
||||
<Xml Include="xml\SDLPongCPP.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,146 @@
|
||||
<?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>
|
||||
<Filter Include="xml">
|
||||
<UniqueIdentifier>{7e2b44c1-a033-4c62-92cc-9a03f5cffda9}</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>
|
||||
<ClInclude Include="Game\Equipment\eBallState.hpp">
|
||||
<Filter>Game\Equipment</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Xml Include="xml\GUI.xml">
|
||||
<Filter>xml</Filter>
|
||||
</Xml>
|
||||
<Xml Include="xml\SDLPongCPP - Copy.xml">
|
||||
<Filter>xml</Filter>
|
||||
</Xml>
|
||||
<Xml Include="xml\SDLPongCPP.xml">
|
||||
<Filter>xml</Filter>
|
||||
</Xml>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 101 KiB |
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
wget -c http://www.machinaesupremacy.com/downloads/machinae_supremacy_-_masquerade.ogg
|
||||
ln -s machinae_supremacy_-_masquerade.ogg game-music.ogg
|
||||
wget -c http://www.machinaesupremacy.com/downloads/machinae_supremacy_-_arcade.ogg
|
||||
ln -s machinae_supremacy_-_arcade.ogg menu-music.ogg
|
||||
clear
|
||||
echo The music is now downloaded.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
<GUI
|
||||
orientation="vertical"
|
||||
align="center"
|
||||
layout="fill_parent"
|
||||
padding="10, 10, 10, 10"
|
||||
debug="false">
|
||||
<Layout>
|
||||
<Label
|
||||
text="Hello World"
|
||||
colour="255" fontsize="30"/>
|
||||
</Layout>
|
||||
</GUI>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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>
|
||||
Reference in New Issue
Block a user