The editor scene now works correctly with the TileSheetManager
This commit is contained in:
@@ -109,9 +109,9 @@ void EditorApplication::LoadScene(SceneList sceneIndex) {
|
||||
switch(sceneIndex) {
|
||||
//add scene creation calls here
|
||||
case SceneList::FIRST:
|
||||
case SceneList::TESTIFICATESCENE:
|
||||
activeScene = new TestificateScene();
|
||||
break;
|
||||
// case SceneList::TESTIFICATESCENE:
|
||||
// activeScene = new TestificateScene();
|
||||
// break;
|
||||
|
||||
case SceneList::EDITORSCENE:
|
||||
activeScene = new EditorScene();
|
||||
|
||||
+12
-15
@@ -50,20 +50,20 @@ EditorScene::EditorScene() {
|
||||
{"Debugging", "Debug On", "Debug Off", "Toggle Debug"}
|
||||
});
|
||||
|
||||
// pager.SetOnNew([](Region* const ptr){
|
||||
// printf("New Region: %d, %d\n", ptr->GetX(), ptr->GetY());
|
||||
// });
|
||||
pager.SetOnNew([](Region* const ptr){
|
||||
printf("New Region: %d, %d\n", ptr->GetX(), ptr->GetY());
|
||||
});
|
||||
|
||||
// pager.SetOnDelete([](Region* const ptr){
|
||||
// printf("Delete Region: %d, %d\n", ptr->GetX(), ptr->GetY());
|
||||
// });
|
||||
pager.SetOnDelete([](Region* const ptr){
|
||||
printf("Delete Region: %d, %d\n", ptr->GetX(), ptr->GetY());
|
||||
});
|
||||
|
||||
//32 * 32 sized tiles
|
||||
// pager.SetWidth(32*4);
|
||||
// pager.SetHeight(32*4);
|
||||
//Set a resonable size for the regions
|
||||
pager.SetWidth(32*4);
|
||||
pager.SetHeight(32*4);
|
||||
|
||||
sheetList.push_front(TileSheet());
|
||||
sheetList.front().LoadSurface("rsc\\graphics\\tilesets\\terrain.bmp", 32, 32);
|
||||
sheetMgr.LoadSheet("rsc\\graphics\\tilesets\\grass.bmp", 32, 32);
|
||||
sheetMgr.LoadSheet("rsc\\graphics\\tilesets\\longgrass.bmp", 32, 32);
|
||||
|
||||
// loadGameMap("rsc\\maps\\mappy", &pager, &sheetList);
|
||||
// saveGameMap("rsc\\maps\\foo", &pager, &sheetList);
|
||||
@@ -71,9 +71,6 @@ EditorScene::EditorScene() {
|
||||
// cout << "Region Width: " << pager.GetWidth() << endl;
|
||||
// cout << "Region Height: " << pager.GetHeight() << endl;
|
||||
|
||||
pager.SetWidth(128);
|
||||
pager.SetHeight(128);
|
||||
|
||||
// for (auto& it : sheetList) {
|
||||
// cout << it.GetName() << ": " << it.GetBegin() << ", " << it.GetEnd() << endl;
|
||||
// }
|
||||
@@ -101,7 +98,7 @@ void EditorScene::FrameEnd() {
|
||||
|
||||
void EditorScene::Render(SDL_Surface* const screen) {
|
||||
//draw the map
|
||||
pager.DrawTo(screen, &sheetList, camera.x, camera.y);
|
||||
pager.DrawTo(screen, &sheetMgr, camera.x, camera.y);
|
||||
|
||||
//draw a big bar across the top
|
||||
buttonImage.SetClipY(0);
|
||||
|
||||
@@ -25,15 +25,13 @@
|
||||
#include "base_scene.hpp"
|
||||
|
||||
#include "region_pager.hpp"
|
||||
#include "tile_sheet.hpp"
|
||||
#include "tile_sheet_manager.hpp"
|
||||
|
||||
#include "image.hpp"
|
||||
#include "raster_font.hpp"
|
||||
#include "menu_bar.hpp"
|
||||
|
||||
#include "map_loader.hpp"
|
||||
|
||||
#include <list>
|
||||
//#include "map_loader.hpp"
|
||||
|
||||
class EditorScene : public BaseScene {
|
||||
public:
|
||||
@@ -63,7 +61,7 @@ protected:
|
||||
bool debugOpen = true;
|
||||
|
||||
RegionPager pager;
|
||||
std::list<TileSheet> sheetList;
|
||||
TileSheetManager sheetMgr;
|
||||
|
||||
RasterFont font;
|
||||
Image buttonImage;
|
||||
|
||||
Reference in New Issue
Block a user