Пример #1
0
    def drawInterface(self):  #界面初始化

        bmp1 = ubitmap.BitmapFromFile("pic/boy")

        bmp2 = ubitmap.BitmapFromFile("pic/girl")
        bmp1.draw(20, 200)  #显示boy图片
        bmp2.draw(140, 200)  #显示girl图片
        screen.drawline(0, 160, 240, 160, 2, 0xff0000)
Пример #2
0
 def sub_cb(self, topic, message):  #从服务器接受信息
     message = message.decode()
     print("服务器发来信息:%s" % message)
     #global count
     if message == "001":  #收到boy表情号码显示boy表情
         bmp1 = ubitmap.BitmapFromFile("pic/boy")
         bmp1.draw(140, 40)
     elif message == "002":  #收到girl表情号码显示girl表情
         bmp1 = ubitmap.BitmapFromFile("pic/girl")
         bmp1.draw(140, 40)
Пример #3
0
    def keyboardEvent(self, key):
        if self.keymatch[key] == "Key1":  #右移键,选择要发送的表情
            if self.select % 2 == 1:  #用红色框选中boy表情
                screen.drawline(20, 200, 92, 200, 2, 0xffffff)
                screen.drawline(92, 200, 92, 272, 2, 0xffffff)
                screen.drawline(92, 272, 20, 272, 2, 0xffffff)
                screen.drawline(20, 272, 20, 200, 2, 0xffffff)
                screen.drawline(140, 200, 212, 200, 2, 0xff0000)
                screen.drawline(212, 200, 212, 272, 2, 0xff0000)
                screen.drawline(212, 272, 140, 272, 2, 0xff0000)
                screen.drawline(140, 272, 140, 200, 2, 0xff0000)
                self.select += 1
            else:  #用红色框选中girl表情
                screen.drawline(140, 200, 212, 200, 2, 0xffffff)
                screen.drawline(212, 200, 212, 272, 2, 0xffffff)
                screen.drawline(212, 272, 140, 272, 2, 0xffffff)
                screen.drawline(140, 272, 140, 200, 2, 0xffffff)
                screen.drawline(20, 200, 92, 200, 2, 0xff0000)
                screen.drawline(92, 200, 92, 272, 2, 0xff0000)
                screen.drawline(92, 272, 20, 272, 2, 0xff0000)
                screen.drawline(20, 272, 20, 200, 2, 0xff0000)
                self.select += 1
        if self.keymatch[key] == "Key3":  #发送表情按键
            if self.select % 2 == 1:  #显示已发送boy表情
                bmp1 = ubitmap.BitmapFromFile("pic/boy")

                bmp1.draw(140, 40)

                self.content = "001"

                self.client.publish(self.TOPIC2, self.content)  #给服务器发送boy表情的号码

            else:  #显示已发送girl表情

                bmp2 = ubitmap.BitmapFromFile("pic/girl")

                bmp2.draw(140, 40)

                self.content = "002"
                self.client.publish(self.TOPIC2,
                                    self.content)  #给服务器发送girl表情的号码
Пример #4
0
import ubitmap

wall = ubitmap.BitmapFromFile('L003_WALL_16X6')
while i:
    J = 0
    while J:
        wall.draw(i, J)
        J += 1
        if J > 7:
            J = 0
    i += 1
    if i > 9:
        i = 0
Пример #5
0
        a = map_list[y][x]
        if a != 3:
            game_state = 1
    return game_state


s1 = Pin(36, Pin.IN, Pin.PULL_UP)
s2 = Pin(39, Pin.IN, Pin.PULL_UP)
s3 = Pin(34, Pin.IN, Pin.PULL_UP)
s4 = Pin(35, Pin.IN, Pin.PULL_UP)
key_list = [s1, s2, s3, s4]
key_state = [0, 0, 0, 0]
key_last_value = [1, 1, 1, 1]
screen.clear()
utime.sleep_ms(1000)
qiang = ubitmap.BitmapFromFile('L003_WALL_30X30')
white = ubitmap.BitmapFromFile('L003_white_30X30')
boy = ubitmap.BitmapFromFile('L003_BOY_30X30')
box = ubitmap.BitmapFromFile('L003_BOX_30X30')
star = ubitmap.BitmapFromFile('L003_STAR_30X30')
map_draw = [white, qiang, star, box, boy]
l0 = [0, 0, 1, 1, 1, 1, 0, 0]
l1 = [0, 0, 1, 2, 2, 1, 0, 0]
l2 = [0, 1, 1, 0, 2, 1, 1, 0]
l3 = [0, 1, 0, 0, 3, 2, 1, 0]
l4 = [1, 1, 0, 3, 0, 0, 1, 1]
l5 = [1, 0, 0, 1, 3, 3, 0, 1]
l6 = [1, 0, 4, 0, 0, 0, 0, 1]
l7 = [1, 1, 1, 1, 1, 1, 1, 1]
map_list = [l0, l1, l2, l3, l4, l5, l6, l7]
target_list = []
Пример #6
0
password_len = len(PASSWORD)
password_posX = 70
password_posY_array = []

password_input_array = []

key_last_state = []
#PADS, KEYS
key_new_state = []

password_show = False
flag_error = False

pic_tab = {
    'menu_S1_1': ubitmap.BitmapFromFile("lock_pic/menu_S1_1"),
    'menu_S1_2': ubitmap.BitmapFromFile("lock_pic/menu_S1_2"),
    'menu_S2': ubitmap.BitmapFromFile("lock_pic/menu_S2"),
    'menu_S4': ubitmap.BitmapFromFile("lock_pic/menu_S4"),
    'tip': ubitmap.BitmapFromFile("lock_pic/tip"),
    'tip_success': ubitmap.BitmapFromFile("lock_pic/tip_success"),
    'tip_failed': ubitmap.BitmapFromFile("lock_pic/tip_failed"),
    'tip_delay': ubitmap.BitmapFromFile("lock_pic/tip_delay"),
    'password': {
        'blank':
        ubitmap.BitmapFromFile("lock_pic/password/blank"),
        'mask':
        ubitmap.BitmapFromFile("lock_pic/password/mask"),
        'nums': [
            ubitmap.BitmapFromFile("lock_pic/password/num_0"),
            ubitmap.BitmapFromFile("lock_pic/password/num_1"),