This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
neofx-zoomedit/src/View/TopView.h
neoraider 36d892d1f0 zoomedit:
* Use signals to inform RenderArea of view changes
2008-05-05 19:26:05 +00:00

87 lines
2.3 KiB
C++

/*
* TopView.h
*
* Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef ZOOMEDIT_VIEW_TOPVIEW_H_
#define ZOOMEDIT_VIEW_TOPVIEW_H_
#include "View.h"
namespace ZoomEdit {
namespace Data {
class Level;
class Room;
class Vertex;
}
namespace View {
class TopView : public View {
private:
class Edge {
public:
const Data::Vertex *v1, *v2;
Edge(const Data::Vertex *v10, const Data::Vertex *v20)
: v1(v10), v2(v20) {};
bool operator<(const Edge &e) const;
};
Data::Level *level;
float viewWidth, viewHeight;
float xCenter, yCenter;
int zoomLevel;
float scale;
void drawGrid();
public:
TopView(Data::Level *level0 = 0) : level(level0), viewWidth(0), viewHeight(0), xCenter(0), yCenter(0), zoomLevel(0), scale(100) {}
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;}
Data::Level* getLevel() {return level;}
void setLevel(Data::Level *level0) {level = level0; signalUpdate().emit();}
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);
static void renderRoom(Data::Room *room);
};
}
}
#endif /*ZOOMEDIT_VIEW_TOPVIEW_H_*/