Closer to actually editing
This commit is contained in:
@@ -1,25 +1,29 @@
|
||||
from OpenGL.GL import *
|
||||
from dusk.defs import defs
|
||||
|
||||
def drawTile(x, y, z):
|
||||
w = float(defs.get('TILE_WIDTH'))
|
||||
h = float(defs.get('TILE_HEIGHT'))
|
||||
d = float(defs.get('TILE_DEPTH'))
|
||||
class Tile:
|
||||
def __init__(self):
|
||||
self.tile_id = 0
|
||||
|
||||
x = x * w
|
||||
y = y * h
|
||||
z = z * d
|
||||
def draw(self, x, y, z):
|
||||
w = float(defs.get('TILE_WIDTH'))
|
||||
h = float(defs.get('TILE_HEIGHT'))
|
||||
d = float(defs.get('TILE_DEPTH'))
|
||||
|
||||
# Center tile.
|
||||
x -= w / 2.0
|
||||
y -= h / 2.0
|
||||
z -= d / 2.0
|
||||
x = x * w
|
||||
y = y * h
|
||||
z = z * d
|
||||
|
||||
# Draw the tile as a flat square on the X-Y plane at depth z.
|
||||
glColor3f(1.0, 0.0, 0.0) # Red color
|
||||
glBegin(GL_QUADS)
|
||||
glVertex3f(x, y, z) # Bottom-left
|
||||
glVertex3f(x + w, y, z) # Bottom-right
|
||||
glVertex3f(x + w, y + h, z) # Top-right
|
||||
glVertex3f(x, y + h, z) # Top-left
|
||||
glEnd()
|
||||
# Center tile.
|
||||
x -= w / 2.0
|
||||
y -= h / 2.0
|
||||
z -= d / 2.0
|
||||
|
||||
# Draw the tile as a flat square on the X-Y plane at depth z.
|
||||
glColor3f(1.0, 0.0, 0.0) # Red color
|
||||
glBegin(GL_QUADS)
|
||||
glVertex3f(x, y, z) # Bottom-left
|
||||
glVertex3f(x + w, y, z) # Bottom-right
|
||||
glVertex3f(x + w, y + h, z) # Top-right
|
||||
glVertex3f(x, y + h, z) # Top-left
|
||||
glEnd()
|
||||
Reference in New Issue
Block a user