From 3141179c76b6c6b0aaa1d74241ba2364c87320d1 Mon Sep 17 00:00:00 2001
From: mstogovs2 <mstogovs2.e@rkg.lv>
Date: Thu, 21 Dec 2023 00:16:47 +0200
Subject: [PATCH] Add basic example

---
 pygame_pamati/basic_example.py | 66 ++++++++++++++++++++++++++++++++++
 requirements.txt               |  1 +
 2 files changed, 67 insertions(+)
 create mode 100644 pygame_pamati/basic_example.py
 create mode 100644 requirements.txt

diff --git a/pygame_pamati/basic_example.py b/pygame_pamati/basic_example.py
new file mode 100644
index 0000000..1507924
--- /dev/null
+++ b/pygame_pamati/basic_example.py
@@ -0,0 +1,66 @@
+# Code is taken from https://realpython.com/pygame-a-primer/
+
+# Import and initialize the pygame library
+import pygame
+
+from pygame.locals import (
+    K_UP,
+    K_DOWN,
+    K_LEFT,
+    K_RIGHT,
+    K_ESCAPE,
+    KEYDOWN,
+    QUIT,
+)
+
+pygame.init()
+
+# Define constants for the screen width and height
+SCREEN_WIDTH = 800
+SCREEN_HEIGHT = 600
+
+# Create the screen object
+# The size is determined by the constant SCREEN_WIDTH and SCREEN_HEIGHT
+screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
+
+# Set up the drawing window
+
+# Variable to keep the main loop running
+running = True
+
+# Main loop
+while running:
+    # Look at every event in the queue
+    for event in pygame.event.get():
+        # Did the user hit a key?
+        if event.type == KEYDOWN:
+            # Was it the Escape key? If so, stop the loop.
+            if event.key == K_ESCAPE:
+                running = False
+
+        # Did the user click the window close button? If so, stop the loop.
+        elif event.type == QUIT:
+            running = False
+
+    # Fill the background with white
+    screen.fill((255, 255, 255))
+
+    # Create a surface and pass in a tuple containing its length and width
+    surf = pygame.Surface((50, 50))
+
+    # Give the surface a color to separate it from the background
+    surf.fill((0, 0, 0))
+    rect = surf.get_rect()
+    
+    surf_center = (
+        (SCREEN_WIDTH-surf.get_width())/2,
+        (SCREEN_HEIGHT-surf.get_height())/2
+    )
+
+    screen.blit(surf, surf_center)
+
+    # Flip the display
+    pygame.display.flip()
+
+# Done! Time to quit.
+pygame.quit()
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..5988648
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1 @@
+pygame==2.5.2