News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
(very) basic slideshow
Author Message
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
(very) basic slideshow

This is an extension of the animation test from earlier today, with inspiration from John's work with drawing objects.

I'm really looking forward to murgaLua 0.5, because this socket.sleep() function is giving me a headache =o)

Problems:
The timer affects the length of time it takes to close the application (click anywhere to close), or to display it at all if you happen to focus a different desktop and come back to it.
It's always fullscreen for now, and large images do not scale down. It's just a test right now, so there are no features other than displaying images.
Since there is no filename filtering, some images will stay onscreen longer than others if you have anything but images in the directory. I have a plan to fix this, but have not implemented it yet.

I couldn't figure out a clean, simple way to prevent socket.sleep() from causing a 15-second pause before first displaying the window, so I set up an initial 0-second pause which gets reset after the first image is displayed.

HINT: Skip to the end of the thread for the most recent version of the script.

Code:
dir=os.getenv("HOME").."/image/"
timer=15 --seconds

fltk.fl_register_images()
images = murgaLua.readDirectory(dir)
table.sort(images)
Fl:visible_focus(0)
imgnum=1
pause=0

function exit() print("goodbye"); os.exit(0) end

function next_image()
socket.sleep(pause)
if imgnum == table.getn(images) then imgnum=2 else imgnum = imgnum+1 end
display:image(Fl_Shared_Image.get(dir..images[imgnum]))
display:redraw()
pause=timer
end

ww=Fl:w();wh=Fl:h()
w=fltk:Fl_Double_Window(ww,wh,"MurgaLua Slideshow")
w:color(fltk.FL_BLACK)
w:fullscreen()
display=fltk:Fl_Button(0,0,ww,wh)
display:box(1);display:color(fltk.FL_BLACK);display:selection_color(fltk.FL_BLACK)
display:callback(exit)
w:callback(next_image)

w:show()
while 1 do
Fl:check()
w:do_callback()
end
Fl:run()

This post was last modified: 07-17-2007 03:35 AM by mikshaw.

06-24-2007 08:55 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
(very) basic slideshow - mikshaw - 06-24-2007 08:55 AM
RE: (very) basic slideshow - mikshaw - 06-24-2007, 12:53 PM
RE: (very) basic slideshow - mikshaw - 06-25-2007, 05:02 AM
RE: (very) basic slideshow - iGame3D - 06-25-2007, 08:13 AM
RE: (very) basic slideshow - mikshaw - 06-25-2007, 11:17 AM
RE: (very) basic slideshow - mikshaw - 07-03-2007, 04:57 AM
RE: (very) basic slideshow - iGame3D - 07-03-2007, 09:28 AM
RE: (very) basic slideshow - mikshaw - 07-03-2007, 12:56 PM
RE: (very) basic slideshow - mikshaw - 07-06-2007, 06:29 AM
RE: (very) basic slideshow - mikshaw - 07-16-2007, 12:06 PM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: