Page 1 of 1

More customizations for global anims

Posted: Thu Mar 14, 2019 6:27 am
by Eizzoux
Just kinda got few other ideas for customizing the global anims:
  1. More "classes" of global anim: option to make global anims render not only in boundaries of playfield and the entire window/border, but also in boundaries of each door ('door_1' and 'door_2');
  2. Aligning anims to left/right or top/bottom side of the screen: option to align them to the sides of borders like 'viewport.door_1.align';
  3. More anim events: just adding more events for changing/initiating anims... not just 'click', but also, maybe, 'unclick' or 'release' and 'press_xk_button';
  4. Activating an action with delay: the point is that when you click on an anim with action that kinda pauses the game/menu/editor like 'anim_event_action: editor.button.save' or 'anim_event_action: main.button.game', it does the action before the anim changes, so sometimes the pressing anim for a global anim button that pauses or changes the screen becomes kinda pointless.

Re: More customizations for global anims

Posted: Thu Mar 14, 2019 8:35 am
by Holger
More "classes" of global anim: option to make global anims render not only in boundaries of playfield and the entire window/border, but also in boundaries of each door ('door_1' and 'door_2');
This already works, with these exact class names. :)
Aligning anims to left/right or top/bottom side of the screen: option to align them to the sides of borders like 'viewport.door_1.align';
This should already work, using the ".position" parameter -- BD2K3 also uses this (and also the classic "toons").
More anim events: just adding more events for changing/initiating anims... not just 'click', but also, maybe, 'unclick' or 'release' and 'press_xk_button';
I have just added some more global animation events last night! It's not pushed to the repo yet, but you can download the latest development executable for Windows and have a look at it -- here's the commit message:

Code: Select all

added several new event types that can trigger global animations

This change adds the following new global animations event types,
which can be used like the already existing "click:anim_X.part_Y":

* init:anim_X.part_Y - triggers when animation is initialized
* start:anim_X.part_Y - triggers when animation is started
* end:anim_X.part_Y - triggers when animation ends
* post:anim_X.part_Y - triggers when animation post delay ends

The second part ".part_Y" is optional; if missing, events for every
animation part will trigger the animation for which this event is
defined.

The "init" event will trigger even if the animation is not yet
displayed, but starts waiting for its "init_delay" or "init_event",
while the "start" event will trigger when the first frame of the
animation is displayed.

The "end" event will trigger when the last frame of the animation is
displayed (either because the animation has stopped due to a click
event, due to the "anim_delay" being finished or because the animation
has completely moved off the screen), while the "post" event will
trigger when the "post_delay" is completely finished.
Activating an action with delay: the point is that when you click on an anim with action that kinda pauses the game/menu/editor like 'anim_event_action: editor.button.save' or 'anim_event_action: main.button.game', it does the action before the anim changes, so sometimes the pressing anim for a global anim button that pauses or changes the screen becomes kinda pointless.
You can now easily accomplish exactly this task with those new animation events! :)

Re: More customizations for global anims

Posted: Sun Mar 17, 2019 7:54 pm
by Holger
More anim events: just adding more events for changing/initiating anims... not just 'click', but also, maybe, 'unclick' or 'release' and 'press_xk_button';
I have just added another animation event action: "unclick:any". It triggers the next animation part when the (any) mouse button was released (anywhere on the screen, not only when the mouse pointer is over that global animation).

This allows for (nearly) "real" (gadget-style) buttons, like the two "zoom" buttons for the level editor: Use a "click" event for the first part, and an "unclick:any" event for the second part. Define the "anim_event_action: XK_plus" (or "XK_minus") event action for either the first or second part, depending on what you like better: executing the "zoom" action directly when pressing the button, or executing it when releasing the mouse button. Using "execute action when released" has the advantage that it works just like all other buttons, but has the disadvantage that it also executes its action when the mouse pointer was moved away from the button before it is released. Using "execute action when pressed" would prevent this, but gives a slightly different behaviour for those new buttons.

Emulating the exact same behaviour of the "normal" buttons (changing between "pressed" and "unpressed" button graphic when moving the mouse away from the button graphic or back over the button graphic while holding the mouse button pressed) is probably not possible (or would be to complicated), but I think the possibilites to define your own functional buttons with the new "unclick:any" event are just fine, and very easy to define in the "graphicsinfo.conf".

This new feature is avaliable in the latest development executable (just uploaded).

Re: More customizations for global anims

