Permalink
Browse files

Fixes relating to the new GL widget

  • Loading branch information...
1 parent d97d762 commit 10dac657f51027596eb174f38bfb0abc939513ec @Kazade committed May 7, 2012
@@ -28,6 +28,7 @@
#include "level.h"
#include "editor_view.h"
#include "actions/spawn_tile_instance_action.h"
+#include "kazbase/logging/logging.h"
/** @brief do_init
*
@@ -40,6 +41,8 @@ void EditorView::do_init()
glAlphaFunc(GL_GREATER, 0.1f);
glEnable(GL_ALPHA_TEST);
glClearColor(0.2078, 0.494, 0.78, 0.5);
+
+ L_DEBUG("Initializing the editor view");
}
/** @brief do_render
@@ -189,8 +192,6 @@ void EditorView::do_scroll(GdkEventScroll* event)
do_resize(get_widget()->get_width(), get_widget()->get_height());
}
-
-
/** @brief do_button_press
*
* @todo: document this function
@@ -1,4 +1,5 @@
#include "gtk_gl_widget.h"
+#include "kazbase/logging/logging.h"
const int attributes[] = {
GLX_RGBA,
@@ -81,6 +82,8 @@ bool GtkGLWidget::on_area_idle() {
void GtkGLWidget::on_area_realize() {
if(make_current()) {
+ L_DEBUG("Initializing a GL widget");
+
glClearColor(0.5f, 0.5f, 0.5f, 0.5f);
glEnable (GL_DEPTH_TEST);
glDepthFunc (GL_LEQUAL);
@@ -67,10 +67,10 @@ void MainWindow::create_widgets() {
builder->get_widget("delete_layer_button", gtk_delete_layer_button_);
builder->get_widget("side_bar_alignment", gtk_side_bar_);
- gtk_canvas_.reset(new GtkGLWidget(canvas));
+ //gtk_canvas_.reset(new GtkGLWidget(canvas));
//assert(gtk_canvas_);
- editor_view_.reset(new EditorView(gtk_canvas_->area(), this));
+ editor_view_.reset(new EditorView(canvas, this));
assert(gtk_tile_selector_canvas_);
selector_.reset(new OpenGLTileSelector(gtk_tile_selector_canvas_));
@@ -93,7 +93,7 @@ void MainWindow::create_widgets() {
gtk_window_->maximize();
- create_new_level("Untitled", 128);
+ create_new_level("Untitled", 128);
}
void MainWindow::on_undo() {
@@ -143,11 +143,8 @@ void MainWindow::create_new_level(const std::string& name, uint32_t tile_size) {
level_changed_connection_ = level_->signal_changed().connect(sigc::mem_fun(this, &MainWindow::on_level_changed));
level_saved_connection_ = level_->signal_saved().connect(sigc::mem_fun(this, &MainWindow::on_level_saved));
- if(editor_view_) {
- editor_view_->set_level(level_.get());
- }
-
layer_manager_->set_level(level_.get());
+ editor_view_->set_level(level_.get());
}
/** @brief on_new_level
@@ -74,7 +74,6 @@ class MainWindow {
Gtk::Button* gtk_add_layer_button_;
Gtk::Button* gtk_delete_layer_button_;
- GtkGLWidget::ptr gtk_canvas_;
Gtk::DrawingArea* gtk_tile_selector_canvas_;
Gtk::TreeView* gtk_layer_view_;
@@ -18,7 +18,7 @@
#include <iostream>
#include "opengl_tile_selector.h"
-
+#include "kazbase/logging/logging.h"
#include "tileset.h"
float tile_size = 1.0f;
@@ -26,7 +26,7 @@
*
* @todo: document this function
*/
-void OpenGLWidget::initialize() {
+void OpenGLWidget::initialize_gl() {
area()->signal_motion_notify_event().connect(sigc::mem_fun(this, &OpenGLWidget::on_motion_notify));
area()->signal_button_press_event().connect(sigc::mem_fun(this, &OpenGLWidget::on_button_press));
area()->signal_button_release_event().connect(sigc::mem_fun(this, &OpenGLWidget::on_button_release));
@@ -39,7 +39,7 @@ void OpenGLWidget::initialize() {
*/
OpenGLWidget::OpenGLWidget(Gtk::DrawingArea* widget):
GtkGLWidget(widget) {
- initialize();
+ initialize_gl();
}
/** @brief on_scroll
@@ -25,7 +25,7 @@
class OpenGLWidget : public GtkGLWidget {
public:
OpenGLWidget(Gtk::DrawingArea* widget);
- void initialize();
+ void initialize_gl();
bool on_motion_notify(GdkEventMotion* event);
bool on_button_press(GdkEventButton* event);

0 comments on commit 10dac65

Please sign in to comment.