Closer to actually editing
This commit is contained in:
@@ -3,8 +3,8 @@ from PyQt5.QtWidgets import QOpenGLWidget
|
||||
from OpenGL.GL import *
|
||||
from OpenGL.GLU import *
|
||||
from editortool.map.selectbox import drawSelectBox
|
||||
from editortool.map.tile import drawTile
|
||||
from editortool.map.camera import setupCamera
|
||||
from editortool.map.camera import Camera
|
||||
from editortool.map.grid import Grid
|
||||
|
||||
class GLWidget(QOpenGLWidget):
|
||||
def __init__(self, parent=None):
|
||||
@@ -12,6 +12,8 @@ class GLWidget(QOpenGLWidget):
|
||||
self.timer = QTimer(self)
|
||||
self.timer.timeout.connect(self.update)
|
||||
self.timer.start(16) # ~60 FPS
|
||||
self.camera = Camera()
|
||||
self.grid = Grid()
|
||||
|
||||
def initializeGL(self):
|
||||
glClearColor(0.392, 0.584, 0.929, 1.0)
|
||||
@@ -20,7 +22,6 @@ class GLWidget(QOpenGLWidget):
|
||||
def resizeGL(self, w, h):
|
||||
pass
|
||||
|
||||
|
||||
def paintGL(self):
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
|
||||
glLoadIdentity()
|
||||
@@ -33,8 +34,7 @@ class GLWidget(QOpenGLWidget):
|
||||
w = 1
|
||||
|
||||
glViewport(0, 0, w, h)
|
||||
setupCamera(self.width(), self.height()) # <-- Add this here
|
||||
self.camera.setup(w, h)
|
||||
|
||||
# Draw test quad at 0,0,0 to 1,1,0
|
||||
drawTile(0, 0, 0)
|
||||
drawSelectBox(0, 0, 0)
|
||||
self.grid.draw()
|
||||
drawSelectBox()
|
||||
Reference in New Issue
Block a user