News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Advice on making GUI tool  (Read 4555 times)

dougeff

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
Advice on making GUI tool
« on: February 20, 2016, 07:48:45 pm »
I'm probably not going to do this, because I have ZERO experience programming a GUI...

But, I've been thinking about making a more complete hack of Punch-Out, with graphic changes. And I was thinking, since all the tiles are scrambled, I was considering the idea of programming a tool to unscramble the tiles, allow you to edit them, and reinsert them into the ROM in real time.

Again... I probably won't do this. But, if I did such a thing... I would opt to make it in Python and Pillow (and TkInter?). But, then if anyone else wanted to use it, they would have to have Python and Pillow installed to use it.

How would you guys approach this kind of project?
« Last Edit: February 20, 2016, 07:54:15 pm by dougeff »
nesdoug.com -- blog/tutorial on programming for the NES

Madsiur

  • RHDN Patreon Supporter!
  • Full Member
  • *****
  • Posts: 179
  • FF6 hacker
    • View Profile
Re: Advice on making GUI tool
« Reply #1 on: February 20, 2016, 08:09:12 pm »
I rarely use Pyhon other than making small scripts.

If you know C#, Visual Studio Community Edition is now free and I find winform application pretty easy to deal with (drag & drop UI components). However, winform is no longer developed but still supported but this can be a minimal impact for an utility that will serve for you only for one hack. Another option is WPF, still developped and maintained by Microsoft. You use an XAML structure for the GUI (sort of XML tags for styling and UI components). You still deal with C# for all the logic behind-code. I use this now.

Another thing I've tried is the Eclipse IDE for Java. I know there are other Java IDE that allow drag & drop for components but I've heard that they are not the best, e.g. they suck, though that is most likely an innacurate statement.

Otherwise I cannot suggest anything else since all the GUI applications I've coded were C# or Java based.

Edit: As for graphics, I've found a nice library that deal with the WriteableBitmap type. I think methods like getPixel() or setPixel() are faster with this library than the native counterpart Bitmap methods of C#.
« Last Edit: February 20, 2016, 08:22:33 pm by Madsiur »

dougeff

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
Re: Advice on making GUI tool
« Reply #2 on: February 20, 2016, 08:40:02 pm »
Unfortunately, I don't know C#. And, I started to learn Java many years ago, but forgot everything.
I know C/C++ and a little Python (and a few other irrelevant languages).
nesdoug.com -- blog/tutorial on programming for the NES

Madsiur

  • RHDN Patreon Supporter!
  • Full Member
  • *****
  • Posts: 179
  • FF6 hacker
    • View Profile
Re: Advice on making GUI tool
« Reply #3 on: February 20, 2016, 09:12:21 pm »
FYI, I just had a look at the Visual C++ templates in Visual Studio and the Default App template (and probably others) use the same or a similar XAML structure for the GUI than WPF. There's a bunch of predefined control as well. I have no idea the difference with a MFC application but I'd roughly say MFC was used in older C++ applications.

As for Python I've never looked if a free IDE easing the GUI creation exists or even how you can code a GUI application with Python.

dougeff

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
Re: Advice on making GUI tool
« Reply #4 on: February 20, 2016, 10:16:12 pm »
I'll look into C# and XAML. Thanks. Or maybe I can get Visual Studio to work with C++.
« Last Edit: February 20, 2016, 10:40:47 pm by dougeff »
nesdoug.com -- blog/tutorial on programming for the NES

Madsiur

  • RHDN Patreon Supporter!
  • Full Member
  • *****
  • Posts: 179
  • FF6 hacker
    • View Profile
Re: Advice on making GUI tool
« Reply #5 on: February 20, 2016, 11:10:59 pm »
Visual C++ is integrated in Visual Studio. It's an IDE for C++ development. You would probably be more comfortable with that if you know already C++.

From stanson.org:

C++ is the programming language, Visual C++ is Microsoft's implementation of it.

When people talk about learning Visual C++, it usually has more to do with learning how to use the programming environment, and how to use the Microsoft Foundation Classes (MFCs) for Windows rather than any language issues. Visual C++ can and will compile straight C and C++.


tvtoon

  • Sr. Member
  • ****
  • Posts: 371
    • View Profile
Re: Advice on making GUI tool
« Reply #6 on: February 21, 2016, 09:25:04 am »
If you know C++, you won't need that much to know C#. So it is highly advisable that you try the .NET environment.

I would never use something like Python with TK, the reason is simple: TCL is the way to go for that. ;)

BlackDog61

  • Hero Member
  • *****
  • Posts: 784
    • View Profile
    • Super Robot Wars A Portable translation thread
Re: Advice on making GUI tool
« Reply #7 on: February 21, 2016, 10:44:09 am »
For the record, there's also the python implementation of Qt. If it's only to edit graphics and write them back with scrambled tiles, it could work. it's kinda tough to get into, though, except for the QML / user interface part while you don't customize anything.
In the end I'm not sure I'd advise you to use it. ;D

Nightcrawler

  • Hero Member
  • *****
  • Posts: 5787
    • View Profile
    • Nightcrawler's Translation Corporation
Re: Advice on making GUI tool
« Reply #8 on: February 21, 2016, 11:12:08 am »
The problem is C++ has no inherent graphical or GUI capabilities. You have to choose one of the many third party library options that have bindings to the C++ language. Some popular cross-platform choices include Qt, GTK+, or wxWidgets. However, there are many others.

