I am trying to make a RPG game, and I would like to display the map on the glasses. Is there an easy way of doing this? I already made the file that a computer would post it on the monitor with, but I do not know how to port that over to Terminal Glasses.
Printing an image to OpenPeripheral Glasses
Started by Selim, Jul 28 2014 11:38 PM
4 replies to this topic
#1
Posted 28 July 2014 - 11:38 PM
#2
Posted 29 July 2014 - 03:22 AM
Well there are many ways of doing this, but the easiest would probably be to just use glass.addBox(...) as a direct replacement for term.setCursorPos(...) term.write(" ") in your code.
For example, if you defined an area to be the map from xmin,ymin to xmax,ymax and had a table which defined x,y coordinates on the terminal and the colour to draw them, your code would look something like this:
you might want to do it slightly differently depending on how you already have the map formatted but that's the general idea
For example, if you defined an area to be the map from xmin,ymin to xmax,ymax and had a table which defined x,y coordinates on the terminal and the colour to draw them, your code would look something like this:
--# draw table in format {[1]={x=,y=,colour=},...}
width=xmax-xmin
height=ymax-ymin
box_width =
box_height =
for box_no, details in pairs(draw) do
glass.addBox(xmin+details.x*box_width,ymin+details.y*box_height,box_width,box_height,details.colour,0.5)
end
you might want to do it slightly differently depending on how you already have the map formatted but that's the general idea
#3
Posted 29 July 2014 - 08:34 PM
Do you know of a good way of converting the map to a format that would be easy to work with? This is how the map is now: http://pastebin.com/45Cu19mQ
#4
Posted 29 July 2014 - 09:04 PM
That's a pretty good format, assuming every letter is a pixel.
Have a look at the fs and string API, and if you don't already have, learn about tables.
EDIT: Typo
Have a look at the fs and string API, and if you don't already have, learn about tables.
EDIT: Typo
Edited by flaghacker, 29 July 2014 - 09:05 PM.
#5
Posted 30 July 2014 - 06:31 AM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











