commit 749afec7
Removed the unused files
Changed files
| D | source/code/CppSdlImageHolder.cpp before |
| D | source/code/CppSdlImageHolder.hpp before |
| M | source/code/MenuSystem.h before |
| M | source/code/global.hpp before |
| M | source/code/main.cpp before |
diff --git a/source/code/CppSdlImageHolder.cpp b/source/code/CppSdlImageHolder.cpp
deleted file mode 100644
index 9f97d3f..0000000
--- a/source/code/CppSdlImageHolder.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
-===========================================================================
-blockattack - Block Attack - Rise of the Blocks
-Copyright (C) 2005-2013 Poul Sander
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see http://www.gnu.org/licenses/
-
-Source information and contacts persons can be found at
-http://blockattack.sf.net
-===========================================================================
-*/
-
-#include "CppSdlImageHolder.hpp"
-#include "SDL_image.h"
-#include <stdexcept>
-
-namespace CppSdl {
-
-CppSdlImageHolder::CppSdlImageHolder() {
- data = nullptr;
-}
-
-CppSdlImageHolder::CppSdlImageHolder(std::string filename) {
- data = IMG_Load(filename.c_str());
- if (!data) {
- //Here we should throw an exception
- throw std::runtime_error(std::string("Could not read file \""+filename+"\""));
- }
- SDL_GetClipRect(data,&area);
-}
-
-CppSdlImageHolder::CppSdlImageHolder(char* rawdata, int datasize) {
- SDL_RWops* rw = SDL_RWFromMem (rawdata, datasize);
-
- //The above might fail and return null.
- if (!rw) {
- throw std::runtime_error(std::string("Could not read raw data"));
- }
-
- data = IMG_Load_RW(rw,true); //the second argument tells the function to free RWops
-
- if (!data) {
- throw std::runtime_error("Could not convert raw data to image");
- }
-
- SDL_GetClipRect(data,&area);
- OptimizeForBlit();
-}
-
-CppSdlImageHolder::~CppSdlImageHolder() {
- MakeNull();
-}
-
-SDL_Surface* CppSdlImageHolder::GetRawDataInsecure() {
- Initialized();
- return data;
-}
-
-Uint32 CppSdlImageHolder::GetWidth() {
- if (IsNull()) {
- return 0;
- }
- return area.w;
-}
-
-Uint32 CppSdlImageHolder::GetHeight() {
- if (IsNull()) {
- return 0;
- }
- return area.h;
-}
-
-void CppSdlImageHolder::PaintTo(SDL_Surface* target, int x, int y) {
- static SDL_Rect dest; //static for reuse
- if (IsNull()) {
- return;
- }
- dest.x = x;
- dest.y = y;
- SDL_BlitSurface(data, &area, target,&dest);
-}
-
-
-void CppSdlImageHolder::Initialized() {
- if (data == nullptr) {
- throw std::runtime_error("ImageHolder used uninitialized!");
- }
-}
-
-bool CppSdlImageHolder::IsNull() {
- if (data == nullptr ) {
- return true;
- }
- return false;
-}
-
-void CppSdlImageHolder::MakeNull() {
- if (IsNull()) {
- return;
- }
- SDL_FreeSurface(data);
- data = nullptr;
-}
-
-}
diff --git a/source/code/CppSdlImageHolder.hpp b/source/code/CppSdlImageHolder.hpp
deleted file mode 100644
index ae55449..0000000
--- a/source/code/CppSdlImageHolder.hpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
-===========================================================================
-blockattack - Block Attack - Rise of the Blocks
-Copyright (C) 2005-2012 Poul Sander
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see http://www.gnu.org/licenses/
-
-Source information and contacts persons can be found at
-http://blockattack.sf.net
-===========================================================================
-*/
-
-#ifndef _CPPSDLIMAGEHOLDER_HPP
-#define _CPPSDLIMAGEHOLDER_HPP
-
-#include "SDL.h"
-#include <string>
-
-namespace CppSdl
-{
-
-class CppSdlImageHolder
-{
-public:
- /**
- * Creates a nulled ImageHolder (without data)
- */
- CppSdlImageHolder();
- /**
- * Creates an image from a file
- * @param filename to be loaded
- */
- CppSdlImageHolder(std::string filename);
- /**
- * Creates a copy. The new copy shares raw data with the original but is otherwise independent.
- * @param orig
- */
- CppSdlImageHolder(const CppSdlImageHolder& orig) = delete;
- CppSdlImageHolder(char *rawdata, int datasize);
- ~CppSdlImageHolder();
- /**
- * This gives access direct access to the internal data.
- * Careful, the data might be shared between multiple ImageHolders,
- * chaing one will change them all.
- * @return A pointer
- */
- SDL_Surface *GetRawDataInsecure();
- CppSdlImageHolder & operator=(const CppSdlImageHolder &rhs) = delete;
- /**
- * The width of the image
- * 0 if the image is nulled
- * @return The width of the image in pizels
- */
- Uint32 GetWidth();
- /**
- * The height of the image
- * 0 if the image is nulled
- * @return The height of the image
- */
- Uint32 GetHeight();
- /**
- * Draws an image to surface at a given position.
- * If the image is nulled nothing is drawn
- * @param target Destination surface
- * @param x horizontal placement on destination surface
- * @param y vertical placement on destination surface
- */
- void PaintTo(SDL_Surface *target, int x, int y);
- /**
- * Tests if there are data in the object
- * @return true if where are data in the object
- */
- bool IsNull();
- /**
- * Removes the data in the object.
- * Once all ImageHolders pointing to the same data has been freed the internal data will be freed too
- */
- void MakeNull();
-private:
- void Initialized(); //throws an exception if *data is null
- SDL_Rect area;
- SDL_Surface *data;
-};
-
-}
-#endif /* _CPPSDLIMAGEHOLDER_HPP */
-
diff --git a/source/code/MenuSystem.h b/source/code/MenuSystem.h
index a443e23..c90ea85 100644
--- a/source/code/MenuSystem.h
+++ b/source/code/MenuSystem.h
@@ -29,7 +29,6 @@ http://blockattack.sf.net
#include "SDL.h"
#include <vector>
#include "Libs/NFont.h"
-#include "CppSdlImageHolder.hpp"
#include "sago/SagoSprite.hpp"
#include <memory>
diff --git a/source/code/global.hpp b/source/code/global.hpp
index da70f50..e61eda1 100644
--- a/source/code/global.hpp
+++ b/source/code/global.hpp
@@ -24,7 +24,6 @@ http://blockattack.sf.net
#ifndef _GLOBAL_HPP
#define _GLOBAL_HPP
-#include "CppSdlImageHolder.hpp"
#include "Libs/NFont.h"
#include <memory>
#include "sago/SagoSpriteHolder.hpp"
diff --git a/source/code/main.cpp b/source/code/main.cpp
index 75fe8d2..4bc4a6e 100644
--- a/source/code/main.cpp
+++ b/source/code/main.cpp
@@ -57,7 +57,6 @@ http://blockattack.sf.net
#include <SDL/SDL_timer.h>
#include <SDL/SDL_video.h>
#include <SDL/SDL_ttf.h>
-#include "CppSdlImageHolder.hpp"
#include "MenuSystem.h"
#include "puzzlehandler.hpp"
#include <memory>