mirror of
https://github.com/Astatin3/autoPlanner.git
synced 2026-06-08 23:58:00 -06:00
Add time indicator
This commit is contained in:
+43
-5
@@ -6,6 +6,8 @@ render = None
|
|||||||
pathEditor = None
|
pathEditor = None
|
||||||
bottomBarRect = None
|
bottomBarRect = None
|
||||||
|
|
||||||
|
# leftSide = True
|
||||||
|
|
||||||
ogNodes = []
|
ogNodes = []
|
||||||
ogCtrlNodes = []
|
ogCtrlNodes = []
|
||||||
ogRotNodes = []
|
ogRotNodes = []
|
||||||
@@ -13,7 +15,9 @@ ogRotNodes = []
|
|||||||
keyFrames = []
|
keyFrames = []
|
||||||
|
|
||||||
matchLength = 15
|
matchLength = 15
|
||||||
matchTicks = 15 * 50
|
TPS = 50
|
||||||
|
|
||||||
|
matchTicks = matchLength * TPS
|
||||||
displayTickResolution = 4
|
displayTickResolution = 4
|
||||||
displayTicks = round(matchTicks / displayTickResolution)
|
displayTicks = round(matchTicks / displayTickResolution)
|
||||||
|
|
||||||
@@ -390,6 +394,29 @@ def controllerClick(pos):
|
|||||||
if render.isInRect(pos, offsetControllerButton(btn)):
|
if render.isInRect(pos, offsetControllerButton(btn)):
|
||||||
toggleControllerButton(btn, i)
|
toggleControllerButton(btn, i)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def renderTimeText():
|
||||||
|
if selFrame == -1:
|
||||||
|
return
|
||||||
|
seconds = round((((selFrame*displayTickResolution)+1)/matchTicks)*matchLength,2)
|
||||||
|
text = f'{str(seconds)} s / {str(matchLength)}.0 s'
|
||||||
|
|
||||||
|
text = render.font.render(text, True, (255,255,255))
|
||||||
|
|
||||||
|
# global leftSide
|
||||||
|
|
||||||
|
# if leftSide:
|
||||||
|
# rect = text.get_rect(bottomright=(render.width,render.height+render.topBarHeight))
|
||||||
|
# else:
|
||||||
|
rect = text.get_rect(bottomleft=(0,render.height+render.topBarHeight))
|
||||||
|
|
||||||
|
render.screen.blit(text, rect)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class buttonEditor:
|
class buttonEditor:
|
||||||
name = "Button Editor"
|
name = "Button Editor"
|
||||||
|
|
||||||
@@ -470,6 +497,7 @@ class buttonEditor:
|
|||||||
else:
|
else:
|
||||||
renderXboxControllers()
|
renderXboxControllers()
|
||||||
|
|
||||||
|
renderTimeText()
|
||||||
|
|
||||||
reloadBar((0,0))
|
reloadBar((0,0))
|
||||||
render.update()
|
render.update()
|
||||||
@@ -500,15 +528,25 @@ class buttonEditor:
|
|||||||
global dragFrameIndex
|
global dragFrameIndex
|
||||||
if dragFrameIndex != -1 or pos[1] > bottomBarRect[1]:
|
if dragFrameIndex != -1 or pos[1] > bottomBarRect[1]:
|
||||||
reloadBar(pos)
|
reloadBar(pos)
|
||||||
|
|
||||||
|
# global leftSide
|
||||||
|
|
||||||
|
# if leftSide and pos[0] > (render.width/2):
|
||||||
|
# leftSide = False
|
||||||
|
# self.refresh()
|
||||||
|
# if not leftSide and pos[0] < (render.width/2):
|
||||||
|
# leftSide = True
|
||||||
|
# self.refresh()
|
||||||
|
|
||||||
# if pos[1] > bottomBarRect[1]:
|
# if pos[1] > bottomBarRect[1]:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def doubleClick(self, pos):
|
def doubleClick(self, pos):
|
||||||
if pos[1] > bottomBarRect[1]:
|
pass
|
||||||
clickBar(pos)
|
# if pos[1] > bottomBarRect[1]:
|
||||||
self.refresh()
|
# clickBar(pos)
|
||||||
|
# self.refresh()
|
||||||
|
|
||||||
|
|
||||||
def keyDown(self, key):
|
def keyDown(self, key):
|
||||||
|
|||||||
@@ -67,6 +67,17 @@ class render():
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# def drawText(self, text, color,):
|
||||||
|
|
||||||
|
# text = self.font.render(text, True, color)
|
||||||
|
|
||||||
|
# rect = text.get_rect()
|
||||||
|
|
||||||
|
# self.screen.blit(text, rect)
|
||||||
|
# # text_rect = text.get_rect(center=(rect[0]+(rect[2]/2), rect[1]+(rect[3]/2)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def isInRect(self, pos, rect):
|
def isInRect(self, pos, rect):
|
||||||
return pos[0] >= rect[0] and \
|
return pos[0] >= rect[0] and \
|
||||||
pos[0] <= rect[0]+rect[2] and \
|
pos[0] <= rect[0]+rect[2] and \
|
||||||
|
|||||||
Reference in New Issue
Block a user