screen.lua (088b4f5f323e73e5eb54b0e409b064ff5d46d221) | screen.lua (901d96e3fb0056b346db5fc0a54a756d7015f206) |
---|---|
1-- 2-- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org> 3-- All rights reserved. 4-- 5-- Redistribution and use in source and binary forms, with or without 6-- modification, are permitted provided that the following conditions 7-- are met: 8-- 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26-- $FreeBSD$ 27-- 28 29local screen = {}; 30 31local color = require("color"); 32local core = require("core"); 33 | 1-- 2-- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org> 3-- All rights reserved. 4-- 5-- Redistribution and use in source and binary forms, with or without 6-- modification, are permitted provided that the following conditions 7-- are met: 8-- 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26-- $FreeBSD$ 27-- 28 29local screen = {}; 30 31local color = require("color"); 32local core = require("core"); 33 |
34-- XXX TODO: This should be fixed in the interpreter to not print decimals 35function intstring(num) 36 local str = tostring(num) 37 local decimal = string.find(str, "[.]") 38 39 if decimal then 40 return string.sub(str, 1, decimal - 1) 41 end 42 return str 43end 44 |
|
34function screen.clear() 35 if core.bootserial() then 36 return; 37 end 38 loader.printc("\027[H\027[J"); 39end 40 41function screen.setcursor(x, y) 42 if core.bootserial() then 43 return; 44 end | 45function screen.clear() 46 if core.bootserial() then 47 return; 48 end 49 loader.printc("\027[H\027[J"); 50end 51 52function screen.setcursor(x, y) 53 if core.bootserial() then 54 return; 55 end |
45 loader.printc("\027["..y..";"..x.."H"); | 56 57 loader.printc("\027["..intstring(y)..";"..intstring(x).."H"); |
46end 47 48function screen.setforeground(c) 49 if color.disabled then 50 return c; 51 end 52 loader.printc("\027[3"..c.."m"); 53end --- 20 unchanged lines hidden --- | 58end 59 60function screen.setforeground(c) 61 if color.disabled then 62 return c; 63 end 64 loader.printc("\027[3"..c.."m"); 65end --- 20 unchanged lines hidden --- |