Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local CUSTOM_FONTS = {
- [false] = { file = nil, height = 16, width = 8 }, -- this is lsnes default font
- snes9xlua = { file = [[data/snes9xlua.font]], height = 16, width = 10 },
- snes9xluaclever = { file = [[data/snes9xluaclever.font]], height = 16, width = 08 }, -- quite pixelated
- snes9xluasmall = { file = [[data/snes9xluasmall.font]], height = 09, width = 05 },
- snes9xtext = { file = [[data/snes9xtext.font]], height = 11, width = 08 },
- verysmall = { file = [[data/verysmall.font]], height = 08, width = 04 }, -- broken, unless for numerals
- }
- -- Verify whether the fonts exist
- for key, value in pairs(CUSTOM_FONTS) do
- if value.file and not io.open(value.file) then
- print("WARNING:", string.format("./%s is missing.", value.file))
- CUSTOM_FONTS[key] = nil
- end
- end
- -- Create a simple function for drawing fonts or the default text
- local draw_font = {}
- for font_name, value in pairs(CUSTOM_FONTS) do
- draw_font[font_name] = function(x, y, text, color, bg, halo)
- if font_name then
- gui.font.load(value.file)(x, y, text, color, bg, halo)
- else
- gui.text(x, y, text, color, bg, halo)
- end
- end
- end
- function on_paint()
- local f = "snes9xluaclever" -- possible: "snes9xtext" , "snes9xluaclever" , "snes9xluaclever" , "snes9xlua" , false
- draw_font[f](0, 00, "A")
- draw_font[f](0, 16, "B")
- draw_font[f](0, 32, "C")
- end
- gui.repaint()
Advertisement
Add Comment
Please, Sign In to add comment