-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
75 lines (73 loc) · 2.33 KB
/
main.py
File metadata and controls
75 lines (73 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import pygame
from Main.game import Game
from Main.sound_manager import SoundManager
pygame.mixer.pre_init(44100, -16, 8, 1024)
pygame.mixer.init()
pygame.init()
sound_manager = SoundManager()
game = Game()
game.run()
pygame.quit()
#
# import pygame
#
# pygame.init()
#
#
# class TextBox(pygame.sprite.Sprite):
# validChars = "`1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./"
# shiftChars = '~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?'
#
# def __init__(self):
# pygame.sprite.Sprite.__init__(self)
# self.text = ""
# self.font = pygame.font.Font(None, 50)
# self.image = self.font.render("Enter your name", False, [255, 255, 255])
# self.rect = self.image.get_rect()
#
# def add_chr(self, char):
# global shiftDown
# if char in self.validChars and not shiftDown:
# self.text += char
# elif char in self.validChars and shiftDown:
# self.text += self.shiftChars[self.validChars.index(char)]
# self.update()
#
# def update(self):
# old_rect_pos = self.rect.center
# self.image = self.font.render(self.text, False, [255, 255, 255])
# self.rect = self.image.get_rect()
# self.rect.center = old_rect_pos
#
#
# screen = pygame.display.set_mode([640, 480])
# textBox = TextBox()
# shiftDown = False
# textBox.rect.center = [320, 240]
#
# running = True
# while running:
# screen.fill([255, 255, 255])
# screen.blit(textBox.image, textBox.rect)
# pygame.display.flip()
# for e in pygame.event.get():
# if e.type == pygame.QUIT:
# running = False
# if e.type == pygame.KEYUP:
# if e.key in [pygame.K_RSHIFT, pygame.K_LSHIFT]:
# shiftDown = False
# if e.type == pygame.KEYDOWN:
# textBox.add_chr(pygame.key.name(e.key))
# if e.key == pygame.K_SPACE:
# textBox.text += " "
# textBox.update()
# if e.key in [pygame.K_RSHIFT, pygame.K_LSHIFT]:
# shiftDown = True
# if e.key == pygame.K_BACKSPACE:
# textBox.text = textBox.text[:-1]
# textBox.update()
# if e.key == pygame.K_RETURN:
# if len(textBox.text) > 0:
# print(textBox.text)
# running = False
# pygame.quit()