GUI Maker

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

User avatar
GoneWacko
Tycoon
Tycoon
Posts: 8680
Joined: 10 Jul 2002 15:08
Location: Enschede, The Netherlands
Contact:

GUI Maker

Post by GoneWacko »

Hmm, not sure if I should create a topic about this yet because it's quite far from being finished or ready for a first release. (I wouldn't want to release it too soon, like I did with my TTDPatch Configuration Manager :roll: )
But I have to get 10k posts before Owen does so I had better spam the board like a wildebeast ;)

I'm currently working on a tool that *should* help developers with their ventures into GUI-land.
Recently I've seen a lot of people upload patches, saying "Here's the patch. You can't configure it yet, because I found the GUI to be very daunting and I didn't feel like digging into it all".

So here's where my GUI Maker, or - if you like - Window Designer might come into play.
It will be able to import OpenTTD .C files, and parse the various windows that might be inside, to allow you to edit them in a graphical development environment, so to speak.

The source code will most probably be available, but because I'm writing it in Delphi (object pascal) I don't think too many people will even be able to edit it. (I might do a C conversion later and a linux port while i'm at it.. Not very experienced with GTK/Qt)

Currently, I'm mainly working on the drawing of the widgets and on the stuff happening in the background, so there aren't too many screenshots available, but here are 3 anyhow :lol::
Attachments
After some more being finished in the background, I was able to draw an entire window. Note that the 'title bar' is not quite right yet (2 pixels missing! :O) but it's very hard to notice the difference anyhow :p
After some more being finished in the background, I was able to draw an entire window. Note that the 'title bar' is not quite right yet (2 pixels missing! :O) but it's very hard to notice the difference anyhow :p
windowdesigner03.png (881 Bytes) Viewed 4479 times
After some studying of the OpenTTD code and doing a lot of manual copy-pasting / RGB to BGR converting, I was able to draw the button in all 16 colors! *Cheer*
After some studying of the OpenTTD code and doing a lot of manual copy-pasting / RGB to BGR converting, I was able to draw the button in all 16 colors! *Cheer*
windowdesigner02.png (5.09 KiB) Viewed 4479 times
This was the first thing I made my program do: Draw a button.
This was the first thing I made my program do: Draw a button.
windowdesigner01.jpg (17.62 KiB) Viewed 4479 times
GoneWacko. Making [url=irc://irc.oftc.net/tycoon]#tycoon[/url] sexy and exciting since 1784.
User avatar
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

Post by LKRaider »

:shock: Awesome! :o

Will be even more awesome when it works! :D
User avatar
lucaspiller
Tycoon
Tycoon
Posts: 1228
Joined: 18 Apr 2004 20:27

Post by lucaspiller »

Nice, one question though: will it be cross-platform?
No longer active here, but you can still reach me via email: luca[at]stackednotion[dot]com
User avatar
Korenn
Tycoon
Tycoon
Posts: 1735
Joined: 26 Mar 2004 01:27
Location: Netherlands
Contact:

Post by Korenn »

great idea!

although personally, I think the window system is extremely simple ;)
User avatar
GoneWacko
Tycoon
Tycoon
Posts: 8680
Joined: 10 Jul 2002 15:08
Location: Enschede, The Netherlands
Contact:

Post by GoneWacko »

lucaspiller wrote:Nice, one question though: will it be cross-platform?
That is my aim for the future, yes.
First I'll get it working in the first place, then I'll try getting it to work on Linux using crossplatform controls or by writing GTK+ version. Not sure yet :)

Korenn: well yes, the GUI was the first thing I changed when I looked at the OTTD source code.
GoneWacko. Making [url=irc://irc.oftc.net/tycoon]#tycoon[/url] sexy and exciting since 1784.
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Post by belugas »

Do you need a hand? I do lots of coding in Delphi 7 (which looks like your tool of dev...)
Maybe I can help.
User avatar
GoneWacko
Tycoon
Tycoon
Posts: 8680
Joined: 10 Jul 2002 15:08
Location: Enschede, The Netherlands
Contact:

Post by GoneWacko »

belugas wrote:Do you need a hand? I do lots of coding in Delphi 7 (which looks like your tool of dev...)
Maybe I can help.
Hmm, well, so far I'm under the impression that I might be able to pull it off myself, but there are always chances that I might end up not quite knowing what to do. (I tend to have that with some of the more advanced stuff like when I start using the Windows API)
Parsing the C files will be a challenge but do-able.

But so far, I'm enjoying this :p
GoneWacko. Making [url=irc://irc.oftc.net/tycoon]#tycoon[/url] sexy and exciting since 1784.
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

Looking great GoneWacko :)

A few suggestions:
1. If you want it portable, write it in QT. It has a free windows licence so you only have to write your application once.
2. Remember that the current maximum number of widgets in a given window is 32. (all the state variables, w->hidden_state, w->clicked_state, etc. are bitmasked 32bit variables).
3. Delphi :p
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
User avatar
GoneWacko
Tycoon
Tycoon
Posts: 8680
Joined: 10 Jul 2002 15:08
Location: Enschede, The Netherlands
Contact:

Post by GoneWacko »

Darkvater wrote:Looking great GoneWacko :)

