This commit is contained in:
cuu 2019-01-17 22:18:33 +08:00
parent f33e6080b9
commit 12c923df8a
3 changed files with 23 additions and 17 deletions

View File

@ -2,7 +2,7 @@
"GameDir":"/home/cpi/games/PICO-8/", "GameDir":"/home/cpi/games/PICO-8/",
"InstallDir":"pico-8", "InstallDir":"pico-8",
"NotFoundMsg":["Please purchase the PICO-8 \n|None|varela16", "NotFoundMsg":["Please purchase the PICO-8 \n|None|varela16",
"and copy it to the \"Games\" folder|None|varela16"], "and copy it to the \"~/games/PICO-8\"|None|varela16"],
"MD5":{"pico-8_0.1.11g_raspi.zip":"a3f2995cf117499f880bd964d6a0e1f2","pico-8_0.1.11g_amd64.zip":"6726141c784afd4a41be6b7414c1b932"}, "MD5":{"pico-8_0.1.11g_raspi.zip":"a3f2995cf117499f880bd964d6a0e1f2","pico-8_0.1.11g_amd64.zip":"6726141c784afd4a41be6b7414c1b932"},
"Post-Up":"bash Post-Up.sh" "Post-Up":"bash Post-Up.sh"

View File

@ -61,7 +61,7 @@ class NotFoundPage(Page):
self._Board._PosX = 4 self._Board._PosX = 4
self._Board._PosY = 100 self._Board._PosY = 100
self._Board._Width= self._Width - 4*2 self._Board._Width= self._Width - 4*2
self._Board._Height = 100 self._Board._Height = 200
self._Board._CanvasHWND = self._CanvasHWND self._Board._CanvasHWND = self._CanvasHWND
self._Board._Align = "Center" self._Board._Align = "Center"
self._Board._RowPitch =28 self._Board._RowPitch =28

View File

@ -112,7 +112,8 @@ class Textbulletinboard(Textarea):
_TextLimit = 200 _TextLimit = 200
_BackgroundColor = MySkinManager.GiveColor("White") _BackgroundColor = MySkinManager.GiveColor("White")
_Align = "Left" ## Left or Center _Align = "Left" ## Left or Center
_RowPitch = -1 _RowPitch = -1 ## for \n
_BreakPitch = -1 ## for linebreak line wrapp
def SetAndBlitText(self,words):# words => [] def SetAndBlitText(self,words):# words => []
@ -150,12 +151,6 @@ class Textbulletinboard(Textarea):
if i == self._TextIndex - 1: if i == self._TextIndex - 1:
cursor_row = linenumber cursor_row = linenumber
if w + t_width >= self._Width-endmargin:
x = self._PosX+xmargin
w = 0
linenumber += 1
blit_rows.append([])
self._BlitWords = blit_rows self._BlitWords = blit_rows
self._BlitIndex = self._TextIndex self._BlitIndex = self._TextIndex
@ -183,33 +178,44 @@ class Textbulletinboard(Textarea):
continue continue
else: else:
total_row_width = 0 total_row_width = 0
for i,v in enumerate(row): for i,v in enumerate(row):
t = v.Render() t = v.Render()
total_row_width += t.get_width() total_row_width += t.get_width()
if total_row_width > self._Width-endmargin: if total_row_width > self._Width-endmargin:
total_row_width = self._Width
start_x = self._PosX + xmargin start_x = self._PosX + xmargin
break
else: else:
if self._Align == "Center": if self._Align == "Center":
start_x = (self._Width - total_row_width)/2 start_x = (self._Width - total_row_width)/2
last_height = 0 last_height = 0
total_row_width = 0 row_width = 0
x = start_x x = start_x
y = y + last_height y = y + last_height
for i,v in enumerate(row): for i,v in enumerate(row):
t = v.Render() t = v.Render()
total_row_width += t.get_width() row_width += t.get_width()
if last_height < v.FnHeight(): if last_height < v.FnHeight():
last_height = v.FnHeight() last_height = v.FnHeight()
if total_row_width > self._Width-endmargin: if row_width >= self._Width-endmargin:
x = start_x x = start_x
y = y + last_height
total_row_width = 0 if self._Align == "Center":
whatisleft = total_row_width - row_width
if whatisleft >= self._Width-endmargin:
x = start_x
else:
x = (self._Width-whatisleft)/2-endmargin
if self._BreakPitch > 0:
y = y + self._BreakPitch
else:
y = y + last_height
row_width = 0
self._CanvasHWND.blit(t, (x,y)) self._CanvasHWND.blit(t, (x,y))
x += t.get_width() x += t.get_width()