Omnimaga
Calculator Community => Other Calc-Related Projects and Ideas => TI-Nspire => Topic started by: hoffa on August 17, 2011, 08:10:29 am
-
Hello,
I started a small project of writing in Lua a GUI library for the TI-Nspire. At the moment there's not much; the windows are clickable and the general floating windows thing works.
As everybody loves screenshots, I give you a screenshot:
(http://webgel.net/bf/5/hyena.png)
Also here's a very early video with some content in one of the windows. I can move windows around and close them also (forgot to show that, but it works).
I'm not even sure if it will actually be that useful when I eventually manage to make something usable, but we'll see about that later.
Well that's about it for the moment. :3
-
Looking great hoffa! I'd love some project like this, I have no idea of how you managed to make it too.
-
Hey,
nice job, this looks like a nice library indeed.
@ephan : He used classes do get the windows, buttons, title etc.
It's quite long to do but not that hard :)
-
I added a short video to show how it works and runs. I can now move and close the windows, and added some content to one of them.
-
Heya Hoffa where have you been? O.O I noticed you stopped posting for over a month recently. D: Nice to see you back now. Also this looks nice. :D
-
Great !
You know, you can use a cursor.set("grab") <-- or something like that, I don't remember exactly
when grabbing windows ...
it's all on http://wiki.inspired-lua.org/cursor.set (http://wiki.inspired-lua.org/cursor.set)
-
Great !
You know, you can use a cursor.set("grab") <-- or something like that, I don't remember exactly
when grabbing windows ...
it's all on http://wiki.inspired-lua.org/cursor.set (http://wiki.inspired-lua.org/cursor.set)
That's great, didn't know about that. Thanks!
-
Aaah ok I see. That explains why you were gone then. To be honest I noticed almost all our european users vanished for a while in Early july, though O.O
-
Alright so now I've rewritten a few parts and restructured my code and done other such things.
Here's a small example of a program, it should be pretty straightforward:
function win_1_f()
hyena:drawImage(win_1, hyenaImage, 0, 0)
hyena:drawString(win_1, "Hello, hyena!", 0, 50)
end
function win_2_f()
hyena:drawString(win_2, "LOOK AT THESE GODDAMN ANTS", 0, 0)
end
function on.mouseDown(x, y)
hyena:mouseDown(x, y)
end
function on.mouseUp(x, y)
hyena:mouseUp(x, y)
end
function on.mouseMove(x, y)
hyena:mouseMove(x, y)
end
function on.timer()
timer.stop()
platform.window:invalidate()
end
initialized = false
function on.paint(gc)
if not initialized then
hyena = Hyena(gc)
win_1 = hyena:createWindow("First window, yay!", 0, 0, 128, 96)
win_2 = hyena:createWindow("FEELS GOOD MAN", 80, 40, 100, 100)
hyena:setWindowContentFunction(win_1, win_1_f)
hyena:setWindowContentFunction(win_2, win_2_f)
initialized = true
end
hyena:drawWindows()
timer.start(0.01)
end
Which gives (it isn't rendered exactly like that on calc, there are a few very minor differences):
(http://webgel.net/bf/6/hyena.png)
-
Hmmm, I don't know how I missed this the first time.
Regardless, it looks really epic :)
Any chance you could upload your library code to pastebin or something like that and give us a link to that sometime soon, because, if it's alright with you, I would really love to implement this in Pacman :D
-
Pretty cool, I might also try a basic window GUI library like this as well.
Also, dragging windows looks rather difficult on the touchpad, maybe you could change instead to holding a button like "ctrl", and pressing 4, 8, 6, or 2 will move the focused window left, up, right or down respectively ?
/suggestion
-
Hmmm, I don't know how I missed this the first time.
Regardless, it looks really epic :)
Any chance you could upload your library code to pastebin or something like that and give us a link to that sometime soon, because, if it's alright with you, I would really love to implement this in Pacman :D
I'll post the current code in less than an hour, got to do some housekeeping and add a few functions. :)
Pretty cool, I might also try a basic window GUI library like this as well.
Also, dragging windows looks rather difficult on the touchpad, maybe you could change instead to holding a button like "ctrl", and pressing 4, 8, 6, or 2 will move the focused window left, up, right or down respectively ?
/suggestion
Actually it's not that difficult to move them around. It looked painful because I moved the window so slowly, and that was because of a small issue (if I moved the cursor too fast, it would ungrab the window). It's fixed now and works pretty well:
-
Hmmm, I don't know how I missed this the first time.
Regardless, it looks really epic :)
Any chance you could upload your library code to pastebin or something like that and give us a link to that sometime soon, because, if it's alright with you, I would really love to implement this in Pacman :D
I'll post the current code in less than an hour, got to do some housekeeping and add a few functions. :)
Wonderful :)
Nice job on this :D
-
Hmmm, I don't know how I missed this the first time.
Regardless, it looks really epic :)
Any chance you could upload your library code to pastebin or something like that and give us a link to that sometime soon, because, if it's alright with you, I would really love to implement this in Pacman :D
I'll post the current code in less than an hour, got to do some housekeeping and add a few functions. :)
Wonderful :)
Nice job on this :D
As promised, here's the current code: http://pastebin.com/4x53C9yk
It's everything but ready, there's still quite a bit of things to do. Codewise, I still need to find a nice way to take full advantage of Nspire Lua's magnificent object oriented programming.
-
Wow nice Hoffa!
-
:O the calculators are more and more looking after pc OS's :)
-
hoffa : you should create a screen class. That way you don't have to do like that
win_2 = hyena:createWindow("FEELS GOOD MAN", 80, 40, 100, 100)
hyena:setWindowContentFunction(win_2, win_2_f)
but like that :
screen = class()
function screen:init()
...
end
function screen:paint(gc) --> here gc is hyena for more "confort"
...
end
...
textBox = class(screen)
function textBox:init(txt)
...
end
-- override screen:paint(gc) function
function screen:paint(gc) --> here gc is hyena for more "confort"
...
end
...
win_2 = textBox("FEELS GOOD MAN")
hyena:setWindowContentFunction(win_2)
-
hoffa disappeared again...
this would be very useful for my project and maybe any other lua projects...
Anyway I've got to learn some object oriented programming... Which could be a problem when we are too much accustomed with TI-BASIC programming.
-
I am thinking about doing something like this for casio LuaFX.
-
hoffa disappeared again...
this would be very useful for my project and maybe any other lua projects...
Anyway I've got to learn some object oriented programming... Which could be a problem when we are too much accustomed with TI-BASIC programming.
I'm making a gui library of EEPro, it will be open source so you will be able to use it :)