(Split from Why should NL levels have all-different IDs? (https://www.lemmingsforums.net/index.php?topic=7472.0))
Quote from: JawaJuice on Today at 12:56:42 PMAh OK, makes sense. I would choose C# as well for that kind of desktop GUI app.
I personally only have experience with C++, but I haven't coded in that language in over 15 years now, as the last time I did so was back when I was in college/university. Hence, I'm not sure how much it has in common with C#, let alone C, in terms of syntax, though it wouldn't surprise me if there are some similarities, especially with C. I recently re-installed Visual Studios on my machine again and am pleased that most of my assignments from the computer programming course I took all those years ago still compile properly ;)
Quote from: kaywhyn on Today at 01:04:21 PMI personally only have experience with C++, but I haven't coded in that language in over 15 years now, as the last time I did so was back when I was in college/university. Hence, I'm not sure how much it has in common with C#, let alone C, in terms of syntax, though it wouldn't surprise me if there are some similarities, especially with C. I recently re-installed Visual Studios on my machine again and am pleased that most of my assignments from the computer programming course I took all those years ago still compile properly ;)
Not wanting to derail the thread, but this is an interesting chat to me, so hey! As a C++ coder, C# is fairly easy to pick up because both languages share a common root in C. C# actually has a fair bit in common with C++ in terms of its syntax, the main architectural difference is around memory management, so C# is more like Java in that it's a managed language where garbage collection is automated. In C, you don't have that luxury at all and are completely responsible for your program's memory allocation and management through pointers (which makes it easily the most dangerous of the three to use if you don't know what you're doing!). Modern standards of C++ have introduced smart pointers, which makes memory management significantly easier, though it's still not fully automated. The reason C# is more suitable for GUI development though, is that it's closely tied to the .NET framework so has GUI elements built in that are almost drag-and-drop through Visual Studio, compared to C++, where you'd have to plug in third party libraries like Qt. Back in the day, we used to use MFC to build GUI apps but no-one in their right mind would choose that over C# these days! Good to hear that your old projects still compile in VS - I think you mentioned that before :thumbsup:
No worries about the derailing - this can easily be split off into its own thread. :)
Visual Studio is great for creating GUI-based Windows apps, but its own GUI can sometimes be a bit janky, especially when it comes to repositioning form elements. Delphi's GUI is actually way better for this. If I'm making a simple tool with a GUI, I often reach for Delphi first.
Ah, OK. The only time I ever used Delphi at work was back in the early Noughts, and that was for a black box wargame simulation rather than a GUI. I've sure the language has evolved out of sight since I last looked at it! In my general course of work now I don't actually do much GUI development, just the odd utility app in C#, I'm mostly on back-end development, which is all C++. Interesting to know what people are using though!
Quote from: JawaJuice on Today at 03:49:17 PMThe only time I ever used Delphi at work was back in the early Noughts ... I've sure the language has evolved out of sight since I last looked at it!
NeoLemmix and SuperLemmix are both Delphi-based, which is pretty much the only reason I know it exists. I find its form-building interface very comprehensive and user-friendly, and it's still a great IDE for simple tool building.
Re: the C# used in NLEditor for the Random ID generator
Quote from: WillLem on Today at 03:31:10 PMThe bit you're interested in is this:
private void btnRandomID_Click(object sender, EventArgs e)
{
CurLevel.LevelID = (ulong)Utility.Random().Next() +
((ulong)Utility.Random().Next() << 32);
txtLevelID.Text = CurLevel.LevelID.ToString("X16");
}
Yes, interesting! I'm not familiar with the Random() method in C# but I'm guessing it must do automatic seeding. In C++, if you use srand() from the standard library, you need to manually seed it with a parameter otherwise it would generate the same random number every time the program is run. I assume '<<' in this context is a left-hand bitwise shift in the same way as in C++.