Initial Commit
This commit is contained in:
27
TESTING/Time.py
Normal file
27
TESTING/Time.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import pygame
|
||||
from icecream import ic
|
||||
from time import sleep
|
||||
|
||||
|
||||
CLOCK = pygame.time.Clock()
|
||||
|
||||
testOn = True
|
||||
timeStart = pygame.time.get_ticks()
|
||||
|
||||
while testOn: # Pretend game loop.
|
||||
if ic(pygame.time.get_ticks() - timeStart) >= 2000: # Once 2000 ms has elapsed.
|
||||
ic("Time has elapsed.")
|
||||
testOn = False
|
||||
|
||||
del testOn, timeStart
|
||||
|
||||
# ---------------------------------------------------------
|
||||
sleep(2)
|
||||
# ---------------------------------------------------------
|
||||
|
||||
timeStart = pygame.time.get_ticks()
|
||||
|
||||
while ic(pygame.time.get_ticks() - timeStart) < 2000:
|
||||
pass
|
||||
|
||||
ic("Time has elapsed.")
|
||||
21
TESTING/Xlib_utilization.py
Executable file
21
TESTING/Xlib_utilization.py
Executable file
@@ -0,0 +1,21 @@
|
||||
# Taken from Glyph, Eevee on https://stackoverflow.com/questions/1225057/how-can-i-determine-the-monitor-refresh-rate
|
||||
# Deconstruction, Commenting and Renaming by Cutieguwu.
|
||||
|
||||
from Xlib import display
|
||||
from Xlib.ext import randr
|
||||
|
||||
displayGlobal = display.Display() # Get every display thing. Maybe a WM object?
|
||||
default_screen = displayGlobal.get_default_screen() # Find default display for some reason.
|
||||
info = displayGlobal.screen(default_screen) # Use this as a point to get information about all screens.
|
||||
|
||||
displayConfigs = randr.get_screen_resources(info.root) # Get every screen's possible configurations.
|
||||
ConfigsActive = set() # Create an empty set to add configurations to.
|
||||
|
||||
for config in displayConfigs.crtcs: # For every display configuration, determine if it's active and add its identifier to the configurations in use.
|
||||
crtc_info = randr.get_crtc_info(info.root, config, displayConfigs.config_timestamp)
|
||||
if crtc_info.mode:
|
||||
ConfigsActive.add(crtc_info.mode)
|
||||
|
||||
for config in displayConfigs.modes:
|
||||
if config.id in ConfigsActive: # For every active display mode, figure out its framerate.
|
||||
print(config.dot_clock / (config.h_total * config.v_total))
|
||||
31
TESTING/clean python version
Normal file
31
TESTING/clean python version
Normal file
@@ -0,0 +1,31 @@
|
||||
from sys import version
|
||||
|
||||
versionStr = ""
|
||||
|
||||
for c in version:
|
||||
if c == " ":
|
||||
break
|
||||
else:
|
||||
versionStr = versionStr + c
|
||||
|
||||
versionTuple = tuple(versionStr.split("."))
|
||||
|
||||
print(versionTuple)
|
||||
|
||||
# GCC CLEANUP
|
||||
|
||||
versionStr = ""
|
||||
startFlag = False
|
||||
|
||||
for c in version:
|
||||
if startFlag:
|
||||
if c not in ["G", "C", "]"]:
|
||||
versionStr = versionStr + c
|
||||
elif c == "[":
|
||||
startFlag = True
|
||||
|
||||
print(versionStr)
|
||||
|
||||
versionTuple = tuple(versionStr.split())
|
||||
|
||||
print(versionTuple)
|
||||
15
TESTING/for loop debugging.py
Normal file
15
TESTING/for loop debugging.py
Normal file
@@ -0,0 +1,15 @@
|
||||
myList = ["A", "A", "A", "D"]
|
||||
|
||||
for i in myList:
|
||||
|
||||
if i == "A":
|
||||
myList.append("A")
|
||||
else:
|
||||
myList[2] = "C"
|
||||
|
||||
print(myList)
|
||||
|
||||
|
||||
for button in buttonList:
|
||||
if button.name in ["Start", "Back"]:
|
||||
button.remove()
|
||||
39
TESTING/refreshed spawned classes.py
Normal file
39
TESTING/refreshed spawned classes.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import pygame
|
||||
from os import path
|
||||
|
||||
class Guy():
|
||||
def __init__(self, mouseCoords):
|
||||
self.coords = mouseCoords
|
||||
self.image = pygame.image.load(path.dirname(__file__) + "/../data/image/ui/icons/settings_neutral.png")
|
||||
|
||||
def draw(self):
|
||||
"""
|
||||
Draws character.
|
||||
"""
|
||||
WINDOW.blit(self.image, (self.coords))
|
||||
|
||||
WINDOW = pygame.display.set_mode((720, 480))
|
||||
CLOCK = pygame.time.Clock()
|
||||
|
||||
gameOn = True
|
||||
guys = []
|
||||
|
||||
while gameOn:
|
||||
|
||||
CLOCK.tick(30)
|
||||
|
||||
WINDOW.fill((150, 150, 150))
|
||||
|
||||
for guy in guys:
|
||||
guy.draw()
|
||||
|
||||
pygame.display.flip()
|
||||
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
gameOn = False
|
||||
pygame.quit()
|
||||
elif event.type == pygame.MOUSEBUTTONDOWN:
|
||||
if 0 in pygame.mouse.get_pressed():
|
||||
# Left button pressed
|
||||
guys.append(Guy(pygame.mouse.get_pos()))
|
||||
Reference in New Issue
Block a user