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 
murgaLua color/image
Author Message
luaCoder
Junior Member
**


Posts: 3
Group: Registered
Joined: Nov 2011
Status: Offline
Reputation: 0
Post: #1
murgaLua color/image

Hi,

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:

Code:
object:color((Fl_Color)179);


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

So I changed it to:

Code:
object:color((Fl_Color),179);


And it would run, only show everything black.


About images. What I have after converting is:

Code:
object:image(image_intel2GenCorei5);


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


Thanks.

11-10-2011 04:17 AM
Find all posts by this user Quote this message in a reply
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #2
RE: murgaLua color/image

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:

Code:
object:color(179)


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:

Code:
-- load the external file image.png
png_img=fltk:Fl_PNG_Image("image.png")
-- make a box on which to display the image
png_box=fltk:Fl_Box(30,20,100,100)
-- apply image data to the box
png_box:image(png_img)

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:

Code:
png_box=fltk:Fl_Box(30,20,100,100)
png_box:image(fltk:Fl_PNG_Image("image.png"))


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.

11-10-2011 06:15 AM
Find all posts by this user Quote this message in a reply
luaCoder
Junior Member
**


Posts: 3
Group: Registered
Joined: Nov 2011
Status: Offline
Reputation: 0
Post: #3
RE: murgaLua color/image

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

This post was last modified: 11-10-2011 01:39 PM by luaCoder.

11-10-2011 01:11 PM
Find all posts by this user Quote this message in a reply
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #4
RE: murgaLua color/image

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.

11-10-2011 04:17 PM
Find all posts by this user Quote this message in a reply
jpjacobs
Member
***


Posts: 113
Group: Registered
Joined: Jul 2007
Status: Offline
Reputation: 0
Post: #5
RE: murgaLua color/image

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.

Regards,

Jan-Pieter

11-10-2011 06:54 PM
Find all posts by this user Quote this message in a reply
luaCoder
Junior Member
**


Posts: 3
Group: Registered
Joined: Nov 2011
Status: Offline
Reputation: 0
Post: #6
RE: murgaLua color/image

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.

11-11-2011 08:07 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

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

Forum Jump: