summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorneoraider <devnull@localhost>2007-12-14 19:22:04 +0100
committerneoraider <devnull@localhost>2007-12-14 19:22:04 +0100
commit9a1bbf4b9ae00bfe6ef7c5c251bae0da9b624d9c (patch)
tree267713fcf9eb34f597f9ad1af6fc2f78a77831ee
parenta8c1d6168797526b9d24bc8c86f2578f3be59fa8 (diff)
downloadzoomedit-9a1bbf4b9ae00bfe6ef7c5c251bae0da9b624d9c.tar
zoomedit-9a1bbf4b9ae00bfe6ef7c5c251bae0da9b624d9c.zip
zoomedit: Fixed some PlayerStart related bugs.
-rw-r--r--EditManager.cpp8
-rw-r--r--EditManager.h2
-rw-r--r--LevelObject.h1
-rw-r--r--PlayerStart.h2
-rw-r--r--Renderer.cpp7
-rw-r--r--Room.h1
-rw-r--r--SidebarView.cpp8
-rw-r--r--Window.h4
8 files changed, 23 insertions, 10 deletions
diff --git a/EditManager.cpp b/EditManager.cpp
index 0656939..bae061d 100644
--- a/EditManager.cpp
+++ b/EditManager.cpp
@@ -38,8 +38,8 @@ EditManager::EditManager(Window *window) {
hasHoveredVertex = false;
}
-void EditManager::update() {
- window->update();
+void EditManager::redraw() {
+ window->redraw();
}
void EditManager::addRoom() {
@@ -92,8 +92,10 @@ void EditManager::setHoveredVertex(Vertex *v) {
for(Level::iterator object = window->getLevel().begin(); object != window->getLevel().end(); object++) {
if((*object)->hit(*v)) {
+ if(hoveredObject && (*object)->getPriority() < hoveredObject->getPriority())
+ continue;
+
hoveredObject = &**object;
- break;
}
}
}
diff --git a/EditManager.h b/EditManager.h
index 00729bf..8c0d86b 100644
--- a/EditManager.h
+++ b/EditManager.h
@@ -35,7 +35,7 @@ class EditManager {
public:
EditManager(Window *window);
- void update();
+ void redraw();
void addRoom();
void finishRoom();
diff --git a/LevelObject.h b/LevelObject.h
index 6ab93a4..d7dbf4f 100644
--- a/LevelObject.h
+++ b/LevelObject.h
@@ -11,6 +11,7 @@ class LevelObject {
virtual const char* getType() const = 0;
virtual bool hit(const Vertex &v) const = 0;
+ virtual int getPriority() const = 0;
bool isOfType(const char *type) const {
return (std::strcmp(getType(), type) == 0);
diff --git a/PlayerStart.h b/PlayerStart.h
index 003583d..dbae78c 100644
--- a/PlayerStart.h
+++ b/PlayerStart.h
@@ -11,6 +11,8 @@ class PlayerStart : public Vertex3d, public LevelObject {
return (v.distanceSq(Vertex(getX(), getZ())) < 0.09);
}
+ virtual int getPriority() const {return 1;}
+
virtual const char* getType() const {
return "PlayerStart";
}
diff --git a/Renderer.cpp b/Renderer.cpp
index 1463d21..3f7d99b 100644
--- a/Renderer.cpp
+++ b/Renderer.cpp
@@ -139,8 +139,11 @@ void Renderer::renderRoom(const Room &room, bool selected, bool hovered, float s
}
void Renderer::renderPlayerStart(const PlayerStart &start, bool selected, bool hovered, float scale) {
- glLineWidth(1.0f);
- glColor4f(0.0f, 0.7f, 0.7f, 0.7f);
+ glLineWidth((hovered || selected) ? 2.0f : 1.0f);
+ if(selected)
+ glColor4f(1.0f, 1.7f, 1.0f, 1.9f);
+ else
+ glColor4f(0.0f, 0.7f, 0.7f, 0.7f);
drawCircle(Vertex(start.getX(), start.getZ()), 0.3f, 128);
glLineWidth(2.0f);
diff --git a/Room.h b/Room.h
index 2b05050..b6d086e 100644
--- a/Room.h
+++ b/Room.h
@@ -23,6 +23,7 @@ class Room : public Polygon, public LevelObject {
void setHeight(float height) {this->height = height;}
virtual bool hit(const Vertex &v) const {return contains(v);}
+ virtual int getPriority() const {return 0;}
virtual const char* getType() const {
return "Room";
diff --git a/SidebarView.cpp b/SidebarView.cpp
index cdf4a2e..99eae25 100644
--- a/SidebarView.cpp
+++ b/SidebarView.cpp
@@ -19,7 +19,7 @@ void SidebarView::spinButtonChanged(GtkWidget *spinbutton, SidebarView *view) {
((PlayerStart*)view->editor->getSelectedObject())->setZ(gtk_spin_button_get_value(GTK_SPIN_BUTTON(spinbutton)));
}
- view->editor->update();
+ view->editor->redraw();
}
SidebarView::SidebarView(EditManager *editor) {
@@ -100,7 +100,7 @@ SidebarView::SidebarView(EditManager *editor) {
gtk_widget_show(labelX);
gtk_table_attach(GTK_TABLE(tablePlayerStart), labelX, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
- spinButtonX = gtk_spin_button_new_with_range(-10000, 10000, 0.1f);
+ spinButtonX = gtk_spin_button_new_with_range(-10000, 10000, 0.01f);
gtk_spin_button_set_digits(GTK_SPIN_BUTTON(spinButtonX), 2);
gtk_entry_set_alignment(GTK_ENTRY(spinButtonX), 1.0);
gtk_widget_show(spinButtonX);
@@ -114,7 +114,7 @@ SidebarView::SidebarView(EditManager *editor) {
gtk_widget_show(labelY);
gtk_table_attach(GTK_TABLE(tablePlayerStart), labelY, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 0, 0);
- spinButtonY = gtk_spin_button_new_with_range(-10000, 10000, 0.1f);
+ spinButtonY = gtk_spin_button_new_with_range(-10000, 10000, 0.01f);
gtk_spin_button_set_digits(GTK_SPIN_BUTTON(spinButtonY), 2);
gtk_entry_set_alignment(GTK_ENTRY(spinButtonY), 1.0);
gtk_widget_show(spinButtonY);
@@ -128,7 +128,7 @@ SidebarView::SidebarView(EditManager *editor) {
gtk_widget_show(labelZ);
gtk_table_attach(GTK_TABLE(tablePlayerStart), labelZ, 0, 1, 3, 4, GTK_FILL, GTK_FILL, 0, 0);
- spinButtonZ = gtk_spin_button_new_with_range(-10000, 10000, 0.1f);
+ spinButtonZ = gtk_spin_button_new_with_range(-10000, 10000, 0.01f);
gtk_spin_button_set_digits(GTK_SPIN_BUTTON(spinButtonZ), 2);
gtk_entry_set_alignment(GTK_ENTRY(spinButtonZ), 1.0);
gtk_widget_show(spinButtonZ);
diff --git a/Window.h b/Window.h
index 00c447c..2e75f13 100644
--- a/Window.h
+++ b/Window.h
@@ -44,6 +44,10 @@ class Window {
void update();
void handleAction(UIManager::Action action);
+ void redraw() {
+ drawer.update();
+ }
+
EditManager& getEditManager() {
return editor;
}