A few suggestions:
1. If you want it portable, write it in QT. It has a free windows licence so you only have to write your application once.
2. Remember that the current maximum number of widgets in a given window is 32. (all the state variables, w->hidden_state, w->clicked_state, etc. are bitmasked 32bit variables).
3. Delphi :p
Okay, thanks for the pointers, I'll keep them in mind :-)
GoneWacko. Making [url=irc://irc.oftc.net/tycoon]#tycoon[/url] sexy and exciting since 1784.
antp
Engineer
Engineer
Posts: 82
Joined: 27 Aug 2003 09:30
Location: Brussels, Belgium
Contact:

Post by antp »

Darkvater wrote: 1. If you want it portable, write it in QT. It has a free windows licence so you only have to write your application once.
In Delphi you can use CLX rather than VCL, this uses QT internally. Then the program can be compiled with Kylix under Linux (if not directly, with only few changes probably)
Mek
TTDPatch Developer
TTDPatch Developer
Posts: 417
Joined: 13 Apr 2004 13:35
Location: Eindhoven, Netherlands
Contact:

Post by Mek »

antp wrote:
Darkvater wrote: 1. If you want it portable, write it in QT. It has a free windows licence so you only have to write your application once.
In Delphi you can use CLX rather than VCL, this uses QT internally. Then the program can be compiled with Kylix under Linux (if not directly, with only few changes probably)
but this of course requires you to make your program GPL, but i assume that was probably going to happen anyway?
antp
Engineer
Engineer
Posts: 82
Joined: 27 Aug 2003 09:30
Location: Brussels, Belgium
Contact:

Post by antp »

Only if you use the free version of Kylix.
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post by Bjarni »

this might be nice for some simple windows, but somehow I have never made a simple one. They always tend to be rather complex, but I have managed anyway. I would be impressed if you manage to allow this editor to make something as complex as say the autoreplace window...... when I made it, I even had to implement the option to have more than one vertical scrollbar :wink:

It looks great for simple and simi complex windows through and will for sure allow some people to make some windows

Great work
User avatar
GoneWacko
Tycoon
Tycoon
Posts: 8680
Joined: 10 Jul 2002 15:08
Location: Enschede, The Netherlands
Contact:

Post by GoneWacko »

I've just started trying to parse the C files for Widget arrays and window descriptions. And it's a bit harder than I had expected :)

I will probably just make it assume the code is compliant with the coding style (for now).
Finding widget arrays is not even that hard at the moment. Finding Window Descriptions will be a bigger challenge :o
GoneWacko. Making [url=irc://irc.oftc.net/tycoon]#tycoon[/url] sexy and exciting since 1784.
User avatar
GoneWacko
Tycoon
Tycoon
Posts: 8680
Joined: 10 Jul 2002 15:08
Location: Enschede, The Netherlands
Contact:

Post by GoneWacko »

Hmm I think I may have hit a breakthrough with the code parsing. It's far from done but I have a general idea about how to do it :)

This is mainly a bump post (not really needed but I hate it when topics about my programs don't get any updates :p)

Today I was kind of bored so I recreated the 'do you want to quit' window >_>. What an achievement. Apart from the text and two pixels in the caption bar, everything's there :p
Attachments
compare.PNG
compare.PNG (4.52 KiB) Viewed 4036 times
GoneWacko. Making [url=irc://irc.oftc.net/tycoon]#tycoon[/url] sexy and exciting since 1784.
User avatar
bobingabout
Tycoon
Tycoon
Posts: 1850
Joined: 21 May 2005 15:10
Location: Hull, England

Post by bobingabout »

i can only notice 1 pixel difference, and imo, yours is the better 1 :P
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.

[/url]
User avatar
mkxx
Engineer
Engineer
Posts: 65
Joined: 06 Jun 2005 22:15
Location: Czech Republic, Prague

Better GUI

Post by mkxx »

I think so... Better is your version - without the "two pixels". I think that these 2 pixels is... ?Bug? in original TTD :wink:
You have not to modify there these pixels.
User avatar
Arsenal
Traffic Manager
Traffic Manager
Posts: 227
Joined: 06 Jan 2004 21:25

Post by Arsenal »

What two pixels?
I can't see the difference!
User avatar
bobingabout
Tycoon
Tycoon
Posts: 1850
Joined: 21 May 2005 15:10
Location: Hull, England

Post by bobingabout »

i can see the second 1 now.

1 is just to the right of the bottom of the X button, the other in in the top right corner.
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.

[/url]
User avatar
Arsenal
Traffic Manager
Traffic Manager
Posts: 227
Joined: 06 Jan 2004 21:25

Post by Arsenal »

bobingabout wrote:i can see the second 1 now.

1 is just to the right of the bottom of the X button, the other in in the top right corner.
Ah, got them both!
That was devilishly difficult to find, wasn't it? :twisted: :twisted:
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 15 guests