whiterabbit Posted August 30, 2014 Share Posted August 30, 2014 I've managed to get a Buffer (and Texture) filled with the current screen. I want to write it to a file, so my game will have a builtin screenshot feature. Leadwerks 2 apparently had a function SaveBuffer which would do exactly what I want, but as far as I can tell it doesn't exist or has been renamed to something else. So, before I try to manually write the bytes to a file, does anyone know if there is a current function for writing a buffer to an image file? (Or maybe there is complete function for taking a screenshot that I don't know about?) EDIT: How do I even get individual values out of a buffer? Quote Link to comment Share on other sites More sharing options...
Brutile Posted August 30, 2014 Share Posted August 30, 2014 I've been using C++, so I use this: if (window->KeyHit(Key::F12)) { context->Screenshot(); } I'm sure lua has something similar Quote Link to comment Share on other sites More sharing options...
macklebee Posted August 30, 2014 Share Posted August 30, 2014 yes it does: if self.window:KeyHit(Key.P) then self.context:Screenshot() end which puts an image into "C:\Users\XXXX\AppData\Local/xProjectNamex/Screenshots/screenshot1.tga" on windows. I preferred the old LE2 way where you had control over where the file was created. EDIT-- ooh ok just saw that you can specify the file path and name: if self.window:KeyHit(Key.P) then self.context:Screenshot("C:/example.tga") end excellent! 1 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Genebris Posted August 30, 2014 Share Posted August 30, 2014 Strange that it is not documented, maybe there is a place where I can watch for other undocumented Lua functions? 1 Quote Link to comment Share on other sites More sharing options...
bandrewk Posted August 30, 2014 Share Posted August 30, 2014 Strange that it is not documented, maybe there is a place where I can watch for other undocumented Lua functions? Inside the C++ header files Quote Link to comment Share on other sites More sharing options...
Genebris Posted August 30, 2014 Share Posted August 30, 2014 Maybe anyone could post a whole list of these functions? Quote Link to comment Share on other sites More sharing options...
Guppy Posted August 30, 2014 Share Posted August 30, 2014 Maybe anyone could post a whole list of these functions? What would be the point? If you have the c++ version you have the header files, if you dont then you cant use them... Quote System: Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k Link to comment Share on other sites More sharing options...
CrazyM Posted August 30, 2014 Share Posted August 30, 2014 Because digging through the source is not the same as documentation. 1 Quote CrazyMinnowStudio.com Youtube, Twitter, Facebook, G+ Link to comment Share on other sites More sharing options...
Guppy Posted August 30, 2014 Share Posted August 30, 2014 Because digging through the source is not the same as documentation. He wants a list of functions (methods really) from the headder files - how is that any different than "digging through the source" Quote System: Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k Link to comment Share on other sites More sharing options...
macklebee Posted August 30, 2014 Share Posted August 30, 2014 He wants a list of functions (methods really) from the headder files - how is that any different than "digging through the source" What would be the point? If you have the c++ version you have the header files, if you dont then you cant use them... Not everyone has the c++ version. While its not exactly the most efficient way to have documentation - having a list of available commands that show the parameters is useful. It looks like Josh has commented the ones that were exposed to lua. Another method I have done is to perform a dump of all globals in LE's lua implementation that show at least the available lua commands for LE classes. globals.txt 2 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Guppy Posted August 30, 2014 Share Posted August 30, 2014 My point was ; not all methods are mapped to lua Quote System: Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k Link to comment Share on other sites More sharing options...
macklebee Posted August 30, 2014 Share Posted August 30, 2014 My point was ; not all methods are mapped to lua And my point and others is: majority of them are exposed to lua and if we can't get official documentation then I see no reason why it hurts to have these posted. I personally would not have been able to do any of the shader effects I have done in lua without shadmar posting the c++ info about buffers here: http://www.leadwerks.com/werkspace/topic/10171-buffer-commands-exposed-to-lua-with-documentation/#entry75328 Granted all of this would be moot if the official documentation was completed. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
whiterabbit Posted August 30, 2014 Author Share Posted August 30, 2014 Thanks very much everyone, context:Screenshot() works perfect, just have to make sure the filename is named with .tga extension. UPDATE: If you call Screenshot() with no filename and you are using Steam, it puts it in your Steam screenshots folder (awesome) ! 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.