1.
There is a nice callback/event-like mechanism for keyboard input, but how about the mouse buttons? And how do I get the mouse cursor position? All queries involving mouse have turned up empty so far.
2.
I think I saw a few scripts display pictures on screen, however I couldn't find any documentation on this. How would I display a .png file (for example). And is it also possible to show movies?
I hope someone can point me too the right direction. I've also got the Celestia source code, so if somebody has some tips that can only be done using the source code, feel free to post. I do prefer CELX solutions, because they are slightly easier to manage (and way easier to create, without further studying the source code).
Sincerely,
Roy T.
Edit:
Ok I've got the mouse buttons figured out (strange how this approach is similar but not analogue to keyboard input, that's confusing)
Code: Select all
-- This allows me to detect e "button pressed event" , fires only once, not as long as the button is pressed
--Mouse input
md = false
function mousedown(m)
if(md ~= true) then
md = true
celestia:print("Mouse pressed", 8, 0, 0, -20, 0)
end
end
function mouseup(m)
md = false
end
--register mouse input
celestia:registereventhandler("mousedown", mousedown)
celestia:registereventhandler("mouseup", mouseup)
However I'm still not sure what "m" (n both methods) is for kind of object in this scenario. I've found this page: http://en.wikibooks.org/wiki/Celestia/C ... enthandler however there is no information on the object given there.
More googling led me to http://www.lns.cornell.edu/~seb/celesti ... notes.html but that simply states "There are also mouseup, mousedown, and tick events. I'll post more information about them soon." So no joy there either.
I did find http://celestia.sourcearchive.com/docum ... ource.html If you take a look at the "bool LuaState::handleMouseButtonEvent(float x, float y, int button, bool down)" method, then so far as I can see "m" is comprised of 3 values.
a field "button" with an integer for the mouse
And fields X and Y.
After some more experiments it seems that this is the mapping:
"button == 1" -> left mouse button
"button == 2" -> scroll wheel clicked
"button ==4" -> right mouse button
(note all measured on a simple mouse that has no more buttons than that).
m.x and m.y indeed give coordinates. where 0,0 is the top left, and screenresolution.x and y are the bottom right.
I posted all this info here, in the hope that someone doesn't have to look for it as long as I have (trough trial and error and C++ source code).
For me the question how to properly show a picture is still open.