- just doing some C++ifying
[supertux.git] / src / leveleditor.cpp
index 7d7d6ae..d913631 100644 (file)
@@ -29,6 +29,7 @@
 #include <SDL.h>
 #include <SDL_image.h>
 #include <algorithm>
+#include <iostream>
 
 #include "leveleditor.h"
 
@@ -82,6 +83,8 @@ LevelEditor::LevelEditor()
   le_show_grid = true;
   show_selections = true;
 
+  pos_x = pos_y = 0;
+
   done = 0;
   le_frame = 0;        /* support for frames in some tiles, like waves and bad guys */
   le_level_changed = false;
@@ -234,12 +237,14 @@ int LevelEditor::run(char* filename)
       /* making events results to be in order */
 
       /* draw the level */
+      context.set_translation(Vector(pos_x, pos_y));
       drawlevel(context);
     }
     else
       fillrect(0, 0, screen->w, screen->h, 0, 0, 0);
 
     /* draw editor interface */
+    context.set_translation(Vector(0, 0));
     drawinterface(context);
 
     Menu* menu = Menu::current();
@@ -548,9 +553,9 @@ void LevelEditor::update_level_settings_menu()
 /*  if((i = string_list_find(level_settings_menu->get_item_by_id(MNID_PARTICLE).list,le_level->get_sector("main")->particlesystem.c_str())) != -1)
     level_settings_menu->get_item_by_id(MNID_PARTICLE).list->active_item = i;*/
 
-  sprintf(str,"%d",le_level->get_sector("main")->solids->get_width());
+  sprintf(str,"%d",static_cast<int>(le_level->get_sector("main")->solids->get_width()));
   level_settings_menu->get_item_by_id(MNID_LENGTH).change_input(str);
-  sprintf(str,"%d",le_level->get_sector("main")->solids->get_height());
+  sprintf(str,"%d", static_cast<int>(le_level->get_sector("main")->solids->get_height()));
   level_settings_menu->get_item_by_id(MNID_HEIGHT).change_input(str);
   sprintf(str,"%d",le_level->time_left);
   level_settings_menu->get_item_by_id(MNID_TIME).change_input(str);
@@ -845,7 +850,7 @@ void LevelEditor::drawlevel(DrawingContext& context)
 
   if(le_current.IsTile())
   {
-le_level->get_sector("main")->solids->draw(context);
+//le_level->get_sector("main")->solids->draw(context);
 /*
     Tile::draw(cursor_x-pos_x, cursor_y-pos_y,le_current.tile,128);
     if(!TileManager::instance()->get(le_current.tile)->images.empty())
@@ -860,7 +865,6 @@ le_level->get_sector("main")->solids->draw(context);
 
   /*       clearscreen(current_level.bkgd_red, current_level.bkgd_green, current_level.bkgd_blue); */
 
-
 le_level->get_sector("main")->solids->draw(context);
 
 // FIXME: make tiles to be drawn semi-transparent when not selected
@@ -1529,8 +1533,6 @@ void LevelEditor::checkevents()
       pos_y = (le_level->get_sector("main")->solids->get_height() * 32) - screen->h;
     if(pos_y < 0)
       pos_y = 0;
-
-    le_level->get_sector("main")->camera->set_scrolling(pos_x, pos_y);
   }
 }
 
@@ -1780,7 +1782,7 @@ void LevelEditor::showhelp()
     for(unsigned int t = 0; t < sizeof(text[i])/sizeof(char *); t++)
       context.draw_text(white_text, text[i][t], Vector(5, 80+(t*white_text->get_height())), LAYER_GUI);
 
-    sprintf(str,"Press any key to continue - Page %d/%d?", i, sizeof(text));
+    sprintf(str,"Press any key to continue - Page %d/%d?", i, static_cast<int>(sizeof(text)));
     context.draw_text(gold_text, str, Vector(0, 0), LAYER_GUI);
 
     context.do_drawing();