From f5b3ba083fb54a3aba6a080578ec7b0c3a0590f9 Mon Sep 17 00:00:00 2001 From: Arnas Udovicius Date: Mon, 3 Feb 2014 18:45:06 +0200 Subject: [PATCH] many things already done - pushing for saving. Needs to crete fighting; then make everything better --- __main__.py | 6 + countries/lt | 9 + countries/ru | 9 + gui.py | 1114 +++++++++++++++++++++++++++++++++++++++++ guilib.py | 409 +++++++++++++++ images/menu.png | Bin 0 -> 7921 bytes images/ru/xix_ark.png | Bin 0 -> 625 bytes images/ru/xix_pst.png | Bin 0 -> 615 bytes images/ru/xix_ptr.png | Bin 0 -> 610 bytes maps/daugiau.ia.map | 3 + maps/figut.ia.map | 3 + maps/lt_lv_ru.ia.map | 3 + 12 files changed, 1556 insertions(+) create mode 100644 __main__.py create mode 100644 countries/lt create mode 100644 countries/ru create mode 100644 gui.py create mode 100644 guilib.py create mode 100644 images/menu.png create mode 100644 images/ru/xix_ark.png create mode 100644 images/ru/xix_pst.png create mode 100644 images/ru/xix_ptr.png create mode 100644 maps/daugiau.ia.map create mode 100644 maps/figut.ia.map create mode 100644 maps/lt_lv_ru.ia.map diff --git a/__main__.py b/__main__.py new file mode 100644 index 0000000..fe803eb --- /dev/null +++ b/__main__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- + +from gui import main + +main() + diff --git a/countries/lt b/countries/lt new file mode 100644 index 0000000..4db3a53 --- /dev/null +++ b/countries/lt @@ -0,0 +1,9 @@ +Lietuva +56 +255 +5 +[XIX] +images/ru/xix_pst.png +images/ru/xix_ark.png +images/ru/xix_ptr.png + diff --git a/countries/ru b/countries/ru new file mode 100644 index 0000000..4d2efbb --- /dev/null +++ b/countries/ru @@ -0,0 +1,9 @@ +Rusija +255 +12 +56 +[XIX] +images/ru/xix_pst.png +images/ru/xix_ark.png +images/ru/xix_ptr.png + diff --git a/gui.py b/gui.py new file mode 100644 index 0000000..5c05a68 --- /dev/null +++ b/gui.py @@ -0,0 +1,1114 @@ +# -*- coding: utf-8 -*- + +from guilib import * +import pygame +from pygame.locals import * + + +def main(): + pygame.init() + + # Window + display_flags = DOUBLEBUF #FULLSCREEN #DOUBLEBUF + width, height = 1366, 768 + + pygame.display.set_mode((width, height), display_flags) + pygame.display.set_caption(u'Imperiju amzius!') + screen = pygame.display.get_surface() + + gs = GameSettings() # main game settings + + while gs.een: + stage = gs.get_stage() + eval(stage+'(screen, gs)') + pygame.display.flip() + + + +def start(screen, gs): + bgcolor = pygame.Surface(screen.get_size()) + bgcolor = bgcolor.convert() + bgcolor.fill((235, 235, 155)) + screen.blit(bgcolor, (0, 0)) + + txt = u'Imperijų amžius!' + fonts = pygame.font.Font(None, 72) + a = fonts.render(txt, True, (0, 0, 0)) + screen.blit(a, (470, 30)) + + img = pygame.image.load("images/menu.png") + screen.blit(img, (383, 110)) + + mygt(screen, 575, 350, 215, 50, u'Pradėti', gs) + mygt(screen, 575, 410, 215, 50, u'Užkrauti', gs) + mygt(screen, 575, 470, 215, 50, u'Nustatymai', gs) + mygt(screen, 575, 530, 215, 50, u'Šalys', gs) + mygt(screen, 575, 590, 215, 50, u'Žemėlapiai', gs) + mygt(screen, 575, 650, 215, 50, u'Išeiti', gs) + + # Inputs + events = pygame.event.get() + for event in events: + if event.type == MOUSEBUTTONUP and event.button == 1: + x_m, y_m = event.pos + + if (x_m > 575 and x_m < 790): + if (y_m > 350 and y_m < 400): + gs.set_stage('new') + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + if (y_m > 410 and y_m < 460): + gs.set_stage('load') + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + if (y_m > 470 and y_m < 520): + gs.set_stage('settings') + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + if (y_m > 530 and y_m < 580): + gs.set_stage('countries') + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + if (y_m > 590 and y_m < 640): + gs.set_stage('maps') + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + if (y_m > 650 and y_m < 700): + gs.set_stage('exit') + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + + +def exit(screen, gs): + gs.quit_game() + + + +def countries(screen, gs): + bgcolor = pygame.Surface(screen.get_size()) + bgcolor = bgcolor.convert() + bgcolor.fill((235, 235, 155)) + screen.blit(bgcolor, (0, 0)) + + txt1 = u'Imperijų amžius!' + fonts = pygame.font.Font(None, 72) + a = fonts.render(txt1, True, (0, 0, 0)) + screen.blit(a, (470, 30)) + + mygt(screen, 1140, 30, 215, 50, u'Atgal', gs) + mygt(screen, 1140, 90, 215, 50, u'Nauja šalis', gs) + + start_y = 100 + age = 'XIX' + for short in gs.countries: + country = gs.countries[short] + + fonts = pygame.font.Font(None, 36) + a = fonts.render(country.name, True, (0, 0, 0)) + screen.blit(a, (30, start_y)) + + pygame.draw.rect(screen, country.color, (200, start_y, 20, 20), 0) + + start_x = 400 + for img in country.ages[age]: + img_load = pygame.image.load(img) + screen.blit(img_load, (start_x, start_y)) + start_x += 150 + + mygt(screen, 800, start_y, 215, 50, u'Keisti', gs) + + start_y += 100 + + + # Inputs + events = pygame.event.get() + for event in events: + if event.type == MOUSEBUTTONUP and event.button == 1: + x_m, y_m = event.pos + + if (x_m > 1140 and x_m < 1355): + if (y_m > 30 and y_m < 80): + gs.set_stage('start') + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + if (y_m > 90 and y_m < 130): + gs.set_stage('new_country') + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + +def maps(screen, gs): + bgcolor = pygame.Surface(screen.get_size()) + bgcolor = bgcolor.convert() + bgcolor.fill((235, 235, 155)) + screen.blit(bgcolor, (0, 0)) + + txt1 = u'Imperijų amžius!' + fonts = pygame.font.Font(None, 72) + a = fonts.render(txt1, True, (0, 0, 0)) + screen.blit(a, (470, 30)) + + mygt(screen, 1140, 30, 215, 50, u'Atgal', gs) + mygt(screen, 1140, 90, 215, 50, u'Naujas žemėlapis', gs) + + start_y = 100 + age = 'XIX' + for map_name in gs.maps: + fonts = pygame.font.Font(None, 36) + a = fonts.render(map_name, True, (0, 0, 0)) + screen.blit(a, (30, start_y)) + + mygt(screen, 800, start_y, 215, 50, u'Keisti', gs) + + start_y += 100 + + # Inputs + events = pygame.event.get() + for event in events: + if event.type == MOUSEBUTTONUP and event.button == 1: + x_m, y_m = event.pos + + if (x_m > 1140 and x_m < 1355): + if (y_m > 30 and y_m < 80): + gs.set_stage('start') + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + if (y_m > 90 and y_m < 130): + gs.set_stage('new_map') + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + + +def new_map(screen, gs): + fonts18 = pygame.font.Font(None, 18) + fonts24 = pygame.font.Font(None, 24) + + bgcolor = pygame.Surface(screen.get_size()) + bgcolor = bgcolor.convert() + bgcolor.fill((235, 235, 155)) + screen.blit(bgcolor, (0, 0)) + + mygt(screen, 1140, 30, 215, 50, u'Atgal', gs) + mygt(screen, 1140, 90, 215, 50, u'Saugoti', gs) + + pygame.draw.rect(screen, (250, 250, 250), (10, 10, 1120, 720), 0) + for border in gs.new_map['borders']: + pos_old = None + for pos in border: + if (pos_old): + pygame.draw.aaline(screen, (0, 0, 0), + (pos_old[0], pos_old[1]), + (pos[0], pos[1]), 1) + pos_old = pos + + if gs.map_editor['tool'] == 'border' and gs.map_editor['action'] == 'stroke': + pos_old = None + for pos in gs.map_editor['tmp']: + if (pos_old): + pygame.draw.aaline(screen, (0, 0, 0), + (pos_old[0], pos_old[1]), + (pos[0], pos[1]), 1) + pos_old = pos + + for pos in gs.new_map['capitals']: + pygame.draw.circle(screen, (0, 0, 0), pos, 10) + + for country_short in gs.new_map['countries']: + country = gs.get_country(country_short) + for i, land in enumerate(gs.new_map['countries'][country_short]): + a = fonts18.render('%i: %s' % (i, country.name), True, country.color) + screen.blit(a, (land[0]+12, land[1]+12)) + + + # editor tools + start_y = 160 + for tool in gs.map_editor_tools: + color = (0, 0, 0) + if tool == gs.map_editor['tool']: + color = (255, 0, 0) + + a = fonts24.render(gs.map_editor_tools[tool], True, color) + screen.blit(a, (1140, start_y)) + start_y += 30 + + start_y = 350 + for country_sh in gs.countries: + country = gs.countries[country_sh] + color = (0, 0, 0) + if country_sh == gs.map_editor['country']: + color = (255, 0, 0) + + a = fonts18.render(country.name, True, color) + screen.blit(a, (1140, start_y)) + + pygame.draw.rect(screen, country.color, (1230, start_y, 20, 20), 0) + + start_y += 30 + + # Inputs + events = pygame.event.get() + for event in events: + if event.type == MOUSEBUTTONUP and event.button == 1: + x_m, y_m = event.pos + + if (x_m > 1140 and x_m < 1355): + if (y_m > 30 and y_m < 80): + gs.set_stage('maps') + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + if (y_m > 90 and y_m < 130): + gs.set_stage('save_map') + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + # tools + if (x_m > 1140 and x_m < 1350): + start_y = 160 + for tool in gs.map_editor_tools: + if (y_m > start_y and y_m < start_y + 30): + if tool == 'undo': + if gs.map_editor['tool'] == 'border': + if len(gs.map_editor['tmp']) > 0: + gs.map_editor['tmp'].pop() + elif len(gs.new_map['borders']) > 0: + gs.new_map['borders'].pop() + elif gs.map_editor['tool'] == 'capital' and len(gs.new_map['capitals']) > 0: + gs.new_map['capitals'].pop() + elif gs.map_editor['tool'] == 'country' and len(gs.new_map['countries']) > 0: + if gs.map_editor['country'] in gs.new_map['countries']: + if len(gs.new_map['countries'][gs.map_editor['country']]) > 0: + gs.new_map['countries'][gs.map_editor['country']].pop() + + else: + gs.map_editor['tool'] = tool + start_y += 30 + + # countries + if (x_m > 1140 and x_m < 1350): + start_y = 350 + for country in gs.countries: + if (y_m > start_y and y_m < start_y + 30): + gs.map_editor['country'] = country + start_y += 30 + + if (x_m > 10 and x_m < 1120 and y_m > 10 and y_m < 720): + if gs.map_editor['tool'] == 'border' and gs.map_editor['action'] == 'stroke': + gs.map_editor['tmp'].append((x_m, y_m)) + + gs.map_editor['x'] = x_m + gs.map_editor['y'] = y_m + + if gs.map_editor['tool'] == 'border' and not gs.map_editor['action'] == 'stroke': + gs.map_editor['action'] = 'stroke' + gs.map_editor['tmp'] = [] + gs.map_editor['tmp'].append((x_m, y_m)) + gs.map_editor['x'] = x_m + gs.map_editor['y'] = y_m + + if (x_m > 10 and x_m < 1120 and y_m > 10 and y_m < 720): + if gs.map_editor['tool'] == 'capital': + gs.new_map['capitals'].append((x_m, y_m)) + if gs.map_editor['country']: + if not gs.map_editor['country'] in gs.new_map['countries']: + gs.new_map['countries'][gs.map_editor['country']] = [] + gs.new_map['countries'][gs.map_editor['country']].append((x_m, y_m)) + + if (x_m > 10 and x_m < 1120 and y_m > 10 and y_m < 720): + if gs.map_editor['tool'] == 'country': + pass # not implemented + + if event.type == MOUSEBUTTONUP and event.button == 3: + x_m, y_m = event.pos + + if (x_m > 10 and x_m < 1120 and y_m > 10 and y_m < 720): + if gs.map_editor['tool'] == 'border' and gs.map_editor['action'] == 'stroke': + gs.map_editor['action'] = None + gs.new_map['borders'].append(gs.map_editor['tmp']) + gs.map_editor['tmp'] = [] + + if event.type == MOUSEMOTION: + x_m, y_m = event.pos + + if (x_m > 10 and x_m < 1120 and y_m > 10 and y_m < 720): + if gs.map_editor['tool'] == 'border' and gs.map_editor['action'] == 'stroke': + + pygame.draw.aaline(screen, (0, 0, 0), + (gs.map_editor['x'], gs.map_editor['y']), + (x_m, y_m), 1) + + + +def save_map(screen, gs): + bgcolor = pygame.Surface(screen.get_size()) + bgcolor = bgcolor.convert() + bgcolor.fill((235, 235, 155)) + screen.blit(bgcolor, (0, 0)) + + txt1 = u'Imperijų amžius!' + fonts = pygame.font.Font(None, 72) + a = fonts.render(txt1, True, (0, 0, 0)) + screen.blit(a, (470, 30)) + + mygt(screen, 1140, 30, 215, 50, u'Atgal', gs) + mygt(screen, 1140, 90, 215, 50, u'Patvirtinti', gs) + + fonts36 = pygame.font.Font(None, 36) + fonts24 = pygame.font.Font(None, 24) + + a = fonts36.render(u'Pavadinimas', True, (0, 0, 0)) + screen.blit(a, (30, 140)) + pygame.draw.rect(screen, (250, 250, 250), (30, 190, 400, 30), 0) + if gs.editor['in_progress']: + editor_word = gs.editor['word'][:gs.editor['cursor']]+'|'+gs.editor['word'][gs.editor['cursor']:] + else: + editor_word = gs.editor['word'] + + a = fonts24.render(editor_word, True, (0, 0, 0)) + screen.blit(a, (35, 195)) + + a = fonts36.render(u'Amžius', True, (0, 0, 0)) + screen.blit(a, (30, 240)) + start_x = 35 + for age in gs.ages: + color = (0, 0, 0) + if age == gs.settings['age']: + color = (255, 0, 0) + + a = fonts24.render(age, True, color) + screen.blit(a, (start_x, 290)) + start_x += 50 + + if len(gs.errors) > 0: + start_y = 400 + for error in gs.errors: + a = fonts36.render(error, True, (255, 0, 0)) + screen.blit(a, (100, start_y)) + start_y += 50 + + # Inputs + events = pygame.event.get() + for event in events: + if event.type == MOUSEBUTTONUP and event.button == 1: + x_m, y_m = event.pos + + if (x_m > 1140 and x_m < 1355): + if (y_m > 30 and y_m < 80): + gs.set_stage('start') + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + if (y_m > 90 and y_m < 130): + gs.errors = [] + if len(gs.editor['word']) == 0: + gs.errors.append(u'Nenurodytas žemėlapio pavadinimas!!!') + else: + gs.save_new_map() + gs.set_stage('maps') + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + # ages + if (y_m > 290 and y_m < 335): + start_x = 35 + for age in gs.ages: + if (x_m > start_x and x_m < start_x + 50): + gs.settings['age'] = age + start_x += 50 + + if (x_m > 30 and x_m < 430 and y_m > 190 and y_m < 220): + gs.editor['in_progress'] = True + + + if gs.editor['in_progress']: + if event.type == KEYDOWN and event.key in [K_LEFT] and gs.editor['cursor'] > 0: + gs.editor['cursor'] -= 1 + + if event.type == KEYDOWN and event.key in [K_RIGHT] and gs.editor['cursor'] < len(gs.editor['word']): + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_q]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'q'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_w]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'w'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_e]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'e'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_r]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'r'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_t]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'t'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_y]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'y'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_u]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'u'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_i]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'i'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_o]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'o'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_p]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'p'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_a]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'a'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_s]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'s'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_d]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'d'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_f]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'f'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_g]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'g'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_h]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'h'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_j]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'j'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_k]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'k'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_l]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'l'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_z]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'z'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_x]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'x'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_c]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'c'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_v]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'v'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_b]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'b'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_n]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'n'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_m]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'m'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_0]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'0'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_1]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'1'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_2]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'2'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_3]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'3'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_4]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'4'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_5]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'5'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_6]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'6'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_7]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'7'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_8]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'8'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_9]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+'9'+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_DELETE]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+gs.editor['word'][gs.editor['cursor']+1:] + + if event.type == KEYDOWN and event.key in [K_SPACE]: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']]+' '+gs.editor['word'][gs.editor['cursor']:] + gs.editor['cursor'] += 1 + + if event.type == KEYDOWN and event.key in [K_BACKSPACE] and gs.editor['cursor'] > 0: + gs.editor['word'] = gs.editor['word'][:gs.editor['cursor']-1]+gs.editor['word'][gs.editor['cursor']+1:] + gs.editor['cursor'] -= 1 + + +def new(screen, gs): + bgcolor = pygame.Surface(screen.get_size()) + bgcolor = bgcolor.convert() + bgcolor.fill((235, 235, 155)) + screen.blit(bgcolor, (0, 0)) + + txt1 = u'Imperijų amžius!' + fonts = pygame.font.Font(None, 72) + a = fonts.render(txt1, True, (0, 0, 0)) + screen.blit(a, (470, 30)) + + mygt(screen, 1140, 30, 215, 50, u'Atgal', gs) + mygt(screen, 1140, 90, 215, 50, u'Pradėti', gs) + + fonts36 = pygame.font.Font(None, 36) + fonts24 = pygame.font.Font(None, 24) + + a = fonts36.render(u'Amžius', True, (0, 0, 0)) + screen.blit(a, (30, 140)) + start_x = 35 + for age in gs.ages: + color = (0, 0, 0) + if age == gs.settings['age']: + color = (255, 0, 0) + + a = fonts24.render(age, True, color) + screen.blit(a, (start_x, 190)) + start_x += 50 + + pygame.draw.aaline(screen, (0, 0, 0), (10, 230), (300, 230), 2) + + a = fonts36.render(u'Žemėlapis', True, (0, 0, 0)) + screen.blit(a, (30, 250)) + start_y = 290 + for map_name in gs.maps: + color = (0, 0, 0) + if map_name == gs.settings['map']: + color = (255, 0, 0) + + a = fonts24.render(map_name, True, color) + screen.blit(a, (30, start_y)) + start_y += 30 + + pygame.draw.aaline(screen, (0, 0, 0), (10, 430), (300, 430), 2) + + a = fonts36.render(u'Šalis', True, (0, 0, 0)) + screen.blit(a, (30, 450)) + start_y = 490 + for country_sh in gs.countries: + country = gs.countries[country_sh] + color = (0, 0, 0) + if country_sh == gs.settings['country']: + color = (255, 0, 0) + + a = fonts24.render(country.name, True, color) + screen.blit(a, (30, start_y)) + + pygame.draw.rect(screen, country.color, (200, start_y, 20, 20), 0) + + start_y += 30 + + if len(gs.errors) > 0: + start_y = 400 + for error in gs.errors: + a = fonts36.render(error, True, (255, 0, 0)) + screen.blit(a, (400, start_y)) + start_y += 50 + + # Inputs + events = pygame.event.get() + for event in events: + if event.type == MOUSEBUTTONUP and event.button == 1: + x_m, y_m = event.pos + + if (x_m > 1140 and x_m < 1355): + if (y_m > 30 and y_m < 80): + gs.set_stage('start') + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + if (y_m > 90 and y_m < 130): + gs.errors = [] + if not gs.settings['age'] or not gs.settings['country'] or not gs.settings['map']: + gs.errors.append(u'Amžius, žemėlapis ir šalis turi būti pasirinktas!!!') + + else: + gs.game['age'] = gs.settings['age'] + gs.game['map'] = gs.maps[gs.settings['map']].map + gs.game['turn'] += 1 + gs.game['stage'] = 'get' + gs.game['users'].append(gs.settings['country']) #1st user is real + for country in gs.game['map']: + if not country in gs.game['users']: + gs.game['users'].append(country) + + gs.set_stage('play') + + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + # ages + if (y_m > 185 and y_m < 230): + start_x = 35 + for age in gs.ages: + if (x_m > start_x and x_m < start_x + 50): + gs.settings['age'] = age + start_x += 50 + + # maps + if (x_m > 30 and x_m < 290): + start_y = 290 + for map_name in gs.maps: + if (y_m > start_y and y_m < start_y + 30): + gs.settings['map'] = map_name + start_y += 30 + + # countries + if (x_m > 30 and x_m < 290): + start_y = 490 + for country in gs.countries: + if (y_m > start_y and y_m < start_y + 30): + gs.settings['country'] = country + start_y += 30 + + +def play(screen, gs): + if gs.game['stage'] == 'get': + for country in gs.game['map']: + for i, land in enumerate(gs.game['map'][country]): + if not 'army' in land: + gs.game['map'][country][i]['army'] = { + 'pst': 0, + 'ark': 0, + 'ptr': 0 + } + + gs.game['map'][country][i]['army']['pst'] += 20 + gs.game['map'][country][i]['army']['ark'] += 5 + gs.game['map'][country][i]['army']['ptr'] += 1 + + gs.game['stage'] = 0 + + + fonts18 = pygame.font.Font(None, 18) + fonts24 = pygame.font.Font(None, 24) + + bgcolor = pygame.Surface(screen.get_size()) + bgcolor = bgcolor.convert() + bgcolor.fill((235, 235, 155)) + screen.blit(bgcolor, (0, 0)) + + mygt(screen, 1140, 30, 215, 50, u'Ėjimas baigtas', gs) + mygt(screen, 1140, 90, 215, 50, u'Meniu', gs) + + pygame.draw.rect(screen, (63, 125, 143), (10, 10, 1120, 720), 0) + + for country in gs.game['map']: + for land in gs.game['map'][country]: + pygame.draw.polygon(screen, land['color'], land['border']) + + pos_old = None + for pos in land['border']: + if (pos_old): + pygame.draw.line(screen, (0, 0, 0), + (pos_old[0], pos_old[1]), + (pos[0], pos[1]), 5) + pos_old = pos + + pygame.draw.circle(screen, (0, 0, 0), land['capital'], 10) + + army_text = '%i | %i | %i' % (land['army']['pst'], land['army']['ark'], land['army']['ptr']) + a = fonts18.render(army_text, True, (0, 0, 0)) + screen.blit(a, (land['capital'][0]+12, land['capital'][1]+12)) + + + a = fonts24.render(u'Ėjimas: %i' % gs.game['turn'], True, (0, 0, 0)) + screen.blit(a, (1140, 160)) + + start_y = 200 + for i, country_sh in enumerate(gs.game['users']): + country = gs.countries[country_sh] + color = (0, 0, 0) + if i == gs.game['stage']: + color = (255, 0, 0) + + a = fonts24.render(country.name, True, color) + screen.blit(a, (1140, start_y)) + + pygame.draw.rect(screen, country.color, (1230, start_y, 20, 20), 0) + + start_y += 30 + + # Inputs + events = pygame.event.get() + for event in events: + if event.type == MOUSEBUTTONUP and event.button == 1: + x_m, y_m = event.pos + + if (x_m > 1140 and x_m < 1355): + if (y_m > 30 and y_m < 80): # and gs.game['stage'] == 0): + if (len(gs.game['users']) == gs.game['stage'] + 1): + gs.game['stage'] = 'get' + else: + gs.game['stage'] += 1 + + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + if (y_m > 90 and y_m < 130): + gs.set_stage('menu') + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + if (x_m > 10 and x_m < 1120 and y_m > 10 and y_m < 720): + country, land = gs.get_country_land_from_capital(x_m, y_m) + if country and country == gs.game['users'][gs.game['stage']]: + gs.game['fight_from'] = land['capital'] + elif country and gs.game['fight_from']: + gs.game['fight_to'] = land['capital'] + gs.set_stage('prepare_fight') + + if event.type == MOUSEMOTION: + x_m, y_m = event.pos + + if (x_m > 10 and x_m < 1120 and y_m > 10 and y_m < 720): + if gs.game['fight_from']: + pygame.draw.line(screen, (255, 0, 0), (gs.game['fight_from'][0], gs.game['fight_from'][1]), (x_m, y_m), 5) + pygame.draw.aaline(screen, (0, 0, 0), (gs.game['fight_from'][0], gs.game['fight_from'][1]), (x_m, y_m), 1) + + +def prepare_fight(screen, gs): + fonts18 = pygame.font.Font(None, 18) + fonts24 = pygame.font.Font(None, 24) + fonts72 = pygame.font.Font(None, 72) + + bgcolor = pygame.Surface(screen.get_size()) + bgcolor = bgcolor.convert() + bgcolor.fill((235, 235, 155)) + screen.blit(bgcolor, (0, 0)) + + mygt(screen, 1140, 30, 215, 50, u'Kovoti', gs) + mygt(screen, 1140, 90, 215, 50, u'Nutraukti puolimą', gs) + + country, land = gs.get_country_land_from_capital(gs.game['fight_from'][0], gs.game['fight_from'][1]) + country = gs.get_country(country) + + img = country.ages[gs.settings['age']][0] + img_load = pygame.image.load(img) + screen.blit(img_load, (50, 100)) + + a = fonts72.render(str(land['army']['pst'] - gs.game['fight_pst']), True, (0, 0, 0)) + screen.blit(a, (250, 120)) + + mygt(screen, 400, 120, 50, 50, '<<<', gs) + mygt(screen, 500, 120, 50, 50, '>>>', gs) + + a = fonts72.render(str(gs.game['fight_pst']), True, (0, 0, 0)) + screen.blit(a, (650, 120)) + + img = country.ages[gs.settings['age']][1] + img_load = pygame.image.load(img) + screen.blit(img_load, (50, 250)) + + a = fonts72.render(str(land['army']['ark'] - gs.game['fight_ark']), True, (0, 0, 0)) + screen.blit(a, (250, 270)) + + mygt(screen, 400, 270, 50, 50, '<<<', gs) + mygt(screen, 500, 270, 50, 50, '>>>', gs) + + a = fonts72.render(str(gs.game['fight_ark']), True, (0, 0, 0)) + screen.blit(a, (650, 270)) + + img = country.ages[gs.settings['age']][2] + img_load = pygame.image.load(img) + screen.blit(img_load, (50, 400)) + + a = fonts72.render(str(land['army']['ptr'] - gs.game['fight_ptr']), True, (0, 0, 0)) + screen.blit(a, (250, 420)) + + mygt(screen, 400, 420, 50, 50, '<<<', gs) + mygt(screen, 500, 420, 50, 50, '>>>', gs) + + a = fonts72.render(str(gs.game['fight_ptr']), True, (0, 0, 0)) + screen.blit(a, (650, 420)) + + # Inputs + events = pygame.event.get() + for event in events: + if event.type == MOUSEBUTTONUP and event.button == 1: + x_m, y_m = event.pos + + if (x_m > 1140 and x_m < 1355): + if (y_m > 30 and y_m < 80): # and gs.game['stage'] == 0): + gs.set_stage('fight') + gs.fight['fields'] = [] + for i in range(54): + gs.fight['fields'].append([]) + for j in range(9): + gs.fight['fields'][i].append('') + + gs.fight['units'] = [] + + land['army']['pst'] -= gs.game['fight_pst'] + land['army']['ark'] -= gs.game['fight_ark'] + land['army']['ptr'] -= gs.game['fight_ptr'] + for i in range(gs.game['fight_pst']): + gs.fight['units'].append({ + 'country': country.short_name, + 'color': country.color, + 'type': 'pst', + 'health': 10 + }) + for i in range(gs.game['fight_ark']): + gs.fight['units'].append({ + 'country': country.short_name, + 'color': country.color, + 'type': 'ark', + 'health': 50 + }) + for i in range(gs.game['fight_ptr']): + gs.fight['units'].append({ + 'country': country.short_name, + 'color': country.color, + 'type': 'ptr', + 'health': 100 + }) + + country_b, land_b = gs.get_country_land_from_capital(gs.game['fight_to'][0], gs.game['fight_to'][1]) + for i in range(land_b['army']['pst']): + gs.fight['units'].append({ + 'country': country_b, + 'color': land_b['color'], + 'type': 'pst', + 'health': 10 + }) + for i in range(land_b['army']['ark']): + gs.fight['units'].append({ + 'country': country_b, + 'color': land_b['color'], + 'type': 'ark', + 'health': 50 + }) + for i in range(land_b['army']['ptr']): + gs.fight['units'].append({ + 'country': country_b, + 'color': land_b['color'], + 'type': 'ptr', + 'health': 100 + }) + + a = 0 + b = 0 + for k, unit in enumerate(gs.fight['units']): + if unit['country'] == country.short_name: + i = a / 9 + j = a % 9 + gs.fight['fields'][i][j] = k + a += 1 + else: + i = b / 9 + 1 + j = b % 9 + gs.fight['fields'][-i][j] = k + b += 1 + + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + if (y_m > 90 and y_m < 130): + gs.set_stage('play') + gs.game['fight_from'] = None + gs.game['fight_to'] = None + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + if (400 < x_m < 450): + if (120 < y_m < 170 and gs.game['fight_pst'] > 0): + gs.game['fight_pst'] -= 1 + + if (270 < y_m < 320 and gs.game['fight_ark'] > 0): + gs.game['fight_ark'] -= 1 + + if (420 < y_m < 470 and gs.game['fight_ptr'] > 0): + gs.game['fight_ptr'] -= 1 + + + if (500 < x_m < 550): + if (120 < y_m < 170 and gs.game['fight_pst'] < land['army']['pst']): + gs.game['fight_pst'] += 1 + + if (270 < y_m < 320 and gs.game['fight_ark'] < land['army']['ark']): + gs.game['fight_ark'] += 1 + + if (420 < y_m < 470 and gs.game['fight_ptr'] < land['army']['ptr']): + gs.game['fight_ptr'] += 1 + + +def fight(screen, gs): + fonts18 = pygame.font.Font(None, 18) + fonts24 = pygame.font.Font(None, 24) + fonts72 = pygame.font.Font(None, 72) + + bgcolor = pygame.Surface(screen.get_size()) + bgcolor = bgcolor.convert() + bgcolor.fill((235, 235, 155)) + screen.blit(bgcolor, (0, 0)) + + mygt(screen, 1140, 30, 215, 50, u'Ėjimo pabaiga', gs) + mygt(screen, 1140, 90, 215, 50, u'Pabėgti iš mūšio', gs) + + country, land = gs.get_country_land_from_capital(gs.game['fight_from'][0], gs.game['fight_from'][1]) + country = gs.get_country(country) + + country_b, land_b = gs.get_country_land_from_capital(gs.game['fight_to'][0], gs.game['fight_to'][1]) + country_b = gs.get_country(country_b) + + army_text = '%i | %i | %i' % (gs.game['fight_pst'], gs.game['fight_ark'], gs.game['fight_ptr']) + a = fonts72.render(army_text, True, country.color) + screen.blit(a, (100, 30)) + + army_text = '%i | %i | %i' % (land_b['army']['pst'], land_b['army']['ark'], land_b['army']['ptr']) + a = fonts72.render(army_text, True, country_b.color) + screen.blit(a, (800, 30)) + + pygame.draw.rect(screen, (163, 225, 143), (50, 500, 1080, 180), 0) + start_y = 500 + for i in range(10): + pygame.draw.line(screen, (0, 0, 0), (50, start_y), (1130, start_y), 3) + start_y += 20 + + start_x = 50 + for i in range(55): + pygame.draw.line(screen, (0, 0, 0), (start_x, 500), (start_x, 680), 3) + start_x += 20 + + for i in range(54): + for j in range(9): + index = gs.fight['fields'][i][j] + if isinstance(index, int): + unit = gs.fight['units'][index] + symbol = 'P' + if unit['type'] == 'ark': + symbol = 'A' + elif unit['type'] == 'ptr': + symbol = 'C' + + pygame.draw.rect(screen, unit['color'], (52 + i * 20, 502 + j * 20, 17, 17), 0) + a = fonts18.render(symbol, True, (0, 0, 0)) + screen.blit(a, (55 + i * 20, 505 + j * 20)) + + if gs.fight['action'] == 'selected': + selected_unit = gs.fight['units'][gs.fight['selected_unit']] + if selected_unit['type'] in ['pst', 'ptr']: + actions = ['X', 'F', 'G', 'S'] + longness = 80 + else: + actions = ['X', 'F', 'G'] + longness = 60 + + x, y = gs.fight['selected_pos'] + pygame.draw.rect(screen, (255, 255, 255), (x, y, longness, 20), 0) + start_x = x + 5 + for letter in actions: + a = fonts18.render(letter, True, (0, 0, 0)) + screen.blit(a, (start_x, y + 5)) + start_x += 20 + + + + # Inputs + events = pygame.event.get() + for event in events: + if event.type == MOUSEBUTTONUP and event.button == 1: + x_m, y_m = event.pos + + if (x_m > 1140 and x_m < 1355): + if (y_m > 30 and y_m < 80): # and gs.game['stage'] == 0): + gs.set_stage('fight') + land['army']['pst'] -= gs.game['fight_pst'] + land['army']['ark'] -= gs.game['fight_ark'] + land['army']['ptr'] -= gs.game['fight_ptr'] + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + if (y_m > 90 and y_m < 130): + gs.set_stage('play') + # we have logic here. If we retriet we lose half of canons, + # 1/5 simple and 1/10 cavalery + land['army']['pst'] += int(gs.game['fight_pst'] * 0.8) + land['army']['ark'] += int(gs.game['fight_ark'] * 0.9) + land['army']['ptr'] += int(gs.game['fight_ptr'] * 0.5) + + gs.game['fight_from'] = None + gs.game['fight_to'] = None + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + if gs.fight['action'] in ['looking']: + for i in range(54): + for j in range(9): + index = gs.fight['fields'][i][j] + if isinstance(index, int): + x = 52 + i * 20 + y = 502 + j * 20 + if x < x_m < x + 17 and y < y_m < y + 17: + pygame.draw.rect(screen, (0, 0, 255), (x, y, 17, 17), 0) + if gs.fight['action'] == 'looking': + gs.fight['selected_unit'] = index + gs.fight['selected_field'] = i, j + gs.fight['selected_pos'] = x + 30, y - 10 + gs.fight['action'] = 'selected' + + if gs.fight['action'] == 'selected': + selected_unit = gs.fight['units'][gs.fight['selected_unit']] + if selected_unit['type'] in ['pst', 'ptr']: + actions = ['X', 'F', 'G', 'S'] + else: + actions = ['X', 'F', 'G'] + + x, y = gs.fight['selected_pos'] + # X - close + if x < x_m < x + 20 and y < y_m < y + 20: + gs.fight['action'] = 'looking' + gs.fight['selected_unit'] = None + gs.fight['selected_field'] = None + gs.fight['selected_pos'] = None + + x += 20 + # F - fortify + if x < x_m < x + 20 and y < y_m < y + 20: + pass + + x += 20 + # G - go + if x < x_m < x + 20 and y < y_m < y + 20: + gs.fight['action'] = 'selected_go' + + x += 20 + # S - shot + if x < x_m < x + 20 and y < y_m < y + 20: + pass + + diff --git a/guilib.py b/guilib.py new file mode 100644 index 0000000..9d81ee4 --- /dev/null +++ b/guilib.py @@ -0,0 +1,409 @@ +# -*- coding: utf-8 -*- + +import pygame +from pygame.locals import * +import json +import os +import re +import time +from math import fabs + + +HAND_CURSOR_STRING = ( + " XX ", + " X..X ", + " X..X ", + " X..X ", + " X..XXXXX ", + " X..X..X.XX ", + " XX X..X..X.X.X ", + "X..XX.........X ", + "X...X.........X ", + " X.....X.X.X..X ", + " X....X.X.X..X ", + " X....X.X.X.X ", + " X...X.X.X.X ", + " X.......X ", + " X....X.X ", + " XXXXX XX ") +CURSOR_HAND, MASK = pygame.cursors.compile(HAND_CURSOR_STRING, black='X', + white='.', xor='o') + + +def mygt(screen, x, y, x_sz, y_sz, txt, gs): + """Drawing button.""" + + x_m, y_m = pygame.mouse.get_pos() + + # if mouse is under button + if (x_m < (x + x_sz) and x_m > x) and (y_m < (y + y_sz) and y_m > y): + pygame.draw.rect(screen, (200, 160, 60), (x, y, x_sz, y_sz), 0) + pygame.mouse.set_cursor((16, 16), (8, 1), CURSOR_HAND, MASK) + gs.register_button(x, y, x_sz, y_sz) + else: + pygame.draw.rect(screen, (255, 200, 80), (x, y, x_sz, y_sz), 0) + if not gs.check_button(x, y, x_sz, y_sz): + pygame.mouse.set_cursor(*pygame.cursors.arrow) + + pygame.draw.rect(screen, (0, 0, 0), (x, y, x_sz, y_sz), 2) + + fonts = pygame.font.Font(None, 24) + a = fonts.render(txt, True, (0, 0, 0)) + screen.blit(a, (x + 8, y + (y_sz / 2) - 8)) + + +class GameSettings: + """Object to save all game parameters during game.""" + een = True # Game loop + stage = 'start' # display stage of game (start, map, settings etc.) + turn = 0 # Player starts + fullscreen = False # Fullscreen is off + + countries = {} # Countries + maps = {} # Maps + ages = ['XIII', 'XIX'] + log = [] # Game log + + GREEN = (0, 180, 0) + RED = (180, 0, 0) + BLUE = (0, 0, 255) + BLACK = (0, 0, 0) + COLORS = [GREEN, RED, BLUE, BLACK] + + PRINT = 0 + LAST_POINT = 0 + POINT = 0 + + HOME = os.path.expanduser("~") + HOME = os.path.join(HOME, '.rc_maumataskis') + try: + f = open(HOME, 'r') + HOME = f.readline() + f.close() + try: + HOME = HOME[:-1] + os.listdir(HOME) + except OSError: + HOME = os.path.expanduser("~") + HOME = os.path.join(HOME, '.rc_maumataskis') + f = open(HOME, 'w') + ent = '\n' + f.write(os.path.expanduser("~")) + f.write(ent) + f.close() + HOME = os.path.expanduser("~") + except IOError: + f = open(HOME, 'w') + ent = '\n' + f.write(os.path.expanduser("~")) + f.write(ent) + f.close() + HOME = os.path.expanduser("~") + + + # FIXME: rewrite opt and flagai + opt = {'kursor_pos' : 0, 't_raidie' : '', 'zaid' : '', + 's_dir_cur' : HOME, 's_dir_pos' : 0, 'HOME' : HOME} # varies options + flagai = {'SAVE_DIR' : 0, 'new_dir' : 0, 'KNIST_DIR' : 0, 'new_file' : 0, + 'new_file_err' : 0, 'load_err' : 0, 'SAUGOM' : 0, 'KRAUNAM' : 0, + 'PRINTINAM' : 0, 'KNIST_OK' : 0} # varies flags + + buttons_stack = {} + errors = [] + + editor = { + 'in_progress': False, + 'word': '', + 'cursor': 0 + } + settings = { + 'age' : 'XIX', + 'map' : '', + 'country' : '' + } + + map_editor = { + 'tool' : 'border', + 'action' : None, + 'x': None, + 'y': None, + 'tmp' : None, + 'country' : None + } + + map_editor_tools = { + 'border': u'Sienos', + 'undo': u'Atšaukti', + 'capital': u'Sostinė', + 'countries': u'Šalys', + 'connect': u'Ribojasi' + } + + new_map = { + 'borders': [], + 'capitals': [], + 'countries': {} + } + + game = { + 'age': '', + 'map': '', + 'users': [], + 'turn': 0, + 'stage': '', + 'fight_from': None, + 'fight_to': None, + 'fight_pst': 0, + 'fight_ark': 0, + 'fight_ptr': 0 + } + + fight = { + 'fields': [], + 'units': [], + 'selected_unit': None, + 'selected_field': None, + 'selected_pos': None, + 'action': 'looking' + } + + def __init__(self): + self.load_countries() + self.load_maps() + + self.fight['fields'] = [] + for i in range(54): + self.fight['fields'].append([]) + for j in range(9): + self.fight['fields'][i].append('') + + + def get_stage(self): + return self.stage + + + def set_stage(self, stage): + self.stage = stage + + + def load_countries(self): + countries = os.listdir('countries') + for country_short in countries: + country = Country(country_short) + + f = open('countries/'+country_short, 'r') + country.name = f.readline()[0:-1] + r = int(f.readline()) + g = int(f.readline()) + b = int(f.readline()) + country.color = (r, g, b) + + # reading players by ages + ages = {} + age = None + line = f.readline() + while line: + line = line[0:-1] + b = re.match('\[(\w+)\]', line) + if b: + age = b.groups()[0] + ages[age] = [] + line = f.readline() + continue + + if line: + ages[age].append(line) + + line = f.readline() + + + f.close() + country.ages = ages + + self.add_country(country_short, country) + + + def add_country(self, country_short, country): + self.countries[country_short] = country + + + def get_country(self, short_name): + if short_name in self.countries: + return self.countries[short_name] + + def get_country_land_from_capital(self, x, y): + for country in self.game['map']: + for land in self.game['map'][country]: + if x - 10 < land['capital'][0] < x + 10 and y - 10 < land['capital'][1] < y + 10: + return country, land + + return None, None + + + def save_new_map(self): + # prepare content + structure ={} + for country in self.new_map['countries']: + structure[country] = [] + country_data = self.get_country(country) + print(country_data) + for capital in self.new_map['countries'][country]: + border = self.get_capital_border(self.new_map['borders'], capital) + if border: + structure[country].append({ + 'capital': capital, + 'border': border, + 'color': country_data.color + }) + + filename = self.editor['word'].replace(' ', '_')+'.ia.map' + f = open('maps/'+filename, 'w') + f.write(self.editor['word']+"\n") + f.write(self.settings['age']+"\n") + f.write(json.dumps(structure)+"\n") + f.close() + + self.maps = {} + self.load_maps() + + + def load_maps(self): + maps = os.listdir('maps') + for filename in maps: + map_ = Map() + + f = open('maps/'+filename, 'r') + map_.name = f.readline()[0:-1] + map_.age = f.readline()[0:-1] + map_.file = 'maps/'+filename + map_.map = json.loads(f.readline()[0:-1]) + f.close() + + self.add_map(map_.name, map_) + + + def add_map(self, map_name, map_object): + self.maps[map_name] = map_object + + + def clear_menu(self): + """Clear menu and set flag.""" + self.menu = False + self.menu_flag = 0 + self.buttons_stack = {} # Make empty for renew situation + + + def register_button(self, x, y, x_sz, y_sz): + self.buttons_stack['%i_%i_%i_%i' % (x, y, x_sz, y_sz)] = True + + + def check_button(self, x, y, x_sz, y_sz): + self.buttons_stack['%i_%i_%i_%i' % (x, y, x_sz, y_sz)] = False + return True in self.buttons_stack.values() + + + def clear_log(text=None): + self.log = [] + if text: + self.log.append(text) + + + def add_log(text): + self.log.insert(0, text) + + + def quit_game(self): + """Quit aplication.""" + self.een = 0 + + def get_extremums(self, border): + """Returns extremums of border.""" + min_x = min([p[0] for p in border]) + max_x = max([p[0] for p in border]) + min_y = min([p[1] for p in border]) + max_y = max([p[1] for p in border]) + return min_x, max_x, min_y, max_y + + + def extend_border(self, border): + extended = [border[0]] + pos_old = None + tmp_border = border + tmp_border.append(border[0]) + for pos in tmp_border: + if pos_old: + if not pos[1] - pos_old[1] == 0: + k = (pos[0] - pos_old[0]) * 1. / (pos[1] - pos_old[1]) + c = -1 * (pos[1] * k - pos[0]) + if (pos[1] > pos_old[1]): + step = 1 + else: + step = -1 + + for y in range(pos_old[1], pos[1], step): + x_ = int(y * k + c) + + if (extended[-1][0] <= x_): + step_x = 1 + else: + step_x = -1 + + for x in range(extended[-1][0], x_, step_x): + extended.append((x, y)) + + else: + if (pos[0] > pos_old[0]): + step = 1 + else: + step = -1 + + for x in range(pos_old[0], pos[0], step): + extended.append((x, pos[1])) + + + pos_old = pos + + return extended + + + def get_capital_border(self, borders, capital): + for border in borders: + min_x, max_x, min_y, max_y = self.get_extremums(border) + FOUND = False + border_extended = self.extend_border(border) + if min_x < capital[0] < max_x and min_y < capital[1] < max_y: + # this algoritm counts how many time it passes contur + # border. If it is < 0 and is odd it meens what point is + # inside contur + y = capital[1] + count = 0 + while y > min_y - 1: + y -= 1 + for p in border_extended: + if p[0] == capital[0] and p[1] == y: + count += 1 + print(count) + + if count > 0 and count % 2 == 1: + return border + + +class Country: + """Main class for country.""" + + def __init__(self, short_name): + self.short_name = short_name + self.ages = {} + self.name = '' + self.color = None + + +class Map: + """Main class for map.""" + + def __init__(self): + self.name = '' + self.age = '' + self.file = '' + self.map = None + diff --git a/images/menu.png b/images/menu.png new file mode 100644 index 0000000000000000000000000000000000000000..59ba4fa2f597106c0b6570a0f1ba6437bbd13468 GIT binary patch literal 7921 zcmV->0000TX;fHrLvL+uWo~o;00000Lvm$d zbY)~9cWHEJAV*0}P-HG;2LJ#bXGugsRCwC$ok@};Hx5NT%;ExC=?ZoK)8rMj(h;H; z)s~ftaHoU7$3%Xt+FDuR6NpEE7#^?J>!1wf@pxSQC%(P-*Z%tTi!X;lQ7)^mFQNJR zxd4|pbWduA#uk%*8E>8lq);dXArVLfQYaLF+?ul2>oo|55rjk_g$SfjCBWmR8R-dye2tiRfh9w8~XCj#3Mj+*JJhpl~CdXNMmDM$nsMIF^?hb;xR^OO$K zZ>m1KvUosv@=Etvy+8_Xm00Xi9!TYh{jVQ5`^tR zNWxLbS_(yB8^3Y*4MK_fegEu6@xmgH+L3mDz5XtHZ~s323A@SfYt5Q_ZgB`#O0Wr~ zJD3l`0K+#32oy(GQ~9KzP@`s*!CO&DWfFG>A`*l_AapV)_LK@zFr9)^y0P9OBx_^# zOcZW<;y~!3oxluxQZSf;SBkVb{0LVHA-Vzx;VUhm8k7{wrQk$v8_7rFQYhKh;6ES) z>Uv`D15z*&f#2#&_>qFNt(Cvs>-8FU18Db^fgjiUZ;kOm=QkEN*lxyc_$$RqUjBKjal0t}5I7|fRV}VBIpPeU3!ANUD_^o6emR~z4K=$g%rA~@mV|Cvy z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lneh#wAn%O`Yz)HI6tr{kfCfLWeiPpOR}#bY@EU=(#*zfF7y=>fF$;2T z7KFtUR*zwUBPrMngbP#94n-$48jBzyM!};KKinN$n13zW+@yEZ^SCkZ9W4<^5N^T6 z7G7gK8ZDP|Y67wnlUhR#^77+LHD-6NMBoY_+=_y5Gq;}H^vSTuSVdT%<0xvG>^IcMjSM;mM5B^337MBsuTBnt!37-J|& zEK;on_7r?_des985`l|@@Nk|!PdZX4B;VEB@Yt?FP7`m7ph&^hKsf&1BqF&;p{%{V zIHe#FxFZN9yE8&@7KAHJR0lQ+pit_#)bb8$MBo-6l$$vcQ3ArSP}sH^n0|AGD2vg~ zs1HP7UwQg%{J(8IiP+Sjtigk|sa6*A5Gp*rzOvvq^}2|_O+k37omU$3GYm*5u3=>9 zGZFLN7-&I3B9I_7xryZB8pfBf++|l3Yw>?lu;wO%2qXvrL?jn?c2Fcn9|-OAuR<3?heK; z4JtN0!UmhcDXUG#@#?)1ew6wYBmyY}VGtTC0P^vGIpqPpiCGar$y)40AcY{DSS_>0 z`nLbIH!0;TbmGve6Avg&-9cA{WL*U1L@RbMf?0mdn4nn$C@f$6&p{*Y1;vMgP9S8b zG|I9bq0#hv12P45Sr1F0q;J$LnokN6gj{m9T*+WdL7^0J2Z6dB(CUFg5R#O>1ofjG zFg=Gt0a7r4f2X~WNI?ogSc0IRi}UyYLt;_(p&;b+db}jx=j#%I6oRlCIInOBA>wRb zPzt5;-f@b5r+-WeQV7CMIK&c>LaF8s+9N2pSS1B11mPk$L=ln4gp@iIM8WS67Z#I( blsEYwXvUN~7)XjV00000NkvXXu0mjfj6=J^ literal 0 HcmV?d00001 diff --git a/images/ru/xix_ark.png b/images/ru/xix_ark.png new file mode 100644 index 0000000000000000000000000000000000000000..e7739a117d724020bdc76da89a7129beb6c9fe45 GIT binary patch literal 625 zcmV-%0*?KOP)WFU8GbZ8()Nlj2>E@cM*00GrWL_t(|+U=V`62l-2 z10xUr|FU}Tp-sRB*|E;))QbcL(q31q)oLXY3NWx5FsnJt>XGJ276gGH01#>pGeg?O z+d2d`x+>8T5DY5U_E6o?**VOcaJJ}5(Fzch7P07Jpf<a0*OuFP-9e$gH5J z9OjSc%m1haPOd^Z(%!Dh&*3Yht2=BDxo;O(u=gn+pCJfb6wXg4AZFvmiv9A$+?i<5)Km895Wd>}ALkDkfihr`dqcisjf zsPLI6<0&we-0_elDV$#4X#rm%{SVU&ixxc-Wlph8^Jh$Zle_;`>D9e1+Tp|QdIO{9 zu$a3uTT7J#!gSJ1tZ+t874^1+x6I*MCzhL$#?@-ITCG;A)k>rfkV;z8va%q<00000 LNkvXXu0mjf5Y`mw literal 0 HcmV?d00001 diff --git a/images/ru/xix_pst.png b/images/ru/xix_pst.png new file mode 100644 index 0000000000000000000000000000000000000000..780b641150942c4df06e189c6d8da2d4ef169617 GIT binary patch literal 615 zcmV-t0+{`YP)WFU8GbZ8()Nlj2>E@cM*00GNML_t(|+U=a%j>9kr zL^~+||I6&#s@iQ@H!(0CcnmRDlfqi$wTLI(Mk4IH# z-R*cAZs6DLsLG|pl%O~49n!+U9$BHgXa(lrh`DgP5x{=oH>{e&K5;*+08D!-iU{c| zIVwBTIva$N0k8zHcmIO|@ZAA|I&d!!R|9rt;H*nLPzR>9J}acbWHHk)Zdwf=G$e;J z64M5KS`r3EPdplU?dENGBVaI0EoV+KQMNPb92!+2?aRe`5GWD{5YfP%IKX}dKDz^` zP8$n6aK#$=<1vpw*vfizx-K^n*kS7?4*Rcfwh8QSA8jMpOCh~9?6*~#5f)K~mpA(j zung=7uoUbkU^&=#z>=_Mz_PHTMN0;D1Xv1o=6ZPA0=;6UC1*9$Fx^1*t(FFE;0A8s z25#U6mH_rPycw{!;ev(&n`p!0z^(>N{T^bLVVcWENVZ%4dQWxH@|6vb+AF=YVFjj2 zi3LzyDHtBY2;X%yNmF+KZ9JoNs(~>7goU`O`l-*EhBMoKw zj}MJNdp0oj=PDEohgd$ya+kuelUYs=>7^fQ`T+t{XE)7O>#9up(4guG(-Q&ymmY-UJAiF1B#Zfaf$kjuc}T$Gwv zlA5AWo>`Ki;O^-gkfN8$&cMKU%+tj&q~g}w*{8)?6nLC<+yDQ6dM3-PSSEgp>d}Cf_a?>Q~Y9_hC+w&H?@?o81RZW7Ih z7n`>E6z4Q;Ef89+un0G5-SJYG~JFaVK2i=%%w?0;_XHYmT8P?o_2focc*xXg6|dej4y&rYpUB8?d9B-<;B02_oepkop1k?z3OKC z$C}FK#-gEZu*l(NL;teKSn(BQMdo+IAAd_S{UuSt_95hgPXgBko&>E68VUVR-4;$R za$}I-dwEqrtFh0lBWr=bG+UshZIE}v*4~WL2G-_zcaPtY`6jbhV)tQ>6EnWFUl8_g zc6z&L_co?C_78TS{qcC-T3RCFyPnizx*8}rs$lVNkzSq-A z=0-BV;*CV*I))4NyP}*5LhfgtpEB=W?w2>2sr^$AH?GxkIPyW@>g#Vh2K{eKmp0g5 t+9~sa!{lqh#ofOnvT}4laRNrQUl}7aqF0$k-I4}HwWq6}%Q~loCID?Y`I-O# literal 0 HcmV?d00001 diff --git a/maps/daugiau.ia.map b/maps/daugiau.ia.map new file mode 100644 index 0000000..94e325f --- /dev/null +++ b/maps/daugiau.ia.map @@ -0,0 +1,3 @@ +daugiau +XIX +{"ru": [{"color": [255, 12, 56], "border": [[715, 329], [641, 457], [626, 548], [648, 565], [663, 593], [683, 648], [703, 684], [706, 700], [715, 719], [753, 718], [791, 717], [833, 718], [896, 716], [973, 717], [1105, 715], [1119, 715], [1114, 625], [1117, 15], [1114, 12], [1114, 13], [805, 20], [847, 148], [902, 176], [913, 201], [921, 213], [922, 238], [910, 272], [872, 280], [863, 288], [842, 295], [841, 290], [821, 331], [763, 312], [717, 331], [715, 329], [715, 329], [715, 329]], "capital": [1021, 191]}, {"color": [255, 12, 56], "border": [[788, 251], [766, 263], [730, 261], [717, 261], [704, 260], [689, 256], [679, 251], [669, 247], [662, 243], [657, 242], [642, 253], [641, 301], [659, 323], [711, 328], [761, 310], [792, 320], [818, 331], [837, 288], [803, 270], [789, 257], [785, 251], [799, 233], [793, 245], [784, 251], [806, 269], [834, 284], [847, 289], [849, 291], [909, 271], [919, 215], [897, 172], [853, 152], [812, 149], [777, 152], [750, 158], [738, 159], [728, 168], [726, 174], [723, 183], [723, 184], [723, 202], [736, 207], [761, 207], [777, 212], [791, 224], [796, 227], [797, 235], [798, 237], [788, 251], [788, 251], [788, 251], [788, 251], [788, 251], [788, 251]], "capital": [678, 277]}], "lt": [{"color": [56, 255, 5], "border": [[788, 251], [766, 263], [730, 261], [717, 261], [704, 260], [689, 256], [679, 251], [669, 247], [662, 243], [657, 242], [642, 253], [641, 301], [659, 323], [711, 328], [761, 310], [792, 320], [818, 331], [837, 288], [803, 270], [789, 257], [785, 251], [799, 233], [793, 245], [784, 251], [806, 269], [834, 284], [847, 289], [849, 291], [909, 271], [919, 215], [897, 172], [853, 152], [812, 149], [777, 152], [750, 158], [738, 159], [728, 168], [726, 174], [723, 183], [723, 184], [723, 202], [736, 207], [761, 207], [777, 212], [791, 224], [796, 227], [797, 235], [798, 237], [788, 251], [788, 251], [788, 251], [788, 251], [788, 251], [788, 251]], "capital": [799, 181]}, {"color": [56, 255, 5], "border": [[633, 283], [574, 283], [541, 274], [485, 241], [462, 214], [464, 162], [455, 136], [454, 76], [547, 57], [593, 69], [618, 108], [668, 155], [674, 157], [643, 188], [639, 231], [660, 244], [641, 255], [643, 288], [633, 283], [633, 283], [633, 283], [633, 283], [633, 283]], "capital": [513, 118]}]} diff --git a/maps/figut.ia.map b/maps/figut.ia.map new file mode 100644 index 0000000..42fee18 --- /dev/null +++ b/maps/figut.ia.map @@ -0,0 +1,3 @@ +figut +XIX +{"ru": [{"color": [255, 12, 56], "border": [[381, 148], [251, 323], [392, 443], [562, 281], [383, 148], [381, 148], [381, 148], [381, 148]], "capital": [395, 240]}], "lt": [{"color": [56, 255, 5], "border": [[750, 82], [713, 195], [832, 271], [967, 207], [804, 199], [768, 160], [976, 115], [750, 82], [750, 82]], "capital": [837, 229]}, {"color": [56, 255, 5], "border": [[634, 305], [629, 598], [936, 591], [940, 320], [634, 306], [634, 305], [634, 305]], "capital": [755, 470]}]} diff --git a/maps/lt_lv_ru.ia.map b/maps/lt_lv_ru.ia.map new file mode 100644 index 0000000..948b97a --- /dev/null +++ b/maps/lt_lv_ru.ia.map @@ -0,0 +1,3 @@ +lt lv ru +XIX +{"ru": [{"color": [255, 12, 56], "border": [[281, 508], [277, 610], [514, 604], [504, 571], [408, 511], [286, 506], [281, 508]], "capital": [319, 533]}, {"color": [255, 12, 56], "border": [[285, 366], [266, 201], [322, 108], [499, 203], [656, 161], [735, 45], [931, 67], [878, 210], [825, 315], [758, 394], [732, 351], [646, 344], [569, 287], [503, 363], [287, 373], [287, 364], [285, 366], [285, 366]], "capital": [600, 185]}], "lt": [{"color": [56, 255, 5], "border": [[505, 362], [284, 373], [261, 450], [282, 506], [410, 512], [505, 570], [513, 604], [606, 633], [606, 685], [747, 673], [787, 584], [817, 596], [861, 556], [794, 545], [772, 478], [854, 430], [826, 313], [756, 396], [733, 351], [645, 345], [568, 289], [506, 362], [505, 362], [505, 362], [505, 362]], "capital": [687, 547]}]}