diff --git a/v2/raycaster.py b/v2/raycaster.py index faacfd6..7946ab2 100755 --- a/v2/raycaster.py +++ b/v2/raycaster.py @@ -107,6 +107,7 @@ class Main: self.raycastWindow = sdl2.ext.Window("3D View", size=(RAYCAST_WIN_WIDTH, RAYCAST_WIN_HEIGHT)) self.raycastWindow.show() self.raycastSurface = self.raycastWindow.get_surface() + self.raycast_u32_pixels = ctypes.cast(self.raycastSurface.pixels, ctypes.POINTER(ctypes.c_uint32)) # Raw SDL surface pixel array # Player self.player_position = PLAYER_SPAWN_POSITION @@ -379,10 +380,9 @@ class Main: self.drawVline(self.raycastSurface, color, x, int(lineStart), int(lineEnd)) def drawVline(self, surface, color, x, startY, endY): - u32_pixels = ctypes.cast(self.raycastSurface.pixels, ctypes.POINTER(ctypes.c_uint32)); startIdx = startY * RAYCAST_WIN_WIDTH + x for idx in range(startIdx, endY * RAYCAST_WIN_WIDTH + x, RAYCAST_WIN_WIDTH): - u32_pixels[idx] = color + self.raycast_u32_pixels[idx] = color def dist(self, ax, ay, bx, by):