-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_ScrollingFrame.py
42 lines (30 loc) · 1007 Bytes
/
test_ScrollingFrame.py
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
import pygame
from pyoneer3.graphics import Screen, Scene, Text, ScrollingFrame, UIElement
pygame.init()
def render():
screen.render((0, 0, 0))
pygame.display.flip()
s = pygame.display.set_mode((100, 100))
screen = Screen(s)
s0 = Scene(screen, active=True)
sf = ScrollingFrame((0, 0, 0, 0), (100, 200), (0, 100, 0, 100))
sf.set_parent(s0)
sf.update()
background = UIElement((0, 0, 0, 0), pygame.Surface((100, 200), pygame.SRCALPHA))
background.set_parent(sf)
background.surf.fill((255, 0, 0, 100))
background.update()
t = Text((0, 0, 0, 0), (100, 10), "Top", (255, 255, 255), pygame.font.Font(None, 20), True, (0, 0, 0))
t.set_parent(background)
t.update()
t1 = Text((0, 0, 1, -10), (100, 10), "Bottom", (255, 255, 255), pygame.font.Font(None, 20), True, (0, 0, 0))
t1.set_parent(background)
t1.update()
running = True
while running:
for e in pygame.event.get():
if e.type == pygame.QUIT:
running = False
else:
sf.handle_event(e)
render()