Author Topic: Using Guichan  (Read 3470 times)

MrTAToad

  • Guest
Using Guichan
« on: 2010-Feb-15 »
My modified version of Guichan seems to be very usable, so here are a few instructions on how to use it.

  • First, you are going to need all the C++ code (which just so happens to be included in this very post).  The files need to go into the same place as your project file (which, if you have multiple projects for the different platforms that GLBasic supports, may not be the same place as the source code)
  • Next, you need the include GLBasic code added to your main project file.
  • Then, you need to initialise Guichan with by calling GUI_Initialise
  • Before the SHOWSCREEN command, you need to call the GUI_Update() command to update all mouse positions and perform all logic
  • At some point, you will destroy all your created windows, containers, labels etc with GUI_Delete, and shutdown Guichan with GUI_Shutdown)
  • It does take some time to compile - especially over a network

Some notes :

  • Widgets outside a window will still be displayed - may or may not be a bug...
  • At the moment, there is nothing to allow changing of colours, alpha values, preventing a window from being moved.  Most of that will be added later
  • Tabs aren't terribly complicated to use - I'm using them like this :
Code: (glbasic) [Select]
window%=GUI_CreateWindow(2,options.screenHeight%-200,"Options",options.screenWidth%-4,180,FALSE)
genContainer%=GUI_CreateContainer()
nameContainer%=GUI_CreateContainer()

tabArea%=GUI_CreateTabbedArea(options.screenWidth%-4,200)

GUI_CreateLabel(genContainer%,1,1,"Music Volume :",PTR_CONTAINER%)
GUI_CreateLabel(genContainer%,1,23,"SFX Volume :",PTR_CONTAINER%)
GUI_CreateLabel(genContainer%,1,45,"Screen Resolution :",PTR_CONTAINER%)
GUI_CreateLabel(genContainer%,1,67,"Use Full Screen ?",PTR_CONTAINER%)
GUI_CreateLabel(genContainer%,1,89,"Use Background :",PTR_CONTAINER%)
GUI_AddTabItem(tabArea%,"General",genContainer%,IS_CONTAINER%)

GUI_CreateLabel(nameContainer%,1,1,"Player 1 Name :",PTR_CONTAINER%)
GUI_CreateLabel(nameContainer%,1,23,"Player 2 Name :",PTR_CONTAINER%)
GUI_CreateLabel(nameContainer%,1,45,"Player 3 Name :",PTR_CONTAINER%)
GUI_CreateLabel(nameContainer%,1,67,"Player 4 Name :",PTR_CONTAINER%)
GUI_AddTabItem(tabArea%,"Name",nameContainer%,IS_CONTAINER%)

GUI_AddTab(window%,tabArea%,0,0,IS_WINDOW%)

I'll be updating all my three games to use it.  At some point I'll be having to do a keyboard overlay for those platforms that dont have a keyboard.

If anyone does find a problem with the source code, let me know.  Performance wise, it should be fine for even complicated things - however, it doesn't work well in a virtual machine.

[attachment deleted by admin]
« Last Edit: 2010-Feb-15 by MrTAToad »

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2702
    • View Profile
Re: Using Guichan
« Reply #1 on: 2010-Feb-15 »
Excellent stuff Mr. T! Have you tried this with the iPhone yet?
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

MrTAToad

  • Guest
Re: Using Guichan
« Reply #2 on: 2010-Feb-15 »
No, not yet - want to update all my games first.

Don't expect any trouble though...

MrTAToad

  • Guest
Re: Using Guichan
« Reply #3 on: 2010-Feb-15 »
Its very sluggish with Sun Virtual Machine and Linux - seems pretty much okay with XP though.

Here is a more recent set of files, by the way.

[attachment deleted by admin]

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2702
    • View Profile
Re: Using Guichan
« Reply #4 on: 2010-Feb-17 »
Is the source to the original demo, the one with all the controls used on it, available?
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

MrTAToad

  • Guest
Re: Using Guichan
« Reply #5 on: 2010-Feb-18 »
Its here!

I dont know the current state of it - it should compile okay though.

[attachment deleted by admin]

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2702
    • View Profile
Re: Using Guichan
« Reply #6 on: 2010-Feb-18 »
Many thanks!  :good:
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2702
    • View Profile
Re: Using Guichan
« Reply #7 on: 2010-Feb-18 »
Seems to be a little bit out of date, 'erase' function missing from the interface and some commands looking for different params?
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

MrTAToad

  • Guest
Re: Using Guichan
« Reply #8 on: 2010-Feb-18 »
Its the latest version, by the sound of it.  You'll probably need to uncomment most of the code because at the time I was testing tabs.

It does compile file though.
« Last Edit: 2010-Feb-18 by MrTAToad »