Posted 19 March 2014 - 06:46 PM
Hello, I currently creating a window API and it feels that much of it got a little over my head :P/>
As the topic says I'm wondering how to redirect the term to write only in the window.
Here's an example of what a window looks like
I also have a function that restores the native functions so I can write normally.
Help is much appreciated :)/>
As the topic says I'm wondering how to redirect the term to write only in the window.
Here's an example of what a window looks like
local window = {
title = "Testing Window";
color = colors.white;
top_background=colors.cyan;
background = colors.white;
sX=1; fX=20; sY=1; fY=10;
resizable=true;
}
The function that initializes the window will calculate and get the window height & width. Then those numbers are inserted into the window so you can access them like this
-- window.w < Width of the window
-- window.h < Height of the window
Now I'm currently doing this when overriding term functions and are keeping this in a function called redirect in the APII also have a function that restores the native functions so I can write normally.
term.setCursorPos = function( x, y )
term.native.setCursorPos( (window.sX-1)+x, window.sY + x )
end
term.getSize = function()
return window.w, window.h
end
But's that's all I'm currently doing since I'm unsure which functions I should override and how I would do this efficiently.Help is much appreciated :)/>