This repository has been archived by the owner on Jan 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
pipboy_tab_items.py
68 lines (52 loc) · 2.07 KB
/
pipboy_tab_items.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
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
# RasPipBoy: A Pip-Boy 3000 implementation for Raspberry Pi
# Neal D Corbett, 2013
# Class for 'Items' tab
import pygame
import config
import pipboy_headFoot as headFoot
class Tab_Items:
name = "ITEMS"
modeNames = ["Weapons","Apparel","Aid","Misc","Ammo"]
class Mode_Items:
changed = True
def __init__(self, *args, **kwargs):
self.parent = args[0]
self.rootParent = self.parent.rootParent
self.pageCanvas = pygame.Surface((config.WIDTH, config.HEIGHT))
def drawPage(self):
pageChanged = self.changed
self.changed = False
if(pageChanged):
True
return self.pageCanvas, pageChanged
# Called every view changes to this page:
def resetPage(self):
True
# Consume events passed to this page:
def ctrlEvents(self,events):
True
# Generate text for header:
def getHeaderText(self):
return [self.name, "Wg 180/200", "HP 210/210", "DT 19.0", "Caps 3014",]
# Trigger page-functions
def drawPage(self,modeNum):
pageCanvas, pageChanged = self.modes[modeNum].drawPage()
return pageCanvas, pageChanged
def resetPage(self,modeNum):
self.modes[modeNum].resetPage()
def ctrlEvents(self,pageEvents,modeNum):
self.modes[modeNum].ctrlEvents(pageEvents)
# Tab init:
def __init__(self, *args, **kwargs):
self.parent = args[0]
self.rootParent = self.parent.rootParent
self.canvas = pygame.Surface((config.WIDTH, config.HEIGHT))
self.drawnPageNum = -1
# Item-pages all use the same class instance:
self.itemPage = self.Mode_Items(self)
self.modes = [self.itemPage,self.itemPage,self.itemPage,self.itemPage,self.itemPage]
for n in range(0,5):
self.modes[n].pageNum = n
self.header = headFoot.Header(self)
# Generate footers for mode-pages:
self.footerImgs = headFoot.genFooterImgs(self.modeNames)