Merge pull request #8 from cuu/master

replace round corner to png
This commit is contained in:
clockworkpi 2018-05-28 19:06:50 +08:00 committed by GitHub
commit 12b605e024
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 5 deletions

View File

@ -10,7 +10,7 @@ from util_funcs import FileExists,midRect
from icon_item import IconItem
from fonts import fonts
from multi_icon_item import MultiIconItem
from icon_pool import MyIconPool
from libs.roundrects import aa_round_rect
icon_base_path = "gameshell/footbar_icons/"
@ -41,7 +41,7 @@ class FootBarIcon(MultiIconItem):
(0,self._IconIndex*self._IconHeight,self._IconWidth,self._IconHeight))
class FootBar:
_PosX = 0
_PosY = Height-20
_PosY = 0
_Width = Width
_Height = 20
_BarHeight = 20.5
@ -87,6 +87,17 @@ class FootBar:
self.ReadFootBarIcons(icon_base_path)
round_corners = MultiIconItem()
round_corners._IconWidth = 10
round_corners._IconHeight = 10
round_corners._MyType = ICON_TYPES["STAT"]
round_corners._Parent = self
round_corners._ImgSurf = MyIconPool._Icons["roundcorners"]
round_corners.Adjust(0,0,10,10,0)
self._Icons["round_corners"] = round_corners
def ResetNavText(self):
self._Icons["nav"]._Label.SetText("Nav.")
self._State = "normal"
@ -128,11 +139,23 @@ class FootBar:
def ClearCanvas(self):
self._CanvasHWND.fill((0,0,0))
self._CanvasHWND.fill( self._BgColor )
self._Icons["round_corners"].NewCoord(5,self._Height -5 )
self._Icons["round_corners"]._IconIndex = 2
self._Icons["round_corners"].Draw()
self._Icons["round_corners"].NewCoord(self._Width-5,self._Height-5)
self._Icons["round_corners"]._IconIndex = 3
self._Icons["round_corners"].Draw()
"""
aa_round_rect(self._CanvasHWND,
(0,0,self._Width,self._Height),self._BgColor,8,0, self._BgColor)
pygame.draw.rect(self._CanvasHWND,self._BgColor,(0,0,Width,self._BarHeight/2), 0 )
"""
def Draw(self):
self.ClearCanvas()
@ -158,4 +181,4 @@ class FootBar:
pygame.draw.line(self._CanvasHWND,(169,169,169),(0,0),(Width,0),self._BorderWidth)
if self._HWND != None:
self._HWND.blit(self._CanvasHWND,(self._PosX,self._PosY,Width,self._BarHeight))
self._HWND.blit(self._CanvasHWND,(self._PosX,Height - self._Height,Width,self._BarHeight))

View File

@ -15,6 +15,7 @@ from constants import ICON_TYPES,Width,Height
from fonts import fonts
from icon_item import IconItem
from multi_icon_item import MultiIconItem
from icon_pool import MyIconPool
from util_funcs import midRect,SwapAndShow
@ -228,17 +229,41 @@ class TitleBar:
self._Icons["soundvolume"] = sound_volume
self.SyncSoundVolume()
round_corners = MultiIconItem()
round_corners._IconWidth = 10
round_corners._IconHeight = 10
round_corners._MyType = ICON_TYPES["STAT"]
round_corners._Parent = self
round_corners._ImgSurf = MyIconPool._Icons["roundcorners"]
round_corners.Adjust(0,0,10,10,0)
self._Icons["round_corners"] = round_corners
if is_wifi_connected_now():
print("wifi is connected")
print( wifi_strength())
def ClearCanvas(self):
self._CanvasHWND.fill((0,0,0))
self._CanvasHWND.fill( self._BgColor )
self._Icons["round_corners"].NewCoord(5,5)
self._Icons["round_corners"]._IconIndex = 0
self._Icons["round_corners"].Draw()
self._Icons["round_corners"].NewCoord(self._Width-5,5)
self._Icons["round_corners"]._IconIndex = 1
self._Icons["round_corners"].Draw()
"""
aa_round_rect(self._CanvasHWND,
(0,0,self._Width,self._Height),self._BgColor,8,0, self._BgColor)
pygame.draw.rect(self._CanvasHWND,self._BgColor,(0,self._Height/2,Width,self._BarHeight), 0 )
"""
def Draw(self,title):
self.ClearCanvas()

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B