Example #1
0
def drawInventory(screen, shipInventory):
    Texthelper.write(screen, [("left+10", 10), f"metal:{shipInventory[0]}", 3],
                     color=(120, 120, 120))
    Texthelper.write(screen, [("left+315", 10), f"gas:{shipInventory[1]}", 3],
                     color=(185, 20, 20))
    Texthelper.write(screen,
                     [("left+560", 10), f"circuits:{shipInventory[2]}", 3],
                     color=(20, 185, 20))
    Texthelper.write(screen,
                     [("left+965", 10), f"credits:{shipInventory[3]}", 3],
                     color=(230, 180, 20))
Example #2
0
def drawInventory(screen, shipInventory):
    Texthelper.write(screen,
                     [("left+10", 10), "metal:" + str(shipInventory[0]), 3],
                     color=(120, 120, 120))
    Texthelper.write(screen,
                     [("left+310", 10), "gas:" + str(shipInventory[1]), 3],
                     color=(185, 20, 20))
    Texthelper.write(
        screen, [("left+550", 10), "circuits:" + str(shipInventory[2]), 3],
        color=(20, 185, 20))
    Texthelper.write(screen,
                     [("left+935", 10), "credits:" + str(shipInventory[3]), 3],
                     color=(230, 180, 20))
Example #3
0
def drawSector(screen, location, number, currentsector, cleared):
    secsize = 80  #side length of the cubes
    if number == currentsector:
        color = (70, 130, 180)
    elif cleared:
        color = (20, 160, 40)
    else:
        color = (180, 50, 50)

    pgx.draw.rect(screen, color, (location[0] - secsize / 2,
                                  location[1] - secsize / 2, secsize, secsize),
                  4)

    if number == currentsector:
        Texthelper.write(screen,
                         [(location[0] - 35, location[1] - 35), "U R Here", 1],
                         color=color)
    Texthelper.write(screen,
                     [(location[0] - len(str(number)) * 10, location[1] - 15),
                      str(number), 2],
                     color=color)
Example #4
0
 def draw(screen, currentfuel, totalfuel, currentarmor, totalarmor,
          ammunition, totalammunition):
     fuelpic = Images.get("fuelpic")
     armorpic = Images.get("armorpic")
     shotpic = Images.get("shotpic")
     #fuel
     InfoBars.fuelalert.update(screen, currentfuel / totalfuel)
     pgx.draw.sblit(screen, fuelpic, ("right-270", 1000))
     pgx.draw.rect(screen, (178, 34, 34), ["right-220", 1000, 200, 50])
     pgx.draw.rect(screen, (139, 0, 0),
                   ["right-220", 1000, 200 * currentfuel / totalfuel, 50])
     #Texthelper.write(screen, [(1665, 1005), str(currentfuel), 3])
     #armor
     InfoBars.armoralert.update(screen, currentarmor / totalarmor)
     pgx.draw.sblit(screen, armorpic, ("right-270", 930))
     pgx.draw.rect(screen, (128, 128, 128), ["right-220", 930, 200, 50])
     pgx.draw.rect(screen, (64, 64, 64),
                   ["right-220", 930, 200 * currentarmor / totalarmor, 50])
     #Texthelper.write(screen, [(1665, 935), str(currentarmor), 3])
     #ammunition
     pgx.draw.sblit(screen, shotpic, ("right-270", 860))
     Texthelper.write(screen,
                      [("right-205", 865),
                       str(ammunition) + "/" + str(totalammunition), 3])
Example #5
0
def setup():
    pygame.init()

    scrInfo = pygame.display.Info()
    suggestedRes = scrInfo.current_w, scrInfo.current_h
    if suggestedRes[0] < 0 or platform.system() == "Darwin":
        suggestedRes = pygame.display.list_modes()[0]

    widthBox = InputGetter([(110, 75), str(suggestedRes[0]), 1.5], "int")
    heightBox = InputGetter([(230, 75), str(suggestedRes[1]), 1.5], "int")

    logo = loadImage("Assets\\images\\earth2.png")
    logo.set_colorkey((255, 0, 0))
    pygame.display.set_icon(logo)
    pygame.display.set_caption("Kessler First Time Setup")
    clock = pygame.time.Clock()
    screen = pygame.display.set_mode([600, 450])

    Texthelper.width = 600
    Texthelper.height = 450
    Texthelper.scalar = 1.5
    Texthelper.SAFEASPECT = (4, 3)

    full = True

    color = (20, 110, 230)

    running = True
    while running:
        clock.tick(100)
        screen.fill(color)

        Texthelper.write(screen,
                         [("center", 20), "Welcome to Kessler Syndrome", 1.4])
        Texthelper.write(
            screen, [("center", 50), "Resolution reported by your system:", 1])
        widthBox.update(screen)
        Texthelper.write(screen, [(190, 75), "by", 1.5])
        heightBox.update(screen)
        Texthelper.write(
            screen,
            [("center", 110), "Please change to your desired resolution", 0.9])

        Texthelper.write(screen, [(50, 170), "Fullscreen:", 1.5])
        if Texthelper.writeButton(screen, [(240, 170), str(full), 1.5]):
            full = not full
        Texthelper.write(
            screen, [(2, 200), "Note: If you are going to do fullscreen,", 1])
        Texthelper.write(
            screen, [(2, 215), "the resolution set should be the same", 1])
        Texthelper.write(screen, [(27, 230), "as your monitors resolution", 1])

        if Texthelper.writeButton(screen, [("center", 270), "Continue", 1.25]):
            contents = filehelper.get(0)
            contents[0] = widthBox.getText()
            contents[1] = heightBox.getText()
            contents[2] = full
            filehelper.set(contents, 0)
            running = False

        collect_inputs()

        pygame.display.flip()
        for event in AllEvents.TICKINPUT:
            if event.type == pygame.QUIT:
                running = False
                pygame.quit()
                raise SystemExit

    pygame.quit()