screen.blit(_ok, (px, py)) else: screen.blit(_cross, (px, py)) if evt.isMouseHit(evt.MOUSE_LEFT): if wRect.collidepoint(evt.getMousePos()): wsx, wsy = world.getShift() x, y = getTerrainByPos( *[terrain] + [evt.getMousePos()[0] + wsx, evt.getMousePos()[1] + wsy] + list(wOffset)) t = terrain.getProperty_s(x, y) if t is not None: li = rgine.int2bool(t) li[CurrentDigit] = not li[CurrentDigit] terrain.setProperty(x, y, rgine.bool2int(li)) if evt.isMouseHit(evt.MOUSE_SCROLL_UP) and evt.isKeyDown(pygame.K_LSHIFT): if wRect.collidepoint(evt.getMousePos()): world.shiftH(-textureSize) elif evt.isMouseHit(evt.MOUSE_SCROLL_UP): if wRect.collidepoint(evt.getMousePos()): world.shiftV(-textureSize) if evt.isMouseHit(evt.MOUSE_SCROLL_DOWN) and evt.isKeyDown( pygame.K_LSHIFT): if wRect.collidepoint(evt.getMousePos()): world.shiftH(textureSize) elif evt.isMouseHit(evt.MOUSE_SCROLL_DOWN):
wm = rgine.windows.WindowsManager() winm = rgine.windows.WindowsMacros() hButton0 = wm.CreateWindow(winm.WC_BUTTON, ((158, 59), rgine.windows._button, "Button 0", pygame.font.SysFont('Times New Romen', 16), True, (255, 255, 255)), True) hButton1 = wm.CreateWindow(winm.WC_BUTTON, ((158, 59), rgine.windows._button, "Button 1", pygame.font.SysFont('Times New Romen', 16), True, (255, 255, 255)), True) wm.MoveWindow(hButton1, 158//2, 59//2) hButton2 = wm.CreateWindow(winm.WC_BUTTON, ((158, 59), rgine.windows._button, "Button 2", pygame.font.SysFont('Times New Romen', 16), True, (255, 255, 255)), True) wm.MoveWindow(hButton2, 158, 59) prpty = [True, True, True, False, True, True, True, True] print(prpty) t.setProperty(0, 0, rgine.bool2int(prpty)) running = True while running: evt.update() if evt.type == pygame.QUIT: running = False if evt.isKeyHit(pygame.K_ESCAPE): # escape running = False if evt.isKeyDown(pygame.K_t): t.setTexture(pygame.Surface((32, 32)), 2) else: t.setTexture(img, 2) t.render(surf, (0, 0), range(0, 5), range(5, 10)) screen.blit(surf, (0, 0)) for hWnd, msg, surface, pos in wm.DispatchMessage(evt):
t = terrain.getProperty_s(x, y) if t is None: continue if test(t, CurrentDigit): screen.blit(_ok, (px, py)) else: screen.blit(_cross, (px, py)) if evt.isMouseHit(evt.MOUSE_LEFT): if wRect.collidepoint(evt.getMousePos()): wsx, wsy = world.getShift() x, y = getTerrainByPos(*[terrain]+[evt.getMousePos()[0]+wsx, evt.getMousePos()[1]+wsy]+list(wOffset)) t = terrain.getProperty_s(x, y) if t is not None: li = rgine.int2bool(t) li[CurrentDigit] = not li[CurrentDigit] terrain.setProperty(x, y, rgine.bool2int(li)) if evt.isMouseHit(evt.MOUSE_SCROLL_UP) and evt.isKeyDown(pygame.K_LSHIFT): if wRect.collidepoint(evt.getMousePos()): world.shiftH(-textureSize) elif evt.isMouseHit(evt.MOUSE_SCROLL_UP): if wRect.collidepoint(evt.getMousePos()): world.shiftV(-textureSize) if evt.isMouseHit(evt.MOUSE_SCROLL_DOWN) and evt.isKeyDown(pygame.K_LSHIFT): if wRect.collidepoint(evt.getMousePos()): world.shiftH(textureSize)
((158, 59), rgine.windows._button, "Button 0", pygame.font.SysFont('Times New Romen', 16), True, (255, 255, 255)), True) hButton1 = wm.CreateWindow(winm.WC_BUTTON, ((158, 59), rgine.windows._button, "Button 1", pygame.font.SysFont('Times New Romen', 16), True, (255, 255, 255)), True) wm.MoveWindow(hButton1, 158 // 2, 59 // 2) hButton2 = wm.CreateWindow(winm.WC_BUTTON, ((158, 59), rgine.windows._button, "Button 2", pygame.font.SysFont('Times New Romen', 16), True, (255, 255, 255)), True) wm.MoveWindow(hButton2, 158, 59) prpty = [True, True, True, False, True, True, True, True] print(prpty) t.setProperty(0, 0, rgine.bool2int(prpty)) running = True while running: evt.update() if evt.type == pygame.QUIT: running = False if evt.isKeyHit(pygame.K_ESCAPE): # escape running = False if evt.isKeyDown(pygame.K_t): t.setTexture(pygame.Surface((32, 32)), 2) else: t.setTexture(img, 2) t.render(surf, (0, 0), range(0, 5), range(5, 10)) screen.blit(surf, (0, 0)) for hWnd, msg, surface, pos in wm.DispatchMessage(evt):