Mario Editor: initialize empty map with correct column size
This commit is contained in:
parent
0475f4967b
commit
301c4f3142
@ -944,7 +944,7 @@ int main() {
|
|||||||
|
|
||||||
// TODO file name
|
// TODO file name
|
||||||
loadMap( scene, global_vars.mario, "test_binary.bin", renderer,
|
loadMap( scene, global_vars.mario, "test_binary.bin", renderer,
|
||||||
global_vars.objects );
|
global_vars.objects, true, MAP_WIDTH );
|
||||||
|
|
||||||
auto font = std::make_shared< SDLPP::Font >( "testfont.ttf", 36 );
|
auto font = std::make_shared< SDLPP::Font >( "testfont.ttf", 36 );
|
||||||
auto font_config = std::make_shared< SDLPP::FontConfiguration >(
|
auto font_config = std::make_shared< SDLPP::FontConfiguration >(
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#include "objectids.hpp"
|
#include "objectids.hpp"
|
||||||
#include "global_vars.hpp"
|
#include "global_vars.hpp"
|
||||||
|
|
||||||
// TODO move to one function
|
|
||||||
void loadMap( std::shared_ptr< SDLPP::Scene > &scene,
|
void loadMap( std::shared_ptr< SDLPP::Scene > &scene,
|
||||||
std::shared_ptr< SDLPP::RenderObject > mario,
|
std::shared_ptr< SDLPP::RenderObject > mario,
|
||||||
const std::string &file,
|
const std::string &file,
|
||||||
@ -22,7 +21,7 @@ void loadMap( std::shared_ptr< SDLPP::Scene > &scene,
|
|||||||
std::shared_ptr< SDLPP::RenderObject > &mario,
|
std::shared_ptr< SDLPP::RenderObject > &mario,
|
||||||
const std::string &file,
|
const std::string &file,
|
||||||
std::shared_ptr< SDLPP::Renderer > &renderer,
|
std::shared_ptr< SDLPP::Renderer > &renderer,
|
||||||
std::vector< mapColumnType > &objects, bool editor ) {
|
std::vector< mapColumnType > &objects, bool editor, size_t editor_width ) {
|
||||||
std::ifstream map_file;
|
std::ifstream map_file;
|
||||||
map_file.open( file, std::ios::in | std::ios::binary );
|
map_file.open( file, std::ios::in | std::ios::binary );
|
||||||
uint16_t cols;
|
uint16_t cols;
|
||||||
@ -101,8 +100,8 @@ void loadMap( std::shared_ptr< SDLPP::Scene > &scene,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( editor && objects.size() < 18 ) {
|
if ( editor && objects.size() < editor_width ) {
|
||||||
objects.resize( 18 );
|
objects.resize( editor_width );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ void loadMap( std::shared_ptr< SDLPP::Scene > &scene,
|
|||||||
std::shared_ptr< SDLPP::RenderObject > &mario,
|
std::shared_ptr< SDLPP::RenderObject > &mario,
|
||||||
const std::string &file,
|
const std::string &file,
|
||||||
std::shared_ptr< SDLPP::Renderer > &renderer,
|
std::shared_ptr< SDLPP::Renderer > &renderer,
|
||||||
std::vector< mapColumnType > &objects, bool editor = true );
|
std::vector< mapColumnType > &objects, bool editor = false, size_t editor_width = 0 );
|
||||||
void saveMap( const std::string &file, std::vector< mapColumnType > &objects );
|
void saveMap( const std::string &file, std::vector< mapColumnType > &objects );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user