Initial commit: Bcut-style Taiko Editor
This commit is contained in:
64
test_ui_mock.py
Normal file
64
test_ui_mock.py
Normal file
@@ -0,0 +1,64 @@
|
||||
import pygame
|
||||
import sys
|
||||
from ui import UI
|
||||
from editor_core import EditorState
|
||||
|
||||
class MockEditorState(EditorState):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
# Initialize with dummy data
|
||||
self.current_course_name = 'Oni'
|
||||
self.tja = type('obj', (object,), {
|
||||
'headers': {'BPM': 120, 'OFFSET': 0, 'TITLE': 'Test Song'},
|
||||
'courses': {}
|
||||
})
|
||||
self.tja.courses['Oni'] = type('obj', (object,), {
|
||||
'level': 10,
|
||||
'balloon': [],
|
||||
'score_init': 0,
|
||||
'score_diff': 0,
|
||||
'notes': []
|
||||
})
|
||||
|
||||
def get_current_course(self):
|
||||
return self.tja.courses['Oni']
|
||||
|
||||
def save(self):
|
||||
print("Mock Save Triggered")
|
||||
|
||||
def main():
|
||||
pygame.init()
|
||||
SCREEN_WIDTH = 1200
|
||||
SCREEN_HEIGHT = 800
|
||||
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
|
||||
pygame.display.set_caption("Taiko Editor UI Test (Mock)")
|
||||
|
||||
editor = MockEditorState()
|
||||
ui = UI(editor, SCREEN_WIDTH, SCREEN_HEIGHT)
|
||||
|
||||
clock = pygame.time.Clock()
|
||||
running = True
|
||||
|
||||
while running:
|
||||
dt = clock.tick(60)
|
||||
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
running = False
|
||||
|
||||
# Pass event to UI
|
||||
ui.handle_event(event)
|
||||
|
||||
ui.draw(screen)
|
||||
|
||||
# Draw debug cursor
|
||||
mx, my = pygame.mouse.get_pos()
|
||||
pygame.draw.circle(screen, (0, 255, 0), (mx, my), 3)
|
||||
|
||||
pygame.display.flip()
|
||||
|
||||
pygame.quit()
|
||||
sys.exit()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user