Checkbox and Radio Button Graphics and Scripts

Wargus is a Warcraft 2 mod that allows you to play Warcraft 2 with the Stratagus engine.
User avatar
Andrettin
Posts: 433
Joined: Sun Jun 30, 2013 9:58 pm
Location: Vienna, Austria
Contact:

Re: Checkbox and Radio Button Graphics and Scripts

Post by Andrettin »

I think that the reason why the first radio button doesn't appear marked is that you are using the same check for both. Trying this could solve the issue:

Code: Select all

  local fog = {}
        fog = menu:addImageRadioButton("", "fog", 26, 146, offi, offi2, oni, oni2, function() SetFogOfWar(false) end)
        if (GetFogOfWar() == true) then
          fog:setMarked(false)
        else
          fog:setMarked(true)
        end

        fog = menu:addImageRadioButton("", "fog", 26, 168, offi, offi2, oni, oni2, function() SetFogOfWar(true) end)
        fog:setMarked(GetFogOfWar())
That you used the same "fog" variable for both might also be a factor in causing the issue, but I'm not sure.
User avatar
DinkyDyeAussie
Posts: 260
Joined: Fri Feb 10, 2012 10:39 am
Location: Australia

Re: Checkbox and Radio Button Graphics and Scripts

Post by DinkyDyeAussie »

You're a legend man!!! :D Thank you for helping solve that it works perfect now :D :D :D

One step closer to getting the wargus version of stratagus looking more like warcraft 2! Now I just gotta make a new menu and swap a few things around in the old menus. Will post screen shots of progress :)
User avatar
DinkyDyeAussie
Posts: 260
Joined: Fri Feb 10, 2012 10:39 am
Location: Australia

Re: Checkbox and Radio Button Graphics and Scripts

Post by DinkyDyeAussie »

Ok so using your code above, I've managed to use it to change the look and behaviour of the following engine parameters:


Preferences Panel
> UI.ButtonPanel.ShowCommandKey - now has two radio buttons for on/off
> Fog of War - same thing - two radion buttons for on/off
> Grab Mouse - same again.

Speed Panel (New)
> Game Speed Slider
> Mouse Scroll Speed Slider
(I want to make a "Key Scroll Slider" for this panel too, just like the original war2 had, but the code isn't there. Would it be hard to implement into the engine? Could I simply copy and rename the mouse scroll speed code?)

Sound Panel
> Effects Volume Slider
> Music Volume Slider
> Has Sound on/off and Music on/off radio buttons as well... The sound on/off buttons work perfectly, but the music on/off radio buttons only work when turning the music off. Clicking the "on" music radio button does not re-enable the music. Here's the code I used for the music radio buttons:

Code: Select all

  local musiccheckbox = {}
		  musiccheckbox = menu:addImageRadioButton("", "musiccheckbox", 138, 200, offi, offi2, oni, oni2, function() SetMusicEnabled(true) end)
		  musiccheckbox:setMarked(IsMusicEnabled())
		
		  musiccheckbox = menu:addImageRadioButton("", "musiccheckbox", 138, 222, offi, offi2, oni, oni2, function() SetMusicEnabled(false) end)
		  if (IsMusicEnabled() == true) then
			   musiccheckbox:setMarked(false)
		  else
			   musiccheckbox:setMarked(true)
		  end
Whoops! Forgot pics!
preferences.png
preferences.png (130.07 KiB) Viewed 5782 times
sound.png
sound.png (122.42 KiB) Viewed 5782 times
speed.png
speed.png (122.54 KiB) Viewed 5782 times
User avatar
Andrettin
Posts: 433
Joined: Sun Jun 30, 2013 9:58 pm
Location: Vienna, Austria
Contact:

Re: Checkbox and Radio Button Graphics and Scripts

Post by Andrettin »

Cool :) Nice UI, by the way.
User avatar
DinkyDyeAussie
Posts: 260
Joined: Fri Feb 10, 2012 10:39 am
Location: Australia

Re: Checkbox and Radio Button Graphics and Scripts

Post by DinkyDyeAussie »

Thanks :) Yeah, kinda wanna update it again to something a bit less busy looking. The original orc warcraft 2 ui was alot smoother looking. Now I have gotten a bit better at using photoshop brushes I'll do another one one day, but it'll probably be a while cos making each resolution take a bit of time lol. I will though. Maybe closer to the look of the original too in colour and look.

But thanks anyway :) Kyran likes it too :)
User avatar
Andrettin
Posts: 433
Joined: Sun Jun 30, 2013 9:58 pm
Location: Vienna, Austria
Contact:

Re: Checkbox and Radio Button Graphics and Scripts

Post by Andrettin »

Did you make any progress with the implementation of the drop-down menu graphics? I took a look at your latest scripts, but I couldn't find anything on that.
User avatar
cybermind
Posts: 110
Joined: Sat Dec 31, 2011 11:43 pm

Re: Checkbox and Radio Button Graphics and Scripts

Post by cybermind »

I think he hasn't, because I haven't added support for graphical drop-downs yet
User avatar
DinkyDyeAussie
Posts: 260
Joined: Fri Feb 10, 2012 10:39 am
Location: Australia

Re: Checkbox and Radio Button Graphics and Scripts

Post by DinkyDyeAussie »

No not yet Andrettin. Once Cybermind has implamented the code into the engine I will be putting those in as well. Still trying to figure out how to get the disabled graphics for the slider bars and arrows to work properly when the game sound/music is turned off.
User avatar
Andrettin
Posts: 433
Joined: Sun Jun 30, 2013 9:58 pm
Location: Vienna, Austria
Contact:

Re: Checkbox and Radio Button Graphics and Scripts

Post by Andrettin »

I see, thanks for the answer :)

DinkyDyeAussie, I have now implemented checkbox graphics in Wyrmsun based on your code, thanks for writing it!

By the way cybermind, I added you on Skype, as you had mentioned in the other thread.
User avatar
DinkyDyeAussie
Posts: 260
Joined: Fri Feb 10, 2012 10:39 am
Location: Australia

Re: Checkbox and Radio Button Graphics and Scripts

Post by DinkyDyeAussie »

Andrettin wrote:DinkyDyeAussie, I have now implemented checkbox graphics in Wyrmsun based on your code, thanks for writing it!
Nawww, I feel all warm and fuzzy now! (Should really shave :P)

Nice to know I contributed to your game a bit...Well, Cybermind did too - without him I wouldn't know how to get them into wargus in the first place, so send some thanks his way too :)

It feels like it's slowly coming together really nicely now. All the games interfaces will finally behave like the original one day, and then it will be complete once the A.I is sorted out - it's still too fast and agressive for my liking, although I have yet to play through the original game + expansion again to see how it compares. I may have to capture the game play to compare.
Post Reply