News:

11 March 2016 - Forum Rules

Main Menu

Advice on making GUI tool

Started by dougeff, February 20, 2016, 07:48:45 PM

Previous topic - Next topic

dougeff

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?
nesdoug.com -- blog/tutorial on programming for the NES

Madsiur

#1
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#.

dougeff

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

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

#4
I'll look into C# and XAML. Thanks. Or maybe I can get Visual Studio to work with C++.
nesdoug.com -- blog/tutorial on programming for the NES

Madsiur

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

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

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

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

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

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

Quote from: dougeff on February 21, 2016, 04:16:50 PMStupid 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.

BlackDog61

Quote from: dougeff on February 21, 2016, 04:16:50 PM
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

Quote from: dougeff on February 20, 2016, 07:48:45 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!

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:

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

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

Quote from: RyanfaeScotland on February 29, 2016, 03:51:47 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