cImage Surface
This commit is contained in:
@@ -7,11 +7,11 @@
|
|||||||
using VideoEngine::cImage;
|
using VideoEngine::cImage;
|
||||||
using UtilityEngine::cUtility;
|
using UtilityEngine::cUtility;
|
||||||
|
|
||||||
cImage::cImage( const cString& dir /*= ""*/, const cString& filename /*= ""*/, const bool transparent /*= false*/,
|
cImage::cImage( 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 red /*= 0*/, const unsigned char blue /*= 0*/, const unsigned char green /*= 255*/,
|
||||||
const unsigned char translevel /*= 255*/)
|
const unsigned char translevel /*= 255*/, const bool isSurface /*= false*/ )
|
||||||
: mp_texture(nullptr), m_dir(dir), m_fileName(filename), m_transparent(transparent),
|
: mp_texture(nullptr), mp_surface(nullptr), m_dir(dir), m_fileName(filename), m_transparent(transparent),
|
||||||
m_transRed(red), m_transBlue(blue), m_transGreen(green), m_transLevel(translevel)
|
m_transRed(red), m_transBlue(blue), m_transGreen(green), m_transLevel(translevel), m_isSurface(isSurface)
|
||||||
{
|
{
|
||||||
if (m_fileName != (char*)"")
|
if (m_fileName != (char*)"")
|
||||||
LoadImage();
|
LoadImage();
|
||||||
@@ -20,21 +20,21 @@ m_transRed(red), m_transBlue(blue), m_transGreen(green), m_transLevel(translevel
|
|||||||
}
|
}
|
||||||
|
|
||||||
cImage::cImage( SDL_Surface* surface )
|
cImage::cImage( SDL_Surface* surface )
|
||||||
: mp_texture(nullptr), m_dir(""), m_fileName(""), m_transparent(false),
|
: mp_texture(nullptr), mp_surface(nullptr), m_dir(""), m_fileName(""), m_transparent(false),
|
||||||
m_transRed(0), m_transBlue(0), m_transGreen(255), m_transLevel(255)
|
m_transRed(0), m_transBlue(0), m_transGreen(255), m_transLevel(255)
|
||||||
{
|
{
|
||||||
setImage(surface);
|
setImage(surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
cImage::cImage( SDL_Texture* texture )
|
cImage::cImage( SDL_Texture* texture )
|
||||||
: mp_texture(nullptr), m_dir(""), m_fileName(""), m_transparent(false),
|
: mp_texture(nullptr), mp_surface(nullptr), m_dir(""), m_fileName(""), m_transparent(false),
|
||||||
m_transRed(0), m_transBlue(0), m_transGreen(255), m_transLevel(255)
|
m_transRed(0), m_transBlue(0), m_transGreen(255), m_transLevel(255)
|
||||||
{
|
{
|
||||||
setImage(texture);
|
setImage(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
cImage::cImage( const cImage& copy, const bool surfaceCopy /*= true*/)
|
cImage::cImage( const cImage& copy, const bool surfaceCopy /*= true*/)
|
||||||
: mp_texture(nullptr), m_dir(copy.getDir()),
|
: mp_texture(nullptr), mp_surface(nullptr), m_dir(copy.getDir()),
|
||||||
m_fileName(copy.getFileName()), m_transparent(copy.getTransparent()), m_transRed(copy.getRedTrans()),
|
m_fileName(copy.getFileName()), m_transparent(copy.getTransparent()), m_transRed(copy.getRedTrans()),
|
||||||
m_transBlue(copy.getBlueTrans()), m_transGreen(copy.getGreenTrans()), m_transLevel(copy.getLevelTrans())
|
m_transBlue(copy.getBlueTrans()), m_transGreen(copy.getGreenTrans()), m_transLevel(copy.getLevelTrans())
|
||||||
{
|
{
|
||||||
@@ -50,7 +50,10 @@ cImage::~cImage()
|
|||||||
///Functions
|
///Functions
|
||||||
void cImage::SaveImage( const cString& fileName, const cString& dir /*= ""*/ )
|
void cImage::SaveImage( const cString& fileName, const cString& dir /*= ""*/ )
|
||||||
{
|
{
|
||||||
cRenderer::Inst().SaveTexture( mp_texture, fileName, dir );
|
if (m_isSurface == false)
|
||||||
|
cRenderer::Inst().SaveTexture(mp_texture, fileName, dir);
|
||||||
|
else
|
||||||
|
cRenderer::Inst().SaveSurface(mp_surface, fileName, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
const cImage* cImage::NewImage( SDL_Rect& area ) const
|
const cImage* cImage::NewImage( SDL_Rect& area ) const
|
||||||
@@ -114,7 +117,8 @@ void cImage::setLevelTrans( const unsigned char translevel /*= 255*/ )
|
|||||||
///Gets
|
///Gets
|
||||||
SDL_Surface* cImage::getSurface() const
|
SDL_Surface* cImage::getSurface() const
|
||||||
{
|
{
|
||||||
return cRenderer::Inst().TextureToSurface(mp_texture);
|
return mp_surface;
|
||||||
|
//return cRenderer::Inst().TextureToSurface(mp_texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Texture* cImage::getImage() const
|
SDL_Texture* cImage::getImage() const
|
||||||
@@ -203,6 +207,11 @@ const unsigned char cImage::getLevelTrans() const
|
|||||||
return m_transLevel;
|
return m_transLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool cImage::getIsSurface() const
|
||||||
|
{
|
||||||
|
return m_isSurface;
|
||||||
|
}
|
||||||
|
|
||||||
//protected:
|
//protected:
|
||||||
void cImage::setImage( SDL_Surface* surface )
|
void cImage::setImage( SDL_Surface* surface )
|
||||||
{
|
{
|
||||||
@@ -235,13 +244,24 @@ void cImage::LoadImage()
|
|||||||
UnloadImage();
|
UnloadImage();
|
||||||
|
|
||||||
SDL_Texture* tempText = nullptr;
|
SDL_Texture* tempText = nullptr;
|
||||||
|
SDL_Surface* tempSurface = nullptr;
|
||||||
|
|
||||||
if (m_fileName != "")
|
if (m_fileName != "")
|
||||||
{
|
{
|
||||||
cString temp = m_dir + m_fileName;
|
cString temp = m_dir + m_fileName;
|
||||||
|
|
||||||
if ((tempText = IMG_LoadTexture( cRenderer::Inst().getRenderer(), temp.c_str() )) == nullptr)
|
if (m_isSurface == false) {
|
||||||
cUtility::Inst().Message("Unable to load necessary image file. " + temp + " IMG_LoadTexture():", __AT__, cUtility::eTypeSDL::IMAGE);
|
if ((tempText = IMG_LoadTexture(cRenderer::Inst().getRenderer(), temp.c_str())) == nullptr)
|
||||||
|
cUtility::Inst().Message("Unable to load necessary image file. " + temp + " IMG_LoadTexture():", __AT__, cUtility::eTypeSDL::IMAGE);
|
||||||
|
else
|
||||||
|
mp_texture = tempText;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ((tempSurface = IMG_Load(temp.c_str())) == nullptr)
|
||||||
|
cUtility::Inst().Message("Unable to load necessary image file. " + temp + " IMG_Load():", __AT__, cUtility::eTypeSDL::IMAGE);
|
||||||
|
else
|
||||||
|
mp_surface = tempSurface;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ namespace VideoEngine {
|
|||||||
class EXPORT_FROM_MYDLL cImage
|
class EXPORT_FROM_MYDLL cImage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cImage( const cString& dir = "", const cString& filename = "", const bool transparent = false,
|
cImage( 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 red = 0, const unsigned char blue = 0, const unsigned char green = 255,
|
||||||
const unsigned char translevel = 255);
|
const unsigned char translevel = 255, const bool isSurface = false );
|
||||||
cImage( SDL_Surface* surface );
|
cImage( SDL_Surface* surface );
|
||||||
cImage( SDL_Texture* texture );
|
cImage( SDL_Texture* texture );
|
||||||
/* Copy constructor */
|
/* Copy constructor */
|
||||||
@@ -78,6 +78,8 @@ namespace VideoEngine {
|
|||||||
/* Gets the transparent level 255 = clear, 0 = solid */
|
/* Gets the transparent level 255 = clear, 0 = solid */
|
||||||
const unsigned char getLevelTrans() const;
|
const unsigned char getLevelTrans() const;
|
||||||
|
|
||||||
|
const bool getIsSurface() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* Protected so only derived class can access. *.
|
/* Protected so only derived class can access. *.
|
||||||
/* Sets the image to surface */
|
/* Sets the image to surface */
|
||||||
@@ -93,6 +95,7 @@ namespace VideoEngine {
|
|||||||
private:
|
private:
|
||||||
///Variables
|
///Variables
|
||||||
SDL_Texture* mp_texture;// = nullptr
|
SDL_Texture* mp_texture;// = nullptr
|
||||||
|
SDL_Surface* mp_surface;// = nullptr
|
||||||
|
|
||||||
cString m_dir;// = ""
|
cString m_dir;// = ""
|
||||||
cString m_fileName;// = ""
|
cString m_fileName;// = ""
|
||||||
@@ -107,6 +110,8 @@ namespace VideoEngine {
|
|||||||
unsigned char m_transGreen;// = 255
|
unsigned char m_transGreen;// = 255
|
||||||
|
|
||||||
unsigned char m_transLevel;// = 255
|
unsigned char m_transLevel;// = 255
|
||||||
|
|
||||||
|
bool m_isSurface;
|
||||||
};/// END CLASS DEFINITION cImage
|
};/// END CLASS DEFINITION cImage
|
||||||
}/// END NAMESPACE DEFINITION VideoEngine
|
}/// END NAMESPACE DEFINITION VideoEngine
|
||||||
#endif/// END IFNDEF _CIMAGE_HPP_
|
#endif/// END IFNDEF _CIMAGE_HPP_
|
||||||
|
|||||||
@@ -112,16 +112,9 @@ void cRenderer::RenderDrawRect( const SDL_Rect& rect, SDL_Texture* dst /*= nullp
|
|||||||
void cRenderer::ScreenShot( const cString& filename, const cString& dir /*= ""*/ )
|
void cRenderer::ScreenShot( const cString& filename, const cString& dir /*= ""*/ )
|
||||||
{
|
{
|
||||||
SDL_Surface* infoSurface = SDL_GetWindowSurface(VideoEngine::cVideo::Inst().getWindow());
|
SDL_Surface* infoSurface = SDL_GetWindowSurface(VideoEngine::cVideo::Inst().getWindow());
|
||||||
if (infoSurface == nullptr)
|
SDL_Surface* saveSurface = NewSurface();
|
||||||
cUtility::Inst().Message("Failed to create info surface from window.\n", __AT__, cUtility::eTypeSDL::SDL);
|
|
||||||
else {
|
|
||||||
SaveSurface(infoSurface, filename, dir);
|
|
||||||
SDL_FreeSurface(infoSurface);
|
|
||||||
infoSurface = NULL;
|
|
||||||
}
|
|
||||||
/*SDL_Surface* saveSurface = NewSurface();
|
|
||||||
|
|
||||||
if (infoSurface == NULL) {
|
if (infoSurface == nullptr) {
|
||||||
cUtility::Inst().Message("Failed to create info surface from window.\n", __AT__, cUtility::eTypeSDL::SDL);
|
cUtility::Inst().Message("Failed to create info surface from window.\n", __AT__, cUtility::eTypeSDL::SDL);
|
||||||
} else {
|
} else {
|
||||||
if (SDL_RenderReadPixels(mp_renderer, &infoSurface->clip_rect, infoSurface->format->format, saveSurface->pixels, infoSurface->w * infoSurface->format->BytesPerPixel) != 0)
|
if (SDL_RenderReadPixels(mp_renderer, &infoSurface->clip_rect, infoSurface->format->format, saveSurface->pixels, infoSurface->w * infoSurface->format->BytesPerPixel) != 0)
|
||||||
@@ -129,10 +122,10 @@ void cRenderer::ScreenShot( const cString& filename, const cString& dir /*= ""*/
|
|||||||
else
|
else
|
||||||
SaveSurface(saveSurface, filename, dir);
|
SaveSurface(saveSurface, filename, dir);
|
||||||
SDL_FreeSurface(infoSurface);
|
SDL_FreeSurface(infoSurface);
|
||||||
infoSurface = NULL;
|
infoSurface = nullptr;
|
||||||
}
|
}
|
||||||
SDL_FreeSurface(saveSurface);
|
SDL_FreeSurface(saveSurface);
|
||||||
saveSurface = NULL;*/
|
saveSurface = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -157,8 +150,7 @@ void cRenderer::SaveTexture( SDL_Texture* texture, const cString& fileName, cons
|
|||||||
|
|
||||||
SDL_Texture* cRenderer::SurfaceToTexture( SDL_Surface* surface )
|
SDL_Texture* cRenderer::SurfaceToTexture( SDL_Surface* surface )
|
||||||
{
|
{
|
||||||
SDL_Texture* rtn = nullptr;
|
SDL_Texture* rtn = SDL_CreateTextureFromSurface( mp_renderer, surface );
|
||||||
rtn = SDL_CreateTextureFromSurface( mp_renderer, surface );
|
|
||||||
if ( rtn == nullptr)
|
if ( rtn == nullptr)
|
||||||
cUtility::Inst().Message("Unable to create Texture. SDL_CreateTextureFromSurface():", __AT__, cUtility::eTypeSDL::SDL);
|
cUtility::Inst().Message("Unable to create Texture. SDL_CreateTextureFromSurface():", __AT__, cUtility::eTypeSDL::SDL);
|
||||||
|
|
||||||
@@ -242,7 +234,7 @@ SDL_Surface* cRenderer::NewSurface( long int width /*= -1*/, long int height /*=
|
|||||||
if (height < 0)
|
if (height < 0)
|
||||||
height = cVideo::Inst().getHeight();
|
height = cVideo::Inst().getHeight();
|
||||||
|
|
||||||
SDL_Surface* rtn = SDL_CreateRGBSurface(cVideo::Inst().getVideoSettings(), width, height, cVideo::Inst().getColour(), cVideo::Inst().getRmask(), cVideo::Inst().getGmask(), cVideo::Inst().getBmask(), cVideo::Inst().getAmask());
|
SDL_Surface* rtn = SDL_CreateRGBSurface(cVideo::Inst().getVideoSettings(), width, height, cVideo::Inst().getColourDepth(), cVideo::Inst().getRmask(), cVideo::Inst().getGmask(), cVideo::Inst().getBmask(), cVideo::Inst().getAmask());
|
||||||
|
|
||||||
if (rtn == nullptr)
|
if (rtn == nullptr)
|
||||||
cUtility::Inst().Message("Unable to create surface. SDL_CreateRGBSurface():", __AT__, cUtility::eTypeSDL::SDL);
|
cUtility::Inst().Message("Unable to create surface. SDL_CreateRGBSurface():", __AT__, cUtility::eTypeSDL::SDL);
|
||||||
|
|||||||
@@ -76,15 +76,20 @@ cSprite::~cSprite()
|
|||||||
///Functions
|
///Functions
|
||||||
void cSprite::Draw()
|
void cSprite::Draw()
|
||||||
{
|
{
|
||||||
SDL_Texture* texture = (*mpp_image)->getImage();
|
//SDL_Texture* texture = (*mpp_image)->getImage();
|
||||||
|
|
||||||
if (mpp_camera != nullptr && *mpp_camera != nullptr) {
|
if (mpp_camera != nullptr && *mpp_camera != nullptr) {
|
||||||
CameraDraw();
|
CameraDraw();
|
||||||
//surface = (*mpp_camera)->getCameraView();
|
//surface = (*mpp_camera)->getCameraView();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mpp_image != nullptr && *mpp_image != nullptr)
|
if (mpp_image != nullptr && *mpp_image != nullptr) {
|
||||||
cRenderer::Inst().Render( texture, &m_imageArea, &m_position);
|
if ((*mpp_image)->getIsSurface() == false)
|
||||||
|
cRenderer::Inst().Render((*mpp_image)->getImage(), &m_imageArea, &m_position);
|
||||||
|
else
|
||||||
|
cRenderer::Inst().Render((*mpp_image)->getSurface(), &m_imageArea, &m_position);
|
||||||
|
}
|
||||||
|
// cRenderer::Inst().Render((*mpp_image)->getImage(), &m_imageArea, &m_position);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cSprite::CameraDraw()
|
void cSprite::CameraDraw()
|
||||||
@@ -103,8 +108,12 @@ void cSprite::CameraDraw()
|
|||||||
|
|
||||||
void cSprite::DefaltDraw()
|
void cSprite::DefaltDraw()
|
||||||
{
|
{
|
||||||
if (mpp_image != nullptr && *mpp_image != nullptr)
|
if (mpp_image != nullptr && *mpp_image != nullptr) {
|
||||||
cRenderer::Inst().Render( (*mpp_image)->getImage(), nullptr, nullptr);
|
if ((*mpp_image)->getIsSurface() == false)
|
||||||
|
cRenderer::Inst().Render((*mpp_image)->getImage(), nullptr, nullptr);
|
||||||
|
else
|
||||||
|
cRenderer::Inst().Render((*mpp_image)->getSurface(), nullptr, nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cSprite::AddPosX( const signed long int x )
|
void cSprite::AddPosX( const signed long int x )
|
||||||
|
|||||||
@@ -197,11 +197,21 @@ const unsigned long int cVideo::getHeight() const
|
|||||||
return m_height;
|
return m_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsigned long int cVideo::getColour() const
|
const unsigned long int cVideo::getColourDepth() const
|
||||||
{
|
{
|
||||||
return m_colour;
|
return m_colour;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const unsigned long int cVideo::getPitch() const
|
||||||
|
{
|
||||||
|
unsigned long int rtn = 0;
|
||||||
|
if (cVideo::getColourDepth() == 32)
|
||||||
|
rtn = 4; // 4 bytes per pixel
|
||||||
|
else
|
||||||
|
rtn = 3;
|
||||||
|
return rtn;
|
||||||
|
}
|
||||||
|
|
||||||
const cString cVideo::getCaption() const
|
const cString cVideo::getCaption() const
|
||||||
{
|
{
|
||||||
cString rtn = "";
|
cString rtn = "";
|
||||||
|
|||||||
@@ -68,7 +68,9 @@ namespace VideoEngine {
|
|||||||
/* Gets the videos height resolution */
|
/* Gets the videos height resolution */
|
||||||
const unsigned long int getHeight() const;
|
const unsigned long int getHeight() const;
|
||||||
/* Gets the videos colour depth in bits */
|
/* Gets the videos colour depth in bits */
|
||||||
const unsigned long int getColour() const;
|
const unsigned long int getColourDepth() const;
|
||||||
|
/* Gets the videos pitch */
|
||||||
|
const unsigned long int getPitch() const;
|
||||||
/* Gets the caption displayed on the window */
|
/* Gets the caption displayed on the window */
|
||||||
const cString getCaption() const;
|
const cString getCaption() const;
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 450 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 450 KiB |
@@ -150,6 +150,7 @@
|
|||||||
<ClCompile Include="main.cpp" />
|
<ClCompile Include="main.cpp" />
|
||||||
<ClCompile Include="UTest\UTest.cpp" />
|
<ClCompile Include="UTest\UTest.cpp" />
|
||||||
<ClCompile Include="UtilityEngineTest\StringTest.cpp" />
|
<ClCompile Include="UtilityEngineTest\StringTest.cpp" />
|
||||||
|
<ClCompile Include="VideoEngineTest\ImageTest.cpp" />
|
||||||
<ClCompile Include="VideoEngineTest\RendererTest.cpp" />
|
<ClCompile Include="VideoEngineTest\RendererTest.cpp" />
|
||||||
<ClCompile Include="VideoEngineTest\VideoTest.cpp" />
|
<ClCompile Include="VideoEngineTest\VideoTest.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -158,6 +159,7 @@
|
|||||||
<ClInclude Include="GUIEngineTest\GUIXMLTest.hpp" />
|
<ClInclude Include="GUIEngineTest\GUIXMLTest.hpp" />
|
||||||
<ClInclude Include="UTest\UTest.hpp" />
|
<ClInclude Include="UTest\UTest.hpp" />
|
||||||
<ClInclude Include="UtilityEngineTest\StringTest.hpp" />
|
<ClInclude Include="UtilityEngineTest\StringTest.hpp" />
|
||||||
|
<ClInclude Include="VideoEngineTest\ImageTest.hpp" />
|
||||||
<ClInclude Include="VideoEngineTest\RendererTest.hpp" />
|
<ClInclude Include="VideoEngineTest\RendererTest.hpp" />
|
||||||
<ClInclude Include="VideoEngineTest\VideoTest.hpp" />
|
<ClInclude Include="VideoEngineTest\VideoTest.hpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -39,6 +39,9 @@
|
|||||||
<ClInclude Include="VideoEngineTest\VideoTest.hpp">
|
<ClInclude Include="VideoEngineTest\VideoTest.hpp">
|
||||||
<Filter>VideoEngineTest</Filter>
|
<Filter>VideoEngineTest</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="VideoEngineTest\ImageTest.hpp">
|
||||||
|
<Filter>VideoEngineTest</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="UTest\UTest.cpp">
|
<ClCompile Include="UTest\UTest.cpp">
|
||||||
@@ -60,6 +63,9 @@
|
|||||||
<ClCompile Include="VideoEngineTest\VideoTest.cpp">
|
<ClCompile Include="VideoEngineTest\VideoTest.cpp">
|
||||||
<Filter>VideoEngineTest</Filter>
|
<Filter>VideoEngineTest</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="VideoEngineTest\ImageTest.cpp">
|
||||||
|
<Filter>VideoEngineTest</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Xml Include="xml\GUI.xml">
|
<Xml Include="xml\GUI.xml">
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#include "ImageTest.hpp"
|
||||||
|
|
||||||
|
#include "../UTest/UTest.hpp"
|
||||||
|
|
||||||
|
/*** TrooperEngine DLL Header Files ***/
|
||||||
|
#include "TrooperEngine.hpp"
|
||||||
|
|
||||||
|
using VideoEngine::cImage;
|
||||||
|
|
||||||
|
using VideoEngine::cSprite;
|
||||||
|
|
||||||
|
void ImageTest()
|
||||||
|
{
|
||||||
|
// cRenderer
|
||||||
|
printf("\nTesting cImage -----\n\n");
|
||||||
|
|
||||||
|
UTest u("cImage");
|
||||||
|
|
||||||
|
cImage* image = new cImage("ImageTest.bmp", "", false, 0, 0, 255, 255, true);
|
||||||
|
|
||||||
|
image->SaveImage("ImageTestSaved.bmp");
|
||||||
|
|
||||||
|
cSprite* sprite = new cSprite(&image);
|
||||||
|
|
||||||
|
sprite->Draw();
|
||||||
|
|
||||||
|
|
||||||
|
u.report();
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#ifndef __IMAGETEST__
|
||||||
|
#define __IMAGETEST__
|
||||||
|
|
||||||
|
void ImageTest();
|
||||||
|
|
||||||
|
#endif // __IMAGETEST__
|
||||||
@@ -23,6 +23,7 @@ see license.txt for details
|
|||||||
|
|
||||||
/*** Video Engine Test ***/
|
/*** Video Engine Test ***/
|
||||||
#include "VideoEngineTest/VideoTest.hpp"
|
#include "VideoEngineTest/VideoTest.hpp"
|
||||||
|
#include "VideoEngineTest/ImageTest.hpp"
|
||||||
|
|
||||||
/*** Utility Engine Test ***/
|
/*** Utility Engine Test ***/
|
||||||
#include "UtilityEngineTest/StringTest.hpp"
|
#include "UtilityEngineTest/StringTest.hpp"
|
||||||
@@ -52,6 +53,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
GUIXMLTest();
|
GUIXMLTest();
|
||||||
|
|
||||||
|
ImageTest();
|
||||||
|
|
||||||
|
|
||||||
UTest::OverAllReport();
|
UTest::OverAllReport();
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<Panel size="200,200">
|
<Panel size="200,200">
|
||||||
<debug/>
|
<debug/>
|
||||||
<Layout>
|
<Layout>
|
||||||
<Label text="Box Sizer" />
|
|
||||||
<Boxsizer />
|
<Boxsizer />
|
||||||
|
<Label text="Box Sizer" />
|
||||||
</Layout>
|
</Layout>
|
||||||
</Panel>
|
</Panel>
|
||||||
Reference in New Issue
Block a user