-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce0b49b
commit 8a4f605
Showing
5 changed files
with
80 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
def main(): | ||
import pygame | ||
from pygame.constants import QUIT, K_ESCAPE, KEYDOWN | ||
|
||
from asyncpygame import Timer | ||
|
||
timer = Timer() | ||
timer.schedule_interval(print, 3000) | ||
|
||
screen = pygame.display.set_mode((600, 500)) | ||
clock = pygame.Clock() | ||
pygame.display.set_caption("Trying out the Timer") | ||
|
||
|
||
pygame_event_get = pygame.event.get | ||
clock_tick = clock.tick | ||
running = True | ||
while running: | ||
for event in pygame_event_get(): | ||
event_type = event.type | ||
if event_type == QUIT: | ||
running = False | ||
elif event_type == KEYDOWN and event.key == K_ESCAPE: | ||
running = False | ||
|
||
dt = clock_tick(10) | ||
timer.progress(dt) | ||
|
||
pygame.quit() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters