Esempio n. 1
0
    def __init__(self):
        self.screenrect = get_screenrect()
        self.sidebar_width = 200
        self.game_area = pygame.Rect(
            0, 0, self.screenrect.width - self.sidebar_width,
            self.screenrect.height)
        self.ant_count = 4
        self.ants = []
        self.create_ants(self.ant_count)
        self.sidebar = Sidebar(
            pygame.Rect(
                self.screenrect.width - self.sidebar_width,
                0,
                self.sidebar_width,
                self.screenrect.height,
            ),
            self,
        )

        # right now a job is just a position
        # we want the ant to pick up the thing
        # and move it to a spot to drop it off
        self.jobs = []
        self.working_jobs = []
        self.done_jobs = []
        self.drop_off = pygame.Rect(20, 20, 20, 20)
        self.create_jobs(self.ant_count)
Esempio n. 2
0
import pygame.freetype

pygame.init()

screen_width = 1280
screen_height = 720
main_surface = pygame.display.set_mode((screen_width, screen_height))

text_container_height = 80
padding = 20
max_cont = (screen_height // (text_container_height + padding)) - 2

event_manager = EventManager()

graph = Graph(event_manager, (0, 0), (screen_width, screen_height))
sidebar = Sidebar((300, screen_height), pygame.Color('#3a577b'),
                  pygame.Color('#4d4d4d'))
toggle_button = ToggleButton(event_manager, (95, 25), [screen_width - 220, 30],
                             'degrees', 'radians')


def create_new_text_container():
    if len(FunctionBox.all_function_boxes) - 1 != max_cont:
        place = len(
            FunctionBox.all_function_boxes) * (text_container_height + padding)
        FunctionBox(event_manager, (0, place), (300, text_container_height),
                    30)


new_expr = Button(event_manager, (25, screen_height - 60),
                  pygame.Color(0, 200, 0),
                  'ADD NEW',