SDLPP: Don't save textures before render
Since textures should only be manipulated in the main thread (as well as rendering), let programmers deal with ensuring the texture is available during rendercopy
This commit is contained in:
parent
392bc4f203
commit
f92a94ef01
@ -119,7 +119,4 @@ void RenderObject::copyTo( std::shared_ptr< RenderObject > other ) {
|
||||
}
|
||||
other->colidedWith.clear();
|
||||
}
|
||||
void RenderObject::saveCurTexture() {
|
||||
cur_texture = texture;
|
||||
}
|
||||
} // namespace SDLPP
|
||||
|
@ -16,6 +16,7 @@ class SDLPPSCOPE RenderObject {
|
||||
public:
|
||||
RenderObject( const std::shared_ptr< Renderer > &r ) : renderer( r ) {}
|
||||
virtual ~RenderObject() {}
|
||||
// TODO maybe do basic render() that all descandants can inherit?
|
||||
virtual void render() = 0;
|
||||
virtual int leftmost() = 0;
|
||||
virtual int topmost() = 0;
|
||||
@ -78,7 +79,6 @@ public:
|
||||
bool isStatic();
|
||||
void setStatic( bool stat = true );
|
||||
std::shared_ptr< Renderer > getRenderer() const;
|
||||
void saveCurTexture();
|
||||
|
||||
protected:
|
||||
virtual void copyTo( std::shared_ptr< RenderObject > other );
|
||||
|
@ -120,11 +120,9 @@ void Scene::renderScene( bool clear_renderer ) {
|
||||
if ( background && background->getTexturePtr() )
|
||||
SDL_RenderCopy( renderer->getRendererPtr(), background->getTexturePtr(),
|
||||
NULL, NULL );
|
||||
for ( const auto &x : render_objects ) {
|
||||
x->saveCurTexture();
|
||||
for ( const auto &x : render_objects )
|
||||
x->render();
|
||||
}
|
||||
}
|
||||
void Scene::presentScene() {
|
||||
SDL_RenderPresent( renderer->getRendererPtr() );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user