-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
[FEATURE] Initialized pygame. [FEATURE] Implemented helper functions for Pygame abstraction.
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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() |
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 |
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 |