Commit c69f534c authored by Tošner, Jan's avatar Tošner, Jan
Browse files

v1.3

- Začátek práce na zjišťování ohraničení
parent 6a1dc4b2
......@@ -14,7 +14,7 @@ os.environ['SDL_VIDEO_WINDOW_POS'] = "0,0"
# Colors according to RGB codes
WHITE_COLOR = (255, 255, 255)
BLACK_COLOR = (0, 0, 0)
MAXIMAL_ZOOM = 3.5
MAXIMAL_ZOOM = 4.5
# Clock used to update game events and frames
clock = pygame.time.Clock()
pygame.font.init()
......@@ -54,6 +54,7 @@ class Game:
moving = False
selected = -1
changed = True
editing = None
while running:
......@@ -65,6 +66,11 @@ class Game:
if event.key == pygame.K_TAB and not in_menu:
in_book = not in_book
changed = True
book.editing = None
editing = None
if (event.key == pygame.K_KP_ENTER or event.key == pygame.K_RETURN) and editing:
book.editing = None
editing = None
elif event.type == pygame.MOUSEBUTTONDOWN:
x, y = pygame.mouse.get_pos()
l, m, r = pygame.mouse.get_pressed()
......@@ -94,7 +100,7 @@ class Game:
# Vypnout program
if 789 < x < 789 + 342 and 635 < y < 635 + 135:
running = False
elif in_book and l == 1:
elif in_book and l == 1 and not editing:
#Doleva
if 330 < x < 330 + 42 and 890 < y < 890 + 63:
if book.page != 0:
......@@ -111,6 +117,10 @@ class Game:
changed = True
else:
selected = book.select(x, y)
elif in_book and r == 1 and not editing:
editing = book.select(x,y)
elif in_book and editing:
pass
elif not in_menu and not in_book:
if event.button == 4:
if picture.extend != MAXIMAL_ZOOM:
......@@ -154,6 +164,10 @@ class Game:
if in_menu:
menu.draw(self.screen)
if editing:
book.editing = pygame.transform.scale(book.blocks[editing].icon, (800, 800))
changed = True
# Update all game graphics
pygame.display.update()
#clock.tick(self.TICK_RATE)
......@@ -280,8 +294,9 @@ class Book:
self.right = pygame.transform.scale(self.right, (42, 63))
self.reload = pygame.image.load("images/GUI/reload.png")
self.reload = pygame.transform.scale(self.reload, (75, 75))
self.editing = None
self.page = 0
self.cords = [(300,100)]
self.cords = [(300, 100)]
self.blocks = []
self.load()
self.surf = pygame.Surface((1920, 1080), pygame.SRCALPHA, 32)
......@@ -294,6 +309,8 @@ class Book:
self.surf.blit(self.left, (330, 890))
self.surf.blit(self.right, (1530, 890))
self.surf.blit(self.reload, (287, 38))
if self.editing:
self.surf.blit(self.editing, (560, 140))
screen.blit(scale(self.surf), (0, 0))
def draw_icons(self, screen, page):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment