Clickable Icons

Bug #1324978 reported by Travis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Wargus
Fix Released
Undecided
cybermind

Bug Description

OK, so I've asked this on the stratagus forum, but I guess things don't move as fast there, so I will ask here.

I have managed to get the icons to animate properly so that when you click them the look as though they get depressed down. My problem is, that all the icons (except for the stop, and stand-ground icons) all react to the mouse click instantly, whereas in the original Warcraft 2, the icons didn't execute the action until after you had released the mouse button.

I skimmed through "buttons.cpp" and "buttons.h" to see if I could find anything that would help me to make the action happen after mouse button release. I found the variable:

    void Button::mouseClick(int, int, int button, int)
    {
        if (button == MouseInput::LEFT)
        {
   generateAction();
        }
    }

A few lines below that I found this:

    void Button::mouseRelease(int, int, int button)
    {
  if (button == MouseInput::LEFT && hasMouse())
        {
            mMouseDown = false;
        }
    }

I put the "generateAction();" variable in the mouseRelease code, but had no luck. I think this code affects the buttons, and not the icons...Is there an equivelent kind of thing for the icons?

All I want is for icons to behave as follows:

Mouse over icon > click icon > icon shows it's been pressed > release button > icon returns to default look > action is executed.

and this:

Mouse over icon > click icon > icon shows it's been pressed > move mouse off icon (with mouse button still pressed) > icon returns to default look > action is NOT executed.

Related branches

Revision history for this message
cybermind (iddqd-mail) wrote :

Fixed in rev.1718

Changed in wargus:
status: New → Fix Committed
assignee: nobody → cybermind (iddqd-mail)
Revision history for this message
Travis (dinky-dye-aussie) wrote :

Thanks Cybermind.

Here's a bit of code to put in icons.cpp, on line 211, after the "DrawUnitIcon" position shift code. Makes the icons look alot more like the original war2 ones did when they were pressed.

   Video.DrawRectangle(ColorGray, pos.x, pos.y, 48, 40);
   Video.DrawHLine(ColorDarkGray, pos.x - 1, pos.y - 1, 49);
   Video.DrawVLine(ColorDarkGray, pos.x - 1, pos.y, 39);
   Video.DrawHLine(ColorDarkGray, pos.x - 1, pos.y + 39, 2);

It's awesome work you're doing man with getting all these bugs sorted out :) Thanks again :) I'll have a vodka shot as a tribute to your efforts :)

cybermind (iddqd-mail)
Changed in wargus:
status: Fix Committed → Fix Released
milestone: none → 2.3
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.