# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
-#.idea/
+.idea/
--- /dev/null
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
--- /dev/null
+class Color:
+ BLACK = (0, 0, 0)
+ GRAY = (128, 128, 128)
+ WHITE = (255, 255, 255)
+
+ RED = (255, 0, 0)
+ GREEN = (0, 255, 0)
+ BLUE = (0, 0, 255)
--- /dev/null
+import pygame
+from rectangle import Rectangle
+
+pygame.init()
+
+screen = pygame.display.set_mode((640, 480))
+pygame.display.set_caption("My Game")
+clock = pygame.time.Clock()
+delta = 0
+
+# Testing Rectangle
+r = Rectangle(100, 100, 100, 100, (255, 0, 0))
+r2 = Rectangle(200, 200, 100, 100, (0, 255, 0), (0, 0, 255), 5, 10)
+r3 = Rectangle(300, 300, 100, 100, (0, 0, 255), (255, 0, 0), 5, 10)
+
+is_running = True
+while is_running:
+ for event in pygame.event.get():
+ if event.type == pygame.QUIT:
+ is_running = False
+
+ screen.fill((255, 255, 255))
+
+ r.draw(screen)
+ r2.draw(screen)
+ r3.move(delta * 10, delta * 10)
+ r3.draw(screen)
+
+ pygame.display.update()
+ delta = clock.tick(60) / 1000 # Seconds since last frame
+
+pygame.quit()
--- /dev/null
+import pygame
+from color import Color
+
+
+class Rectangle:
+
+ def __init__(self, x, y, width, height, background_color, border_color=Color.BLACK, border_width=0,
+ border_radius=0):
+ self.x = x
+ self.y = y
+ self.width = width
+ self.height = height
+ self.background_color = background_color
+
+ self.border_color = border_color
+ self.border_width = border_width
+ self.border_radius = border_radius
+
+ def set_position(self, x, y):
+ self.x = x
+ self.y = y
+
+ def move(self, dx, dy):
+ self.x += dx
+ self.y += dy
+
+ def set_size(self, width, height):
+ self.width = width
+ self.height = height
+
+ def set_background_color(self, background_color):
+ self.background_color = background_color
+
+ def set_border_color(self, border_color):
+ self.border_color = border_color
+
+ def draw(self, screen):
+ pygame.draw.rect(screen, self.background_color, (self.x, self.y, self.width, self.height),
+ border_radius=self.border_radius)
+ pygame.draw.rect(screen, self.border_color, (self.x, self.y, self.width, self.height), self.border_width,
+ border_radius=self.border_radius)