Posted: Thu Mar 21, 2019 4:52 am
by Eizzoux
Alrighty, works as intended, but there's few errors happening:
  1. If you do a very short click on the anim with '.part_1.anim_event: click' and '.part_2.anim_event: unclick:any', the anim will only count the clicking and then sticks on the pressed frame and only fixes after clicking again. It's kind of same situation when clicking on a button which brings out the request window/request in door;
  2. Undo button now works as redo button for some reason... Well, at least the anim which clicks on it:

    Code: Select all

    global.anim_5.part_1.EDITOR.anim_event:click
    global.anim_5.part_1.EDITOR.anim_event_action:editor.button.undo
    global.anim_5.part_1.EDITOR.class:window
    
  3. The anims with 'anim_event_action' (anim_24 and anim_25) which requires to click on another anim (anim_23.part_1) can be triggered on clicking on themselves instead of the one listed on their 'anim_event':

    Code: Select all

    global.anim_23.part_1.EDITOR.anim_event:click
    global.anim_23.part_1.EDITOR.class:window
    global.anim_23.part_2.EDITOR.anim_event:unclick:any
    global.anim_23.part_2.EDITOR.class:window
    global.anim_24.EDITOR.anim_event:click:anim_23.part_1
    global.anim_24.EDITOR.anim_event_action:XK_Shift_L
    global.anim_24.EDITOR.style:multiple_actions
    global.anim_25.EDITOR.anim_event:click:anim_23.part_1
    global.anim_25.EDITOR.anim_event_action:XK_U
    
    The point is that I can click in the top left corner of playfield since these anims are positioned on the (0,0) coordinates of the boundaries of playfield, and when I click on the top left corner, it triggers the redo sequence.

Re: More customizations for global anims

Posted: Fri Mar 22, 2019 9:53 am
by Holger
Haven't checked these issues yet, but you might like to check them with the latest development version. Not sure if it changes anything in this regard, though. Will do some checks for myself soon...

Re: More customizations for global anims

Posted: Fri Mar 22, 2019 11:25 am
by filbo
> you might like to check them with the latest development version

I'd like to encourage you to update the git repository more often; not just at major releases, but whenever you make a change, so lurkers can follow along even if we are not running Windows...

You seem to keep meticulous records of what you change, as if you check each change into your local git, just don't push them to the public visible repository. [I contrast with a project I work on, where the original author keeps his work secret for months at a time, then checks it all in with a comment like 'update to version 21'; all the while ignoring half a dozen PRs and committing conflicting code to his local repo, so that when he finally dumps it all in the waiting PRs have to be worked over to merge successfully... :( ]

Re: More customizations for global anims

Posted: Sat Mar 23, 2019 11:09 pm
by Holger
I'd like to encourage you to update the git repository more often; not just at major releases
OK, I'll try! :D

Usually I do push recent changes and additions from time to time, not just for major releases, but sometimes I just forget doing it.
You seem to keep meticulous records of what you change, as if you check each change into your local git, just don't push them to the public visible repository.
Yes, that's right. The reason for this is that I often do some rebasing and history-rewriting with the last few commits (to clean things up or fix some bugs found when testing directly in the related commits), which I cannot do after I pushed to the public repo. Unfortunately I cannot "push everything in master up to one week ago". But I could make more use of branches, so it would be easier to push blocks of older commits, and keep the newer ones.

I'll try to push at more regular (and shorter) intervals in the future... :?

BTW: Just pushed everything to the public repo. :D
[I contrast with a project I work on, where the original author keeps his work secret for months at a time, then checks it all in with a comment like 'update to version 21'; all the while ignoring half a dozen PRs and committing conflicting code to his local repo, so that when he finally dumps it all in the waiting PRs have to be worked over to merge successfully... :( ]
That's indeed not very nice! :shock:

Especially it sounds like he dumped everything into one single commit, which is really bad. I really try hard to make small commits, to have a chance to find bugs quicker using "git bisect"...

Re: More customizations for global anims

Posted: Mon Apr 01, 2019 3:13 pm
by Eizzoux
Holger wrote: Thu Mar 14, 2019 8:35 am This should already work, using the ".position" parameter -- BD2K3 also uses this (and also the classic "toons").
Maybe I'm not using it right, but I can get it to work as intended. It still keeps the same position on the left side instead of right as I intent to:

Code: Select all

global.anim_1.MENU.position:        right
global.anim_1.MENU.class:           window
I tried replacing 'right' with 'topright' and 'top,right', but nothing. Maybe I'm doing it wrong?