Hosting courtesy of Sourceforge

SourceForge Logo
Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

EditorMain.cpp

Go to the documentation of this file.
00001 //
00002 //                                 EditorMain.cpp
00003 //                             -------------------
00004 //    begin                : Fri Mar 29 2002
00005 //    copyright           : (C) 2002 by Rob Renaud
00006 //    email                : rrenaud@eden.rutgers.edu
00007 //
00008 //   This program is free software; you can redistribute it and/or modify
00009 //   it under the terms of the GNU General Public License as published by
00010 //   the Free Software Foundation; either version 2 of the License, or
00011 //   (at your option) any later version.
00012 //
00013 
00014 #include "MapEditor.h"
00015 #include <iostream>
00016 
00017 using namespace Editor;
00018 
00019 int main(int argc, char* argv[]) {
00020         try {
00021                 std::string mapName="GameData/Maps/Quads.blm";
00022                 {
00023                         Parse::CommandLineParser parser(argc,argv);             
00024 
00025                         parser.addAction("-m",          new Parse::StdRead<std::string>(mapName));
00026                         parser.addAction("--map",       new Parse::StdRead<std::string>(mapName));
00027 
00028                         parser.read();
00029                 } // destruct parser causing finishingAction's to occur
00030             SDL_Init(SDL_INIT_VIDEO);
00031                 //SDL_Surface* screen = SDL_SetVideoMode(800, 600, 16, SDL_DOUBLEBUF | SDL_FULLSCREEN);
00032                 SDL_Surface* screen = SDL_SetVideoMode(800, 600, 16, SDL_DOUBLEBUF);
00033                 std::cout << "mapName = " << mapName << std::endl;
00034                 MapEditor mapEd(mapName);
00035 
00036                 // mapEd.changeMapName(mapName + ".bak");
00037                 bool loopRunning=true;
00038                 while (loopRunning) {
00039                 SDL_Event event;
00040                         SDL_PumpEvents();
00041                 while (SDL_PollEvent(&event)) {
00042                                 switch (event.type) {
00043                                         case SDL_KEYDOWN:
00044                                                 switch (event.key.keysym.sym) {
00045                                                         case SDLK_ESCAPE: loopRunning=false; break;
00046                                                 }
00047                                         break;
00048                                         case SDL_MOUSEBUTTONDOWN:
00049                                                 mapEd.handleMouseClick(event.button);
00050                                         break;
00051                                 }
00052                         }
00053                         mapEd.draw(screen);
00054                         SDL_Flip(screen);
00055                 }               
00056         } catch (Util::GeneralException& e) {
00057                 std::cout << "Fatal exception:" << e << std::endl;
00058         }       
00059         Graphics::ImageManager::destroy();
00060         SDL_Quit();     
00061         return 0;
00062 }
00063         

Generated on Tue May 21 07:26:51 2002 for BomberLAN by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001