Pre-resize fillparent

This commit is contained in:
2018-08-13 22:22:10 -04:00
parent 58fa6f0503
commit 353dc21750
95 changed files with 478 additions and 437 deletions
@@ -21,7 +21,7 @@ cAnimatedSprite::~cAnimatedSprite()
{
}
///Functions
/// Functions
void cAnimatedSprite::UptoDown()
{
//if (TimeLeft() == 0)
@@ -91,7 +91,7 @@ void cAnimatedSprite::RighttoLeft()
Draw();
}
///Sets
/// Sets
void cAnimatedSprite::setXIncrement( const unsigned long int x )
{
m_xIncrement = x;
@@ -115,7 +115,7 @@ void cAnimatedSprite::setFPS( const unsigned long int fps /*= 16*/ )
m_nextTime = ((unsigned long int)SDL_GetTicks()) + m_RATE;
}
///Gets
/// Gets
const unsigned long int cAnimatedSprite::getXIncrement() const
{
return m_xIncrement;
@@ -19,7 +19,7 @@ namespace VideoEngine {
cAnimatedSprite( const cAnimatedSprite& copy );
~cAnimatedSprite();
///Functions
/// Functions
/* Runs down the image */
void UptoDown();
/* Runs up the image */
@@ -29,7 +29,7 @@ namespace VideoEngine {
/* Runs Left of the image */
void RighttoLeft();
///Sets
/// Sets
/* Sets the x increment */
void setXIncrement( const unsigned long int x );
/* Sets the y increment */
@@ -39,7 +39,7 @@ namespace VideoEngine {
/* Sets the speed of going from one frame to the next */
void setFPS( const unsigned long int fps = 16 );
///Gets
/// Gets
/* Gets the x increment */
const unsigned long int getXIncrement() const;
/* Gets the y increment */
@@ -55,15 +55,15 @@ namespace VideoEngine {
void AddTimeandRate();
private:
///Variables
unsigned long int m_xIncrement;// = 0
unsigned long int m_yIncrement;// = 0
/// Variables
unsigned long int m_xIncrement;/// = 0
unsigned long int m_yIncrement;/// = 0
unsigned long int m_fps;// = 16
unsigned long int m_fps;/// = 16
unsigned long int m_nextTime;// = 0
unsigned long int m_nextTime;/// = 0
unsigned long int m_RATE;// = 0
unsigned long int m_RATE;/// = 0
};/// END CLASS DEFINITION cAnimatedSprite
}/// END NAMESPACE DEFINITION VideoEngine
@@ -46,7 +46,7 @@ void cCamera::SaveImage( const cString& fileName, const cString& dir /*= ""*/ )
cRenderer::Inst().SaveTexture(mp_texture, fileName, dir);
}
///Sets
/// Sets
void cCamera::setXPosandYPos( const signed long int xPos /*= 0*/, const signed long int yPos /*= 0*/ )
{
m_position.x = Sint16(xPos);
@@ -71,7 +71,7 @@ void cCamera::setTexture( SDL_Texture* texture )
cRenderer::Inst().CopyTexture(texture, mp_texture);
}
///Gets
/// Gets
const unsigned long int cCamera::getXPos() const
{
return m_position.x;
@@ -28,7 +28,7 @@ namespace VideoEngine {
/* Saves the Camera Image to a BMP file */
void SaveImage( const cString& fileName, const cString& dir = "" );
///Sets
/// Sets
/* Sets the x and y position on the video buffer */
void setXPosandYPos( const signed long int xPos = 0, const signed long int yPos = 0 );
/* Sets the width and height the camera should be */
@@ -36,7 +36,7 @@ namespace VideoEngine {
/* Sets the Surface */
void setTexture( SDL_Texture* texture );
///Gets
/// Gets
/* Gets the x position of the camera */
const unsigned long int getXPos() const;
/* Gets the y position of the camera */
@@ -54,15 +54,15 @@ namespace VideoEngine {
SDL_Texture* getTexture() const;
private:
///Functions
/// Functions
void CreateCamera();
void DeleteCamera();
private:
///Variables
/// Variables
SDL_Rect m_position;
SDL_Texture* mp_texture;// = nullptr
SDL_Texture* mp_texture;/// = nullptr
//std::vector<cSprite*> m_sprites;
//LinkList::cLList m_sprites;
@@ -70,7 +70,7 @@ const cImage* cImage::NewImage( SDL_Rect& area ) const
return rtn;
}
///Sets
/// Sets
void cImage::setTransparent( const bool transparent /*= true*/ )
{
m_transparent = transparent;
@@ -90,7 +90,7 @@ void cImage::setLevelTrans( const unsigned char translevel /*= 255*/ )
m_transLevel = translevel;
}
///Gets
/// Gets
SDL_Surface* cImage::getSurface() const
{
SDL_Surface* rtn = nullptr;
@@ -187,7 +187,7 @@ const bool cImage::getIsSurface() const
return m_isSurface;
}
//protected:
/// protected:
void cImage::setImage( SDL_Surface* surface )
{
UnloadImage();
@@ -206,8 +206,8 @@ void cImage::setImage( SDL_Texture* texture )
mp_texture = texture;
}
///private
///Functions
/// private
/// Functions
void cImage::TransparentSetup()
{
if (m_transparent == false)
@@ -30,7 +30,7 @@ namespace VideoEngine {
/* Creates a New Image based on input */
const cImage* NewImage( SDL_Rect& area ) const;
///Sets
/// Sets
/* Sets Transparent on if set to true */
void setTransparent( const bool transparent = true );
/* Sets the colour to be made transparent */
@@ -38,7 +38,7 @@ namespace VideoEngine {
/* Sets the level of the transparent 255 = clear, 0 = solid */
void setLevelTrans( const unsigned char translevel = 255 );
///Gets
/// Gets
/* Gets a pointer to the SDL_Surface */
SDL_Surface* getSurface() const;
/* Gets a pointer to the SDL_Texture */
@@ -76,22 +76,22 @@ namespace VideoEngine {
void setImage( SDL_Texture* texture );
private:
///Functions
/// Functions
void TransparentSetup();
void UnloadImage();
private:
///Variables
SDL_Texture* mp_texture;// = nullptr
/// Variables
SDL_Texture* mp_texture;/// = nullptr
SDL_Surface* mp_surface;// = nullptr
bool m_transparent;// = false
bool m_transparent;/// = false
unsigned char m_transRed;// = 0
unsigned char m_transBlue;// = 0
unsigned char m_transGreen;// = 255
unsigned char m_transRed;/// = 0
unsigned char m_transBlue;/// = 0
unsigned char m_transGreen;/// = 255
unsigned char m_transLevel;// = 255
unsigned char m_transLevel;/// = 255
bool m_isSurface;
};/// END CLASS DEFINITION cImage
@@ -7,35 +7,35 @@
using VideoEngine::cImageFile;
using UtilityEngine::cUtility;
cImageFile::cImageFile(const cString& filename, const cString& dir /*= ""*/, const bool transparent /*= false*/,
cImageFile::cImageFile( const cString& filename, const cString& dir /*= ""*/, const bool transparent /*= false*/,
const unsigned char red /*= 0*/, const unsigned char blue /*= 0*/, const unsigned char green /*= 255*/,
const unsigned char translevel /*= 255*/, const bool isSurface /*= false*/)
const unsigned char translevel /*= 255*/, const bool isSurface /*= false*/ )
: cImage(transparent, red, blue, green, translevel, isSurface), m_dir(dir), m_fileName(filename)
{
if (m_fileName != (char*)"")
LoadImage();
}
cImageFile::cImageFile(const cImageFile& copy, const bool surfaceCopy /*= true*/)
cImageFile::cImageFile( const cImageFile& copy, const bool surfaceCopy /*= true*/ )
: cImage(copy)
{}
cImageFile::~cImageFile()
{}
///Sets
void cImageFile::setDir(const cString& dir)
/// Sets
void cImageFile::setDir( const cString& dir )
{
m_dir = dir;
}
void cImageFile::setFileName(const cString& filename)
void cImageFile::setFileName( const cString& filename )
{
m_fileName = filename;
LoadImage();
}
void cImageFile::setFileNameandDir(const cString& filename, const cString& dir /*= ""*/)
void cImageFile::setFileNameandDir( const cString& filename, const cString& dir /*= ""*/ )
{
setDir(dir);
setFileName(filename);
@@ -51,8 +51,8 @@ const cString& cImageFile::getFileName() const
return m_fileName;
}
///private
///Functions
/// private
/// Functions
void cImageFile::LoadImage()
{
SDL_Texture* tempText = nullptr;
@@ -18,35 +18,35 @@ namespace VideoEngine {
class EXPORT_FROM_MYDLL cImageFile : public cImage
{
public:
cImageFile(const cString& filename = "", const cString& dir = "", const bool transparent = false,
cImageFile( const cString& filename = "", const cString& dir = "", const bool transparent = false,
const unsigned char red = 0, const unsigned char blue = 0, const unsigned char green = 255,
const unsigned char translevel = 255, const bool isSurface = false);
const unsigned char translevel = 255, const bool isSurface = false );
/* Copy constructor */
cImageFile(const cImageFile& copy, const bool surfaceCopy = true);
cImageFile( const cImageFile& copy, const bool surfaceCopy = true );
~cImageFile();
///Sets
/// Sets
/* Sets the Directory of the image */
void setDir(const cString& dir);
void setDir( const cString& dir );
/* Sets the File Name of the image */
void setFileName(const cString& filename);
void setFileName( const cString& filename );
/* Sets the File Name and the Directory of the image */
void setFileNameandDir(const cString& filename, const cString& dir = "");
void setFileNameandDir( const cString& filename, const cString& dir = "" );
///Gets
/// Gets
/* Gets the Directory of the image */
const cString& getDir() const;
/* Gets the File Name of the image */
const cString& getFileName() const;
private:
///Functions
/// Functions
void LoadImage();
private:
///Variables
cString m_dir;// = ""
cString m_fileName;// = ""
/// Variables
cString m_dir;/// = ""
cString m_fileName;/// = ""
};/// END CLASS DEFINITION cImageFile
}/// END NAMESPACE DEFINITION VideoEngine
#endif/// END IFNDEF _CIMAGEFILE_HPP_
@@ -10,7 +10,7 @@ using UtilityEngine::cUtility;
/*static*/ cRenderer* cRenderer::sp_inst = nullptr;
//private:
/// private:
cRenderer::cRenderer()
: mp_renderer(nullptr), mp_rendererSoftware(nullptr)
{
@@ -22,8 +22,8 @@ cRenderer::~cRenderer()
CleanUp();
}
//public:
///Functions
/// public:
/// Functions
/*static*/ cRenderer& cRenderer::Inst()
{
if (sp_inst == nullptr)
@@ -229,7 +229,7 @@ SDL_Texture* cRenderer::NewTexture( long int width, long int height, const bool
return rtn;
}
const bool cRenderer::AreEqual(SDL_Surface& one, SDL_Surface& two)
const bool cRenderer::AreEqual( SDL_Surface& one, SDL_Surface& two )
{
bool rtn = false;
@@ -270,7 +270,7 @@ const bool cRenderer::AreEqual(SDL_Surface& one, SDL_Surface& two)
return rtn;
}
void cRenderer::SetRenderTarget(SDL_Renderer* renderer, SDL_Texture* target /*= nullptr*/)
void cRenderer::SetRenderTarget( SDL_Renderer* renderer, SDL_Texture* target /*= nullptr*/ )
{
if (SDL_SetRenderTarget(renderer, target) < 0)
cUtility::Inst().Message("Unable to set render target to dst. SDL_SetRenderTarget():", __AT__, cUtility::eTypeSDL::SDL);
@@ -54,15 +54,15 @@ namespace VideoEngine {
SDL_Surface* NewSurface( long int width = -1, long int height = -1 ) const;
SDL_Texture* NewTexture( long int width = -1, long int height = -1, const bool copyRenderer = false, const unsigned long int access = SDL_TEXTUREACCESS_TARGET ) const;
const bool AreEqual(SDL_Surface& one, SDL_Surface& two);
const bool AreEqual( SDL_Surface& one, SDL_Surface& two );
void SetRenderTarget(SDL_Renderer* renderer, SDL_Texture* target = nullptr);
void SetRenderTarget(SDL_Texture* target = nullptr);
void SetRenderTarget( SDL_Renderer* renderer, SDL_Texture* target = nullptr );
void SetRenderTarget( SDL_Texture* target = nullptr );
void ResetRenderTarget();
///Sets
/// Sets
///Gets
/// Gets
SDL_Renderer* getRenderer();
SDL_Renderer* getRendererCopy();
@@ -27,18 +27,24 @@ cSprite::cSprite( VideoEngine::cImage** image, VideoEngine::cCamera** camera /*=
setEndImageArea(Uint16((*mpp_image)->getWidth()), Uint16((*mpp_image)->getHeight()));
}
//cSprite::cSprite( TextTypeEngine::cText** image, VideoEngine::cCamera** camera /*= nullptr*/ )
/*: mpp_camera(camera)
cSprite::cSprite( const cSprite& copy )
{
image;
//VideoEngine::cImage* im = VideoEngine::cImage(*image);
setPosition(0, 0);
setStartImageArea(0, 0);
setEndImageArea(Uint16((*mpp_image)->getWidth()), Uint16((*mpp_image)->getHeight()));
}*/
Copy(copy);
}
cSprite& cSprite::operator=( const cSprite& copy )
{
return Copy(copy);
}
cSprite::~cSprite()
{
mpp_image = nullptr;
mpp_camera = nullptr;
}
/// Functions
cSprite& cSprite::Copy( const cSprite & copy )
{
if (this != &copy)
{
@@ -63,17 +69,9 @@ cSprite& cSprite::operator=( const cSprite& copy )
*mpp_image = copy.getImage();
*mpp_camera = copy.getCamera();
}
return *this;
}
cSprite::~cSprite()
{
mpp_image = nullptr;
mpp_camera = nullptr;
}
///Functions
void cSprite::Draw()
{
//SDL_Texture* texture = (*mpp_image)->getImage();
@@ -135,7 +133,7 @@ void cSprite::SaveImage( const cString& fileName, const cString& dir /*= ""*/ )
}
}
///Sets
/// Sets
void cSprite::setPosX( const signed long int x )
{
setPosition( x, getPosY());
@@ -196,7 +194,7 @@ void cSprite::setCamera( VideoEngine::cCamera** camera )
mpp_camera = camera;
}
///Get's
/// Gets
const signed long int cSprite::getPosX() const
{
return m_position.x;
@@ -28,10 +28,12 @@ namespace VideoEngine {
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( const cSprite& copy );
cSprite& operator=( const cSprite& copy );
~cSprite();
///Functions
/// Functions
cSprite& Copy(const cSprite& copy);
/* Draws the sprite to the video buffer */
void Draw();
/* Draws the sprite to the camera */
@@ -46,7 +48,7 @@ namespace VideoEngine {
void SaveImage( const cString& fileName, const cString& dir = "" );
///Sets
/// 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 */
@@ -68,7 +70,7 @@ namespace VideoEngine {
/* Sets the pointer to a pointer for the camera the sprite will be draw on */
void setCamera( VideoEngine::cCamera** camera );
///Gets
/// 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 */
@@ -104,13 +106,13 @@ namespace VideoEngine {
void setPositionEnd();
private:
///Variables
/// 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
VideoEngine::cImage** mpp_image;/// = nullptr
VideoEngine::cCamera** mpp_camera;/// = nullptr
};/// END CLASS DEFINITION cSprite
}/// END NAMESPACE DEFINITION VideoEngine
#endif/// END IFNDEF _CSPRITE_HPP_
@@ -32,7 +32,7 @@ cVideo::~cVideo()
CleanUp();
}
///Functions
/// Functions
/*static*/ cVideo& cVideo::Inst()
{
if (sp_inst == nullptr)
@@ -125,7 +125,7 @@ void cVideo::VideoSettings()
m_videoSettings = (m_videoSettings | SDL_WINDOW_FULLSCREEN);
}
///Set's
/// Sets
void cVideo::setWidth( const unsigned long int width /*= 640*/ )
{
m_width = width;
@@ -173,7 +173,7 @@ void cVideo::setDisplayMode( const SDL_DisplayMode& mode )
cUtility::Inst().Message("Unable to set display mode. SDL_SetWindowDisplayMode()", __AT__, cUtility::eTypeSDL::SDL);
}
///Gets
/// Gets
const bool cVideo::IsInit() const
{
bool rtn = false;
@@ -22,7 +22,7 @@ namespace VideoEngine {
~cVideo();
public:
///Functions
/// Functions
static cVideo& Inst();
static void Delete();
@@ -41,7 +41,7 @@ namespace VideoEngine {
SDL_Renderer* CreateRender();
///Sets
/// Sets
/* Sets the videos width resolution */
void setWidth( const unsigned long int width = 640 );
/* Sets the videos height resolution */
@@ -60,7 +60,7 @@ namespace VideoEngine {
void setDisplayMode( const SDL_DisplayMode& mode );
///Gets
/// Gets
/* Gets return true if video was initialized */
const bool IsInit() const;
/* Gets the videos width resolution */
@@ -100,27 +100,27 @@ namespace VideoEngine {
const unsigned long int getAmask() const;
private:
///Functions
/// Functions
void VideoSettings();
private:
///Variables
SDL_Window* mp_window;// = nullptr
//SDL_Renderer* mp_rend;// = nullptr
/// Variables
SDL_Window* mp_window;/// = nullptr
//SDL_Renderer* mp_rend;/// = nullptr
unsigned long int m_xPos;// = 100
unsigned long int m_yPos;// = 100
unsigned long int m_width;// = 640
unsigned long int m_height;// = 480
unsigned long int m_colour;// = 32
unsigned long int m_xPos;/// = 100
unsigned long int m_yPos;/// = 100
unsigned long int m_width;/// = 640
unsigned long int m_height;/// = 480
unsigned long int m_colour;/// = 32
bool m_hardwareVideo;// = false
bool m_fullscreen;// = false
bool m_vsync;// = false
bool m_hardwareVideo;/// = false
bool m_fullscreen;/// = false
bool m_vsync;/// = false
unsigned long int m_videoSettings;// = SDL_RENDERER_SOFTWARE
unsigned long int m_videoSettings;/// = SDL_RENDERER_SOFTWARE
static cVideo* sp_inst;// = nullptr
static cVideo* sp_inst;/// = nullptr
/*SDL interprets each pixel as a 32-bit number, so our masks must depend
on the endianness (byte order) of the machine */