-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: add SDLImageInterface #44
Open
chrboe
wants to merge
2
commits into
skaupper:master
Choose a base branch
from
chrboe:sdl-image-interface
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,10 @@ SET (SOURCES src/core/Game.cpp | |
src/core/builder/ImageTextureBuilder.cpp | ||
src/core/builder/TextTextureBuilder.cpp | ||
|
||
src/core/impl/SDLImageTexture.cpp | ||
|
||
src/interfaces/impl/INISettingsInterface.cpp | ||
src/interfaces/impl/SDLImageInterface.cpp | ||
|
||
src/utils/Color.cpp | ||
src/utils/Colors.cpp | ||
|
@@ -86,6 +89,7 @@ SET(HEADERS include/bkengine/core/builder/templates/AnimationBuilder_templates.h | |
include/bkengine/exceptions/NullPointerException.h | ||
|
||
include/bkengine/interfaces/impl/INISettingsInterface.h | ||
include/bkengine/interfaces/impl/SDLImageInterface.h | ||
|
||
include/bkengine/interfaces/EventInterface.h | ||
include/bkengine/interfaces/FontInterface.h | ||
|
@@ -106,7 +110,69 @@ SET(HEADERS include/bkengine/core/builder/templates/AnimationBuilder_templates.h | |
include/bkengine/utils/Keys.h | ||
include/bkengine/utils/Logger.h | ||
include/bkengine/utils/Timer.h | ||
) | ||
include/bkengine/core/impl/SDLImageTexture.h | ||
include/bkengine/exceptions/NotImplementedException.h | ||
src/utils/InterfaceContainer.cpp | ||
src/core/impl/SDLImageTexture.cpp | ||
) | ||
|
||
SET(HEADERS include/bkengine/core/builder/templates/AnimationBuilder_templates.h | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wasn't that part of the most recent PR? |
||
include/bkengine/core/builder/templates/ElementBuilder_templates.h | ||
include/bkengine/core/builder/templates/GameBuilder_templates.h | ||
include/bkengine/core/builder/templates/SceneBuilder_templates.h | ||
|
||
include/bkengine/core/builder/AnimationBuilder.h | ||
include/bkengine/core/builder/ElementBuilder.h | ||
include/bkengine/core/builder/GameBuilder.h | ||
include/bkengine/core/builder/ImageTextureBuilder.h | ||
include/bkengine/core/builder/SceneBuilder.h | ||
include/bkengine/core/builder/TextTextureBuilder.h | ||
include/bkengine/core/builder/TextureBuilder.h | ||
|
||
include/bkengine/core/utils/AnimationUtils.h | ||
include/bkengine/core/utils/ElementUtils.h | ||
include/bkengine/core/utils/GameUtils.h | ||
include/bkengine/core/utils/SceneUtils.h | ||
|
||
include/bkengine/core/Animation.h | ||
include/bkengine/core/Element.h | ||
include/bkengine/core/Game.h | ||
include/bkengine/core/ImageTexture.h | ||
include/bkengine/core/Scene.h | ||
include/bkengine/core/TextTexture.h | ||
include/bkengine/core/Texture.h | ||
|
||
include/bkengine/exceptions/BuilderException.h | ||
include/bkengine/exceptions/GameLoopException.h | ||
include/bkengine/exceptions/NameAlreadyExistsException.h | ||
include/bkengine/exceptions/NameNotFoundException.h | ||
include/bkengine/exceptions/NullPointerException.h | ||
|
||
include/bkengine/interfaces/impl/INISettingsInterface.h | ||
include/bkengine/interfaces/impl/SDLImageInterface.h | ||
|
||
include/bkengine/interfaces/EventInterface.h | ||
include/bkengine/interfaces/FontInterface.h | ||
include/bkengine/interfaces/GraphicsInterface.h | ||
include/bkengine/interfaces/ImageInterface.h | ||
include/bkengine/interfaces/SettingsInterface.h | ||
|
||
include/bkengine/utils/templates/InterfaceContainer_templates.h | ||
|
||
include/bkengine/utils/backtrace.h | ||
include/bkengine/utils/Color.h | ||
include/bkengine/utils/Colors.h | ||
include/bkengine/utils/CoordinateUtils.h | ||
include/bkengine/utils/Event.h | ||
include/bkengine/utils/Geometry.h | ||
include/bkengine/utils/InterfaceContainer.h | ||
include/bkengine/utils/Key.h | ||
include/bkengine/utils/Keys.h | ||
include/bkengine/utils/Logger.h | ||
include/bkengine/utils/Timer.h | ||
include/bkengine/core/impl/SDLImageTexture.h | ||
include/bkengine/exceptions/NotImplementedException.h | ||
) | ||
|
||
SET (TEST_SOURCES tests/main.cpp | ||
tests/INISettingsInterfaceTest.cpp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef BKENGINE_SDLIMAGETEXTURE_H | ||
#define BKENGINE_SDLIMAGETEXTURE_H | ||
|
||
#include <SDL_surface.h> | ||
#include <SDL_system.h> | ||
|
||
#include "core/ImageTexture.h" | ||
#include "exceptions/NotImplementedException.h" | ||
|
||
namespace bkengine | ||
{ | ||
class SDLImageTexture : public ImageTexture | ||
{ | ||
friend class SDLImageInterface; | ||
|
||
public: | ||
void onRender() override; | ||
|
||
const SDL_Texture *getTexture() const; | ||
|
||
~SDLImageTexture(); | ||
SDLImageTexture(SDL_Texture *); | ||
|
||
private: | ||
SDL_Texture *texture; | ||
}; | ||
} | ||
|
||
#endif //BKENGINE_SDLIMAGETEXTURE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#ifndef BKENGINE_NOTIMPLEMENTEDEXCEPTION_H | ||
#define BKENGINE_NOTIMPLEMENTEDEXCEPTION_H | ||
|
||
#include <stdexcept> | ||
|
||
namespace bkengine | ||
{ | ||
class NotImplementedException : public std::logic_error | ||
{ | ||
public: | ||
NotImplementedException() : std::logic_error("Function not yet implemented.") { }; | ||
}; | ||
} | ||
|
||
#endif //BKENGINE_NOTIMPLEMENTEDEXCEPTION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef BKENGINE_SDLIMAGEINTERFACE_H | ||
#define BKENGINE_SDLIMAGEINTERFACE_H | ||
|
||
#include <SDL_image.h> | ||
#include <SDL_system.h> | ||
#include <fstream> | ||
|
||
#include "interfaces/ImageInterface.h" | ||
|
||
namespace bkengine | ||
{ | ||
class SDLImageInterface : public ImageInterface | ||
{ | ||
public: | ||
virtual void init(); | ||
virtual void cleanup(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am curious where you wanna call these two methods^^ |
||
virtual std::shared_ptr<ImageTexture> renderImageFileToTexture(const std::string &filePath, | ||
const AbsRect &) override; | ||
}; | ||
} | ||
|
||
#endif //BKENGINE_SDLIMAGEINTERFACE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
|
||
using namespace bkengine; | ||
|
||
|
||
bool Scene::onRender() | ||
{ | ||
return false; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
|
||
using namespace bkengine; | ||
|
||
|
||
std::string Texture::getName() const | ||
{ | ||
return name; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
|
||
using namespace bkengine; | ||
|
||
|
||
ElementBuilder ElementBuilder::createBuilder() | ||
{ | ||
return ElementBuilder(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
|
||
using namespace bkengine; | ||
|
||
|
||
GameBuilder GameBuilder::createBuilder() | ||
{ | ||
return GameBuilder(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
|
||
using namespace bkengine; | ||
|
||
|
||
SceneBuilder SceneBuilder::createBuilder() | ||
{ | ||
return SceneBuilder(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "core/impl/SDLImageTexture.h" | ||
|
||
using namespace bkengine; | ||
|
||
void SDLImageTexture::onRender() | ||
{ | ||
throw NotImplementedException(); | ||
} | ||
|
||
const SDL_Texture *SDLImageTexture::getTexture() const | ||
{ | ||
return texture; | ||
} | ||
|
||
SDLImageTexture::~SDLImageTexture() | ||
{ | ||
SDL_DestroyTexture(texture); | ||
} | ||
|
||
SDLImageTexture::SDLImageTexture(SDL_Texture *texture) | ||
{ | ||
this->texture = texture; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you mixing .h and .cpp files here?