Skip to content

Commit

Permalink
[CREATE] Created project.
Browse files Browse the repository at this point in the history
[FEATURE] Initialized pygame.
[FEATURE] Implemented helper functions for Pygame abstraction.
  • Loading branch information
nickname2002 committed May 28, 2023
0 parents commit ebb0bf1
Show file tree
Hide file tree
Showing 13 changed files with 237 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/jorcademy-template.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
pygame = "*"

[dev-packages]

[requires]
python_version = "3.11"
python_full_version = "3.11.3"
96 changes: 96 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added assets/jc_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/jorcademy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions engine.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import pygame
import game
import jorcademy as jc

# Init user setup
game.setup()

# pygame setup
pygame.init()
screen = pygame.display.set_mode(jc.screen_size)
clock = pygame.time.Clock()
running = True

# Set app icon
pygame_icon = pygame.image.load('assets/jorcademy.png')
pygame.display.set_icon(pygame_icon)

while running:
# poll for events
# pygame.QUIT event means the user clicked X to close your window
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False

# fill the screen with a color to wipe away anything from last frame
pygame.display.set_caption(jc.screen_title)
screen.fill(jc.background_color)

# Render game
game.draw()

# flip() the display to put your work on screen
pygame.display.flip()

clock.tick(60) # limits FPS to 60


pygame.quit()
11 changes: 11 additions & 0 deletions game.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from jorcademy import *


def setup() -> None:
screen(800, 600)
title("Best game ever")
backdrop(255, 255, 255)


def draw() -> None:
pass
44 changes: 44 additions & 0 deletions jorcademy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import pygame

# Game settings
screen_size = (100, 100)
screen_title = "JorCademy Engine"
background_color = (0, 0, 0)


# Change screen size
def screen(width: int, height: int) -> (int, int):
global screen_size
screen_size = (width, height)


# Change screen title
def title(t: str):
global screen_title
screen_title = t


# Change screen background color
def backdrop(r: int, g: int, b: int):
global background_color
background_color = (r, g, b)


# Draw a circle
def circle():
pass


# Draw a rectangle
def rect():
pass


# Draw a triangle
def triangle():
pass


# Draw a string of text
def text():
pass

0 comments on commit ebb0bf1

Please sign in to comment.