As far as Microsoft goes, you can still get away with MFC (long dead) with C++ if you jump through a few hoops (if you already knew MFC in the past). Any current options require you to move to C++/CLI if you want to stick with C++. Although even then, I don't think you can even use WPF with C++, and get good IDE designer support. WinForms might be it. Really, Microsoft wants you to use C# for regular Windows GUI development (I'd agree).

If you do think C#/.NET might be something you're interested in, know that Mono is pretty good these days, so you can get good cross platform results from .NET as well.

However you shape it, you're going to have to learn something new! :D
TransCorp - Over 20 years of community dedication.
Dual Orb 2, Wozz, Emerald Dragon, Tenshi No Uta, Glory of Heracles IV SFC/SNES Translations

dougeff

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
Re: Advice on making GUI tool
« Reply #9 on: February 21, 2016, 04:16:50 pm »
I am interested in learning to make GUIs, but after looking at some C# code, not too excited about learning it.

Stupid question, but if I went the C++ and Qt route (for example)... could I do everything with free / open source stuff.
nesdoug.com -- blog/tutorial on programming for the NES

zonk47

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
Re: Advice on making GUI tool
« Reply #10 on: February 21, 2016, 04:22:29 pm »
You can do everything with anything. If you're going the GUI route, you want to use BASIC. Look for a list of free BASIC compilers on Google and decide which one you want to use. Most BASIC compilers allow you to call C functions from libraries. Visual BASIC in particular is very good at this.
A good slave does not realize he is one; the best slave will not accept that he has become one.

Gemini

  • Hero Member
  • *****
  • Posts: 2026
  • 時を越えよう、そして彼女の元に戻ろう
    • View Profile
    • Apple of Eden
Re: Advice on making GUI tool
« Reply #11 on: February 21, 2016, 05:17:51 pm »
Stupid question, but if I went the C++ and Qt route (for example)... could I do everything with free / open source stuff.
Pretty much. You can either use QT (comes with full sources) or just dive into WinAPI. I've been using my own WinAPI wrappers for a few years now, it's not that bad and in most cases you have complete control over what the heck is happening on screen. Still, a few pieces of the API are a mess to deal with, but it's super easy to come up with stuff such as custom controls.

As for C# and .NET, I'd stay away from that. Seriously, it's just a glorified toy.
I am the lord, you all know my name, now. I got it all: cash, money, and fame.

BlackDog61

  • Hero Member
  • *****
  • Posts: 784
    • View Profile
    • Super Robot Wars A Portable translation thread
Re: Advice on making GUI tool
« Reply #12 on: February 22, 2016, 04:26:44 am »
Stupid question, but if I went the C++ and Qt route (for example)... could I do everything with free / open source stuff.
In addition to what Gemini said, if you go the Qt route and your computer uses windows, make sure you use Visual Studio + the Qt plugin. (The Qt plugin is actually available from the Qt site - go where you would if you were going to download one of their packages, and scroll down to the end of the list to find it.)
The reason I state this is, a couple of months back, I tried using Qt Designer and it just crashed on me very often. Don't give up on Qt because of that...

RyanfaeScotland

  • Sr. Member
  • ****
  • Posts: 366
    • View Profile
    • My Brill Game Site
Re: Advice on making GUI tool
« Reply #13 on: February 29, 2016, 03:51:47 pm »
I'm probably not going to do this, because I have ZERO experience programming a GUI...

Whatever avenue you choose do your best to keep your GUI code and your program code separate. This is great practice to follow and will make for much more reusable code and easier maintainability and updatability. I'll give a quick example in case you don't know it but definitely quick in case you do!

Code: [Select]
function onClick(){
  var name = "Steve";
  alert("Hello " + name);
}

Now if I want to make another version of my program that runs from the command line, or perhaps call the function on mouse over instead and have it beep on click then I can't, the function is tied to the onClick event.

A better version separates the functionality from the event:

Code: [Select]
function onClick(){
  sayHelloToSteve();
}

function sayHelloToSteve(){
  var name = "Steve";
  alert("Hello " + name);
}

Now I can call the function sayHelloToSteve() from wherever I want.

I won't go any further in case I am teaching you to suck eggs but stuff like this seems to be pretty related to several of the topics I'm posting at the moment so had to post it somewhere.

dougeff

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
Re: Advice on making GUI tool
« Reply #14 on: February 29, 2016, 06:38:35 pm »
Thanks for the advice.

I bought a big-ass book on C# that includes GUI making with Visual Studio. Give me about 6-12 months to figure this stuff out.
nesdoug.com -- blog/tutorial on programming for the NES

Nightcrawler

  • Hero Member
  • *****
  • Posts: 5787
    • View Profile
    • Nightcrawler's Translation Corporation
Re: Advice on making GUI tool
« Reply #15 on: March 01, 2016, 06:45:04 pm »
Whatever avenue you choose do your best to keep your GUI code and your program code separate. This is great practice to follow and will make for much more reusable code and easier maintainability and updatability. I'll give a quick example in case you don't know it but definitely quick in case you do!

Basic design patterns like that are incredibly useful to learn and have under your belt. Such design patterns like MVC or MVP employ separation of logic and presentation domains. You can take these skills to any language, desktop, mobile, web etc. Besides these types of design patterns, there are many more for approaches to solving common problems (singleton, factory, etc.). It's the basis for being a good software architect. Many self taught programmers miss out in these areas (I know I sure did). They may seem complicated at first, but you will find over time they are invaluable and will only make you a better programmer!
TransCorp - Over 20 years of community dedication.
Dual Orb 2, Wozz, Emerald Dragon, Tenshi No Uta, Glory of Heracles IV SFC/SNES Translations