local MainScene = class("MainScene", cc.load("mvc").ViewBase) function MainScene:onCreate() --使用系统字体 self.lab = cc.Label:createWithSystemFont("Hello World", "Arial", 40) :move(display.cx, display.cy + 200) :addTo(self) --使用资源字体 self.lab2 = cc.Label:createWithTTF("你是","font/msyhn_boot.ttf",36) :move(display.cx,display.cy + 100) :addTo(self) local config = {} config.fontFilePath = "font/msyhn_boot.ttf" config.fontSize = 50 self.lab3 = cc.Label:createWithTTF(config,"HeiHei") :move(display.cx,display.cy) :addTo(self) --使用位图字体 fnt-png self.lab4 = cc.Label:createWithBMFont("font/number0-9.fnt","2019") :move(display.cx,display.cy - 100) :addTo(self) self.lab4:setString("2020") end return MainScene