Closed lualiliu closed 6 years ago
You messed up the code, You shuld draw on screen between Screen.refresh and Screen.waitVblankStart calls.
my_font = Font.load("/arial.ttf") Font.setPixelSizes(my_font,18)
-- Main Loop while true do
-- Updating screens
Screen.refresh()
-- Writing something on screen
--Screen.debugPrint(0,0,"Hello World",Color.new(255,255,255),TOP_SCREEN)
Font.print(my_font, 5, 5, "Hello World!", Color.new(255,255,255), TOP_SCREEN)
Screen.waitVblankStart()
Screen.flip()
end
always black screen...I don't think I understand.What's wrong?
Looks fine to me, swap positions for waitVblankStart and flip calls and try to add a Screen.clear(TOP_SCREEN) after Screen.refresh.
my_font = Font.load("/font.ttf") Font.setPixelSizes(my_font,18)
-- Main Loop while true do
-- Updating screens
--Screen.waitVblankStart()
Screen.refresh()
Screen.clear(TOP_SCREEN)
-- Writing something on screen
Screen.debugPrint(0,0,"Hello World",Color.new(255,255,255),TOP_SCREEN)
Font.print(my_font, 5, 5, "Hello World!", Color.new(255,255,255), TOP_SCREEN)
-- Flipping screen
Screen.flip()
Screen.waitVblankStart()
end
I tried many times in different codes.It still forces the exit. I'm using lpp-3ds_R5 and my 3ds a9lh. The text editor I'm using is sublime text
sorry ,I found the tff file should put in sdmc...Is not romfs
while true do -- Draw something on screen Screen.refresh() Screen.waitVblankStart() Screen.flip() my_font = Font.load("/font.tff"); Font.setPixelSizes(my_font,18); -- Writing something on screen Font.print(my_font, 5, 5, "hello world", Color.new(255,255,255), TOP_SCREEN) -- Sets up HomeMenu syscall if Controls.check(Controls.read(),KEY_HOME) or Controls.check(Controls.read(),KEY_POWER) then System.showHomeMenu() end -- Exit if HomeMenu calls APP_EXITING if System.checkStatus() == APP_EXITING then System.exit() end end
This is about ttf script ,and my 3ds forced exit,just like the Font.print doesn't work.