Murga-Projects Forums
murgaLua color/image - Printable Version

+- Murga-Projects Forums (
+-- Forum: Project Forums (/forumdisplay.php?fid=1)
+--- Forum: MurgaLua - General (/forumdisplay.php?fid=2)
+--- Thread: murgaLua color/image (/showthread.php?tid=417)

murgaLua color/image - luaCoder - 11-10-2011 04:17 AM


I have had some trouble loading images into my app and getting colors to properly show.

What I had after converting the script to lua for colors is:


That way I can't run it because it will error at the "179" part.

So I changed it to:


And it would run, only show everything black.

About images. What I have after converting is:


But running it again it won't show it.

Also I was wondering, the .cxx file contains an array of the entire image. How does it do it after converting, because that part is gone of course?
And if I compile it into an exe, do I have to provide the image with the compiled exe?
Or does it compile the image inside/with the exe?
How does it work? Smile


RE: murgaLua color/image - mikshaw - 11-10-2011 06:15 AM

I'm guessing you are using Fluid and converting it to Lua. Honestly I don't know a thing about using Fluid, and the code that comes from it looks unusual to me. One thing, for example, is the excessive use of "object" as a variable name. In my view this serves only to make things confusing and potentially broken, but then as I said I don't understand what it's doing. But I'll try to help in a way I can.

It took me a long time to get to understanding color in Fltk/murgaLua as well as I do now, and there are still some parts that give me trouble. If you are looking to apply a color to a widget according to the Fltk color index (in this case 179...a sort of dark sky blue?), you only need to specify the index:


I'll assume image_intel2GenCorei5 refers to the image array. I've worked with embedded image arrays for pixmaps only...haven't figured out how to do anything other than that. Pixmaps are particularly easy to embed because they are just text files themselves. What I've found is easiest is to use one of the image loading functions to load an external image at runtime, applying that data to a variable which can then be manipulated in murgaLua. For example:

-- load the external file image.png
-- make a box on which to display the image
-- apply image data to the box

Here's another simpler way to do that, but might limit what you can do with the data after it's loaded, since it doesn't assign the image data to a named variable:


I assume if it's compiled from a script which uses external images, you'll need to keep the images with the program. The compiler, as far as I understand it, simply combines the script and a murgaLua executable into a single compressed file.

RE: murgaLua color/image - luaCoder - 11-10-2011 01:11 PM

Wow thanks. Everything worked. Smile

Also, is it perhaps possible to minimize the app to the system tray that you know of?

And can you add an icon to the final compiled exe? By using murgaLua itself. I could think of a few other ways to do it, but not sure yet since I haven't tested it.

Windows systems of course. Smile

RE: murgaLua color/image - mikshaw - 11-10-2011 04:17 PM

As far as minimizing goes, the nearest thing I can think of is window:iconize() -- "window" being the name of your window. My desktop doesn't have a taskbar, so I haven't done anything related to minimizing to test this.

I couldn't add an icon on my system, but I'm pretty sure the feature is available at least on Windows. I seem to remember seeing something about it in the FLTK documentation. sorry I'm no better help with it. Even if it turns out to be not supported, I think there are free tools you can download which will let you modify a Windows executable to add an icon to it.

RE: murgaLua color/image - jpjacobs - 11-10-2011 06:54 PM

If I remember right, there's this library in the windows builts (with examples in bin/Windows/luacom/trayocx ) that lets you put icons in the system tray. this is windows only though Wink.



RE: murgaLua color/image - luaCoder - 11-11-2011 08:07 AM

Nice, thanks I will check it out later.

I did find another problem. With the "no console patch.exe". It appears to contain a virus. First I thought it was probably a false/positive because it came with murgaLua but after checking online I saw that 29 out of 43 AVs flagged it as more than just a "hack/patch tool" and started doubting it.

If it changes the header only to not open a console window it may do more too.

But is the source from where it was obtained clean/trusted? Or did John make it himself? Even when I used it the exe that it modified was also immediately flagged. So obviously I can't distribute apps that "potentially" contain a virus. This is a small problem.
Can't the header be modified manually? To cause it to be most likely without virus or potential virus.

For now it has done quite some damage to my system and I have been repairing it for a day now. So I am not so happy about it.