Skip to content

Commit

Permalink
add constants for some Puyo Puyo Tetris graphics data
Browse files Browse the repository at this point in the history
  • Loading branch information
rystills committed Mar 1, 2019
1 parent b63b488 commit 23f069b
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 10 deletions.
11 changes: 11 additions & 0 deletions PPT graphics.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
resolution: 1920x1080

active block size: 36,36
preview block size (next): 28,28
preview block size (after next): 22,22

grid topleft (excluding partially obstructed topmost row): 308,160
grid bottomright: 632, 844

numRows (excluding partially obstructed topmost row): 20
numCols: 10
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# T-Spin-Tutor
Aids players in setting up T-Spins in Puyo Puyo Tetris
Requirements:
-PyAutoGUI for analyzing the screen
-Tkinter for rendering the overlay
# T-Spin-Tutor
Aids players in setting up T-Spins in Puyo Puyo Tetris
Requirements:
-Python 3.x
-PyAutoGUI for analyzing the screen
-Tkinter for rendering the overlay (this should already be installed if you are using a typical Python install)
37 changes: 32 additions & 5 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,25 @@
import pyautogui
import time
import threading
import random

#constants
sw = 1920
sh = 1080
bSize = 36
bSizePrev = 28
bSizePrevFuture = 22
gridLeft = 308
gridRight = 632
gridTop = 160
gridBot = 844
numRows = 20
numCols = 10

class TkApp(threading.Thread):
def __init__(self):
#init canvas to None so we can safely avoid a data race
self.canvas = None
threading.Thread.__init__(self)
self.start()

Expand All @@ -18,16 +34,27 @@ def run(self):
self.root.wm_attributes("-topmost", 1)
self.root.wm_attributes('-alpha', .1)
self.root.overrideredirect(1)
self.root.geometry('1920x1080+0+0')
self.root.geometry('{0}x{1}+0+0'.format(sw,sh))

self.canvas = tk.Canvas(self.root, width=sw, height=sh)
self.canvas.pack()

self.root.mainloop()

def main():
#initialize an always on top, semitransparent window with no decorations, that covers the entire screen
#initialize an always on top, semitransparent TK window with no decorations, that covers the entire screen
app = TkApp()
#test screenshot abilities
time.sleep(4)
sc = pyautogui.screenshot()
print(sc.getpixel((760,223)))
while (True):
#stall until the tk app is initialized
if (app.canvas == None):
continue
sc = pyautogui.screenshot()
sc.getpixel((760,223))
app.canvas.delete("all")
x = gridLeft + bSize*random.randint(0,numCols-1)
y = gridTop + bSize*random.randint(0,numRows-1)
app.canvas.create_rectangle(x, y, x+bSize, y+bSize, fill='purple')

if __name__ == "__main__":
main()

0 comments on commit 23f069b

Please sign in to comment.