Skip to content

Instantly share code, notes, and snippets.

@Grumbel
Created July 19, 2018 23:35
Show Gist options
  • Save Grumbel/05cb81928bdd268b49ce5277ed650255 to your computer and use it in GitHub Desktop.
Save Grumbel/05cb81928bdd268b49ce5277ed650255 to your computer and use it in GitHub Desktop.
diff --git a/src/supertux/game_session.cpp b/src/supertux/game_session.cpp
index 23cd7b201..d1d5cf838 100644
--- a/src/supertux/game_session.cpp
+++ b/src/supertux/game_session.cpp
@@ -247,7 +247,10 @@ GameSession::check_end_conditions()
void
GameSession::draw(DrawingContext& context)
{
- currentsector->draw(context);
+ for(int i = 0; i < 2; ++i)
+ {
+ currentsector->draw(context, i);
+ }
drawstatus(context);
if(game_pause)
diff --git a/src/supertux/sector.cpp b/src/supertux/sector.cpp
index d2c516106..f83fac28f 100644
--- a/src/supertux/sector.cpp
+++ b/src/supertux/sector.cpp
@@ -23,6 +23,7 @@
#include "editor/editor.hpp"
#include "math/aatriangle.hpp"
#include "math/rect.hpp"
+#include "object/background.hpp"
#include "object/bullet.hpp"
#include "object/camera.hpp"
#include "object/display_effect.hpp"
@@ -534,16 +535,29 @@ Sector::try_unexpose_me()
sq_settop(vm, oldtop);
}
void
:...skipping...
diff --git a/src/supertux/game_session.cpp b/src/supertux/game_session.cpp
index 23cd7b201..d1d5cf838 100644
--- a/src/supertux/game_session.cpp
+++ b/src/supertux/game_session.cpp
@@ -247,7 +247,10 @@ GameSession::check_end_conditions()
void
GameSession::draw(DrawingContext& context)
{
- currentsector->draw(context);
+ for(int i = 0; i < 2; ++i)
+ {
+ currentsector->draw(context, i);
+ }
drawstatus(context);
if(game_pause)
diff --git a/src/supertux/sector.cpp b/src/supertux/sector.cpp
index d2c516106..f83fac28f 100644
--- a/src/supertux/sector.cpp
+++ b/src/supertux/sector.cpp
@@ -23,6 +23,7 @@
#include "editor/editor.hpp"
#include "math/aatriangle.hpp"
#include "math/rect.hpp"
+#include "object/background.hpp"
#include "object/bullet.hpp"
#include "object/camera.hpp"
#include "object/display_effect.hpp"
@@ -534,16 +535,29 @@ Sector::try_unexpose_me()
sq_settop(vm, oldtop);
}
void
-Sector::draw(DrawingContext& context)
+Sector::draw(DrawingContext& context, int gamer)
{
context.set_ambient_color( ambient_light );
context.push_transform();
- context.set_translation(camera->get_translation());
+ if (gamer == 0)
+ {
+ context.set_translation(camera->get_translation());
+ }
+ else
+ {
+ context.set_translation(camera->get_translation() - Vector(500, 50));
+ }
for(const auto& object : gameobjects) {
if(!object->is_valid())
continue;
+ if (dynamic_cast<TileMap*>(object.get()))
+ continue;
+
+ if (dynamic_cast<Background*>(object.get()))
+ continue;
+
if (draw_solids_only)
{
auto tm = dynamic_cast<TileMap*>(object.get());
diff --git a/src/supertux/sector.hpp b/src/supertux/sector.hpp
index eaa2b416c..4253a878e 100644
--- a/src/supertux/sector.hpp
+++ b/src/supertux/sector.hpp
@@ -77,7 +77,7 @@ public:
void update(float elapsed_time);
void update_game_objects();
- void draw(DrawingContext& context);
+ void draw(DrawingContext& context, int player = 0);
void on_window_resize();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment