Skip to content

Instantly share code, notes, and snippets.

@dorktoast
Last active March 10, 2024 19:04
Show Gist options
  • Select an option

  • Save dorktoast/8a6c3f3a000a77e8d55138feaf97b217 to your computer and use it in GitHub Desktop.

Select an option

Save dorktoast/8a6c3f3a000a77e8d55138feaf97b217 to your computer and use it in GitHub Desktop.
Could this be the smalled possible game engine?
# MinimalEngine
# Creates a block of pixels. If the game is running, refresh the pixels.
# It's up to you, the game creator, to creae the logic that decides what pixels to draw.
# Good luck.
import pygame
import sys
# Initialize Pygame
pygame.init()
# Set up the display
screen = pygame.display.set_mode((800, 600))
# Game loop
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
# Game logic goes here
# Refresh the screen
pygame.display.flip()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment