/* * TopView.h * * Copyright (C) 2008 Matthias Schiffer * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ #ifndef ZOOMEDIT_VIEW_TOPVIEW_H_ #define ZOOMEDIT_VIEW_TOPVIEW_H_ #include "View.h" #include namespace ZoomEdit { class Instance; namespace Data { class Level; class Room; } namespace View { class TopView : public View { private: class Edge { public: const vmml::vec3f *v1, *v2; Edge(const vmml::vec3f *v10, const vmml::vec3f *v20) : v1(v10), v2(v20) {}; bool operator<(const Edge &e) const; }; Instance *instance; float viewWidth, viewHeight; float xCenter, yCenter; int zoomLevel; float scale; void drawGrid(); public: TopView(Instance *instance0) : instance(instance0), viewWidth(0), viewHeight(0), xCenter(0), yCenter(0), zoomLevel(0), scale(100) {} Instance* getInstance() {return instance;} float getWidth() const {return viewWidth;} float getHeight() const {return viewHeight;} float getXCenter() const {return xCenter;} void setXCenter(float xCenter0) {xCenter = xCenter0; signalUpdate().emit();} float getYCenter() const {return yCenter;} void setYCenter(float yCenter0) {yCenter = yCenter0; signalUpdate().emit();} float getScale() const {return scale;} virtual void init(); virtual void resize(float width, float height); virtual void render(); virtual void zoom(int zoom, float x, float y); virtual void move(float x, float y, unsigned int state); virtual void click(float x, float y, unsigned int button); static void renderRoom(Data::Room *room, bool selected = false); }; } } #endif /*ZOOMEDIT_VIEW_TOPVIEW_H_*/