Andy Gilbert Posted February 13, 2012 Share Posted February 13, 2012 HI, im trying to find a way to impliment a splash screen? Just simply show a 2D image for n seconds at the start of the app? With lua not having any build in commands its not a great styart. Ive tryed using Leadwerks timing functons but cant find a way to do it? Anyone had any luck with doing this? Thanks Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Canardia Posted February 13, 2012 Share Posted February 13, 2012 You don't even need timers, because loading the whole scene and setting up things takes longer than you would display the splash screen. So just show a splash screen with DrawImage(); before you load the scene, and then hide it when before the main loop starts. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Andy Gilbert Posted February 13, 2012 Author Share Posted February 13, 2012 HI Metatron, doesnt in my case? The whole game is ready pretty much instantly... I dont get any "black screen" or anything, it just immidiatly puts me in otthe game. I want to show a splash either before or "over" the game for at least 2 - 3 seconds. Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Pixel Perfect Posted February 13, 2012 Share Posted February 13, 2012 well the same still applies, just load a splash screen and then wait for 3 seconds before the main loop Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
Canardia Posted February 13, 2012 Share Posted February 13, 2012 Then you can make a simple wait command after you draw the image on screen and flip. --- Delay for a number of seconds. -- @param delay Number of seconds function delay_s(delay) delay = delay or 1 local time_to = os.time() + delay while os.time() < time_to do end end Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Andy Gilbert Posted February 13, 2012 Author Share Posted February 13, 2012 Ok, i guess that will do for now, the loading time is around 2 seconds, which is fine enough. Would still know how to do it for n seconds though? Thanks Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Andy Gilbert Posted February 13, 2012 Author Share Posted February 13, 2012 ok, but its the "wait" or the "delay" command i cant seem to find for LUA? A wait or pause is exactly what i want, but i cant find a way in lua to do this? Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Canardia Posted February 13, 2012 Share Posted February 13, 2012 You would have to actually measure the time after the drawimage and before the wait loop, so that the delay doesn't get bigger than n seconds if the scene loading takes already n seconds or more. I just posted an example of a delay command, read up. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Canardia Posted February 13, 2012 Share Posted February 13, 2012 The complete sequence is then pretty simple: DrawImage() Flip(0) local time_to = os.time() + 5 -- 5 secs wished delay LoadScene() while os.time() < time_to do end Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Andy Gilbert Posted February 13, 2012 Author Share Posted February 13, 2012 ok ill give this a go. I dont understand why ive been searching for time functions for lua and read everywhere that lua doesnt have any time functions built in to it, yet it obv has? Thanks Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Marleys Ghost Posted February 13, 2012 Share Posted February 13, 2012 I dont understand why ive been searching for time functions for lua and read everywhere that lua doesnt have any time functions built in to it, yet it obv has? Really? yet its in the Lua 5.1 Reference Manual, and mentioned in posts on this forum? Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Andy Gilbert Posted February 13, 2012 Author Share Posted February 13, 2012 Well i certainly wouldnt make up posts for no reason Marley? I assume its because i was searching for terms like, sleep, delay, pause. Which wernt findng much in regards to lua. I did search the forum and found one particlar post that refered the method above but ended on saying you shouldnt use the method as it pauses everything, including loading of assets? So i ignored it... http://www.leadwerks...h__1#entry21594 Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Marleys Ghost Posted February 13, 2012 Share Posted February 13, 2012 Well i certainly wouldnt make up posts for no reason Marley? I never said you did make up a post for no reason Andy. Just found it odd you could not find any reference to time functions..... Quote AMD Bulldozer FX-4 Quad Core 4100 Black Edition 2 x 4GB DDR3 1333Mhz Memory Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5 Windows 7 Home 64 bit BlitzMax 1.50 • Lua 5.1 • MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro 3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET LE 2.5/3.4 • Skyline • UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0 Marleys Ghost's YouTube Channel • Marleys Ghost's Blog "I used to be alive like you .... then I took an arrow to the head" Link to comment Share on other sites More sharing options...
Andy Gilbert Posted February 13, 2012 Author Share Posted February 13, 2012 ok, apologise for sounding snappy. Just find it fustrating when you cant find something. Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Naughty Alien Posted February 14, 2012 Share Posted February 14, 2012 ..if you using Bmax, Ill provide whole example how things works, with easy to use timer lib... Quote Link to comment Share on other sites More sharing options...
Naughty Alien Posted February 14, 2012 Share Posted February 14, 2012 ..actually, im bored, ill upload small mod for that later today..hihihih EDIT: Here it is...enjoy http://www.leadwerks.com/werkspace/files/file/318-splash-scrzip/ Quote Link to comment Share on other sites More sharing options...
epsilonion Posted January 9, 2015 Share Posted January 9, 2015 This is what I did in LUA to display a splash screen and pause for 10 seconds. I am trying to implement this in C++ but it is not doing it for some reason. Under the App:start Function --Load a spash screen texture self.splash = Texture:Load("Materials/splash.tex") --Set a flag so it does not run the splash screen everytime it loops StartUp = 1 Under the function App:Loop() --load a splash screen before starting the game -- If the startUp flag is grater or equal to 1 then load the splash screen -- It did not like it if it was just equal to 1 and it bugged out until I put the greater than in if startUp >= 1 then self.context:SetColor(0,0,0) self.context:Clear() -- Clear the context self.context:SetColor(1,1,1) self.context:DrawImage(self.splash,0,0) --Draw the splash screen self.context:Sync(true) -- Sync so it loads the screen Time:Delay(10000) -- Time delay of 10 sec's while the splash is displayed startUp = 0 -- set the startUp flag to 0 so the splash screen does not -- display on the next pass in the loop. end -- end the if statement 1 Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted January 9, 2015 Share Posted January 9, 2015 What exactly doesn't work? Is it not showing or do you get an error. Also please make a new topic as this once is 2 years old. Quote Link to comment Share on other sites More sharing options...
epsilonion Posted January 10, 2015 Share Posted January 10, 2015 I put it in this topic to limit the amount of duplicate ones you have to troll through before getting an answer, thats if you can find an answer.. and there's no problem with it, it works that's why I posted it here and not made another thread.. Quote Link to comment Share on other sites More sharing options...
Gloomshroud Posted February 28, 2015 Share Posted February 28, 2015 Thank you for the script, liam. I would like to point out that by adding the two further parameters (width, height) to the DrawImage() function you can resize it (as per documentation). It works just fine out of the box. However, I am having an interesting issues in which my two splash screens (LE logo and my own logo) are repeating infinitely, despite the flag being set to 0. Any reason that might happen, or is it just the result of having no other code to follow? More specifically, it will load self.splash1, then wait (Time:Delay(5000)), then it draws self.splash2, and then waits another 5 seconds. After that, it loops back to splash1, despite my flag. I'll keep working on this to find a way, but if you have any input it'd be most welcome! EDIT: Apologies if I am considered to be also "necro'ing" this thread, but it is simply too useful to leave dormant. EDIT #2: I tossed in return false and that made it stop. Hehe. A rather heavy-handed work around however. Also, do you think there is a way to "fade" the screens from one to the other? Quote Link to comment Share on other sites More sharing options...
AnthonyPython Posted February 28, 2015 Share Posted February 28, 2015 Thank you for the script, liam. I would like to point out that by adding the two further parameters (width, height) to the DrawImage() function you can resize it (as per documentation). It works just fine out of the box. However, I am having an interesting issues in which my two splash screens (LE logo and my own logo) are repeating infinitely, despite the flag being set to 0. Any reason that might happen, or is it just the result of having no other code to follow? More specifically, it will load self.splash1, then wait (Time:Delay(5000)), then it draws self.splash2, and then waits another 5 seconds. After that, it loops back to splash1, despite my flag. I'll keep working on this to find a way, but if you have any input it'd be most welcome! EDIT: Apologies if I am considered to be also "necro'ing" this thread, but it is simply too useful to leave dormant. EDIT #2: I tossed in return false and that made it stop. Hehe. A rather heavy-handed work around however. Also, do you think there is a way to "fade" the screens from one to the other? the blood overlay in the fps script does fading which is a good example to start from. 1 Quote OS: Windows 10 Pro CPU: i3-10100 CPU @ 3.60GHz GPU: NVIDIA 2060 Super - 8 GB RAM: 32 GB Link to comment Share on other sites More sharing options...
Gloomshroud Posted February 28, 2015 Share Posted February 28, 2015 Ineed?!?!? Taking a look now! Thank you! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.