Re: Packaging and Distributing Dlang Applications with GtkD Dependency?
On Wednesday, 25 September 2019 at 11:46:04 UTC, Ron Tarrant wrote: Hi y'all, I've been Googling how to do this, but coming up with nothing definitive. Are there any articles for how to do this for: Windows? Linux? other UNIX-alike OSs? For macOS you should distribute a GUI application for end users as an application bundle [1]. That's basically a directory containing a specific structure. Any dependencies and resources like libraries (GTK), images and so on should be bundled inside the application bundle. Then package the application bundle inside an archive, ideally a Disk Image (DMG) [2]. The application would be completely self contained and the user can install it by dragging it to the Application directory. There might be some specific documentation how to bundle a GTK application on macOS. I found this [3], don't know if it's good or not. Ideally the application should be distributed on the Mac App Store. But that requires a developer account that costs money. It also has some restrictions that distribution outside of the Mac App Store doesn't have. If you cannot distribute using the Mac App Store the next best thing is to notarize the application (also requires a paid developer account, as far as I can see) before distributing it. Otherwise the user will get a dialog complaining that the application is from an unknown developer and the user need to explicitly go into System Preferences to allow it. [1] https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/1123i-CH101-SW1 [2] https://en.wikipedia.org/wiki/Apple_Disk_Image [3] https://gitlab.gnome.org/GNOME/gtk-mac-bundler -- /Jacob Carlborg
Blog Post #74: Cairo IX - Doodle a Noodle
Because at this point we've covered almost every widget GtkD has to offer, today we're taking a departure from that to do something non-standard. Nodes-n-noodles are becoming more popular as UI elements, so this is the beginnings of how we can get this paradigm working in GtkD. You can find part one here: https://gtkdcoding.com/2019/09/27/0074-cairo-doodle-a-noodle.html
Re: Help making a game with transparency
Sorry this is a bit vague. I suppose you're using engine.d or screen.d directly right? Depending on your setup (OpenGL or Software) transparency will be different. For example take a look at line 733, putpixel function and you'll see that It handle Color differently if it's OpenGL x Software and for the latter it checks if 32bpp or less. Now if it's OpenGL take a look for "Alpha". Matheus. Thanks for the reply. Do you know the arsd library?
Re: Help making a game with transparency
On Friday, 27 September 2019 at 11:32:53 UTC, Adam D. Ruppe wrote: On Friday, 27 September 2019 at 11:28:35 UTC, matheus wrote: Sorry this is a bit vague. I suppose you're using engine.d or screen.d directly right? those two are obsolete, new stuff should use simpledisplay but with simpledisplay you need to use opengl for transparency since the xlib/gdi+ impl doesn't support it (though they probably could if someone wanted to write some code) i just am doing 4 other things at once right now and can't do it myself at the moment Alright, thanks, the problem is that I was unable to figure out the opengl functions. Later when you have the time see if you can help me out, then I will add this to your library's tutorial.
Re: Help making a game with transparency
On Friday, 27 September 2019 at 16:36:14 UTC, Murilo wrote: ...Do you know the arsd library? Yes but I use mostly terminal.d and others. On the other hand I use to code games too using SDL and OpenGL. I know for example in OpenGL you can do: glEnable(GL_ALPHA_TEST); to enable alpha channel and set transparency. Matheus.
Re: Help making a game with transparency
On Friday, 27 September 2019 at 17:53:33 UTC, matheus wrote: On Friday, 27 September 2019 at 16:36:14 UTC, Murilo wrote: ...Do you know the arsd library? Yes but I use mostly terminal.d and others. On the other hand I use to code games too using SDL and OpenGL. I know for example in OpenGL you can do: glEnable(GL_ALPHA_TEST); to enable alpha channel and set transparency. Matheus. Thanks, but I don't know how that will fit in my code. I will show up a code snippet and you tell me how I can use your idea in it, okay? import arsd.image, arsd.simpledisplay; void main() { auto memImgShip = loadImageFromFile("ship.png"), memImgBackground = loadImageFromFile("background.png"); auto imgShip = Image.fromMemoryImage(memImgShip), imgBackground = Image.fromMemoryImage(memImgBackground); auto window = new SimpleWindow; window.eventLoop(10, { auto painter = window.draw; painter.drawImage(Point(0, 0), imgBackground); painter.drawImage(Point(100, 100), imgShip); }); } Here it is, how do I make the ship have a transparent background?
How to use Dbus to detect application uniqueness in D?
Hi I need to detect application uniqueness using dbus. I have a working code in Rust: fn run_as_unique_instance() { println!("First instance detected. Doing work..."); loop {} } fn run_as_nonunique_instance() { println!("Another instance is already running. Quiting..."); std::process::exit(0); } fn main() { let session = dbus::blocking::Connection::new_session().expect("Cannot setup a new dbus session"); match session.request_name("com.localserver.app.bus", false, false, false) { Ok(dbus::blocking::stdintf::org_freedesktop_dbus::RequestNameReply::PrimaryOwner) => { run_as_unique_instance() } Ok(_) => run_as_nonunique_instance(), // RequestNameReply::InQueue Err(_) => panic!("Error in session name request."), } } This creates a new session in dbus and then requests name. If the response is "PrimaryOwner" it means the application is unique. However I can't find the similar symbols in ddbus. https://ddbus.dpldocs.info/search-results.html#!session https://ddbus.dpldocs.info/search-results.html#!Connection Returns nothing.
Re: Help making a game with transparency
On Friday, 27 September 2019 at 21:16:07 UTC, Murilo wrote: ... Here it is, how do I make the ship have a transparent background? First: Your PNG file has transparency data information right? Second: I was Looking into the drawImage function (Line 854): https://github.com/adamdruppe/arsd/blob/b0d21de148ef0b23ea845be322af5e6931ca4cb6/screen.d And I'd suggest you to try to add the glEnable(GL_ALPHA_TEST); before glBegin(GL_QUADS); In fact you should do this only once, maybe inside the constructor, but just try it there to see if it works. Matheus.
Re: Help making a game with transparency
On Friday, 27 September 2019 at 22:13:43 UTC, matheus wrote: https://github.com/adamdruppe/arsd/blob/b0d21de148ef0b23ea845be322af5e6931ca4cb6/screen.d I really should just remove that file as it is no longer well maintained. I haven't used it for anything in years and doubt anyone else is either. He's using the simpledisplay.d lib which DOES NOT SUPPORT transparency in its drawImage function. It does NOT use opengl functions and are not compatible with them. To do opengl stuff with simpledisplay, there is a separate flow. You use opengl functions on a redraw scene delegate instead of using any of the Image or Painter objects. It is quite different and there is no easy fix on that end. but the gdi+ functions in sdpy MIGHT be able to be ported to alpha blend on Windows easily enough. I just haven't gotten around to it yet.
Re: Help making a game with transparency
On Friday, 27 September 2019 at 22:13:43 UTC, matheus wrote: On Friday, 27 September 2019 at 21:16:07 UTC, Murilo wrote: ... Here it is, how do I make the ship have a transparent background? First: Your PNG file has transparency data information right? Second: I was Looking into the drawImage function (Line 854): https://github.com/adamdruppe/arsd/blob/b0d21de148ef0b23ea845be322af5e6931ca4cb6/screen.d And I'd suggest you to try to add the glEnable(GL_ALPHA_TEST); before glBegin(GL_QUADS); In fact you should do this only once, maybe inside the constructor, but just try it there to see if it works. Matheus. Thanks for trying to help me but unfortunately you are suggesting I use arsd.screen which is supposed to be obsolete, I am using arsd.simpledisplay instead and it is very different although many functions have the same name.
Re: Help making a game with transparency
On Friday, 27 September 2019 at 22:40:14 UTC, Adam D. Ruppe wrote: On Friday, 27 September 2019 at 22:13:43 UTC, matheus wrote: https://github.com/adamdruppe/arsd/blob/b0d21de148ef0b23ea845be322af5e6931ca4cb6/screen.d I really should just remove that file as it is no longer well maintained. I haven't used it for anything in years and doubt anyone else is either. He's using the simpledisplay.d lib which DOES NOT SUPPORT transparency in its drawImage function. It does NOT use opengl functions and are not compatible with them. To do opengl stuff with simpledisplay, there is a separate flow. You use opengl functions on a redraw scene delegate instead of using any of the Image or Painter objects. It is quite different and there is no easy fix on that end. but the gdi+ functions in sdpy MIGHT be able to be ported to alpha blend on Windows easily enough. I just haven't gotten around to it yet. Ahhh, that clears everything up. I will then leave the program without the transparency and wait until you get around to implement the fixes to it, I am not a developer, I am a scientist, I only use libraries, I don't know how to make them properly.
Re: Help making a game with transparency
On Friday, 27 September 2019 at 02:54:27 UTC, Murilo wrote: Hi guys, I am making a game but for some reason the sprites do not show with the transparent background that they were supposed to. I'm using the arsd library. Can anyone help me? Sorry this is a bit vague. I suppose you're using engine.d or screen.d directly right? Depending on your setup (OpenGL or Software) transparency will be different. For example take a look at line 733, putpixel function and you'll see that It handle Color differently if it's OpenGL x Software and for the latter it checks if 32bpp or less. Now if it's OpenGL take a look for "Alpha". Matheus.
Re: Help making a game with transparency
On Friday, 27 September 2019 at 11:28:35 UTC, matheus wrote: Sorry this is a bit vague. I suppose you're using engine.d or screen.d directly right? those two are obsolete, new stuff should use simpledisplay but with simpledisplay you need to use opengl for transparency since the xlib/gdi+ impl doesn't support it (though they probably could if someone wanted to write some code) i just am doing 4 other things at once right now and can't do it myself at the moment
Re: Packaging and Distributing Dlang Applications with GtkD Dependency?
On Wednesday, 25 September 2019 at 11:46:04 UTC, Ron Tarrant wrote: Hi y'all, I've been Googling how to do this, but coming up with nothing definitive. Are there any articles for how to do this for: Linux? For Linux there are 3 new options: 1. Appimages (https://appimage.org/): This is very similar to Window's msi installer. You can host the app installer binary in bintray or in your website. 2. Flatpaks (https://flatpak.org/): Flatpak is quickly becoming more and more popular as it provides higher level customization for desktop applications in Linux. The flatpak API is not trivial but there are tutorials available to use flatpak and meson. A well known Linux application named Tilix (https://github.com/gnunn1/tilix) has a flatpak repo (https://github.com/gnunn1/tilix/tree/master/experimental/flatpak). 3. Snap (https://snapcraft.io/): Backed by Cannonical, snap provides a really easy way to distribute applications in Linux. I personally think Snaps are easier to create although I haven't invested time in distributing an app using snap. DMD, Dub and LDC are also shipped with it. There are tutorials for using all of those three online, but not specific to Dlang. But if you use the Meson build system there are plenty of tutorials available.
Help playing sounds using arsd.simpleaudio
Can anyone just please show me how to play a background sound(like those in games) using arsd.simpleaudio? I'd like something simple with a code snippet please.