├── .github ├── CODEOWNERS ├── PULL_REQUEST_TEMPLATE.md ├── FUNDING.yml └── CONTRIBUTING.md ├── .gitattributes ├── Tween ├── Helpers.ash ├── _blank.crm ├── room1.crm ├── room2.crm ├── room3.crm ├── room4.crm ├── room5.crm ├── room6.crm ├── room99.crm ├── AGSFNT0.WFN ├── AGSFNT1.WFN ├── AGSFNT2.WFN ├── acsprset.spr ├── room101.crm ├── room102.crm ├── room103.crm ├── room104.crm ├── room301.crm ├── room302.crm ├── room303.crm ├── room304.crm ├── room305.crm ├── room306.crm ├── room307.crm ├── sprindex.dat ├── template.ico ├── Music │ └── music1.ogg ├── room99.asc ├── Display2.ash ├── EasingDemo.ash ├── TestHelpers.ash ├── room6.asc ├── GlobalScript.ash ├── Helpers.asc ├── room307.asc ├── Tween3.ash ├── TestHelpers.asc ├── room103.asc ├── room305.asc ├── Tween3.asc ├── TweenThrow.ash ├── room303.asc ├── room104.asc ├── room304.asc ├── room5.asc ├── Tween2Compatibility.asc ├── room2.asc ├── Tween2Compatibility.ash ├── Display2.asc ├── room3.asc ├── TweenThrow.asc ├── room306.asc ├── EasingDemo.asc ├── room4.asc ├── room1.asc ├── room301.asc ├── Tween1Compatibility.asc ├── room302.asc ├── Tween1Compatibility.ash ├── room101.asc ├── GlobalScript.asc ├── room102.asc └── Tween.ash ├── .editorconfig ├── package.bat ├── .gitignore ├── README.md ├── INSTALL.TXT ├── LICENSE └── CHANGES.TXT /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @edmundito 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.asc linguist-language=AGS Script 2 | 3 | -------------------------------------------------------------------------------- /Tween/Helpers.ash: -------------------------------------------------------------------------------- 1 | import int GetScreenWidth(); 2 | import int GetScreenHeight(); -------------------------------------------------------------------------------- /Tween/_blank.crm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/_blank.crm -------------------------------------------------------------------------------- /Tween/room1.crm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/room1.crm -------------------------------------------------------------------------------- /Tween/room2.crm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/room2.crm -------------------------------------------------------------------------------- /Tween/room3.crm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/room3.crm -------------------------------------------------------------------------------- /Tween/room4.crm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/room4.crm -------------------------------------------------------------------------------- /Tween/room5.crm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/room5.crm -------------------------------------------------------------------------------- /Tween/room6.crm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/room6.crm -------------------------------------------------------------------------------- /Tween/room99.crm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/room99.crm -------------------------------------------------------------------------------- /Tween/AGSFNT0.WFN: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/AGSFNT0.WFN -------------------------------------------------------------------------------- /Tween/AGSFNT1.WFN: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/AGSFNT1.WFN -------------------------------------------------------------------------------- /Tween/AGSFNT2.WFN: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/AGSFNT2.WFN -------------------------------------------------------------------------------- /Tween/acsprset.spr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/acsprset.spr -------------------------------------------------------------------------------- /Tween/room101.crm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/room101.crm -------------------------------------------------------------------------------- /Tween/room102.crm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/room102.crm -------------------------------------------------------------------------------- /Tween/room103.crm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/room103.crm -------------------------------------------------------------------------------- /Tween/room104.crm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/room104.crm -------------------------------------------------------------------------------- /Tween/room301.crm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/room301.crm -------------------------------------------------------------------------------- /Tween/room302.crm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/room302.crm -------------------------------------------------------------------------------- /Tween/room303.crm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/room303.crm -------------------------------------------------------------------------------- /Tween/room304.crm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/room304.crm -------------------------------------------------------------------------------- /Tween/room305.crm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/room305.crm -------------------------------------------------------------------------------- /Tween/room306.crm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/room306.crm -------------------------------------------------------------------------------- /Tween/room307.crm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/room307.crm -------------------------------------------------------------------------------- /Tween/sprindex.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/sprindex.dat -------------------------------------------------------------------------------- /Tween/template.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/template.ico -------------------------------------------------------------------------------- /Tween/Music/music1.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edmundito/ags-tween/HEAD/Tween/Music/music1.ogg -------------------------------------------------------------------------------- /Tween/room99.asc: -------------------------------------------------------------------------------- 1 | // room script file 2 | 3 | function room_AfterFadeIn() 4 | { 5 | dHub.Start(); 6 | } 7 | -------------------------------------------------------------------------------- /Tween/Display2.ash: -------------------------------------------------------------------------------- 1 | // Better Display function using guis and the tween module. 2 | import function Display2(String message); -------------------------------------------------------------------------------- /Tween/EasingDemo.ash: -------------------------------------------------------------------------------- 1 | // new module header 2 | import function StartCurve(); 3 | import function UpdateTweenCurve(TweenEasingType easingX, TweenEasingType easingY); -------------------------------------------------------------------------------- /Tween/TestHelpers.ash: -------------------------------------------------------------------------------- 1 | import function Test(const string description); 2 | import function ExpectIntToBe(int actual, int expected, const string description); 3 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*] 2 | charset = utf-8 3 | end_of_line = crlf 4 | insert_final_newline = false 5 | trim_trailing_whitespace = false 6 | indent_style = space 7 | indent_size = 2 8 | -------------------------------------------------------------------------------- /Tween/room6.asc: -------------------------------------------------------------------------------- 1 | // room script file 2 | 3 | function room_AfterFadeIn() 4 | { 5 | SetGameSpeed(60); 6 | oObject0.TweenThrow(1.0, oObject0.X + 50, oObject0.Y - 20, Room.Width - 10, player.y, eEaseInSineTween, eReverseRepeatTween); 7 | } 8 | -------------------------------------------------------------------------------- /Tween/GlobalScript.ash: -------------------------------------------------------------------------------- 1 | // Main header script - this will be included into every script in 2 | // the game (local and global). Do not place functions here; rather, 3 | // place import definitions and #define names here to be used by all 4 | // scripts. 5 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ## How did you test your changes? 5 | 6 | 7 | ## Checklist 8 | - [ ] I wrapped new engine features around `#ifdef SCRIPT_API_v{version}` 9 | - [ ] I logged my changes in `CHANGES.TXT` 10 | -------------------------------------------------------------------------------- /package.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set filename=ags-tween-%1-module.zip 4 | 5 | C:\windows\System32\tar.exe ^ 6 | -cvaf %filename% ^ 7 | Tween.scm ^ 8 | Tween1Compatibility.scm ^ 9 | Tween2Compatibility.scm ^ 10 | INSTALL.TXT ^ 11 | CHANGES.TXT ^ 12 | LICENSE 13 | 14 | echo Created: %filename% 15 | -------------------------------------------------------------------------------- /Tween/Helpers.asc: -------------------------------------------------------------------------------- 1 | int GetScreenWidth() { 2 | #ifdef SCRIPT_API_v3507 3 | return Screen.Width; 4 | #endif 5 | #ifndef SCRIPT_API_v3507 6 | return System.ScreenWidth; 7 | #endif 8 | } 9 | 10 | int GetScreenHeight() { 11 | #ifdef SCRIPT_API_v3507 12 | return Screen.Height; 13 | #endif 14 | #ifndef SCRIPT_API_v3507 15 | return System.ScreenHeight; 16 | #endif 17 | } -------------------------------------------------------------------------------- /Tween/room307.asc: -------------------------------------------------------------------------------- 1 | // room 307 - Sandbox 2 | 3 | function room_AfterFadeIn() 4 | { 5 | Camera* camera = Screen.Viewport.Camera; 6 | 7 | Tween.IncreaseGameSpeed(); 8 | 9 | camera.TweenZoomTo(1.0, 6.0, player.x, player.y - 25, eEaseOutQuadTween); 10 | player.Say("TOO CLOSE!"); 11 | camera.TweenZoomTo(1.0, 3.0, 218, 30, eEaseInQuadTween); 12 | camera.TweenZoomTo(1.0, 2.0, 130, 110, eEaseLinearTween); 13 | camera.TweenZoom(1.0, 1.0, eEaseOutQuadTween); 14 | 15 | Tween.RestoreGameSpeed(); 16 | } 17 | -------------------------------------------------------------------------------- /Tween/Tween3.ash: -------------------------------------------------------------------------------- 1 | // Right now these are only experiments for a new Tween engine 2 | 3 | managed struct ManagedTween { 4 | protected float _duration; 5 | import attribute float Duration; 6 | import ManagedTween* SetStartDelay(float startDelay); 7 | import ManagedTween* Play(); 8 | import ManagedTween* Stop(); 9 | import ManagedTween* Pause(); 10 | import ManagedTween* Rewind(); 11 | }; 12 | 13 | managed struct ManagedTween2 extends ManagedTween { 14 | }; 15 | 16 | import void ManagedTweenTimeline(ManagedTween* tween1, ManagedTween* tween2, ManagedTween* tween3 = 0); -------------------------------------------------------------------------------- /Tween/TestHelpers.asc: -------------------------------------------------------------------------------- 1 | String _testDescription; 2 | 3 | function on_event(EventType event, int data) { 4 | if (event == eEventEnterRoomBeforeFadein) { 5 | _testDescription = String.Format("Test"); 6 | } 7 | } 8 | 9 | function Test(const string description) { 10 | _testDescription = String.Format("%s Test", description); 11 | } 12 | 13 | function ExpectIntToBe(int actual, int expected, const string description) { 14 | if (actual != expected) { 15 | Display("%s[Not the same %s![Actual: %d[Expected: %d", _testDescription, description, actual, expected); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Blank 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: edmundito 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Adventure Game Studio git ignore 2 | # -------------------------------- 3 | 4 | # Built things 5 | _Debug/ 6 | Compiled/ 7 | 8 | # AudioCache can be rebuilt from sources 9 | AudioCache/ 10 | 11 | # Lockfile 12 | _OpenInEditor.lock 13 | 14 | # User settings 15 | Game.agf.user 16 | *.crm.user 17 | 18 | # Backups 19 | Game.agf.bak 20 | backup_acsprset.spr 21 | 22 | # Memory dumps 23 | *.dmp 24 | 25 | # Temporary files 26 | # temporarily created during sprite or room background compression 27 | ~aclzw.tmp 28 | # temporary, main game data, before getting packed into exe 29 | game28.dta 30 | # temporary build of the game before being moved to Compiled/ folder 31 | *.exe 32 | 33 | # Log files 34 | warnings.log 35 | 36 | Tween Module specific 37 | --------------------- 38 | 39 | *.scm 40 | *.zip 41 | Assets/ 42 | dist/ 43 | site/ 44 | -------------------------------------------------------------------------------- /Tween/room103.asc: -------------------------------------------------------------------------------- 1 | // room 103 (Audio tests) script file 2 | 3 | #ifdef STRICT_AUDIO 4 | 5 | function testSystemVolume() { 6 | readonly int systemVolume = System.Volume; 7 | 8 | Test("System.Volume"); 9 | System.TweenVolume(0.5, 0, eEaseLinearTween, eBlockTween); 10 | ExpectIntToBe(System.Volume, 0, "Volume"); 11 | 12 | System.TweenVolume(0.5, 100, eEaseLinearTween, eNoBlockTween); 13 | System.StopTweenVolume(eFinishTween); 14 | ExpectIntToBe(System.Volume, 100, "Stop"); 15 | 16 | System.Volume = systemVolume; 17 | } 18 | 19 | #endif 20 | 21 | function room_AfterFadeIn() 22 | { 23 | #ifdef STRICT_AUDIO 24 | StartCutscene(eSkipESCOnly); 25 | 26 | testSystemVolume(); 27 | 28 | EndCutscene(); 29 | player.ChangeRoom(99); 30 | #endif 31 | } 32 | 33 | function room_Load() 34 | { 35 | 36 | } 37 | 38 | function room_FirstLoad() 39 | { 40 | 41 | } 42 | 43 | function room_Leave() 44 | { 45 | 46 | } 47 | 48 | function room_RepExec() 49 | { 50 | 51 | } 52 | -------------------------------------------------------------------------------- /Tween/room305.asc: -------------------------------------------------------------------------------- 1 | // Object tests (room 305) script file 2 | 3 | function testScaling() { 4 | #ifdef SCRIPT_API_v360 5 | readonly int minScaling = 1; 6 | readonly int maxScaling = 32767; 7 | 8 | readonly int initialScaling = cEgo.Scaling; 9 | cEgo.Scaling = minScaling; 10 | 11 | Test("Scaling"); 12 | oBluecup.TweenScaling(0.5, 200); 13 | ExpectIntToBe(oBluecup.Scaling, 200, "scaling"); 14 | 15 | oBluecup.TweenScaling(0.5, -1); 16 | ExpectIntToBe(oBluecup.Scaling, minScaling, "min scaling"); 17 | 18 | oBluecup.TweenScaling(0.5, maxScaling + 100); 19 | ExpectIntToBe(oBluecup.Scaling, maxScaling, "max scaling"); 20 | 21 | oBluecup.TweenScaling(0.5, 100, eLinearTween, eNoBlockTween); 22 | oBluecup.StopTweenScaling(eFinishTween); 23 | ExpectIntToBe(oBluecup.Scaling, 100, "stopped scaling"); 24 | #endif 25 | } 26 | 27 | function room_AfterFadeIn() 28 | { 29 | StartCutscene(eSkipESCOnly); 30 | 31 | testScaling(); 32 | 33 | EndCutscene(); 34 | player.ChangeRoom(99); 35 | } 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Tween Module for Adventure Game Studio (AGS) 2 | 3 | [![Join the chat at https://discord.gg/vmuCyWX](https://img.shields.io/badge/chat-%23tween__module%20on%20Discord-7289da.svg)](https://discord.gg/vmuCyWX) 4 | 5 | [Docs](https://edmundito.gitbook.io/ags-tween/) 6 | 7 | ## About 8 | 9 | The Tween Module for [Adventure Game Studio (AGS)](http://www.adventuregamestudio.co.uk/) 10 | can be used to script ["inbetweening"](https://en.wikipedia.org/wiki/Inbetweening). The module allows you to control many properties in GUIs, GUI controls, room objects, characters, audio, System, etc. 11 | It allows these inbetweens to be blocking, non blocking, or to loop them, and it features 12 | acceleration/deceleration easing functions. 13 | 14 | ## Compatibility 15 | 16 | - The current module is compatible with AGS 3.4.0 and above 17 | - Version 2.1.0 is compatible with AGS 3.0 or above 18 | - Version 1.5.1 is AGS 2.72 19 | 20 | ## Financial Support 21 | 22 | Tips and donations are accepted via Ko-fi: https://ko-fi.com/edmundito 23 | -------------------------------------------------------------------------------- /Tween/Tween3.asc: -------------------------------------------------------------------------------- 1 | ManagedTween* Create() { 2 | ManagedTween* tween = new ManagedTween; 3 | return tween; 4 | } 5 | 6 | void ManagedTweenArg(ManagedTween* tween) { 7 | 8 | } 9 | 10 | ManagedTween*[] ManagedTweenArray(int size) { 11 | ManagedTween* tweenArray[] = new ManagedTween[size]; 12 | return tweenArray; 13 | } 14 | 15 | ManagedTween* ManagedTween::SetStartDelay(float startDelay) { 16 | return this; 17 | } 18 | 19 | ManagedTween* ManagedTween::Play() { 20 | return this; 21 | } 22 | 23 | ManagedTween* ManagedTween::Stop() { 24 | return this; 25 | } 26 | 27 | ManagedTween* ManagedTween::Pause() { 28 | return this; 29 | } 30 | 31 | ManagedTween* ManagedTween::Rewind() { 32 | return this; 33 | } 34 | 35 | float get_Duration(this ManagedTween*) 36 | { return this._duration; } 37 | 38 | void set_Duration(this ManagedTween*, float value) 39 | { this._duration = value; } 40 | 41 | void ManagedTweenTimeline(ManagedTween* tween1, ManagedTween* tween2, ManagedTween* tween3) { 42 | } 43 | 44 | void TestCallChain() { 45 | ManagedTween* tween = new ManagedTween; 46 | // Call chain is not supported: "stucture required on left side of '.'" 47 | // tween.Play().Pause().Rewind(); 48 | } -------------------------------------------------------------------------------- /Tween/TweenThrow.ash: -------------------------------------------------------------------------------- 1 | // TERMS OF USE - AGS TWEEN MODULE (ags-tween) 2 | // 3 | // Copyright (c) 2009-present Edmundo Ruiz Ghanem 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | #ifdef __TWEEN_MODULE__ 23 | 24 | import int TweenThrow(this Object*, float timing, int peakX, int peakY, int endX, int endY, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 25 | 26 | #endif // __TWEEN_MODULE__ -------------------------------------------------------------------------------- /Tween/room303.asc: -------------------------------------------------------------------------------- 1 | // room 303 (region tests) script file 2 | Region* _r1; 3 | 4 | function RestoreRegion() { 5 | _r1.Tint(0, 0, 0, 1, 50); 6 | } 7 | 8 | function ExpectRegionTintToBe(Region* r, int red, int green, int blue, int saturation, int luminance, const string description) { 9 | ExpectIntToBe(r.TintRed, red, String.Format("%s Red", description)); 10 | ExpectIntToBe(r.TintGreen, green, String.Format("%s Green", description)); 11 | ExpectIntToBe(r.TintBlue, blue, String.Format("%s Blue", description)); 12 | ExpectIntToBe(r.TintSaturation, saturation, String.Format("%s Saturation", description)); 13 | ExpectIntToBe(r.TintLuminance, luminance, String.Format("%s Luminance", description)); 14 | } 15 | 16 | function testRegionTint() { 17 | _r1.TweenTintRed(0.5, 255); 18 | ExpectRegionTintToBe(_r1, 255, 0, 0, 1, 50, "TweenTintRed"); 19 | 20 | RestoreRegion(); 21 | 22 | _r1.TweenTintGreen(0.5, 255); 23 | ExpectRegionTintToBe(_r1, 0, 255, 0, 1, 50, "TweenTintGreen"); 24 | 25 | RestoreRegion(); 26 | 27 | _r1.TweenTintBlue(0.5, 255); 28 | ExpectRegionTintToBe(_r1, 0, 0, 255, 1, 50, "TweenTintBlue"); 29 | 30 | RestoreRegion(); 31 | 32 | _r1.TweenTintSaturation(0.5, 100); 33 | ExpectRegionTintToBe(_r1, 0, 0, 0, 100, 50, "TweenTintSaturation"); 34 | 35 | RestoreRegion(); 36 | 37 | _r1.TweenTintLuminance(0.5, 100); 38 | ExpectRegionTintToBe(_r1, 0, 0, 0, 1, 100, "TweenTintLuminance"); 39 | 40 | RestoreRegion(); 41 | 42 | _r1.TweenTint(0.5, 128, 128, 128, 100, 100); 43 | ExpectRegionTintToBe(_r1, 128, 128, 128, 100, 100, "TweenTint"); 44 | } 45 | 46 | function room_AfterFadeIn() 47 | { 48 | testRegionTint(); 49 | player.ChangeRoom(99); 50 | } 51 | 52 | function room_Load() 53 | { 54 | _r1 = region[1]; 55 | } 56 | 57 | function room_FirstLoad() 58 | { 59 | 60 | } 61 | 62 | function room_Leave() 63 | { 64 | 65 | } 66 | 67 | function room_RepExec() 68 | { 69 | 70 | } 71 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to ags-tween 2 | 3 | ## Requirements 4 | 5 | * AGS Editor 3.5.0 6 | * Module should be compatible with AGS 3.4.0 or above. New features should be wrapped around `#ifver` 7 | 8 | ## Submission process 9 | 10 | 1. Fork this repo into your own account 11 | 2. Make your changes in your fork 12 | 3. Update `CHANGES.TXT` and ensure new features are wrapped in `#ifver` 13 | 4. Push your changes and create a Pull Request 14 | 5. The [code owners](CODEOWNERS) will approve the Pull Request and merge into master 15 | 6. Your changes may be released by the code owners in a new version as soon as possible 16 | 17 | ## Code style 18 | 19 | There are some really simple code style guidelines that the code should follow to 20 | keep convention. When in doubt, take a look at the Tween script file for examples. 21 | 22 | ### Indentation 23 | 24 | * Please use 2 spaces for indentation as it is the standard for AGS scripts 25 | 26 | ### Blocks 27 | 28 | * Functions and blocks must have the opening bracket `{` start at the end of the statement 29 | and not in a new line 30 | * Blocks should ideally be enclosed in brackets `{}` even when they are not necessary 31 | 32 | Example: 33 | 34 | ``` 35 | function HelloGoodbye(bool hello) { 36 | if (hello) { 37 | Display("Hello Example!"); 38 | } 39 | else { 40 | Display("Goodbye Example!"); 41 | } 42 | } 43 | ``` 44 | 45 | ### Naming 46 | 47 | * Macros (`#define`s) must always be written in `ALL_CAPS_WITH_UNDERSCORE_SPACING` 48 | * Variables, structs, and functions that are local to the script should start with an underscore `_` 49 | * Function names should always be in `TitleCase` 50 | * Variable names should always be in `camelCase` 51 | * Please use clear names for functions and variables 52 | 53 | Example: 54 | 55 | ``` 56 | #define MY_MACRO 1 57 | 58 | int _myScriptVar; 59 | 60 | function _MyScriptFunction() { 61 | int myLocalVar; 62 | } 63 | ``` 64 | -------------------------------------------------------------------------------- /INSTALL.TXT: -------------------------------------------------------------------------------- 1 | 2 | Tween Scripting Module for Adventure Game Studio 3 | ================================================ 4 | 5 | Files 6 | ===== 7 | 8 | - Tween.scm: The Tween module! 9 | - Tween1Compatiblity.scm: Module needed if you were already using Tween 1.x in your game. 10 | - Tween2Compatiblity.scm: Module may be needed if you were already using Tween 2.x viewport or system tweens prior to upgrading to AGS 3.5.0. 11 | - LICENSE: Contains licensing information. 12 | You may need to include the contents of this file in your commercial game. 13 | - CHANGES.TXT: The change log. 14 | - INSTALL.TXT: This file! 15 | 16 | How to Install 17 | ============== 18 | 19 | 1. Open the AGS Editor and your game. 20 | 2. Remove the existing Tween module from the AGS Editor: Right-click on it and select "Delete". 21 | 3. Import Tween.scm: Right-click in Scripts and select "Import..." 22 | 4. Make sure that the Tween module is at the top or close to the top of the script list: 23 | In AGS 3.3 or above you can drag the script. 24 | In earlier versions, you can right-click and select "Move Up" until it's at the top. 25 | 5. If you were using Tween 1.x, then you can also import Tween1Compatiblity.scm. 26 | Make sure that it is placed right below the Tween script module. 27 | 6. If you were using some AGS features that have been deprecated, then you can also import Tween2Compatiblity.scm. 28 | Make sure that it is placed right below the Tween script module. 29 | 30 | Documentation 31 | ============= 32 | 33 | Available online at: 34 | https://edmundito.gitbook.io/ags-tween/ 35 | 36 | Support 37 | ======= 38 | 39 | Visit the AGS forums and post in the Tween 2.x thread: 40 | http://www.adventuregamestudio.co.uk/forums/index.php?board=10.0 41 | 42 | You can also chat in #tween_module in the AGS Discord server: 43 | https://discord.gg/vmuCyWX 44 | 45 | You can also post in the ags-tween Github at: 46 | https://github.com/edmundito/ags-tween/issues 47 | -------------------------------------------------------------------------------- /Tween/room104.asc: -------------------------------------------------------------------------------- 1 | // Point Tests (room 104) script file 2 | 3 | #ifdef SCRIPT_API_v3507 4 | function runTween(Point* p, int startX, int startY, int endX, int endY, TweenStyle style) { 5 | p.x = startX; 6 | p.y = startY; 7 | 8 | if (startX != endX && startY != endY) { 9 | p.TweenPosition(0.5, endX, endY, eEaseLinearTween, style); 10 | } 11 | else if (startX != endX) { 12 | p.TweenX(0.5, endX, eEaseLinearTween, style); 13 | } 14 | else { 15 | p.TweenY(0.5, endY, eEaseLinearTween, style); 16 | } 17 | } 18 | 19 | function runPointTest(int startX, int startY, int endX, int endY) { 20 | Point* p = new Point; 21 | 22 | runTween(p, startX, startY, endX, endY, eBlockTween); 23 | 24 | ExpectIntToBe(p.x, endX, "x"); 25 | ExpectIntToBe(p.y, endY, "y"); 26 | 27 | runTween(p, startX, startY, endX, endY, eNoBlockTween); 28 | p.StopTweenPosition(eFinishTween); 29 | 30 | ExpectIntToBe(p.x, endX, "stop x"); 31 | ExpectIntToBe(p.y, endY, "stop y"); 32 | } 33 | 34 | function testPointPosition() { 35 | Test("Point.Position"); 36 | runPointTest(-1000, -2500, 2000, 3400); 37 | 38 | Test("Point.X"); 39 | runPointTest(-1000, 0, 2000, 0); 40 | 41 | Test("Point.Y"); 42 | runPointTest(0, -2500, 0, 3400); 43 | } 44 | 45 | function testStopAll() { 46 | Test("Point.StopAll"); 47 | Point* p = new Point; 48 | int endX = 1234; 49 | int endY = 5678; 50 | 51 | runTween(p, 0, 0, endX, 0, eNoBlockTween); 52 | runTween(p, 0, 0, 0, endY, eNoBlockTween); 53 | p.StopAllTweens(eFinishTween); 54 | 55 | ExpectIntToBe(p.x, endX, "stop x"); 56 | ExpectIntToBe(p.y, endY, "stop y"); 57 | } 58 | #endif 59 | 60 | function room_Load() { 61 | 62 | } 63 | 64 | function room_AfterFadeIn() { 65 | #ifndef SCRIPT_API_v3507 66 | Display("Point is only supported on Script API v30507 or above."); 67 | #endif 68 | #ifdef SCRIPT_API_v3507 69 | StartCutscene(eSkipESCOnly); 70 | 71 | testPointPosition(); 72 | testStopAll(); 73 | 74 | EndCutscene(); 75 | #endif 76 | 77 | player.ChangeRoom(99); 78 | } 79 | 80 | function room_Leave() { 81 | 82 | } 83 | -------------------------------------------------------------------------------- /Tween/room304.asc: -------------------------------------------------------------------------------- 1 | // Character Tests (room 304) script file 2 | 3 | function testScaling() { 4 | #ifnver 3.6.0 5 | Display("Alternative scaling test availabe for 3.6.0 or above"); 6 | readonly int minScaling = 2; 7 | readonly int maxScaling = 200; 8 | #endif 9 | #ifver 3.6.0 10 | Display("Alternative scaling test availabe for below 3.6.0"); 11 | readonly int minScaling = 1; 12 | readonly int maxScaling = 32767; 13 | #endif 14 | 15 | readonly int initialScaling = cEgo.Scaling; 16 | cEgo.Scaling = minScaling; 17 | 18 | Test("Scaling"); 19 | cEgo.TweenScaling(0.5, 100); 20 | ExpectIntToBe(cEgo.Scaling, 100, "scaling"); 21 | 22 | cEgo.TweenScaling(0.5, -1); 23 | ExpectIntToBe(cEgo.Scaling, minScaling, "min scaling"); 24 | 25 | cEgo.TweenScaling(0.5, maxScaling + 100); 26 | ExpectIntToBe(cEgo.Scaling, maxScaling, "max scaling"); 27 | 28 | cEgo.TweenScaling(0.5, 100, eLinearTween, eNoBlockTween); 29 | cEgo.StopTweenScaling(eFinishTween); 30 | ExpectIntToBe(cEgo.Scaling, 100, "stopped scaling"); 31 | 32 | cEgo.Scaling = initialScaling; 33 | cEgo.ManualScaling = false; 34 | } 35 | 36 | function testAnimationVolume() { 37 | #ifdef SCRIPT_API_v360 38 | readonly int animationVolume = cEgo.AnimationVolume; 39 | readonly int minVolume = 0; 40 | readonly int maxVolume = 100; 41 | 42 | Test("AnimationVolume"); 43 | cEgo.TweenAnimationVolume(0.5, maxVolume / 2, eEaseLinearTween, eBlockTween); 44 | ExpectIntToBe(cEgo.AnimationVolume, maxVolume / 2, "animation volume"); 45 | 46 | cEgo.TweenAnimationVolume(0.5, minVolume - 10, eEaseOutBackTween, eBlockTween); 47 | ExpectIntToBe(cEgo.AnimationVolume, minVolume, "min animation volume"); 48 | 49 | cEgo.TweenAnimationVolume(0.5, maxVolume + 10, eEaseOutBackTween, eBlockTween); 50 | ExpectIntToBe(cEgo.AnimationVolume, maxVolume, "max animation volume"); 51 | 52 | cEgo.TweenAnimationVolume(1.0, maxVolume / 2, eEaseLinearTween, eNoBlockTween); 53 | cEgo.StopTweenAnimationVolume(eFinishTween); 54 | ExpectIntToBe(cEgo.AnimationVolume, maxVolume / 2, "stopped animation volume"); 55 | 56 | cEgo.AnimationVolume = cEgo.AnimationVolume; 57 | #endif 58 | } 59 | 60 | function room_AfterFadeIn() 61 | { 62 | StartCutscene(eSkipESCOnly); 63 | 64 | testScaling(); 65 | testAnimationVolume(); 66 | 67 | EndCutscene(); 68 | player.ChangeRoom(99); 69 | } 70 | -------------------------------------------------------------------------------- /Tween/room5.asc: -------------------------------------------------------------------------------- 1 | // room script file 2 | 3 | function ShowCurveGUI() 4 | { 5 | mouse.Mode = eModePointer; 6 | gEasing.Visible = true; 7 | StartCurve(); 8 | } 9 | 10 | function RunCustomTweenDemo() 11 | { 12 | Tween.IncreaseGameSpeed(); 13 | 14 | Tween myTweenX; 15 | Tween myTweenY; 16 | myTweenX.Init(3.0, GetScreenWidth() / 2, GetScreenWidth() - 5, eEaseInElasticTween); 17 | myTweenY.Init(3.0, 10, GetScreenHeight() - 5); 18 | int previousX = FloatToInt(myTweenX.FromValue); 19 | int previousY = FloatToInt(myTweenY.FromValue); 20 | 21 | // .IsPlaying() returns true if the the tween is not finished. 22 | while (myTweenX.IsPlaying() || myTweenY.IsPlaying()) { 23 | // .Update() moves the tween one step forward in time. 24 | myTweenX.Update(); 25 | myTweenY.Update(); 26 | 27 | DrawingSurface *surface = Room.GetDrawingSurfaceForBackground(); 28 | surface.DrawingColor = Game.GetColorFromRGB(255, 255, 255); 29 | surface.DrawLine(previousX, previousY, myTweenX.Value, myTweenY.Value, 1 + FloatToInt((1.0 - myTweenY.GetProgress()) * 30.0, eRoundNearest)); 30 | surface.Release(); 31 | 32 | // .Value contains the current value between the FromValue and ToValue. 33 | previousX = myTweenX.Value; 34 | previousY = myTweenY.Value; 35 | 36 | Wait(1); 37 | } 38 | 39 | Tween.RestoreGameSpeed(); 40 | } 41 | 42 | function TweenIndyMapLine(int fromX, int fromY, int toX, int toY) { 43 | Tween.IncreaseGameSpeed(); 44 | 45 | Tween myTweenX; 46 | Tween myTweenY; 47 | myTweenX.Init(3.0, fromX, toX); 48 | myTweenY.Init(3.0, fromY, toY); 49 | int previousX = FloatToInt(myTweenX.FromValue); 50 | int previousY = FloatToInt(myTweenY.FromValue); 51 | int drawColor = Game.GetColorFromRGB(255, 0, 0); 52 | 53 | while (myTweenX.IsPlaying() || myTweenY.IsPlaying()) { 54 | myTweenX.Update(); 55 | myTweenY.Update(); 56 | 57 | DrawingSurface *surface = Room.GetDrawingSurfaceForBackground(); 58 | surface.DrawingColor = drawColor; 59 | surface.DrawLine(previousX, previousY, myTweenX.Value, myTweenY.Value, 3); 60 | surface.Release(); 61 | 62 | previousX = myTweenX.Value; 63 | previousY = myTweenY.Value; 64 | 65 | Wait(1); 66 | } 67 | 68 | Tween.RestoreGameSpeed(); 69 | } 70 | 71 | function room_AfterFadeIn() 72 | { 73 | ShowCurveGUI(); 74 | //RunCustomTweenDemo(); 75 | //TweenIndyMapLine(0, 0, Screen.Width / 2, Screen.Height / 2); 76 | //TweenIndyMapLine(Screen.Width / 2, Screen.Height / 2, Screen.Width, Screen.Height / 2); 77 | } 78 | 79 | function room_Leave() 80 | { 81 | } 82 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | TERMS OF USE - AGS TWEEN MODULE (ags-tween) 2 | 3 | Copyright (c) 2009-present Edmundo Ruiz Ghanem 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | 23 | 24 | TERMS OF USE - EASING EQUATIONS 25 | 26 | Open source under the BSD License. 27 | 28 | Copyright (c) 2001 Robert Penner 29 | All rights reserved. 30 | 31 | Redistribution and use in source and binary forms, with or without modification, 32 | are permitted provided that the following conditions are met: 33 | 34 | * Redistributions of source code must retain the above copyright notice, this 35 | list of conditions and the following disclaimer. 36 | * Redistributions in binary form must reproduce the above copyright notice, 37 | this list of conditions and the following disclaimer in the documentation 38 | and/or other materials provided with the distribution. 39 | * Neither the name of the author nor the names of contributors may be used to 40 | endorse or promote products derived from this software without 41 | specific prior written permission. 42 | 43 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 44 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 45 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 46 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 47 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 48 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 49 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 50 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 51 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 52 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 53 | -------------------------------------------------------------------------------- /Tween/Tween2Compatibility.asc: -------------------------------------------------------------------------------- 1 | // TERMS OF USE - AGS TWEEN MODULE (ags-tween) 2 | // 3 | // Copyright (c) 2009-present Edmundo Ruiz Ghanem 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE 21 | 22 | #ifdef __TWEEN_MODULE__ 23 | 24 | #ifdef SCRIPT_API_v3507 25 | int TweenViewportX(float timing, int toX, TweenEasingType easingType, TweenStyle style, float startDelay, TweenTimingType timingType) { 26 | return Game.Camera.TweenX(timing, toX, easingType, style, startDelay, timingType); 27 | } 28 | int TweenViewportY(float timing, int toY, TweenEasingType easingType, TweenStyle style, float startDelay, TweenTimingType timingType) { 29 | return Game.Camera.TweenY(timing, toY, easingType, style, startDelay, timingType); 30 | } 31 | int TweenViewport(float timing, int toX, int toY, TweenEasingType easingType, TweenStyle style, float startDelay, TweenTimingType timingType) { 32 | return Game.Camera.TweenPosition(timing, toX, toY, easingType, style, startDelay, timingType); 33 | } 34 | function StopTweenViewport(TweenStopResult result) { 35 | Game.Camera.StopTweenPosition(result); 36 | } 37 | #endif 38 | 39 | int TweenSystemGamma(float timing, int toGamma, TweenEasingType easingType, TweenStyle style, float startDelay, TweenTimingType timingType) { 40 | return System.TweenGamma(timing, toGamma, easingType, style, startDelay, timingType); 41 | } 42 | function StopTweenSystemGamma(TweenStopResult result) { 43 | System.StopTweenGamma(result); 44 | } 45 | 46 | int TweenSystemVolume(float timing, int toVolume, TweenEasingType easingType, TweenStyle style, float startDelay, TweenTimingType timingType) { 47 | return System.TweenVolume(timing, toVolume, easingType, style, startDelay, timingType); 48 | } 49 | function StopTweenSystemVolume(TweenStopResult result) { 50 | System.StopTweenVolume(result); 51 | } 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /Tween/room2.asc: -------------------------------------------------------------------------------- 1 | // room script file 2 | 3 | function room_AfterFadeIn() 4 | { 5 | StartCutscene(eSkipESCOnly); 6 | 7 | player.Say("Welcome to Demo 2."); 8 | player.Say("I'll introduce you to Character tweens and other intermediate effects."); 9 | 10 | player.Say("There are three tween types for a character: Position, Scaling, and Transparency."); 11 | player.Say("From the previous demo, you should be familiar with Position and Transparency, and Scaling works the same way."); 12 | 13 | player.TweenScaling(2.0, 5, eEaseOutTween); // Scale player in 2 seconds to 5% and ease out. 14 | player.TweenScaling(2.0, 200, eEaseInEaseOutTween); // Scale player in 2 seconds to 200% and ease in and out. 15 | 16 | player.Say("That was fun!"); 17 | player.Say("Now I'll show you one of the powers of using the Tween module, which is tweening things without blocking."); 18 | 19 | player.TweenScaling(1.0, 100, eEaseOutTween); 20 | 21 | player.Say("Let's say you want to tween my position without blocking and then have me say something."); 22 | player.Say("What you need to do is use a timer. All non-blocking Tweens return how long (in game loops) they are going to take."); 23 | player.Say("So, here I go, I will tween without blocking and say something:"); 24 | 25 | // Every non-blocking tween function returns the number of cycles it's going to take. 26 | // This way, you can do things like these. You could also use Wait() and make it blocking. 27 | SetTimer(1, player.TweenPosition(2.5, 160, 199, eEaseOutTween, eNoBlockTween)); 28 | } 29 | 30 | function room_RepExec() 31 | { 32 | if (IsTimerExpired(1)) 33 | { 34 | player.Say("I just moved without blocking and waited to say this!"); 35 | 36 | player.Say("Now, we can make this more complicated."); 37 | player.Say("I can tween my position, scale, and transparency at the same time, non-blocking, and say something."); 38 | player.Say("Here we go:"); 39 | 40 | SetTimerForLongest(2, 41 | player.TweenTransparency(2.5, 100, eEaseOutTween, eNoBlockTween), 42 | player.TweenScaling(2.5, 5, eEaseOutTween, eNoBlockTween), 43 | player.TweenPosition(2.5, 160, 100, eEaseInEaseOutTween, eNoBlockTween) 44 | ); 45 | 46 | // Alternatively, you could code it like this: 47 | // float seconds = 2.5; 48 | // player.TweenPosition(seconds, 160, 100, eEaseInEaseOutTween, eNoBlockTween); 49 | // SetTimerInSeconds(2, seconds); 50 | } 51 | 52 | if (IsTimerExpired(2)) 53 | { 54 | player.Say("I'm invisible!"); 55 | 56 | float duration = 2.5; 57 | WaitForLongest( 58 | player.TweenTransparency(duration, 0, eEaseOutTween, eNoBlockTween), 59 | player.TweenScaling(duration, 100, eEaseOutTween, eNoBlockTween) 60 | ); 61 | 62 | player.Say("See? That was easy."); 63 | player.Say("Hopefully, you're thinking about what you can do with this kind of power."); 64 | player.Say("Demo 3 might give you a taste of that."); 65 | 66 | Wait(SecondsToLoops(2.0)); 67 | 68 | EndCutscene(); 69 | player.ChangeRoom(3); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Tween/Tween2Compatibility.ash: -------------------------------------------------------------------------------- 1 | // TERMS OF USE - AGS TWEEN MODULE (ags-tween) 2 | // 3 | // Copyright (c) 2009-present Edmundo Ruiz Ghanem 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE 21 | 22 | #ifdef __TWEEN_MODULE__ 23 | 24 | #ifdef SCRIPT_API_v3507 25 | 26 | /// (Tween 2 Compatibility) Deprecated: Use Game.Camera.TweenX 27 | import int TweenViewportX(float timing, int toX, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 28 | 29 | /// (Tween 2 Compatibility) Deprecated: Use Game.Camera.TweenY 30 | import int TweenViewportY(float timing, int toY, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 31 | 32 | /// (Tween 2 Compatibility) Deprecated: Use Game.Camera.TweenPosition 33 | import int TweenViewport(float timing, int toX, int toY, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 34 | 35 | /// (Tween 2 Compatibility) Deprecated: Use Game.Camera.StopTweenPosition 36 | import function StopTweenViewport(TweenStopResult result=Tween_STOP_RESULT); 37 | 38 | #endif 39 | 40 | /// (Tween 2 Compatibility) Deprecated: Use System.TweenGamma 41 | import int TweenSystemGamma(float timing, int toGamma, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 42 | 43 | /// (Tween 2 Compatibility) Deprecated: Use System.StopTweenGamma 44 | import function StopTweenSystemGamma(TweenStopResult result=Tween_STOP_RESULT); 45 | 46 | /// (Tween 2 Compatibility) Deprecated: Use System.TweenVolume 47 | import int TweenSystemVolume(float timing, int toVolume, TweenEasingType easingType=Tween_EASING_TYPE_AUDIO, TweenStyle style=Tween_STYLE_AUDIO, float startDelay=Tween_START_DELAY_AUDIO, TweenTimingType timingType=Tween_TIMING_AUDIO); 48 | 49 | /// (Tween 2 Compatibility) Deprecated: Use System.StopTweenVolume 50 | import function StopTweenSystemVolume(TweenStopResult result=Tween_STOP_RESULT); 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /Tween/Display2.asc: -------------------------------------------------------------------------------- 1 | // Some variables we need to remember across different funtions. 2 | int _targetWidth, _targetHeight, _targetX, _targetY; 3 | 4 | // Some constant values. 5 | readonly int kFontSize = 9; 6 | readonly int kLineLength = 30; 7 | readonly int kPadding = 9; 8 | 9 | // Tweens the display GUI so we don't have to copy and paste the code. 10 | function _tweenDisplay(int transparency, int toX, int toY, int toWidth, int toHeight, TweenEasingType easing) { 11 | float delay = 0.0; 12 | if(transparency > 50) { 13 | delay = 0.4; 14 | } 15 | gDisplay.StopAllTweens(); 16 | WaitForLongest( 17 | gDisplay.TweenTransparency(0.1, transparency, eEaseLinearTween, eNoBlockTween, delay), 18 | gDisplay.TweenPosition(0.5, toX, toY, easing, eNoBlockTween), 19 | gDisplay.TweenSize(0.5, toWidth, toHeight, easing, eNoBlockTween) 20 | ); 21 | } 22 | 23 | // Uses the message length to resize the GUI and Label properly. 24 | function _reflow(int length) { 25 | _targetWidth = 1; 26 | _targetHeight = (kFontSize - 1); 27 | if (length < kLineLength) { 28 | _targetWidth = length * kFontSize; 29 | } 30 | else { 31 | _targetWidth = kLineLength * kFontSize; 32 | while (length > kLineLength) { 33 | _targetHeight += (kFontSize - 2); 34 | length -= kLineLength; 35 | } 36 | } 37 | 38 | lblDisplay.X = kPadding; 39 | lblDisplay.Width = _targetWidth; 40 | lblDisplay.Height = _targetHeight; 41 | _targetWidth += (kPadding * 2); 42 | _targetHeight += (kPadding * 2); 43 | lblDisplay.Y = _targetHeight; 44 | _targetX = GetScreenWidth() / 2 - _targetWidth / 2; 45 | _targetY = GetScreenHeight() / 2 - _targetHeight / 2; 46 | } 47 | 48 | function noloopcheck Display2(String message) { 49 | // Init 50 | _reflow(message.Length); 51 | gDisplay.Width = 1; 52 | gDisplay.Height = 1; 53 | gDisplay.X = GetScreenWidth() / 2; 54 | gDisplay.Y = GetScreenHeight() - 1; 55 | gDisplay.Transparency = 100; 56 | lblDisplay.Text = message; 57 | gDisplay.Visible = true; 58 | lblDisplay.Visible = false; 59 | 60 | // Tween In 61 | bool wasButtonDown = Mouse.IsButtonDown(eMouseLeft); 62 | lblDisplay.StopAllTweens(); 63 | Tween.IncreaseGameSpeed(); 64 | _tweenDisplay(0, _targetX, _targetY, _targetWidth, _targetHeight, eEaseOutBackTween); 65 | lblDisplay.Visible = true; 66 | lblDisplay.TweenY(0.3, kPadding, eEaseOutSineTween, eBlockTween); 67 | 68 | // Remember mouse mode, change it, and wait for input 69 | if (game.skip_display == eSkipTime) { 70 | WaitSeconds(IntToFloat(message.Length)/IntToFloat(Game.TextReadingSpeed)); 71 | } 72 | else { 73 | CursorMode previousMode = mouse.Mode; 74 | mouse.Mode = eModeWait; 75 | mouse.ChangeModeGraphic(eModeWait, mouse.GetModeGraphic(eModePointer)); 76 | while(!Mouse.IsButtonDown(eMouseLeft) || wasButtonDown) { 77 | if(!Mouse.IsButtonDown(eMouseLeft)) { 78 | wasButtonDown = false; 79 | } 80 | Wait(1); 81 | } 82 | mouse.UseDefaultGraphic(); 83 | mouse.Mode = previousMode; 84 | } 85 | 86 | // Tween Out 87 | lblDisplay.TweenY(0.3, -lblDisplay.Height, eEaseInSineTween, eBlockTween); 88 | lblDisplay.Visible = false; 89 | _tweenDisplay(100, GetScreenWidth() / 2, -1, 1, 1, eEaseInBackTween); 90 | gDisplay.Visible = false; 91 | Tween.RestoreGameSpeed(); 92 | } 93 | -------------------------------------------------------------------------------- /Tween/room3.asc: -------------------------------------------------------------------------------- 1 | // room script file 2 | bool _useFancyIconbar = false; 3 | bool _iconbarVisible = false; 4 | 5 | // Make sure you call this when you click a button on the iconbar and want to hide it. 6 | function HideIconbar() 7 | { 8 | _iconbarVisible = false; 9 | gIconbar.StopAllTweens(); 10 | gIconbar.TweenTransparency(0.4, 100, eEaseOutTween, eNoBlockTween); 11 | } 12 | // Shows the iconbar with some tween action! 13 | function ShowIconbar() 14 | { 15 | gIconbar.SetPosition(0, -gIconbar.Height); 16 | gIconbar.Transparency = 100; 17 | _iconbarVisible = true; 18 | 19 | gIconbar.StopAllTweens(); 20 | gIconbar.TweenPosition(0.4, 0, 0, eEaseOutBackTween, eNoBlockTween); 21 | gIconbar.TweenTransparency(0.4, 0, eEaseInEaseOutTween, eNoBlockTween); 22 | } 23 | 24 | // Enter room (after fadein): 25 | function room_AfterFadeIn() 26 | { 27 | StartCutscene(eSkipESCOnly); 28 | Display2("Welcome to Demo 3."); 29 | Display2("Here we will demonstrate some GUI Tweens that hopefully can improve your GUIs."); 30 | Display2("Like Room Objects and Characters, GUIs can both be tweened in Position and Transparency."); 31 | Display2("You can also tween GUI elements like Labels, Lists, etc!"); 32 | Display2("Note that on the Tween script module header, you can customize whether GUI tweens are blocking or not by default."); 33 | Display2("Let's tween the size:"); 34 | 35 | int width = gStatusline.Width; 36 | int height = gStatusline.Height; 37 | 38 | gStatusline.TweenSize(2.0, GetScreenWidth(), GetScreenHeight(), eEaseOutTween, eBlockTween); 39 | gStatusline.TweenPosition(2.0, GetScreenHeight() / 2, GetScreenHeight() / 2, eEaseInTween, eNoBlockTween); 40 | gStatusline.TweenSize(2.0, 0, 0, eEaseInTween, eBlockTween); 41 | gStatusline.TweenPosition(2.0, 0, 0, eEaseOutExpoTween, eNoBlockTween); 42 | gStatusline.TweenSize(2.0, width, height, eEaseOutExpoTween, eBlockTween); 43 | 44 | Display2("Wasn't that fun?"); 45 | gStatusline.TweenTransparency(0.5, 100, eEaseLinearTween, eNoBlockTween); 46 | Display2("Now, here's what we're going to do:"); 47 | gIconbar.SetPosition(0, 0); 48 | gIconbar.Visible = true; 49 | Display2("The default Iconbar in AGS is very stale."); 50 | Display2("What if it could fade in while sliding down when putting the mouse over, and fades out when the mouse goes away?"); 51 | Display2("You could probably do it blocking with a Wait statement forcing the player to wait for the animation."); 52 | Display2("That's annoying!"); 53 | gIconbar.Visible = false; 54 | Display2("How about this:"); 55 | 56 | // Note that for this to work, you have to change the iconbar away from the "popup on mouse Y" mode. 57 | _useFancyIconbar = true; 58 | Wait(SecondsToLoops(1.0)); 59 | 60 | Display2("Well, go ahead! Move your cursor up to the iconbar and see the difference."); 61 | Display2("(This is the end of the demo, by the way, so enjoy that new iconbar.)"); 62 | 63 | EndCutscene(); 64 | } 65 | 66 | // Repeatedly execute: 67 | function room_RepExec() 68 | { 69 | // Normally, you would put this check on the global script repeatedly_execute function. 70 | if (_useFancyIconbar) 71 | { 72 | if (mouse.y > gIconbar.Height && _iconbarVisible) 73 | { 74 | HideIconbar(); 75 | } 76 | 77 | if (mouse.y <= 13 && !gIconbar.Visible && !IsGamePaused()) 78 | { 79 | ShowIconbar(); 80 | } 81 | } 82 | } 83 | 84 | function room_Load() 85 | { 86 | gStatusline.Visible = true; 87 | } 88 | 89 | function room_Leave() 90 | { 91 | gStatusline.Visible = false; 92 | } 93 | -------------------------------------------------------------------------------- /Tween/TweenThrow.asc: -------------------------------------------------------------------------------- 1 | // TERMS OF USE - AGS TWEEN MODULE (ags-tween) 2 | // 3 | // Copyright (c) 2009-present Edmundo Ruiz Ghanem 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | #ifdef __TWEEN_MODULE__ 23 | 24 | #define MAX_PARABOLA_TWEENS 8 25 | 26 | managed struct Parabola { 27 | float A; 28 | float B; 29 | float C; 30 | 31 | import float GetY(float x); 32 | import int GetYInt(int x); 33 | }; 34 | 35 | Tween _objXTweens[MAX_PARABOLA_TWEENS]; 36 | Parabola* _parabolas[MAX_PARABOLA_TWEENS]; 37 | int _idx2ObjID[MAX_PARABOLA_TWEENS]; 38 | 39 | Parabola* CreateParabola(float x1, float y1, float x2, float y2, float x3, float y3) { 40 | // Calculate the determinants 41 | readonly float D = x1*x1*(x2 - x3) + x2*x2*(x3 - x1) + x3*x3*(x1 - x2); 42 | readonly float D1 = y1*(x2 - x3) + y2*(x3 - x1) + y3*(x1 - x2); 43 | readonly float D2 = x1*x1*(y2 - y3) + x2*x2*(y3 - y1) + x3*x3*(y1 - y2); 44 | readonly float D3 = x1*x1*(x2*y3 - x3*y2) + x2*x2*(x3*y1 - x1*y3) + x3*x3*(x1*y2 - x2*y1); 45 | 46 | Parabola* p = new Parabola; 47 | p.A = D1 / D; 48 | p.B = D2 / D; 49 | p.C = D3 / D; 50 | 51 | return p; 52 | } 53 | 54 | Parabola* CreateParabolaInt(int x1, int y1, int x2, int y2, int x3, int y3) { 55 | return CreateParabola( 56 | IntToFloat(x1), 57 | IntToFloat(y1), 58 | IntToFloat(x2), 59 | IntToFloat(y2), 60 | IntToFloat(x3), 61 | IntToFloat(y3) 62 | ); 63 | } 64 | 65 | float Parabola::GetY(float x) { 66 | return this.A*(x*x) + this.B*x + this.C; 67 | } 68 | 69 | int Parabola::GetYInt(int x) { 70 | return FloatToInt(this.GetY(IntToFloat(x)), eRoundDown); 71 | } 72 | 73 | int FindFreeIndex() { 74 | for (int i = 0; i < MAX_PARABOLA_TWEENS; i++) { 75 | if (!_objXTweens[i].IsPlaying()) return i; 76 | } 77 | 78 | return -1; 79 | } 80 | 81 | int TweenThrow(this Object*, float timing, int peakX, int peakY, int endX, int endY, TweenEasingType easingType, TweenStyle style, float startDelay, TweenTimingType timingType) { 82 | readonly int idx = FindFreeIndex(); 83 | if (idx < 0) { 84 | AbortGame("Too many throw tweens running. Max: %d", MAX_PARABOLA_TWEENS); 85 | return 0; 86 | } 87 | 88 | _idx2ObjID[idx] = this.ID; 89 | _parabolas[idx] = CreateParabolaInt(this.X, this.Y, peakX, peakY, endX, endY); 90 | readonly int loops = _objXTweens[idx].Init(timing, this.X, endX, easingType, style, startDelay, timingType); 91 | 92 | //System.Log(eLogInfo, "%d,%d %d,%d %d,%d", this.X, this.Y, peakX, peakY, endX, endY); 93 | //System.Log(eLogInfo, "%f %f %f", _parabolas[idx].A, _parabolas[idx].B, _parabolas[idx].C); 94 | 95 | if (style == eBlockTween) { 96 | Wait(loops); 97 | return 1; 98 | } 99 | 100 | return loops; 101 | } 102 | 103 | #region Events 104 | 105 | void game_start() { 106 | for (int i = 0; i < MAX_PARABOLA_TWEENS; i++) { 107 | _objXTweens[i].Stop(); 108 | } 109 | } 110 | 111 | void on_event(EventType event, int data) { 112 | if (event == eEventLeaveRoom) { 113 | for (int i = 0; i < MAX_PARABOLA_TWEENS; i++) { 114 | if (_objXTweens[i].IsPlaying()) { 115 | _objXTweens[i].Stop(); 116 | } 117 | } 118 | } 119 | } 120 | 121 | void repeatedly_execute_always() { 122 | if (IsGamePaused()) return; 123 | 124 | int objID; 125 | 126 | for (int i = 0; i < MAX_PARABOLA_TWEENS; i++) { 127 | if (!_objXTweens[i].Update()) continue; 128 | 129 | objID = _idx2ObjID[i]; 130 | object[objID].X = _objXTweens[i].Value; 131 | object[objID].Y = _parabolas[i].GetYInt(_objXTweens[i].Value); 132 | } 133 | } 134 | 135 | #endregion // Events 136 | 137 | #endif // __TWEEN_MODULE__ 138 | -------------------------------------------------------------------------------- /Tween/room306.asc: -------------------------------------------------------------------------------- 1 | // Overlay tests (room 306) script file 2 | 3 | Overlay* _overlay; 4 | 5 | #ifdef SCRIPT_API_v360 6 | int _overlayWidth; 7 | int _overlayHeight; 8 | #endif 9 | 10 | function _RestoreOverlay() { 11 | _overlay.X = 0; 12 | _overlay.Y = 0; 13 | 14 | #ifdef SCRIPT_API_v360 15 | _overlay.Width = _overlayWidth; 16 | _overlay.Height = _overlayHeight; 17 | _overlay.Transparency = 0; 18 | #endif 19 | } 20 | 21 | function testPosition() { 22 | Test("Position"); 23 | 24 | _overlay.TweenPosition(0.5, Room.Width, Room.Height); 25 | ExpectIntToBe(_overlay.X, Room.Width, "Position X"); 26 | ExpectIntToBe(_overlay.Y, Room.Height, "Position Y"); 27 | 28 | _RestoreOverlay(); 29 | 30 | _overlay.TweenX(0.5, Room.Width); 31 | ExpectIntToBe(_overlay.X, Room.Width, "X X"); 32 | ExpectIntToBe(_overlay.Y, 0, "X Y"); 33 | 34 | _RestoreOverlay(); 35 | 36 | _overlay.TweenY(0.5, Room.Height); 37 | ExpectIntToBe(_overlay.X, 0, "Y X"); 38 | ExpectIntToBe(_overlay.Y, Room.Height, "Y Y"); 39 | 40 | _RestoreOverlay(); 41 | 42 | _overlay.TweenPosition(0.5, Room.Width, Room.Height, eEaseLinearTween, eNoBlockTween); 43 | _overlay.StopTweenPosition(eFinishTween); 44 | ExpectIntToBe(_overlay.X, Room.Width, "Stop X"); 45 | ExpectIntToBe(_overlay.Y, Room.Height, "Stop Y"); 46 | 47 | _RestoreOverlay(); 48 | } 49 | 50 | function testSize() { 51 | #ifdef SCRIPT_API_v360 52 | Test("Size"); 53 | 54 | _overlay.TweenSize(0.5, Room.Width, Room.Height); 55 | ExpectIntToBe(_overlay.Width, Room.Width, "Size Width"); 56 | ExpectIntToBe(_overlay.Height, Room.Height, "Size Height"); 57 | 58 | _RestoreOverlay(); 59 | 60 | _overlay.TweenSize(0.5, -1, -1); 61 | ExpectIntToBe(_overlay.Width, 1, "Min Width"); 62 | ExpectIntToBe(_overlay.Height, 1, "Min Height"); 63 | 64 | _RestoreOverlay(); 65 | 66 | _overlay.TweenWidth(0.5, Room.Width); 67 | ExpectIntToBe(_overlay.Width, Room.Width, "Width Width"); 68 | ExpectIntToBe(_overlay.Height, _overlayHeight, "Width Height"); 69 | 70 | _RestoreOverlay(); 71 | 72 | _overlay.TweenHeight(0.5, Room.Height); 73 | ExpectIntToBe(_overlay.Width, _overlayWidth, "Height Width"); 74 | ExpectIntToBe(_overlay.Height, Room.Height, "Height Height"); 75 | 76 | _RestoreOverlay(); 77 | 78 | _overlay.TweenSize(0.5, Room.Width, Room.Height, eEaseLinearTween, eNoBlockTween); 79 | _overlay.StopTweenSize(eFinishTween); 80 | ExpectIntToBe(_overlay.Width, Room.Width, "Stop Width"); 81 | ExpectIntToBe(_overlay.Height, Room.Height, "Stop Height"); 82 | 83 | _RestoreOverlay(); 84 | #endif 85 | } 86 | 87 | function testTransparency() { 88 | #ifdef SCRIPT_API_v360 89 | Test("Transparency"); 90 | 91 | _overlay.Transparency = 0; 92 | _overlay.TweenTransparency(0.5, 50); 93 | ExpectIntToBe(_overlay.Transparency, 50, "Transparency"); 94 | 95 | _RestoreOverlay(); 96 | 97 | _overlay.Transparency = 100; 98 | _overlay.TweenTransparency(0.5, -20); 99 | ExpectIntToBe(_overlay.Transparency, 0, "Min Transparency"); 100 | 101 | _RestoreOverlay(); 102 | 103 | _overlay.TweenTransparency(0.5, 120); 104 | ExpectIntToBe(_overlay.Transparency, 100, "Max Transparency"); 105 | 106 | _RestoreOverlay(); 107 | 108 | _overlay.TweenTransparency(0.5, 50, eEaseLinearTween, eNoBlockTween); 109 | _overlay.StopTweenTransparency(eFinishTween); 110 | ExpectIntToBe(_overlay.Transparency, 50, "Stop Transparency"); 111 | 112 | _RestoreOverlay(); 113 | 114 | _overlay.TweenFadeOut(0.5); 115 | ExpectIntToBe(_overlay.Transparency, 100, "FadeOut"); 116 | 117 | _overlay.TweenFadeIn(0.5); 118 | ExpectIntToBe(_overlay.Transparency, 0, "FadeIn"); 119 | 120 | _RestoreOverlay(); 121 | #endif 122 | } 123 | 124 | 125 | function testStopAll() { 126 | Test("StopAll"); 127 | 128 | _overlay.TweenPosition(0.5, Room.Width, Room.Height, eEaseLinearTween, eNoBlockTween); 129 | #ifdef SCRIPT_API_v360 130 | _overlay.TweenTransparency(0.5, 50, eEaseLinearTween, eNoBlockTween); 131 | #endif 132 | 133 | _overlay.StopAllTweens(eFinishTween); 134 | 135 | ExpectIntToBe(_overlay.X, Room.Width, "X"); 136 | ExpectIntToBe(_overlay.Y, Room.Height, "Y"); 137 | #ifdef SCRIPT_API_v360 138 | ExpectIntToBe(_overlay.Transparency, 50, "Transparency"); 139 | #endif 140 | 141 | _RestoreOverlay(); 142 | } 143 | 144 | function room_Load() 145 | { 146 | _overlay = Overlay.CreateTextual(0, 0, 120, eFontNormal, 15, "Hello, world!"); 147 | #ifdef SCRIPT_API_v360 148 | _overlayWidth = _overlay.Width; 149 | _overlayHeight = _overlay.Height; 150 | #endif 151 | } 152 | 153 | function room_AfterFadeIn() 154 | { 155 | StartCutscene(eSkipESCOnly); 156 | 157 | testPosition(); 158 | testSize(); 159 | testTransparency(); 160 | testStopAll(); 161 | 162 | EndCutscene(); 163 | player.ChangeRoom(99); 164 | } 165 | 166 | function room_Leave() 167 | { 168 | _overlay.Remove(); 169 | _overlay = null; 170 | } 171 | -------------------------------------------------------------------------------- /Tween/EasingDemo.asc: -------------------------------------------------------------------------------- 1 | #define MAX_TWEENGRAPHS 3 2 | int _index; 3 | Tween _tweenX[MAX_TWEENGRAPHS]; 4 | Tween _tweenY[MAX_TWEENGRAPHS]; 5 | 6 | struct _TweenGraph { 7 | int index; 8 | int previousX; 9 | int previousY; 10 | import function Init(String description, int x, int y, int width, int height, TweenEasingType easingX, TweenEasingType easingY, bool inverseY); 11 | import function Update(); 12 | import bool IsPlaying(); 13 | }; 14 | 15 | function _TweenGraph::Init(String description, int x, int y, int width, int height, TweenEasingType easingX, TweenEasingType easingY, bool inverseY) { 16 | _tweenX[this.index].Init(2.5, x + 1, width - 1, easingX); 17 | this.previousX = x + 1; 18 | 19 | if (inverseY) { 20 | _tweenY[this.index].Init(2.5, height - 1, y + 1, easingY); 21 | this.previousY = height - 1; 22 | } 23 | else { 24 | _tweenY[this.index].Init(2.5, y + 1, height - 1, easingY); 25 | this.previousY = y + 1; 26 | } 27 | 28 | DrawingSurface *surface = Room.GetDrawingSurfaceForBackground(); 29 | surface.DrawingColor = 8; 30 | surface.DrawRectangle(x, y, width, height); 31 | surface.DrawingColor = 0; 32 | surface.DrawRectangle(x + 1, y + 1, width - 1, height - 1); 33 | surface.DrawingColor = 8; 34 | surface.DrawString(x + ((width / 2) - (description.Length*9 / 2)), y + 2, Game.SpeechFont, description); 35 | surface.Release(); 36 | } 37 | 38 | bool _TweenGraph::IsPlaying() { 39 | return _tweenX[this.index].IsPlaying() && _tweenY[this.index].IsPlaying(); 40 | } 41 | 42 | function _TweenGraph::Update() { 43 | if (this.IsPlaying()) { 44 | _tweenX[this.index].Update(); 45 | _tweenY[this.index].Update(); 46 | 47 | DrawingSurface *surface = Room.GetDrawingSurfaceForBackground(); 48 | surface.DrawingColor = Game.GetColorFromRGB( 49 | 255, 50 | FloatToInt(255.0 * _tweenX[this.index].GetProgress(), eRoundNearest), 51 | 0); 52 | surface.DrawLine(this.previousX, this.previousY, _tweenX[this.index].Value, _tweenY[this.index].Value, 1); 53 | surface.Release(); 54 | 55 | this.previousX = _tweenX[this.index].Value; 56 | this.previousY = _tweenY[this.index].Value; 57 | } 58 | } 59 | 60 | /// --- END _TweenGraph OBJECT --- /// 61 | 62 | _TweenGraph _tweenGraphs[MAX_TWEENGRAPHS]; 63 | TweenEasingType _easingX; 64 | TweenEasingType _easingY; 65 | String _easingNames[31]; 66 | 67 | function DrawTweenCurve(int margin, int width, int height) { 68 | DrawingSurface *surface = Room.GetDrawingSurfaceForBackground(); 69 | surface.Clear(); 70 | surface.Release(); 71 | _tweenGraphs[0].Init("Combined X and Y", margin, margin, width - margin, height / 2, _easingX, _easingY, true); 72 | if (true) { 73 | _tweenGraphs[1].Init("X Only", margin, height / 2, width - margin, height - margin / 2 - height / 4, _easingX, eEaseLinearTween, true); 74 | _tweenGraphs[2].Init("Y Only", margin, height - margin / 2 - height / 4, width - margin, height - margin, eEaseLinearTween, _easingY, true); 75 | } 76 | else { 77 | _tweenGraphs[1].Init("X Over Time", margin, height / 2, width - margin, height - margin / 2 - height / 4, eEaseLinearTween, _easingX, true); 78 | _tweenGraphs[2].Init("Y Over Time", margin, height - margin / 2 - height / 4, width - margin, height - margin, eEaseLinearTween, _easingY, true); 79 | } 80 | } 81 | 82 | function UpdateTweenCurve(TweenEasingType easingX, TweenEasingType easingY) { 83 | if(_easingX == easingX && _easingY == easingY) { 84 | //return; 85 | } 86 | _easingX = easingX; 87 | _easingY = easingY; 88 | DrawTweenCurve(5, gEasing.X, GetScreenHeight()); 89 | } 90 | 91 | function StartCurve() { 92 | UpdateTweenCurve(eEaseLinearTween, eEaseLinearTween); 93 | } 94 | 95 | function game_start() { 96 | Tween.IncreaseGameSpeed(); 97 | 98 | _easingNames[0] = "Linear"; 99 | _easingNames[1] = "InSine"; 100 | _easingNames[2] = "OutSine"; 101 | _easingNames[3] = "InOutSine"; 102 | _easingNames[4] = "InQuad"; 103 | _easingNames[5] = "OutQuad"; 104 | _easingNames[6] = "InOutQuad"; 105 | _easingNames[7] = "InCubic"; 106 | _easingNames[8] = "OutCubic"; 107 | _easingNames[9] = "InOutCubic"; 108 | _easingNames[10] = "InQuart"; 109 | _easingNames[11] = "OutQuart"; 110 | _easingNames[12] = "InOutQuart"; 111 | _easingNames[13] = "InQuint"; 112 | _easingNames[14] = "OutQuint"; 113 | _easingNames[15] = "InOutQuint"; 114 | _easingNames[16] = "InCirc"; 115 | _easingNames[17] = "OutCirc"; 116 | _easingNames[18] = "InOutCirc"; 117 | _easingNames[19] = "InExpo"; 118 | _easingNames[20] = "OutExpo"; 119 | _easingNames[21] = "InOutExpo"; 120 | _easingNames[22] = "InBack"; 121 | _easingNames[23] = "OutBack"; 122 | _easingNames[24] = "InOutBack"; 123 | _easingNames[25] = "InElastic"; 124 | _easingNames[26] = "OutElastic"; 125 | _easingNames[27] = "InOutElastic"; 126 | _easingNames[28] = "InBounce"; 127 | _easingNames[29] = "OutBounce"; 128 | _easingNames[30] = "InOutBounce"; 129 | 130 | int i; 131 | for (i = 0; i < 31; i++) { 132 | lstEasingX.AddItem(_easingNames[i]); 133 | lstEasingY.AddItem(_easingNames[i]); 134 | i++; 135 | } 136 | 137 | for (i = 0; i < MAX_TWEENGRAPHS; i++) { 138 | _tweenGraphs[i].index = i; 139 | } 140 | } 141 | 142 | function repeatedly_execute_always() { 143 | if (!gEasing.Visible) { 144 | return; 145 | } 146 | 147 | for (int i = 0; i < MAX_TWEENGRAPHS; i++) { 148 | _tweenGraphs[i].Update(); 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /Tween/room4.asc: -------------------------------------------------------------------------------- 1 | // room script file 2 | struct Position { 3 | int x; 4 | int y; 5 | }; 6 | 7 | Position pT; 8 | Position pW; 9 | Position pE; 10 | Position pE1; 11 | Position pN; 12 | 13 | function _remember() { 14 | pT.x = oT.X; 15 | pT.y = oT.Y; 16 | oT.Y = oN.Y; 17 | 18 | pW.x = oW.X; 19 | pW.y = oW.Y; 20 | oW.Y = oN.Y; 21 | 22 | pE.x = oE.X; 23 | pE.y = oE.Y; 24 | oE.Y = oN.Y; 25 | 26 | pE1.x = oE1.X; 27 | pE1.y = oE1.Y; 28 | oE1.Y = oN.Y; 29 | 30 | pN.x = oN.X; 31 | pN.y = oN.Y; 32 | } 33 | 34 | function room_AfterFadeIn() 35 | { 36 | mouse.Visible = false; 37 | game.skip_display = eSkipTime; 38 | AudioChannel *channel = aOdyssey.Play(); 39 | 40 | Tween.IncreaseGameSpeed(); 41 | WaitSeconds(12.0); 42 | gPreview.TweenTransparency(5.0, 100, eEaseOutSineTween); 43 | WaitSeconds(1.0); 44 | 45 | float amount = 10.0; 46 | oT.TweenY(amount, pT.y, eEaseInSineTween, eNoBlockTween); 47 | oT.TweenTransparency(amount, 0, eEaseOutSineTween, eNoBlockTween); 48 | oW.TweenY(amount, pW.y, eEaseInSineTween, eNoBlockTween); 49 | oW.TweenTransparency(amount, 0, eEaseOutSineTween, eNoBlockTween); 50 | oE.TweenY(amount, pE.y, eEaseInSineTween, eNoBlockTween); 51 | oE.TweenTransparency(amount, 0, eEaseOutSineTween, eNoBlockTween); 52 | oE1.TweenY(amount, pE1.y, eEaseInSineTween, eNoBlockTween); 53 | oE1.TweenTransparency(amount, 0, eEaseOutSineTween, eNoBlockTween); 54 | oN.TweenTransparency(amount, 0, eEaseOutSineTween, eNoBlockTween); 55 | 56 | Tween.WaitForAllToFinish(); 57 | Display2("TWEEN 2 IS COMING SOON!"); 58 | WaitSeconds(2.0); 59 | 60 | amount = 100.0; 61 | oT.TweenX(amount, 10, eEaseOutSineTween, eNoBlockTween, 0.0, eTweenSpeed); 62 | oT.TweenY(amount, pN.y, eEaseOutBounceTween, eNoBlockTween, 0.0, eTweenSpeed); 63 | 64 | oW.TweenX(amount, 70, eEaseOutSineTween, eNoBlockTween, 1.0, eTweenSpeed); 65 | oW.TweenY(amount, pN.y, eEaseOutBounceTween, eNoBlockTween, 1.0, eTweenSpeed); 66 | 67 | oE.TweenX(amount, 140, eEaseOutSineTween, eNoBlockTween, 2.0, eTweenSpeed); 68 | oE.TweenY(amount, pN.y, eEaseOutBounceTween, eNoBlockTween, 2.0, eTweenSpeed); 69 | 70 | oE1.TweenX(amount, 200, eEaseOutSineTween, eNoBlockTween, 2.5, eTweenSpeed); 71 | oE1.TweenY(amount, pN.y, eEaseOutBounceTween, eNoBlockTween, 2.5, eTweenSpeed); 72 | 73 | Tween.WaitForAllToFinish(); 74 | 75 | Display2("...with Bounce animations!"); 76 | 77 | WaitSeconds(4.0); 78 | 79 | amount = 3.5; 80 | oT.TweenY(amount, 70, eEaseOutBackTween, eNoBlockTween); 81 | oW.TweenY(amount, 70, eEaseOutBackTween, eNoBlockTween); 82 | oE.TweenY(amount, 70, eEaseOutBackTween, eNoBlockTween); 83 | oE1.TweenY(amount, 70, eEaseOutBackTween, eNoBlockTween); 84 | oN.TweenY(amount, 70, eEaseOutBackTween, eNoBlockTween); 85 | 86 | Tween.WaitForAllToFinish(); 87 | Display2("And featuring 25 easing equations..."); 88 | 89 | _remember(); 90 | 91 | amount = 70.0; 92 | oT.TweenX(amount, -100, eEaseInBackTween, eNoBlockTween, 0.0, eTweenSpeed); 93 | oW.TweenX(amount, -100, eEaseInBackTween, eNoBlockTween, 0.0, eTweenSpeed); 94 | oE.TweenX(amount, -100, eEaseInBackTween, eNoBlockTween, 0.0, eTweenSpeed); 95 | oE1.TweenX(amount, GetScreenWidth(), eEaseInBackTween, eNoBlockTween, 0.0, eTweenSpeed); 96 | oN.TweenX(amount, GetScreenHeight(), eEaseInBackTween, eNoBlockTween, 0.0, eTweenSpeed); 97 | 98 | Tween.WaitForAllToFinish(); 99 | 100 | oT.Y = -100; 101 | oW.Y = GetScreenWidth(); 102 | oE.Y = -100; 103 | oE1.Y = GetScreenHeight(); 104 | oN.Y = -100; 105 | 106 | Display2("...to move objects like that!"); 107 | Display2("And many more goodies..."); 108 | Display2("...such as..."); 109 | Display2("...elastic easing!"); 110 | 111 | amount = 4.0; 112 | oT.TweenX(amount, pT.x, eEaseOutElasticTween, eNoBlockTween, 0.0); 113 | oT.TweenY(amount, pT.y, eEaseOutElasticTween, eNoBlockTween, 0.0); 114 | 115 | oW.TweenX(amount, pW.x, eEaseOutElasticTween, eNoBlockTween, 0.5); 116 | oW.TweenY(amount, pW.y, eEaseOutElasticTween, eNoBlockTween, 0.5); 117 | 118 | oE.TweenX(amount, pE.x, eEaseOutElasticTween, eNoBlockTween, 1.0); 119 | oE.TweenY(amount, pE.y, eEaseOutElasticTween, eNoBlockTween, 1.0); 120 | 121 | oE1.TweenX(amount, pE1.x, eEaseOutElasticTween, eNoBlockTween, 1.5); 122 | oE1.TweenY(amount, pE1.y, eEaseOutElasticTween, eNoBlockTween, 1.5); 123 | 124 | oN.TweenX(amount, pN.x, eEaseOutElasticTween, eNoBlockTween, 2.0); 125 | oN.TweenY(amount, pN.y, eEaseOutElasticTween, eNoBlockTween, 2.0); 126 | 127 | Tween.WaitForAllToFinish(); 128 | 129 | Display2("Play ALL tweens by SPEED OR SECONDS, or DELAY the start."); 130 | Display2("And even create YOUR OWN tweens!"); 131 | Display2("Tween 2 is destined to be..."); 132 | Display2("...THE BEST..."); 133 | Display2("...MODULE..."); 134 | Display2("...EVER!"); 135 | Display2("(until Tween 3)"); 136 | 137 | amount = 7.0; 138 | oT.TweenTransparency(amount, 100, eEaseOutCubicTween, eNoBlockTween); 139 | oW.TweenTransparency(amount, 100, eEaseOutCubicTween, eNoBlockTween); 140 | oE.TweenTransparency(amount, 100, eEaseOutCubicTween, eNoBlockTween); 141 | oE1.TweenTransparency(amount, 100, eEaseOutCubicTween, eNoBlockTween); 142 | oN.TweenTransparency(amount, 100, eEaseOutCubicTween, eNoBlockTween); 143 | 144 | Tween.WaitForAllToFinish(); 145 | 146 | while(channel.IsPlaying) { 147 | Wait(1); 148 | } 149 | 150 | Tween.RestoreGameSpeed(); 151 | QuitGame(0); 152 | } 153 | 154 | function room_Load() 155 | { 156 | gPreview.Visible = true; 157 | pT.x = oT.X; 158 | pT.y = oT.Y; 159 | oT.Y = oN.Y; 160 | oT.Transparency = 100; 161 | 162 | pW.x = oW.X; 163 | pW.y = oW.Y; 164 | oW.Y = oN.Y; 165 | oW.Transparency = 100; 166 | 167 | pE.x = oE.X; 168 | pE.y = oE.Y; 169 | oE.Y = oN.Y; 170 | oE.Transparency = 100; 171 | 172 | pE1.x = oE1.X; 173 | pE1.y = oE1.Y; 174 | oE1.Y = oN.Y; 175 | oE1.Transparency = 100; 176 | 177 | pN.x = oN.X; 178 | pN.y = oN.Y; 179 | oN.Transparency = 100; 180 | } 181 | 182 | function room_RepExec() 183 | { 184 | } 185 | -------------------------------------------------------------------------------- /Tween/room1.asc: -------------------------------------------------------------------------------- 1 | // room script file 2 | // Tween Tutorial 1: Room Objects and the basics of Tween 3 | // Room 1 has a room object called oBall (a red ball) 4 | 5 | function room_AfterFadeIn() 6 | { 7 | StartCutscene(eSkipESCOnly); 8 | player.Say("The Tween module allows you to programatically create animated effects with many of the AGS objects including Objects, Characters, and GUIs."); 9 | player.Say("Let's go over the basics."); 10 | 11 | // SecondsToLoops comes with the Tween module. 12 | // It allows you to convert seconds to AGS game loops without thinking about the game's framerate. 13 | Wait(SecondsToLoops(0.5)); // Wait half asecond. 14 | // For convenience you can also use WaitSeconds: 15 | WaitSeconds(0.5); 16 | 17 | player.Say("Room Objects, for example, have three Tween types: Position, Transparency, and Image."); 18 | player.Say("Let's mess around with the position and transparency."); 19 | oBall.Visible = true; 20 | player.Say("We'll use this red 'ball'."); 21 | 22 | 23 | player.Say("Let's tween its transparency by fading it out:"); 24 | // Tween the ball's transparency from its current transparency to 100%. 25 | oBall.TweenTransparency(2.5, 100); // Note that transparency must be from 0 to 100%. 26 | player.Say("And fading it in to 50%."); 27 | oBall.TweenTransparency(2.5, 50); 28 | player.Say("And fading it in to 100%."); 29 | oBall.TweenTransparency(2.5, 0); // 0% transparency in AGS means 100% visible ;) 30 | 31 | 32 | player.Say("Now, let's tween the ball's position to move it around."); 33 | // Tween the ball's position in 1.5 seconds from its current position to x: 0 and y: 120 34 | oBall.TweenPosition(1.5, 0, 120, eEaseInOutBackTween); 35 | 36 | 37 | int ballX = oBall.X; 38 | int ballY = oBall.Y; 39 | 40 | player.Say("If you're familiar with AGS, you're probably thinking: \"I could have used the Object.Move() function!\""); 41 | player.Say("All tweens have a feature that AGS lacks which we'll call Timing."); 42 | player.Say("Timing is an optional parameter in all Tweens that can tell whether the object should accelerate on start, decelerate at the end, or do both."); 43 | player.Say("We call these EaseIn, EaseOut, and EaseInEaseOut."); 44 | player.Say("By default, the timing is just Linear."); 45 | oBall.TweenPosition(2.0, 279, 120, eLinearTween); 46 | 47 | player.Say("EaseIn. Notice how it starts out slow."); 48 | oBall.TweenPosition(2.0, 0, 120, eEaseInBounceTween); 49 | 50 | player.Say("EaseOut. Notice how it slows down at the end."); 51 | oBall.TweenPosition(2.0, 279, 120, eEaseOutBounceTween); 52 | 53 | player.Say("EaseInEaseOut. Notice how it both accelerates and decelerates."); 54 | oBall.TweenPosition(2.0, 0, 120, eEaseInOutBounceTween); 55 | 56 | player.Say("And here's Object.Move() for comparison."); 57 | oBall.Move(279, 120, 4, eBlock, eAnywhere); 58 | 59 | player.Say("I hope you noted how smoother you can make your movements with these!"); 60 | 61 | player.Say("Another thing you can do is that you can set the tween to Block and NoBlock."); 62 | player.Say("You can also set it to Repeat, or to reverse when repeating."); 63 | player.Say("Here's repeat:"); 64 | // All non-blocking tweens return their duration in loops. 65 | Wait(oBall.TweenPosition(1.0, 0, 120, eEaseOutBounceTween, eRepeatTween) * 3); // Wait 3 repeats 66 | oBall.StopAllTweens(); // This can stop all the tweens affecting an object. 67 | player.Say("And here's ReverseRepeat in action:"); 68 | 69 | Wait(oBall.TweenPosition(1.0, 279, 120, eEaseOutBounceTween, eReverseRepeatTween) * 4); // Wait 4 repeats 70 | oBall.StopAllTweens(); 71 | 72 | player.Say("Note that the repeats are only non-blocking."); 73 | player.Say("It doesn't make sense to infintely repeat something and have the game wait forever, right?"); 74 | 75 | Wait(SecondsToLoops(2.0)); 76 | 77 | player.Say("You can also control when and how to stop the tweens."); 78 | player.Say("Let's go back to that earlier tween we were playing with:"); 79 | float duration = 2.0; 80 | oBall.X = ballX; 81 | oBall.Y = ballY; 82 | oBall.Transparency = 0; 83 | oBall.TweenPosition(duration, 279, 120, eLinearTween); 84 | 85 | player.Say("We can stop a non-blocking tween at any time. Let's run the tween the same way but stop it half way."); 86 | oBall.X = ballX; 87 | oBall.Y = ballY; 88 | oBall.TweenPosition(duration, 279, 120, eLinearTween, eNoBlockTween); // remember, it has to be non-blocking! 89 | WaitSeconds(duration * 0.5); // handy-dandy function that comes with the Tween module! 90 | oBall.StopAllTweens(ePauseTween); // ePauseTween comes as the default 91 | WaitSeconds(duration * 0.5); 92 | player.Say("See, no problem!"); 93 | 94 | player.Say("Since Tween version 1.2, we can make it reset back to its original position."); 95 | oBall.X = ballX; 96 | oBall.Y = ballY; 97 | oBall.TweenPosition(duration, 279, 120, eLinearTween, eNoBlockTween); 98 | WaitSeconds(duration * 0.5); 99 | oBall.StopAllTweens(eResetTween); // Go back to the beginning at this point! 100 | WaitSeconds(duration * 0.5); 101 | 102 | player.Say("We can also make it immediatelly snap to the its final destination."); 103 | oBall.X = ballX; 104 | oBall.Y = ballY; 105 | oBall.TweenPosition(duration, 279, 120, eLinearTween, eNoBlockTween); 106 | WaitSeconds(duration * 0.5); 107 | oBall.StopAllTweens(eFinishTween); // Jump to the end of the tween at this point! 108 | WaitSeconds(duration * 0.5); 109 | 110 | player.Say("Fun!"); 111 | 112 | // Fade out the ball while moving it to x 0, y 120. 113 | oBall.TweenPosition(duration, oBall.X, oBall.Y + 50, eEaseOutTween, eNoBlockTween); 114 | oBall.TweenFadeOut(duration, eEaseOutTween, eNoBlockTween); 115 | Tween.WaitForAllToFinish(); // Waits for all the current running tweens to finish! 116 | 117 | player.Say("Well, we're done in this room."); 118 | player.Say("Take a look at the Room script for room 1 to see how this demo you just saw was done."); 119 | player.Say("Coming up next: Tweeining basics for Characters and GUIs."); 120 | 121 | EndCutscene(); 122 | player.ChangeRoom(2); 123 | } -------------------------------------------------------------------------------- /Tween/room301.asc: -------------------------------------------------------------------------------- 1 | // Tint Tests (room 301) script file 2 | 3 | function _characterTintTest() { 4 | #ifdef SCRIPT_API_v341 5 | Test("Character Tint"); 6 | cHiRes.ChangeRoom(player.Room); 7 | cHiRes.Tint(255, 255, 255, 100, 100); 8 | cHiRes.TweenTintRed(0.5, 0); 9 | ExpectIntToBe(cHiRes.TintRed, 0, "TintRed"); 10 | 11 | cHiRes.Tint(255, 255, 255, 100, 100); 12 | cHiRes.TweenTintGreen(0.5, 0); 13 | ExpectIntToBe(cHiRes.TintGreen, 0, "TintGreen"); 14 | 15 | cHiRes.Tint(255, 255, 255, 100, 100); 16 | cHiRes.TweenTintBlue(0.5, 0); 17 | ExpectIntToBe(cHiRes.TintBlue, 0, "TintBlue"); 18 | 19 | cHiRes.Tint(255, 0, 0, 100, 100); 20 | cHiRes.TweenTintSaturation(0.5, 0); 21 | ExpectIntToBe(cHiRes.TintSaturation, 0, "TintSaturation"); 22 | 23 | cHiRes.Tint(255, 0, 0, 100, 100); 24 | cHiRes.TweenTintLuminance(0.5, 0); 25 | ExpectIntToBe(cHiRes.TintLuminance, 0, "TintLuminance"); 26 | 27 | cHiRes.Tint(255, 255, 255, 100, 100); 28 | cHiRes.TweenTint(0.5, 0, 0, 0, 0, 0); 29 | ExpectIntToBe(cHiRes.TintRed, 0, "Tint TintRed"); 30 | ExpectIntToBe(cHiRes.TintGreen, 0, "Tint TintGreen"); 31 | ExpectIntToBe(cHiRes.TintBlue, 0, "Tint TintBlue"); 32 | ExpectIntToBe(cHiRes.TintSaturation, 0, "Tint TintSaturation"); 33 | ExpectIntToBe(cHiRes.TintLuminance, 0, "Tint TintLuminance"); 34 | 35 | cHiRes.RemoveTint(); 36 | 37 | cHiRes.TweenTintRed(5.0, 255, eEaseLinearTween, eNoBlockTween); 38 | cHiRes.StopTweenTintRed(eFinishTween); 39 | ExpectIntToBe(cHiRes.TintRed, 255, "StopTweenTintRed"); 40 | 41 | cHiRes.TweenTintGreen(5.0, 255, eEaseLinearTween, eNoBlockTween); 42 | cHiRes.StopTweenTintGreen(eFinishTween); 43 | ExpectIntToBe(cHiRes.TintGreen, 255, "StopTweenTintGreen"); 44 | 45 | cHiRes.TweenTintBlue(5.0, 255, eEaseLinearTween, eNoBlockTween); 46 | cHiRes.StopTweenTintBlue(eFinishTween); 47 | ExpectIntToBe(cHiRes.TintBlue, 255, "StopTweenTintBlue"); 48 | 49 | cHiRes.TweenTintSaturation(5.0, 100, eEaseLinearTween, eNoBlockTween); 50 | cHiRes.StopTweenTintSaturation(eFinishTween); 51 | ExpectIntToBe(cHiRes.TintSaturation, 100, "StopTweenTintSaturation"); 52 | 53 | cHiRes.TweenTintLuminance(5.0, 100, eEaseLinearTween, eNoBlockTween); 54 | cHiRes.StopTweenTintLuminance(eFinishTween); 55 | ExpectIntToBe(cHiRes.TintLuminance, 100, "StopTweenTintLuminance"); 56 | 57 | cHiRes.RemoveTint(); 58 | cHiRes.TweenTint(5.0, 255, 255, 255, 100, 100, eEaseLinearTween, eNoBlockTween); 59 | cHiRes.StopTweenTint(eFinishTween); 60 | ExpectIntToBe(cHiRes.TintRed, 255, "StopTweenTint Red"); 61 | ExpectIntToBe(cHiRes.TintGreen, 255, "StopTweenTint Green"); 62 | ExpectIntToBe(cHiRes.TintBlue, 255, "StopTweenTint Blue"); 63 | ExpectIntToBe(cHiRes.TintSaturation, 100, "StopTweenTint Saturation"); 64 | ExpectIntToBe(cHiRes.TintLuminance, 100, "StopTweenTint Luminance"); 65 | 66 | cHiRes.RemoveTint(); 67 | cHiRes.ChangeRoom(0); 68 | #endif 69 | } 70 | 71 | function _objectTweenTest() { 72 | #ifdef SCRIPT_API_v341 73 | Test("Object Tint"); 74 | oHiRes.Visible = true; 75 | oHiRes.Tint(255, 255, 255, 100, 100); 76 | oHiRes.TweenTintRed(0.5, 0); 77 | ExpectIntToBe(oHiRes.TintRed, 0, "TintRed"); 78 | 79 | oHiRes.Tint(255, 255, 255, 100, 100); 80 | oHiRes.TweenTintGreen(0.5, 0); 81 | ExpectIntToBe(oHiRes.TintGreen, 0, "TintGreen"); 82 | 83 | oHiRes.Tint(255, 255, 255, 100, 100); 84 | oHiRes.TweenTintBlue(0.5, 0); 85 | ExpectIntToBe(oHiRes.TintBlue, 0, "TintBlue"); 86 | 87 | oHiRes.Tint(255, 0, 0, 100, 100); 88 | oHiRes.TweenTintSaturation(0.5, 0); 89 | ExpectIntToBe(oHiRes.TintSaturation, 0, "TintSaturation"); 90 | 91 | oHiRes.Tint(255, 0, 0, 100, 100); 92 | oHiRes.TweenTintLuminance(0.5, 0); 93 | ExpectIntToBe(oHiRes.TintLuminance, 0, "TintLuminance"); 94 | 95 | oHiRes.Tint(255, 255, 255, 100, 100); 96 | oHiRes.TweenTint(0.5, 0, 0, 0, 0, 0); 97 | ExpectIntToBe(oHiRes.TintRed, 0, "Tint TintRed"); 98 | ExpectIntToBe(oHiRes.TintGreen, 0, "Tint TintGreen"); 99 | ExpectIntToBe(oHiRes.TintBlue, 0, "Tint TintBlue"); 100 | ExpectIntToBe(oHiRes.TintSaturation, 0, "Tint TintSaturation"); 101 | ExpectIntToBe(oHiRes.TintLuminance, 0, "Tint TintLuminance"); 102 | 103 | oHiRes.RemoveTint(); 104 | 105 | oHiRes.TweenTintRed(5.0, 255, eEaseLinearTween, eNoBlockTween); 106 | oHiRes.StopTweenTintRed(eFinishTween); 107 | ExpectIntToBe(oHiRes.TintRed, 255, "StopTweenTintRed"); 108 | 109 | oHiRes.TweenTintGreen(5.0, 255, eEaseLinearTween, eNoBlockTween); 110 | oHiRes.StopTweenTintGreen(eFinishTween); 111 | ExpectIntToBe(oHiRes.TintGreen, 255, "StopTweenTintGreen"); 112 | 113 | oHiRes.TweenTintBlue(5.0, 255, eEaseLinearTween, eNoBlockTween); 114 | oHiRes.StopTweenTintBlue(eFinishTween); 115 | ExpectIntToBe(oHiRes.TintBlue, 255, "StopTweenTintBlue"); 116 | 117 | oHiRes.TweenTintSaturation(5.0, 100, eEaseLinearTween, eNoBlockTween); 118 | oHiRes.StopTweenTintSaturation(eFinishTween); 119 | ExpectIntToBe(oHiRes.TintSaturation, 100, "StopTweenTintSaturation"); 120 | 121 | oHiRes.TweenTintLuminance(5.0, 100, eEaseLinearTween, eNoBlockTween); 122 | oHiRes.StopTweenTintLuminance(eFinishTween); 123 | ExpectIntToBe(oHiRes.TintLuminance, 100, "StopTweenTintLuminance"); 124 | 125 | oHiRes.RemoveTint(); 126 | oHiRes.TweenTint(5.0, 255, 255, 255, 100, 100, eEaseLinearTween, eNoBlockTween); 127 | oHiRes.StopTweenTint(eFinishTween); 128 | ExpectIntToBe(oHiRes.TintRed, 255, "StopTweenTint Red"); 129 | ExpectIntToBe(oHiRes.TintGreen, 255, "StopTweenTint Green"); 130 | ExpectIntToBe(oHiRes.TintBlue, 255, "StopTweenTint Blue"); 131 | ExpectIntToBe(oHiRes.TintSaturation, 100, "StopTweenTint Saturation"); 132 | ExpectIntToBe(oHiRes.TintLuminance, 100, "StopTweenTint Luminance"); 133 | 134 | oHiRes.RemoveTint(); 135 | oHiRes.Visible = true; 136 | #endif 137 | } 138 | 139 | function room_AfterFadeIn() 140 | { 141 | StartCutscene(eSkipESCOnly); 142 | _characterTintTest(); 143 | _objectTweenTest(); 144 | EndCutscene(); 145 | player.ChangeRoom(99); 146 | } 147 | 148 | function room_Load() 149 | { 150 | player.Transparency = 100; 151 | Tween.IncreaseGameSpeed(); 152 | } 153 | 154 | function room_FirstLoad() 155 | { 156 | 157 | } 158 | 159 | function room_Leave() 160 | { 161 | player.Transparency = 0; 162 | Tween.RestoreGameSpeed(); 163 | } 164 | 165 | function room_RepExec() 166 | { 167 | 168 | } 169 | -------------------------------------------------------------------------------- /Tween/Tween1Compatibility.asc: -------------------------------------------------------------------------------- 1 | // TERMS OF USE - AGS TWEEN MODULE (ags-tween) 2 | // 3 | // Copyright (c) 2009-present Edmundo Ruiz Ghanem 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE 21 | 22 | float GetDistance(int fromX, int fromY, int toX, int toY) { 23 | return TweenMaths.GetDistance(fromX, fromY, toX, toY); 24 | } 25 | 26 | function TweenStopAll(TweenStopResult result) { 27 | Tween.StopAll(result); 28 | } 29 | 30 | function WaitForTweensToStop() { 31 | Tween.WaitForAllToFinish(); 32 | } 33 | 34 | int TweenGamma(float seconds, short toGamma, Tween1Timing timing, TweenStyle style) { 35 | return System.TweenGamma(seconds, toGamma, timing, style, 0.0, eTweenSeconds); 36 | } 37 | 38 | int TweenViewportPosition(float seconds, short toX, short toY, Tween1Timing timing, TweenStyle style) { 39 | #ifdef SCRIPT_API_v3507 40 | return Game.Camera.TweenPosition(seconds, toX, toY, timing, style, 0.0, eTweenSeconds); 41 | #endif 42 | #ifndef SCRIPT_API_v3507 43 | return TweenViewport(seconds, toX, toY, timing, style, 0.0, eTweenSeconds); 44 | #endif 45 | } 46 | int TweenViewportPositionBySpeed(float speed, short toX, short toY, Tween1Timing timing, TweenStyle style) { 47 | #ifdef SCRIPT_API_v3507 48 | return Game.Camera.TweenPosition(speed, toX, toY, timing, style, 0.0, eTweenSpeed); 49 | #endif 50 | #ifndef SCRIPT_API_v3507 51 | return TweenViewport(speed, toX, toY, timing, style, 0.0, eTweenSpeed); 52 | #endif 53 | } 54 | 55 | int TweenTintR(this Region*, float seconds, short toR, Tween1Timing timing, TweenStyle style) { 56 | return this.TweenTintRed(seconds, toR, timing, style, 0.0, eTweenSeconds); 57 | } 58 | int TweenTintG(this Region*, float seconds, short toG, Tween1Timing timing, TweenStyle style) { 59 | return this.TweenTintGreen(seconds, toG, timing, style, 0.0, eTweenSeconds); 60 | } 61 | int TweenTintB(this Region*, float seconds, short toB, Tween1Timing timing, TweenStyle style) { 62 | return this.TweenTintBlue(seconds, toB, timing, style, 0.0, eTweenSeconds); 63 | } 64 | int TweenTintAmount(this Region*, float seconds, short toAmount, Tween1Timing timing, TweenStyle style) { 65 | return this.TweenTintSaturation(seconds, toAmount, timing, style, 0.0, eTweenSeconds); 66 | } 67 | int TweenTintBlackAndWhite(this Region*, float seconds, Tween1Timing timing, TweenStyle style) { 68 | return this.TweenTint(seconds, 255, 255, 255, 100, this.TintLuminance, timing, style, 0.0, eTweenSeconds); 69 | } 70 | 71 | int TweenColorR(this Label*, float seconds, short toR, Tween1Timing timing, TweenStyle style) { 72 | return this.TweenTextColorRed(seconds, toR, timing, style, 0.0, eTweenSeconds); 73 | } 74 | int TweenColorG(this Label*, float seconds, short toG, Tween1Timing timing, TweenStyle style) { 75 | return this.TweenTextColorGreen(seconds, toG, timing, style, 0.0, eTweenSeconds); 76 | } 77 | int TweenColorB(this Label*, float seconds, short toB, Tween1Timing timing, TweenStyle style) { 78 | return this.TweenTextColorBlue(seconds, toB, timing, style, 0.0, eTweenSeconds); 79 | } 80 | int TweenColorR(this Button*, float seconds, short toR, Tween1Timing timing, TweenStyle style) { 81 | return this.TweenTextColorRed(seconds, toR, timing, style, 0.0, eTweenSeconds); 82 | } 83 | int TweenColorG(this Button*, float seconds, short toG, Tween1Timing timing, TweenStyle style) { 84 | return this.TweenTextColorGreen(seconds, toG, timing, style, 0.0, eTweenSeconds); 85 | } 86 | int TweenColorB(this Button*, float seconds, short toB, Tween1Timing timing, TweenStyle style) { 87 | return this.TweenTextColorBlue(seconds, toB, timing, style, 0.0, eTweenSeconds); 88 | } 89 | 90 | int TweenSelectedItem(this ListBox*, float seconds, short toSelectedItem, Tween1Timing timing, TweenStyle style) { 91 | return this.TweenSelectedIndex(seconds, toSelectedItem, timing, style, 0.0, eTweenSeconds); 92 | } 93 | 94 | int TweenPositionBySpeed(this Character*, float speed, short toX, short toY, Tween1Timing timing, TweenStyle style) { 95 | return this.TweenPosition(speed, toX, toY, timing, style, 0.0, eTweenSpeed); 96 | } 97 | 98 | int TweenPositionBySpeed(this Object*, float speed, short toX, short toY, Tween1Timing timing, TweenStyle style) { 99 | return this.TweenPosition(speed, toX, toY, timing, style, 0.0, eTweenSpeed); 100 | } 101 | 102 | int TweenPositionBySpeed(this GUI*, float speed, short toX, short toY, Tween1Timing timing, TweenStyle style) { 103 | return this.TweenPosition(speed, toX, toY, timing, style, 0.0, eTweenSpeed); 104 | } 105 | 106 | int TweenPositionBySpeed(this GUIControl*, float speed, short toX, short toY, Tween1Timing timing, TweenStyle style) { 107 | return this.TweenPosition(speed, toX, toY, timing, style, 0.0, eTweenSpeed); 108 | } 109 | 110 | int TweenPositionBySpeed(this Label*, float speed, short toX, short toY, Tween1Timing timing, TweenStyle style) { 111 | return this.TweenPosition(speed, toX, toY, timing, style, 0.0, eTweenSpeed); 112 | } 113 | 114 | int TweenPositionBySpeed(this Button*, float speed, short toX, short toY, Tween1Timing timing, TweenStyle style) { 115 | return this.TweenPosition(speed, toX, toY, timing, style, 0.0, eTweenSpeed); 116 | } 117 | 118 | int TweenPositionBySpeed(this TextBox*, float speed, short toX, short toY, Tween1Timing timing, TweenStyle style) { 119 | return this.TweenPosition(speed, toX, toY, timing, style, 0.0, eTweenSpeed); 120 | } 121 | 122 | int TweenPositionBySpeed(this ListBox*, float speed, short toX, short toY, Tween1Timing timing, TweenStyle style) { 123 | return this.TweenPosition(speed, toX, toY, timing, style, 0.0, eTweenSpeed); 124 | } 125 | 126 | int TweenPositionBySpeed(this Slider*, float speed, short toX, short toY, Tween1Timing timing, TweenStyle style) { 127 | return this.TweenPosition(speed, toX, toY, timing, style, 0.0, eTweenSpeed); 128 | } 129 | 130 | int TweenPositionBySpeed(this InvWindow*, float speed, short toX, short toY, Tween1Timing timing, TweenStyle style) { 131 | return this.TweenPosition(speed, toX, toY, timing, style, 0.0, eTweenSpeed); 132 | } 133 | 134 | int TweenColorR(this TextBox*, float seconds, short toR, Tween1Timing timing, TweenStyle style) { 135 | return this.TweenTextColorRed(seconds, toR, timing, style, 0.0, eTweenSeconds); 136 | } 137 | int TweenColorG(this TextBox*, float seconds, short toG, Tween1Timing timing, TweenStyle style) { 138 | return this.TweenTextColorGreen(seconds, toG, timing, style, 0.0, eTweenSeconds); 139 | } 140 | int TweenColorB(this TextBox*, float seconds, short toB, Tween1Timing timing, TweenStyle style) { 141 | return this.TweenTextColorBlue(seconds, toB, timing, style, 0.0, eTweenSeconds); 142 | } 143 | -------------------------------------------------------------------------------- /Tween/room302.asc: -------------------------------------------------------------------------------- 1 | // room script file 2 | 3 | #ifdef SCRIPT_API_v3507 4 | function resetCameraAndViewport() { 5 | Camera* camera = Screen.Viewport.Camera; 6 | Viewport* viewport = Screen.Viewport; 7 | 8 | viewport.SetPosition(0, 0, Screen.Width, Screen.Height); 9 | camera.X = 0; 10 | camera.Y = 0; 11 | camera.SetSize(Screen.Width, Screen.Height); 12 | camera.AutoTracking = true; 13 | } 14 | 15 | function ExpectCamera(Camera* camera, int expectedX, int expectedY, int expectedWidth, int expectedHeight) { 16 | ExpectIntToBe(camera.X, expectedX, "Camera X"); 17 | ExpectIntToBe(camera.Y, expectedY, "Camera Y"); 18 | ExpectIntToBe(camera.Width, expectedWidth, "Camera Width"); 19 | ExpectIntToBe(camera.Height, expectedHeight, "Camera Height"); 20 | } 21 | 22 | function testViewport(Viewport* viewport) { 23 | int r = 2; 24 | viewport.TweenWidth(1.0, Screen.Width / r, eEaseOutBounceTween); 25 | viewport.TweenHeight(1.0, Screen.Height / r, eEaseOutBounceTween); 26 | viewport.TweenX(1.0, Screen.Width / r, eEaseOutBounceTween); 27 | viewport.TweenY(1.0, Screen.Height / r, eEaseOutBounceTween); 28 | viewport.TweenPosition(1.0, 0, 0, Screen.Width, Screen.Height, eEaseInOutBackTween); 29 | viewport.TweenPosition(1.0, Screen.Width / r, Screen.Height / r, Screen.Width / r*2, Screen.Height / r*2, eEaseInOutBackTween); 30 | } 31 | 32 | function testScreenViewport() { 33 | testViewport(Screen.Viewport); 34 | 35 | Camera* camera = Camera.Create(); 36 | camera.SetAt(0, 0); 37 | camera.SetSize(Screen.Width, Screen.Height); 38 | Viewport* viewport = Viewport.Create(); 39 | viewport.Camera = camera; 40 | viewport.SetPosition(0, 0, Screen.Width, Screen.Height); 41 | viewport.Visible = true; 42 | //testViewport(viewport); 43 | 44 | viewport.Delete(); 45 | resetCameraAndViewport(); 46 | } 47 | 48 | function testCamera() { 49 | Camera* camera = Screen.Viewport.Camera; 50 | camera.TweenX(1.0, Room.Width, eEaseOutBounceTween); 51 | camera.TweenY(1.0, Room.Height, eEaseOutBounceTween); 52 | camera.TweenWidth(1.0, Screen.Width / 2, eEaseOutBackTween); 53 | camera.TweenHeight(1.0, Screen.Height / 2, eEaseOutBackTween); 54 | camera.TweenPosition(1.0, 0, 0, eEaseOutQuadTween); 55 | camera.TweenSize(1.0, Screen.Width, Screen.Height, eEaseOutBackTween); 56 | resetCameraAndViewport(); 57 | } 58 | 59 | function testCameraZoom() { 60 | Test("Camera.TweenZoom"); 61 | 62 | readonly Camera* camera = Screen.Viewport.Camera; 63 | camera.X = (Room.Width - camera.Width) / 2; 64 | camera.Y = (Room.Height - camera.Height) / 2; 65 | 66 | readonly int expectedWidth = Screen.Viewport.Width * 100 / 150; 67 | readonly int expectedHeight = Screen.Viewport.Height * 100 / 150; 68 | readonly int expectedX = camera.X + camera.Width / 2 - expectedWidth / 2; 69 | readonly int expectedY = camera.Y + camera.Height / 2 - expectedHeight / 2; 70 | 71 | camera.TweenZoom(5.0, 2.0, eEaseLinearTween, eBlockTween); 72 | 73 | ExpectCamera(camera, expectedX, expectedY, expectedWidth, expectedHeight); 74 | 75 | resetCameraAndViewport(); 76 | } 77 | 78 | function testCameraZoomTo() { 79 | Test("Camera.TweenZoomTo"); 80 | 81 | readonly Camera* camera = Screen.Viewport.Camera; 82 | readonly int toX = Room.Width / 2; 83 | readonly int toY = Room.Height / 2; 84 | 85 | readonly int expectedWidth = Screen.Viewport.Width * 100 / 150; 86 | readonly int expectedHeight = Screen.Viewport.Height * 100 / 150; 87 | readonly int expectedX = toX - expectedWidth / 2; 88 | readonly int expectedY = toY - expectedHeight / 2; 89 | 90 | camera.TweenZoomTo(0.5, 1.5, toX, toY, eEaseLinearTween, eBlockTween); 91 | 92 | ExpectCamera(camera, expectedX, expectedY, expectedWidth, expectedHeight); 93 | 94 | resetCameraAndViewport(); 95 | } 96 | 97 | function splitScreen(float timing, int toWidth, TweenEasingType easingType, TweenTimingType timingType) { 98 | // Pick up the main camera and viewport 99 | Camera* camera = Screen.Viewport.Camera; 100 | Viewport* viewport = Screen.Viewport; 101 | 102 | // Create a new camera 103 | Camera* camera2 = Camera.Create(); 104 | // Set the camera position at the end of the screen size 105 | camera2.SetAt(Screen.Width, Screen.Height); 106 | // Set the size to 0 because the tween will resize it 107 | camera2.SetSize(0, Screen.Height); 108 | 109 | // Create a new viewport and assign the new camera: 110 | Viewport* viewport2 = Viewport.Create(); 111 | // Set the position to the width of the screen, and shorten the width because tween will resize it 112 | // The viewport width must be a min of 1 otherwise it collapses the height (is this a bug or expected in ags 3.5.0?) 113 | viewport2.SetPosition(Screen.Width, 0, 1, Screen.Height); 114 | viewport2.Camera = camera2; 115 | 116 | WaitSeconds(1.0); 117 | 118 | // Disable the first camera auto tracking because 119 | // otherwise it will track the character and change the position while it resizes 120 | // You can disable this if that is the effect you want 121 | camera.AutoTracking = false; 122 | 123 | // Tween the width of the viewport to the target width - 1 (minus 1 so that there is a black line between the viewpors) 124 | viewport.TweenWidth(timing, toWidth - 1, easingType, eNoBlockTween, 0.0, timingType); 125 | // At the same time, tween the camera width to the same size as the viewport 126 | camera.TweenWidth(timing, toWidth - 1, easingType, eNoBlockTween, 0.0, timingType); 127 | 128 | // Tween the new viewport x to land 1 pixel past the first viewport 129 | viewport2.TweenX(timing, toWidth + 1, easingType, eNoBlockTween, 0.0, timingType); 130 | // At the same time, tween the viewport width so it can cover the screen as it moves 131 | viewport2.TweenWidth(timing, Screen.Width - toWidth - 1, easingType, eNoBlockTween, 0.0, timingType); 132 | // At the same time, tween the camera width to the same size as the viewport 133 | // Notice here tha the tween is set to blocking so that it can wait 134 | camera2.TweenWidth(timing, Screen.Width - toWidth - 1, easingType, eBlockTween, 0.0, timingType); 135 | 136 | // Just wait a bit to marvel the changes 137 | WaitSeconds(5.0); 138 | 139 | // Before leaving this demo, delete the new viewport and camera and reset all the camera settings 140 | viewport2.Delete(); 141 | camera2.Delete(); 142 | resetCameraAndViewport(); 143 | } 144 | #endif 145 | 146 | function testSystemGamma() { 147 | Test("System.Gamma"); 148 | 149 | System.TweenGamma(1.0, 200, eEaseOutElasticTween); 150 | ExpectIntToBe(System.Gamma, 200, "Gamma"); 151 | 152 | System.TweenGamma(1.0, 0, eEaseOutElasticTween, eNoBlockTween); 153 | System.StopTweenGamma(eFinishTween); 154 | ExpectIntToBe(System.Gamma, 0, "Stop"); 155 | 156 | System.Gamma = 100; 157 | } 158 | 159 | function room_AfterFadeIn() 160 | { 161 | StartCutscene(eSkipESCOnly); 162 | 163 | //testSystemGamma(); 164 | 165 | #ifdef SCRIPT_API_v3507 166 | //testCamera(); 167 | //testCameraZoom(); 168 | for (int i = 1; i <= 160; i++) { 169 | //Screen.Viewport.Width -= 1; 170 | Game.Camera.Width -= 4; 171 | Game.Camera.X -= 4; 172 | //Game.Camera.X += 1; 173 | Wait(8); 174 | } 175 | //testCameraZoomTo(); 176 | //testScreenViewport(); 177 | 178 | // These are just for fun and not testing, do uncomment: 179 | /* 180 | splitScreen(300.0, Screen.Width / 2, eEaseOutQuadTween, eTweenSpeed); 181 | splitScreen(300.0, Screen.Width / 3, eEaseOutBackTween, eTweenSpeed); 182 | splitScreen(200.0, Screen.Width / 3, eEaseOutElasticTween, eTweenSpeed); 183 | */ 184 | #endif 185 | 186 | EndCutscene(); 187 | player.ChangeRoom(99); 188 | } 189 | 190 | function room_Load() 191 | { 192 | Tween.IncreaseGameSpeed(); 193 | } 194 | 195 | function room_FirstLoad() 196 | { 197 | 198 | } 199 | 200 | function room_Leave() 201 | { 202 | Tween.RestoreGameSpeed(); 203 | } 204 | 205 | function room_RepExec() 206 | { 207 | 208 | } 209 | -------------------------------------------------------------------------------- /Tween/Tween1Compatibility.ash: -------------------------------------------------------------------------------- 1 | // TERMS OF USE - AGS TWEEN MODULE (ags-tween) 2 | // 3 | // Copyright (c) 2009-present Edmundo Ruiz Ghanem 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | // this software and associated documentation files (the "Software"), to deal in 7 | // the Software without restriction, including without limitation the rights to 8 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | // the Software, and to permit persons to whom the Software is furnished to do so, 10 | // subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE 21 | 22 | #ifdef __TWEEN_MODULE__ 23 | 24 | enum Tween1Timing { 25 | eLinearTween = eEaseLinearTween, 26 | eEaseInTween = eEaseInSineTween, 27 | eEaseOutTween = eEaseOutSineTween, 28 | eEaseInEaseOutTween = eEaseInOutSineTween 29 | }; 30 | 31 | /// (Tween 1 Compatibility) Deprecated: Use TweenMaths.GetDistance 32 | import float GetDistance(int fromX, int fromY, int toX, int toY); 33 | 34 | /// (Tween 1 Compatibility) Deprecated: Use Tween.StopAll 35 | import function TweenStopAll(TweenStopResult result=Tween_STOP_RESULT); 36 | 37 | /// (Tween 1 Compatibility) Deprecated: Use Tween.WaitForAllToFinish 38 | import function WaitForTweensToStop(); 39 | 40 | /// (Tween 1 Compatibility) Deprecated: Use System.TweenGamma 41 | import int TweenGamma(float seconds, short toGamma, Tween1Timing timing=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE); 42 | 43 | /// (Tween 1 Compatibility) Deprecated: Use TweenViewport (or Game.Camera.TweenPosition if API >= 3.5.0) 44 | import int TweenViewportPosition(float seconds, short toX, short toY, Tween1Timing timing=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE); 45 | 46 | /// (Tween 1 Compatibility) Deprecated: Use TweenViewport(speed, ..., eTweenSpeed) (or Game.Camera.TweenPosition(speed, ..., eTweenSpeed) if API >= 3.5.0) 47 | import int TweenViewportPositionBySpeed(float speed, short toX, short toY, Tween1Timing timing=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE); 48 | 49 | /// (Tween 1 Compatibility) Deprecated: Use TweenTintRed 50 | import int TweenTintR(this Region*, float seconds, short toR, Tween1Timing timing=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE); 51 | 52 | /// (Tween 1 Compatibility) Deprecated: Use TweenTintGreen 53 | import int TweenTintG(this Region*, float seconds, short toG, Tween1Timing timing=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE); 54 | 55 | /// (Tween 1 Compatibility) Deprecated: Use TweenTintBlue 56 | import int TweenTintB(this Region*, float seconds, short toB, Tween1Timing timing=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE); 57 | 58 | /// (Tween 1 Compatibility) Deprecated: Use TweenTintSaturation 59 | import int TweenTintAmount(this Region*, float seconds, short toAmount, Tween1Timing timing=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE); 60 | 61 | /// (Tween 1 Compatibility) Deprecated: Use TweenTint(timing, 255, 255, 255, 100) 62 | import int TweenTintBlackAndWhite(this Region*, float seconds, Tween1Timing timing=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE); 63 | 64 | /// (Tween 1 Compatibility) Deprecated: Use TweenTextColorRed 65 | import int TweenColorR(this Label*, float seconds, short toR, Tween1Timing timing=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI); 66 | 67 | /// (Tween 1 Compatibility) Deprecated: Use TweenTextColorGreen 68 | import int TweenColorG(this Label*, float seconds, short toG, Tween1Timing timing=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI); 69 | 70 | /// (Tween 1 Compatibility) Deprecated: Use TweenTextColorBlue 71 | import int TweenColorB(this Label*, float seconds, short toB, Tween1Timing timing=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI); 72 | 73 | /// (Tween 1 Compatibility) Deprecated: Use TweenTextColorRed 74 | import int TweenColorR(this Button*, float seconds, short toR, Tween1Timing timing=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI); 75 | 76 | /// (Tween 1 Compatibility) Deprecated: Use TweenTextColorGreen 77 | import int TweenColorG(this Button*, float seconds, short toG, Tween1Timing timing=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI); 78 | 79 | /// (Tween 1 Compatibility) Deprecated: Use TweenTextColorBlue 80 | import int TweenColorB(this Button*, float seconds, short toB, Tween1Timing timing=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI); 81 | 82 | /// (Tween 1 Compatibility) Deprecated: Use TweenSelectedIndex 83 | import int TweenSelectedItem(this ListBox*, float seconds, short toSelectedItem, Tween1Timing timing=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI); 84 | 85 | /// (Tween 1 Compatibility) Deprecated: Use TweenPosition(speed, ..., eTweenSpeed) 86 | import int TweenPositionBySpeed(this Character*, float speed, short toX, short toY, Tween1Timing timing=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE); 87 | 88 | /// (Tween 1 Compatibility) Deprecated: Use TweenPosition(speed, ..., eTweenSpeed) 89 | import int TweenPositionBySpeed(this Object*, float speed, short toX, short toY, Tween1Timing timing=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE); 90 | 91 | /// (Tween 1 Compatibility) Deprecated: Use TweenPosition(speed, ..., eTweenSpeed) 92 | import int TweenPositionBySpeed(this GUI*, float speed, short toX, short toY, Tween1Timing timing=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI); 93 | 94 | /// (Tween 1 Compatibility) Deprecated: Use TweenPosition(speed, ..., eTweenSpeed) 95 | import int TweenPositionBySpeed(this GUIControl*, float speed, short toX, short toY, Tween1Timing timing=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI); 96 | 97 | /// (Tween 1 Compatibility) Deprecated: Use TweenPosition(speed, ..., eTweenSpeed) 98 | import int TweenPositionBySpeed(this Label*, float speed, short toX, short toY, Tween1Timing timing=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI); 99 | 100 | /// (Tween 1 Compatibility) Deprecated: Use TweenPosition(speed, ..., eTweenSpeed) 101 | import int TweenPositionBySpeed(this Button*, float speed, short toX, short toY, Tween1Timing timing=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI); 102 | 103 | /// (Tween 1 Compatibility) Deprecated: Use TweenPosition(speed, ..., eTweenSpeed) 104 | import int TweenPositionBySpeed(this TextBox*, float speed, short toX, short toY, Tween1Timing timing=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI); 105 | 106 | /// (Tween 1 Compatibility) Deprecated: Use TweenPosition(speed, ..., eTweenSpeed) 107 | import int TweenPositionBySpeed(this ListBox*, float speed, short toX, short toY, Tween1Timing timing=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI); 108 | 109 | /// (Tween 1 Compatibility) Deprecated: Use TweenPosition(speed, ..., eTweenSpeed) 110 | import int TweenPositionBySpeed(this Slider*, float speed, short toX, short toY, Tween1Timing timing=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI); 111 | 112 | /// (Tween 1 Compatibility) Deprecated: Use TweenPosition(speed, ..., eTweenSpeed) 113 | import int TweenPositionBySpeed(this InvWindow*, float speed, short toX, short toY, Tween1Timing timing=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI); 114 | 115 | /// (Tween 1 Compatibility) Deprecated: Use TweenTextColorRed 116 | import int TweenColorR(this TextBox*, float seconds, short toR, Tween1Timing timing=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI); 117 | 118 | /// (Tween 1 Compatibility) Deprecated: Use TweenTextColorGreen 119 | import int TweenColorG(this TextBox*, float seconds, short toG, Tween1Timing timing=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI); 120 | 121 | /// (Tween 1 Compatibility) Deprecated: Use TweenTextColorBlue 122 | import int TweenColorB(this TextBox*, float seconds, short toB, Tween1Timing timing=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI); 123 | 124 | #endif 125 | -------------------------------------------------------------------------------- /Tween/room101.asc: -------------------------------------------------------------------------------- 1 | // GUI Tests (room 6) script file 2 | 3 | int _gTestX, _gTestY, _gTestWidth, _gTestHeight; 4 | 5 | #ifdef SCRIPT_API_v350 6 | int _gBackgroundColor, _gBorderColor; 7 | 8 | int UpdateRedInColor(int color, int red) { 9 | return Game.GetColorFromRGB(red, TweenGame.GetGFromColor(color), TweenGame.GetBFromColor(color)); 10 | } 11 | 12 | int UpdateGreenInColor(int color, int green) { 13 | return Game.GetColorFromRGB(TweenGame.GetRFromColor(color), green, TweenGame.GetBFromColor(color)); 14 | } 15 | 16 | int UpdateBlueInColor(int color, int blue) { 17 | return Game.GetColorFromRGB(TweenGame.GetRFromColor(color), TweenGame.GetGFromColor(color), blue); 18 | } 19 | 20 | int UpdateRedInBackgroundColor(int red) { return UpdateRedInColor(_gBackgroundColor, red); } 21 | int UpdateGreenInBackgroundColor(int green) { return UpdateGreenInColor(_gBackgroundColor, green); } 22 | int UpdateBlueInBackgroundColor(int blue) { return UpdateBlueInColor(_gBackgroundColor, blue); } 23 | 24 | int UpdateRedInBorderColor(int red) { return UpdateRedInColor(_gBorderColor, red); } 25 | int UpdateGreenInBorderColor(int green) { return UpdateGreenInColor(_gBorderColor, green); } 26 | int UpdateBlueInBorderColor(int blue) { return UpdateBlueInColor(_gBorderColor, blue); } 27 | #endif 28 | 29 | function SaveTestGUI() { 30 | _gTestX = gTest.X; 31 | _gTestY = gTest.Y; 32 | _gTestWidth = gTest.Width; 33 | _gTestHeight = gTest.Height; 34 | #ifdef SCRIPT_API_v350 35 | _gBackgroundColor = gTest.BackgroundColor; 36 | _gBorderColor = gTest.BorderColor; 37 | #endif 38 | } 39 | 40 | function RestoreTestGUI() { 41 | gTest.X = _gTestX; 42 | gTest.Y = _gTestY; 43 | gTest.Width = _gTestWidth; 44 | gTest.Height = _gTestHeight; 45 | #ifdef SCRIPT_API_v350 46 | gTest.BackgroundColor = _gBackgroundColor; 47 | gTest.BorderColor = _gBorderColor; 48 | #endif 49 | } 50 | 51 | function testGUIBounds() { 52 | Test("GUI Bounds"); 53 | gTest.TweenPosition(0.5, -GetScreenWidth(), -GetScreenHeight()); 54 | ExpectIntToBe(gTest.X, -GetScreenWidth(), "X"); 55 | ExpectIntToBe(gTest.Y, -GetScreenHeight(), "Y"); 56 | 57 | gTest.TweenPosition(0.5, GetScreenWidth() + 1, GetScreenHeight() + 1); 58 | #ifdef SCRIPT_API_v350 59 | ExpectIntToBe(gTest.X, GetScreenWidth() + 1, "X"); 60 | ExpectIntToBe(gTest.Y, GetScreenHeight() + 1, "Y"); 61 | #endif 62 | #ifndef SCRIPT_API_v350 63 | ExpectIntToBe(gTest.X, GetScreenWidth() - 1, "X"); 64 | ExpectIntToBe(gTest.Y, GetScreenHeight() - 1, "Y"); 65 | #endif 66 | 67 | RestoreTestGUI(); 68 | 69 | gTest.TweenSize(1.0, 0, 0); 70 | ExpectIntToBe(gTest.Width, 1, "Width is 1"); 71 | ExpectIntToBe(gTest.Height, 1, "Height is 1"); 72 | 73 | gTest.TweenSize(1.0, GetScreenWidth() * 2, GetScreenHeight() * 2); 74 | #ifdef SCRIPT_API_v350 75 | ExpectIntToBe(gTest.Width, GetScreenWidth() * 2, "Width"); 76 | ExpectIntToBe(gTest.Height, GetScreenHeight() * 2, "Height"); 77 | #endif 78 | #ifndef SCRIPT_API_v350 79 | ExpectIntToBe(gTest.Width, GetScreenWidth(), "Width"); 80 | ExpectIntToBe(gTest.Height, GetScreenHeight(), "Height"); 81 | #endif 82 | 83 | RestoreTestGUI(); 84 | } 85 | 86 | function testBackgroundColor() { 87 | #ifdef SCRIPT_API_v350 88 | SaveTestGUI(); 89 | Test("GUI.BackgroundColor"); 90 | 91 | int expectedColor = UpdateRedInBackgroundColor(128); 92 | gTest.TweenBackgroundColorRed(0.5, 128, eEaseInBackTween); 93 | ExpectIntToBe(gTest.BackgroundColor, expectedColor, "Red"); 94 | 95 | RestoreTestGUI(); 96 | 97 | expectedColor = UpdateGreenInBackgroundColor(128); 98 | gTest.TweenBackgroundColorGreen(0.5, 128, eEaseInBackTween); 99 | ExpectIntToBe(gTest.BackgroundColor, expectedColor, "Green"); 100 | 101 | RestoreTestGUI(); 102 | 103 | expectedColor = UpdateBlueInBackgroundColor(128); 104 | gTest.TweenBackgroundColorBlue(0.5, 128, eEaseInBackTween); 105 | ExpectIntToBe(gTest.BackgroundColor, expectedColor, "Blue"); 106 | 107 | RestoreTestGUI(); 108 | 109 | int toColor = Game.GetColorFromRGB(64, 128, 255); 110 | 111 | gTest.TweenBackgroundColor(0.5, toColor, eEaseInBackTween); 112 | ExpectIntToBe(gTest.BackgroundColor, toColor, "Color"); 113 | 114 | RestoreTestGUI(); 115 | 116 | gTest.TweenBackgroundColorRGB(0.5, 64, 128, 255, eEaseInBackTween); 117 | ExpectIntToBe(gTest.BackgroundColor, toColor, "ColorRGB"); 118 | 119 | RestoreTestGUI(); 120 | 121 | expectedColor = UpdateRedInBackgroundColor(128); 122 | int lerpColor = Game.GetColorFromRGB( 123 | TweenMaths.ClampInt(0, TweenMaths.Lerp(IntToFloat(TweenGame.GetRFromColor(gTest.BackgroundColor)), 128.0, 1.0), 255), 124 | TweenGame.GetGFromColor(gTest.BackgroundColor), 125 | TweenGame.GetBFromColor(gTest.BackgroundColor) 126 | ); 127 | gTest.TweenBackgroundColorRed(0.5, 128, eEaseLinearTween, eNoBlockTween); 128 | gTest.StopTweenBackgroundColorRed(eFinishTween); 129 | ExpectIntToBe(gTest.BackgroundColor, expectedColor, "R Finish"); 130 | 131 | RestoreTestGUI(); 132 | 133 | expectedColor = UpdateGreenInBackgroundColor(128); 134 | gTest.TweenBackgroundColorGreen(0.5, 128, eEaseLinearTween, eNoBlockTween); 135 | gTest.StopTweenBackgroundColorGreen(eFinishTween); 136 | ExpectIntToBe(gTest.BackgroundColor, expectedColor, "G Finish"); 137 | 138 | RestoreTestGUI(); 139 | 140 | expectedColor = UpdateBlueInBackgroundColor(128); 141 | gTest.TweenBackgroundColorBlue(0.5, 128, eEaseLinearTween, eNoBlockTween); 142 | gTest.StopTweenBackgroundColorBlue(eFinishTween); 143 | ExpectIntToBe(gTest.BackgroundColor, expectedColor, "B Finish"); 144 | 145 | RestoreTestGUI(); 146 | 147 | gTest.TweenBackgroundColor(0.5, toColor, eEaseLinearTween, eNoBlockTween); 148 | gTest.StopTweenBackgroundColor(eFinishTween); 149 | ExpectIntToBe(gTest.BackgroundColor, toColor, "Color Finish"); 150 | 151 | RestoreTestGUI(); 152 | 153 | gTest.TweenBackgroundColorRGB(0.5, 64, 128, 255, eEaseLinearTween, eNoBlockTween); 154 | gTest.StopTweenBackgroundColor(eFinishTween); 155 | ExpectIntToBe(gTest.BackgroundColor, toColor, "ColorRGB Finish"); 156 | 157 | RestoreTestGUI(); 158 | #endif 159 | } 160 | 161 | function testBorderColor() { 162 | #ifdef SCRIPT_API_v350 163 | SaveTestGUI(); 164 | Test("GUI.BorderColor"); 165 | 166 | int expectedColor = UpdateRedInBorderColor(128); 167 | gTest.TweenBorderColorRed(0.5, 128, eEaseInBackTween); 168 | ExpectIntToBe(gTest.BorderColor, expectedColor, "Red"); 169 | 170 | RestoreTestGUI(); 171 | 172 | expectedColor = UpdateGreenInBorderColor(128); 173 | gTest.TweenBorderColorGreen(0.5, 128, eEaseInBackTween); 174 | ExpectIntToBe(gTest.BorderColor, expectedColor, "Green"); 175 | 176 | RestoreTestGUI(); 177 | 178 | expectedColor = UpdateBlueInBorderColor(128); 179 | gTest.TweenBorderColorBlue(0.5, 128, eEaseInBackTween); 180 | ExpectIntToBe(gTest.BorderColor, expectedColor, "Blue"); 181 | 182 | RestoreTestGUI(); 183 | 184 | int toColor = Game.GetColorFromRGB(64, 128, 255); 185 | 186 | gTest.TweenBorderColor(0.5, toColor, eEaseInBackTween); 187 | ExpectIntToBe(gTest.BorderColor, toColor, "Color"); 188 | 189 | RestoreTestGUI(); 190 | 191 | gTest.TweenBorderColorRGB(0.5, 64, 128, 255, eEaseInBackTween); 192 | ExpectIntToBe(gTest.BorderColor, toColor, "ColorRGB"); 193 | 194 | RestoreTestGUI(); 195 | 196 | expectedColor = UpdateRedInBorderColor(128); 197 | gTest.TweenBorderColorRed(0.5, 128, eEaseLinearTween, eNoBlockTween); 198 | gTest.StopTweenBorderColorRed(eFinishTween); 199 | ExpectIntToBe(gTest.BorderColor, expectedColor, "R Finish"); 200 | 201 | RestoreTestGUI(); 202 | 203 | expectedColor = UpdateGreenInBorderColor(128); 204 | gTest.TweenBorderColorGreen(0.5, 128, eEaseLinearTween, eNoBlockTween); 205 | gTest.StopTweenBorderColorGreen(eFinishTween); 206 | ExpectIntToBe(gTest.BorderColor, expectedColor, "G Finish"); 207 | 208 | RestoreTestGUI(); 209 | 210 | expectedColor = UpdateBlueInBorderColor(128); 211 | gTest.TweenBorderColorBlue(0.5, 128, eEaseLinearTween, eNoBlockTween); 212 | gTest.StopTweenBorderColorBlue(eFinishTween); 213 | ExpectIntToBe(gTest.BorderColor, expectedColor, "B Finish"); 214 | 215 | RestoreTestGUI(); 216 | 217 | gTest.TweenBorderColor(0.5, toColor, eEaseLinearTween, eNoBlockTween); 218 | gTest.StopTweenBorderColor(eFinishTween); 219 | ExpectIntToBe(gTest.BorderColor, toColor, "Color Finish"); 220 | 221 | RestoreTestGUI(); 222 | 223 | gTest.TweenBorderColorRGB(0.5, 64, 128, 255, eEaseLinearTween, eNoBlockTween); 224 | gTest.StopTweenBorderColor(eFinishTween); 225 | ExpectIntToBe(gTest.BorderColor, toColor, "ColorRGB Finish"); 226 | 227 | RestoreTestGUI(); 228 | #endif 229 | } 230 | 231 | function room_AfterFadeIn() 232 | { 233 | StartCutscene(eSkipESCOnly); 234 | 235 | testGUIBounds(); 236 | testBackgroundColor(); 237 | testBorderColor(); 238 | 239 | EndCutscene(); 240 | player.ChangeRoom(99); 241 | } 242 | 243 | function room_Load() 244 | { 245 | SaveTestGUI(); 246 | gTest.Visible = true; 247 | } 248 | 249 | function room_Leave() 250 | { 251 | gTest.Visible = false; 252 | RestoreTestGUI(); 253 | } 254 | 255 | function room_RepExec() 256 | { 257 | 258 | } 259 | -------------------------------------------------------------------------------- /CHANGES.TXT: -------------------------------------------------------------------------------- 1 | Revision History 2 | ================ 3 | 4 | 2.4.0 (TBD) 5 | - Fixed all `.TweenColorRGB`, `Camera.TweenPosition`, `Camera.TweenSize`, `Viewport.TweenPostition`, `Region.TweenTint`, `Object.TweenImage` to respect non-blocking style. Previously, style was partially set to `eNoBlockTween` 6 | - Fixed `GUIControl.StopAllTweens` not stopping GUI control tweens 7 | - 3.5.0: Added `Camera.TweenZoom` and `Camera.TweenZoomTo` 8 | - 3.5.0: Remove clampling camera tweens X and Y to 0 - room width/height 9 | 10 | 2.3.0 (April 3, 2023) 11 | - Added `Overlay` `TweenX`, `TweenY`, `TweenPosition` 12 | - 3.5.0: Added `Point` `TweenX`, `TweenY`, `TweenPosition` 13 | - 3.6.0: Added `Character` `TweenAnimationVolume` 14 | - 3.6.0: `Character.TweenScaling` is no longer limited by a range of 5-200. Now supports 1-32767 15 | - 3.6.0: Added `GUIControl` `TweenTransparency` 16 | - 3.6.0: Added `Object` `TweenScaling` 17 | - 3.6.0: Added `Overlay` `Width`, `Height`, `Size`, `Transparency` 18 | - Internal: Updated how managed tweens are created to support `Point` and `Overlay` tweens 19 | - Added function documentation where extra properties such as `ManualScaling`, `Visible` are also updated 20 | 21 | 2.2.1 / 2.2.2 (October 10, 2021) 22 | - Fixed `Character`.`TweenZ` not applying the correct value (@edmundito) 23 | - 3.5.0: Fixed script API version check for new Camera and Viewport (@AlanDrake) 24 | - 3.5.0: Fixed `Viewport`.`TweenX/Y` incorrectly clamping values (@AlanDrake) 25 | - Changed the float `Elapsed++` which is not allowed on new compiler (@AlanDrake) 26 | 27 | 2.2.0 (September 8, 2020) 28 | - Fixed `Region` `StopTweenTint` result parameter (was not used) 29 | - Fixed `Region` tween tint saturation to 1-100 and luminance clamping to 0-100 30 | - Fixed exception when using `Button.TweenTextColorRed` 31 | - Removed compatibility with any version below 3.4.0 32 | - Replaced internal `#ifver` checks to check based on `SCRIPT_API_v*` to improve compatibility 33 | - Replaced `Region.TweenTintEx` with additional `luminance` parameter in `Region.TweenTint` 34 | - Removed `TweenSystemGamma` and `StopTweenSystemGamma` in favor of using existing `System.TweenGamma` and `System.StopTweenGamma` 35 | - Removed `TweenSystemVolume` and `StopTweenSystemVolume` in favor of using exiting `System.TweenVolume` and `System.StopTweenVolume` 36 | - Added `TweenTextColorRGB` for `Button`, `Label`, and `TextBox` 37 | - 3.4.1: Added `Character` `TweenTint` (+ Red/Green/Blue), `TweenTintSaturation`, `TweenTintLuminance` 38 | - 3.4.1: Added `Object` `TweenTint`, `TweenTintRed`, `TweenTintGreen`, `TweenTintBlue`, `TweenTintSaturation`, `TweenTintLuminance` 39 | - 3.5.0: Removed limitations of GUI tweens to screen width and height 40 | - 3.5.0: Replaced old `Viewport` tweens with `Camera` `TweenX`, `TweenY`, `TweenWidth`, `TweenHeight`, `TweenPosition`, `TweenSize` 41 | - 3.5.0: Added new `Viewport` object tweens `TweenX`, `TweenY`, `TweenWidth`, `TweenHeight`, `TweenPosition` 42 | - 3.5.0: Updated `Tween1Compatiblity` module to support legacy `Viewport` tweens (via `Camera`) 43 | - 3.5.0: Added `Tween2Compatiblity` module to support legacy `Viewport` tweens (via `Camera`) 44 | - 3.5.0: Added `GUI` `TweenBackgroundColor` (+ Red/Green/Blue/RGB) and `TweenBorderColor` (+ Red/Green/Blue/RGB) 45 | - 3.5.0: Added `ListBox` `TweenSelectedBackColor` (+ Red/Green/Blue/RGB), `TweenSelectedTextColor` (+ Red/Green/Blue/RGB), `TweenTextColor` (+ Red/Green/Blue/RGB) 46 | 47 | 2.1.0 (December 4, 2016) 48 | - Fix `TweenViewport` setting the incorrect X and Y value 49 | - Update tween stop sequence when leaving the room 50 | Originally, all tweens stop. Now some tween such as GUI and Audio will continue to play 51 | - Update `eRepeatTween` value to be compatible with `eRepeat` so that they can be used interchangeably 52 | - 3.3.0: Update min legacy `SetMusicMasterVolume` volume to `-210` 53 | - Add more validation to tween min and max values so that games don't crash 54 | - Add `Tween_STOP_ALL_ON_LEAVE_ROOM` global define to determine whether to stop all tweens when leaving room. Default is `false` 55 | - Add `AudioChannel::TweenPosition`, `AudioChannel::StopTweenPosition`. However, the quality is not what you expect due to engine limitations. 56 | - 3.4.0: Add `AudioChannel::TweenSpeed`, `AudioChannel::StopTweenSpeed` to make your audio sound funny! 57 | - 3.4.0: Add `System.TweenVolume`, `System.StopTweenVolume`. `TweenSystemVolume,` `StopSystemTweenVolume` will still work! 58 | - 3.4.0: Add `Region::TweenTintLuminance`, `Region::StopTweenTintLuminance` 59 | - 3.4.0: Add `Region::TweenTintEx` to tween region tint with luminance included 60 | - 3.4.0: Add `Character::TweenLightLevel`, `Character::StopTweenLightLevel` 61 | - 3.4.0: Add `Object::TweenLightLevel`, `Object::StopTweenLightLevel` 62 | - 3.4.0: Add `TweenAmbientLightLevel`, `StopTweenAmbientLightLevel` 63 | - 3.4.0: Add `System.TweenGamma`, `System.StopTweenGamma`. `TweenSystemGamma` and `StopTweenSystemGamma` will still work! 64 | - 3.4.0: Add `Character::TweenProperty`, `Character::StopTweenProperty` 65 | - 3.4.0: Add `Hotspot::TweenProperty`, `Hotspot::StopTweenProperty` 66 | - 3.4.0: Add `InventoryItem::TweenProperty`, `InventoryItem::StopTweenProperty` 67 | - 3.4.0: Add `Object::TweenProperty`, `Object::StopTweenProperty` 68 | - 3.4.0: Add `Room.TweenProperty`, `Room.StopTweenProperty` 69 | - 3.4.0: Add `Tween_STYLE_PROPERTY` global define to determine the default style for tween properties. Default is `eNoBlockTween` 70 | 71 | 2.0.2 (February 22 2016) 72 | - Fix: Make eBlockTween and eNoBlockTween compatible with eBlock and eNoBlock. This was always intended to work! 73 | 74 | 2.0.1 (July 12 2015) 75 | - Fix: Remove unused toTransparency parameters from Character, GUI, and Object TweenFadeIn/Out functions. 76 | 77 | 2.0.0 (February 28 2014) 78 | - Added ability to stop individual Tweens. 79 | - Added ability to set optional startDelay for all tweens. 80 | - Added ability to optionally play all tweens by seconds or speed. 81 | - Added convenient FadeIn and FadeOut tween functions where it made sense. 82 | - Added support to create custom tweens. 83 | - Added new Tweens (X, Y, and Character Z). 84 | - Added ability to speed up game during blocking tween playback. 85 | - Exposed internal functions into TweenMaths and TweenGame. 86 | - Added more timing utility functions. 87 | - Added new common Easing equations. 88 | - Improved limit and error checking. 89 | - Changed all values away from short and towards int or float. 90 | - Broke compatibility with 1.x modules and created compatibility module. 91 | - Removed support for AGS 2.x. 92 | - Using more standard names and now more compliant with the module guidelines. 93 | 94 | 1.5.1 (September 20 2014) 95 | 96 | - Fixed bad import statements for various *BySpeed tweens (viewport, GUI, GUI control, and character) 97 | - Fixed Y miscalculation in GetDistance function (use for speed tweens) 98 | - Fixed new strict audio check issue that would make module incompatible with AGS 3.1 and below. 99 | - Fixed incorrect documentation 100 | 101 | 1.5 (2012) 102 | - Added WaitForTweensToStop which allows waiting for all non-looping tweens to be done. 103 | - Added ability to tween positions based on speed instead of time 104 | - Added utility function GetDistance(fromX, fromY, toX, toY) 105 | - Changed the way the module refers to objects internally, costing less memory per tween object and simplifying the code 106 | - Tween position, size, and stop functions for GUI Controls have been unified into one 107 | - Deprecated GUI Control Specific functions for AGS 2.x can be enabled by commenting out the TWEEN_1_2_LEGACY_FUNCTIONS_DISABLED define 108 | - Renamed TweenViewportXY to TweenViewportPosition for consistency 109 | -- Can be reenabled with the if TWEEN_1_2_LEGACY_FUNCTIONS_DISABLED is commented 110 | - Renamed the NO_VER_2_TWEENS define to AGS_2_COMPATIBLE_TWEENS_DISABLED 111 | - Migrated demo code to AGS 3.2.1 112 | - Added new Strict audio tweens in AGS 3.2 113 | - Added support for tweening the System.Volume in AGS 3.2 114 | - Added custom default timing and styles for Audio Tweens 115 | - eReverseRepeatTween now reverses the timing, too! 116 | - Increased default max number of simultaneous tweens from 10 to 16 117 | 118 | 1.22 (August 14 2010) 119 | - Restored compatibility with AGS 2.72 and 3.0! 120 | - Added optional GetColorFromRGB(red, green, blue) function to 2.72. It can be exposed by uncommenting it in the script header. 121 | 1.21 (June 12 2010) 122 | - Compatible with AGS 3.2. Note that support for most audio tweens only work if the "Enforce new-style audio scripting" is set to False. 123 | - New-style audio scripting support is coming in a future version! 124 | 125 | 1.2 (June 5 2010) 126 | - New: You can now change the defaults for TweenTiming and TweenStyle. 127 | (GUIs have their own defaults, and NOTE that as of this version GUIs are blocking by default.) 128 | - New: You can now set how tweens stop, whether they pause, finish, or reset (thanks to Dualnames for the inspiration!) 129 | - New: WaitSeconds(seconds), very handy for timing things instead of guessing number of loops with regular Wait() 130 | - General code cleanup, removed some redundancies 131 | - Better code documentation 132 | 133 | 1.1 (February 17 2010) 134 | - Now supports virtually every function that could be tweened in AGS 135 | - Improved documentation formatting, and validaded by w3c as strict 136 | - Created this changes document :) 137 | 138 | 1.0L (July 11 2009) 139 | - Added MIT License 140 | 141 | 1.0 (June 13 2009) 142 | - Initial Release 143 | -------------------------------------------------------------------------------- /Tween/GlobalScript.asc: -------------------------------------------------------------------------------- 1 | // main global script file 2 | 3 | // Called when the game starts, before the first room is loaded 4 | function game_start() { 5 | // Put the code all in a function and then just call the function. 6 | // It saves cluttering up places like game_start. 7 | //SetGameSpeed(60); 8 | //System.VSync = true; 9 | //player.ChangeRoom(7); 10 | 11 | SetRestartPoint(); 12 | } 13 | 14 | function repeatedly_execute() { 15 | 16 | // put anything you want to happen every game cycle, even when 17 | // the game is paused, here 18 | 19 | if (IsGamePaused() == 1) return; 20 | 21 | // put anything you want to happen every game cycle, but not 22 | // when the game is paused, here 23 | } 24 | 25 | function show_inventory_window() 26 | { 27 | gInventory.Visible = true; 28 | // switch to the Use cursor (to select items with) 29 | mouse.Mode = eModeInteract; 30 | // But, override the appearance to look like the arrow 31 | mouse.UseModeGraphic(eModePointer); 32 | } 33 | 34 | function show_save_game_dialog() 35 | { 36 | gSaveGame.Visible = true; 37 | // Get the list of save games 38 | lstSaveGamesList.FillSaveGameList(); 39 | if (lstSaveGamesList.ItemCount > 0) 40 | { 41 | // If there is at least one, set the default text 42 | // to be the first game's name 43 | txtNewSaveName.Text = lstSaveGamesList.Items[0]; 44 | } 45 | else 46 | { 47 | // No save games yet, default empty text. 48 | txtNewSaveName.Text = ""; 49 | } 50 | mouse.UseModeGraphic(eModePointer); 51 | gIconbar.Visible = false; 52 | } 53 | 54 | function show_restore_game_dialog() 55 | { 56 | gRestoreGame.Visible = true; 57 | lstRestoreGamesList.FillSaveGameList(); 58 | mouse.UseModeGraphic(eModePointer); 59 | gIconbar.Visible = false; 60 | } 61 | 62 | function close_save_game_dialog() 63 | { 64 | gSaveGame.Visible = false; 65 | mouse.UseDefaultGraphic(); 66 | gIconbar.Visible = true; 67 | } 68 | 69 | function close_restore_game_dialog() 70 | { 71 | gRestoreGame.Visible = false; 72 | mouse.UseDefaultGraphic(); 73 | gIconbar.Visible = true; 74 | } 75 | 76 | // Called when a key is pressed. keycode holds the key's ASCII code 77 | function on_key_press(eKeyCode keycode) { 78 | // The following is called before "if game is paused keycode=0", so 79 | // it'll happen even when the game is paused. 80 | 81 | if ((keycode == eKeyEscape) && gRestartYN.Visible) { 82 | //Use ESC to cancel restart. 83 | gRestartYN.Visible = false; 84 | gIconbar.Visible = true; 85 | return; 86 | } 87 | if ((keycode == eKeyEscape) && (gSaveGame.Visible)) 88 | { 89 | // Use ESC to close the save game dialog 90 | close_save_game_dialog(); 91 | return; 92 | } 93 | if ((keycode == eKeyEscape) && (gRestoreGame.Visible)) 94 | { 95 | // Use ESC to close the restore game dialog 96 | close_restore_game_dialog(); 97 | return; 98 | } 99 | 100 | if (keycode == eKeyReturn) { 101 | // ENTER, in this case merely confirms restart 102 | if (gRestartYN.Visible) RestartGame(); 103 | } 104 | 105 | if (IsGamePaused() || (IsInterfaceEnabled() == 0)) 106 | { 107 | // If the game is paused with a modal GUI on the 108 | // screen, or the player interface is disabled in 109 | // a cut scene, ignore any keypresses. 110 | return; 111 | } 112 | 113 | // FUNCTION KEYS AND SYSTEM SHORTCUTS 114 | if (keycode == eKeyCtrlQ) QuitGame(1); // Ctrl-Q 115 | if (keycode == eKeyF5) show_save_game_dialog(); // F5 116 | if (keycode == eKeyF7) show_restore_game_dialog(); // F7 117 | if (keycode == eKeyF9) { 118 | // F9, asks the player to confirm restarting (so much better to always confirm first) 119 | gRestartYN.Visible = true; 120 | gIconbar.Visible = false; 121 | mouse.UseModeGraphic(eModePointer); 122 | } 123 | if (keycode == eKeyF12) SaveScreenShot("scrnshot.bmp"); // F12 124 | if (keycode == eKeyTab) show_inventory_window(); // Tab, show inventory 125 | 126 | // GAME COMMAND SHORTCUTS 127 | if (keycode == 'W') mouse.Mode=eModeWalkto; //Notice this alternate way to indicate keycodes. 128 | if (keycode == 'L') mouse.Mode=eModeLookat; //Note that all we do here is set modes. 129 | if (keycode == 'U') mouse.Mode=eModeInteract; //If you want something else to happen, such as GUI buttons highlighting, 130 | if (keycode == 'T') mouse.Mode=eModeTalkto; //you'll need some more scripting done. 131 | if (keycode == 'I') mouse.Mode=eModeUseinv; //But this will, as-is, give you some standard keyboard shortcuts your players will very much appreciate. 132 | 133 | // For extra cursor modes, such as pick up, feel free to add as you will. 134 | // Uncomment the line below if you use the "Pick Up" mode. 135 | //if (keycode == 'P' || keycode == 'G') mouse.Mode=eModePickup; 136 | 137 | // DEBUG FUNCTIONS 138 | if (keycode == eKeyCtrlS) Debug(0,0); // Ctrl-S, give all inventory 139 | if (keycode == eKeyCtrlV) Debug(1,0); // Ctrl-V, version 140 | if (keycode == eKeyCtrlA) Debug(2,0); // Ctrl-A, show walkable areas 141 | if (keycode == eKeyCtrlX) Debug(3,0); // Ctrl-X, teleport to room 142 | if (keycode == eKeyCtrlW && game.debug_mode) 143 | player.PlaceOnWalkableArea(); //Ctrl-W, move to walkable area 144 | } 145 | 146 | 147 | function on_mouse_click(MouseButton button) { 148 | // called when a mouse button is clicked. button is either LEFT or RIGHT 149 | if (IsGamePaused() == 1) { 150 | // Game is paused, so do nothing (ie. don't allow mouse click) 151 | } 152 | else if (button == eMouseLeft) { 153 | Room.ProcessClick(mouse.x, mouse.y, mouse.Mode ); 154 | } 155 | } 156 | 157 | function interface_click(int interface, int button) { 158 | // This function is obsolete, from 2.62 and earlier versions. 159 | } 160 | 161 | function btnInvUp_Click(GUIControl *control, MouseButton button) { 162 | invCustomInv.ScrollUp(); 163 | } 164 | 165 | function btnInvDown_Click(GUIControl *control, MouseButton button) { 166 | invCustomInv.ScrollDown(); 167 | } 168 | 169 | function btnInvOK_Click(GUIControl *control, MouseButton button) { 170 | // They pressed the OK button, close the GUI 171 | gInventory.Visible = false; 172 | mouse.UseDefaultGraphic(); 173 | } 174 | 175 | function btnInvSelect_Click(GUIControl *control, MouseButton button) { 176 | 177 | // They pressed SELECT, so switch to the Get cursor 178 | mouse.Mode = eModeInteract; 179 | // But, override the appearance to look like the arrow 180 | mouse.UseModeGraphic(eModePointer); 181 | } 182 | 183 | function btnIconInv_Click(GUIControl *control, MouseButton button) { 184 | 185 | show_inventory_window(); 186 | } 187 | 188 | function btnIconCurInv_Click(GUIControl *control, MouseButton button) { 189 | 190 | if (player.ActiveInventory != null) 191 | mouse.Mode = eModeUseinv; 192 | } 193 | 194 | function btnIconSave_Click(GUIControl *control, MouseButton button) 195 | { 196 | show_save_game_dialog(); 197 | } 198 | 199 | function btnIconLoad_Click(GUIControl *control, MouseButton button) 200 | { 201 | show_restore_game_dialog(); 202 | } 203 | 204 | function btnIconExit_Click(GUIControl *control, MouseButton button) { 205 | 206 | QuitGame(1); 207 | } 208 | 209 | function btnIconAbout_Click(GUIControl *control, MouseButton button) { 210 | Display("Tween Module Demo[[Created with Adventure Game Studio[By Chris Jones"); 211 | } 212 | 213 | function cEgo_Look() 214 | { 215 | Display("Damn, I'm looking good!"); 216 | } 217 | 218 | function cEgo_Interact() 219 | { 220 | Display("You rub your hands up and down your clothes."); 221 | } 222 | 223 | function cEgo_Talk() 224 | { 225 | Display("Talking to yourself is a sign of madness!"); 226 | } 227 | 228 | function gControl_OnClick(GUI *theGui, MouseButton button) 229 | { 230 | 231 | } 232 | 233 | function dialog_request(int param) 234 | { 235 | // This is used by the dialog text parser if you need to process 236 | // text that the player types in to the parser. 237 | // It is not used by default. 238 | } 239 | 240 | function btnRestart_OnClick(GUIControl *control, MouseButton button) 241 | { 242 | gRestartYN.Visible=true; 243 | gIconbar.Visible=false; 244 | } 245 | 246 | function btnRestartYes_OnClick(GUIControl *control, MouseButton button) 247 | { 248 | RestartGame(); 249 | } 250 | 251 | function btnRestartNo_OnClick(GUIControl *control, MouseButton button) 252 | { 253 | gRestartYN.Visible = false; 254 | gIconbar.Visible = true; 255 | } 256 | 257 | function btnCancelSave_OnClick(GUIControl *control, MouseButton button) 258 | { 259 | close_save_game_dialog(); 260 | } 261 | 262 | function btnSaveGame_OnClick(GUIControl *control, MouseButton button) 263 | { 264 | int gameSlotToSaveInto = lstSaveGamesList.ItemCount + 1; 265 | int i = 0; 266 | while (i < lstSaveGamesList.ItemCount) 267 | { 268 | if (lstSaveGamesList.Items[i] == txtNewSaveName.Text) 269 | { 270 | gameSlotToSaveInto = lstSaveGamesList.SaveGameSlots[i]; 271 | } 272 | i++; 273 | } 274 | SaveGameSlot(gameSlotToSaveInto, txtNewSaveName.Text); 275 | close_save_game_dialog(); 276 | } 277 | 278 | function btnCancelRestore_OnClick(GUIControl *control, MouseButton button) 279 | { 280 | close_restore_game_dialog(); 281 | } 282 | 283 | function btnRestoreGame_OnClick(GUIControl *control, MouseButton button) 284 | { 285 | if (lstRestoreGamesList.SelectedIndex >= 0) 286 | { 287 | RestoreGameSlot(lstRestoreGamesList.SaveGameSlots[lstRestoreGamesList.SelectedIndex]); 288 | } 289 | close_restore_game_dialog(); 290 | } 291 | 292 | function lstSaveGamesList_OnSelectionCh(GUIControl *control) 293 | { 294 | txtNewSaveName.Text = lstSaveGamesList.Items[lstSaveGamesList.SelectedIndex]; 295 | } 296 | 297 | function txtNewSaveName_OnActivate(GUIControl *control) 298 | { 299 | // Pressing return in the text box simulates clicking the Save button 300 | btnSaveGame_OnClick(control, eMouseLeft); 301 | } 302 | 303 | function btnDeleteSave_OnClick(GUIControl *control, MouseButton button) 304 | { 305 | if (lstSaveGamesList.SelectedIndex >= 0) 306 | { 307 | DeleteSaveSlot(lstSaveGamesList.SaveGameSlots[lstSaveGamesList.SelectedIndex]); 308 | lstSaveGamesList.FillSaveGameList(); 309 | } 310 | } 311 | 312 | function lstEasingX_OnSelectionChanged(GUIControl *control) 313 | { 314 | UpdateTweenCurve(lstEasingX.SelectedIndex + 1, lstEasingY.SelectedIndex + 1); 315 | } 316 | 317 | function lstEasingY_OnSelectionChanged(GUIControl *control) 318 | { 319 | UpdateTweenCurve(lstEasingX.SelectedIndex + 1, lstEasingY.SelectedIndex + 1); 320 | } 321 | 322 | function gStatusline_OnClick(GUI *theGui, MouseButton button) 323 | { 324 | 325 | } 326 | 327 | function UpdateRegion() 328 | { 329 | region[1].Tint(Slider1.Value, Slider2.Value, Slider3.Value, Slider4.Value, Slider5.Value); 330 | lblTint.Text = String.Format("%d[%d[%d[%d[%d",Slider1.Value, Slider2.Value, Slider3.Value, Slider4.Value, Slider5.Value); 331 | } 332 | 333 | function Slider1_OnChange(GUIControl *control) 334 | { 335 | UpdateRegion(); 336 | } 337 | 338 | -------------------------------------------------------------------------------- /Tween/room102.asc: -------------------------------------------------------------------------------- 1 | // room 102 (GUI Control Tests) script file 2 | 3 | int _btnTextColor; 4 | int _lblTextColor; 5 | int _txtTextColor; 6 | 7 | #ifdef SCRIPT_API_v360 8 | int _btnTransparency; 9 | #endif 10 | 11 | int UpdateRedInColor(int color, int red) { 12 | return Game.GetColorFromRGB(red, TweenGame.GetGFromColor(color), TweenGame.GetBFromColor(color)); 13 | } 14 | 15 | int UpdateGreenInColor(int color, int green) { 16 | return Game.GetColorFromRGB(TweenGame.GetRFromColor(color), green, TweenGame.GetBFromColor(color)); 17 | } 18 | 19 | int UpdateBlueInColor(int color, int blue) { 20 | return Game.GetColorFromRGB(TweenGame.GetRFromColor(color), TweenGame.GetGFromColor(color), blue); 21 | } 22 | 23 | int UpdateRedInButtonTextColor(int red) { return UpdateRedInColor(_btnTextColor, red); } 24 | int UpdateGreenInButtonTextColor(int green) { return UpdateGreenInColor(_btnTextColor, green); } 25 | int UpdateBlueInButtonTextColor(int blue) { return UpdateBlueInColor(_btnTextColor, blue); } 26 | 27 | int UpdateRedInLabelTextColor(int red) { return UpdateRedInColor(_lblTextColor, red); } 28 | int UpdateGreenInLabelTextColor(int green) { return UpdateGreenInColor(_lblTextColor, green); } 29 | int UpdateBlueInLabelTextColor(int blue) { return UpdateBlueInColor(_lblTextColor, blue); } 30 | 31 | int UpdateRedInTextBoxTextColor(int red) { return UpdateRedInColor(_txtTextColor, red); } 32 | int UpdateGreenInTextBoxTextColor(int green) { return UpdateGreenInColor(_txtTextColor, green); } 33 | int UpdateBlueInTextBoxTextColor(int blue) { return UpdateBlueInColor(_txtTextColor, blue); } 34 | 35 | #ifdef SCRIPT_API_v350 36 | int _lstSelectedBackColor, _lstSelectedTextColor, _lstTextColor; 37 | 38 | int UpdateRedInListBoxSeletedBackColor(int red) { return UpdateRedInColor(_lstSelectedBackColor, red); } 39 | int UpdateGreenInListBoxSeletedBackColor(int green) { return UpdateGreenInColor(_lstSelectedBackColor, green); } 40 | int UpdateBlueInListBoxSeletedBackColor(int blue) { return UpdateBlueInColor(_lstSelectedBackColor, blue); } 41 | 42 | int UpdateRedInListBoxSeletedTextColor(int red) { return UpdateRedInColor(_lstSelectedTextColor, red); } 43 | int UpdateGreenInListBoxSeletedTextColor(int green) { return UpdateGreenInColor(_lstSelectedTextColor, green); } 44 | int UpdateBlueInListBoxSeletedTextColor(int blue) { return UpdateBlueInColor(_lstSelectedTextColor, blue); } 45 | 46 | int UpdateRedInListBoxTextColor(int red) { return UpdateRedInColor(_lstTextColor, red); } 47 | int UpdateGreenInListBoxTextColor(int green) { return UpdateGreenInColor(_lstTextColor, green); } 48 | int UpdateBlueInListBoxTextColor(int blue) { return UpdateBlueInColor(_lstTextColor, blue); } 49 | #endif 50 | 51 | function SaveGUIControls() { 52 | _btnTextColor = btnTest.TextColor; 53 | 54 | _lblTextColor = lblTest.TextColor; 55 | 56 | _txtTextColor = txtTest.TextColor; 57 | 58 | #ifdef SCRIPT_API_v350 59 | _lstSelectedBackColor = lstTest.SelectedBackColor; 60 | _lstSelectedTextColor = lstTest.SelectedTextColor; 61 | _lstTextColor = lstTest.TextColor; 62 | #endif 63 | 64 | #ifdef SCRIPT_API_v360 65 | _btnTransparency = btnTest.Transparency; 66 | #endif 67 | } 68 | 69 | function RestoreGUIControls() { 70 | btnTest.TextColor = _btnTextColor; 71 | 72 | lblTest.TextColor = _lblTextColor; 73 | 74 | txtTest.TextColor = _txtTextColor; 75 | 76 | #ifdef SCRIPT_API_v350 77 | lstTest.SelectedBackColor = _lstSelectedBackColor; 78 | lstTest.SelectedTextColor = _lstSelectedTextColor; 79 | lstTest.TextColor = _lstTextColor; 80 | #endif 81 | 82 | #ifdef SCRIPT_API_v360 83 | btnTest.Transparency = _btnTransparency; 84 | btnTest.Visible = true; 85 | #endif 86 | } 87 | 88 | function testTransparency() { 89 | #ifdef SCRIPT_API_v360 90 | Test("GUIControl.Transparency"); 91 | 92 | btnTest.Transparency = 0; 93 | btnTest.TweenTransparency(0.5, 50); 94 | ExpectIntToBe(btnTest.Transparency, 50, "Transparency"); 95 | 96 | btnTest.Visible = false; 97 | btnTest.Transparency = 100; 98 | btnTest.TweenTransparency(0.5, -20); 99 | ExpectIntToBe(btnTest.Transparency, 0, "Min Transparency"); 100 | ExpectIntToBe(btnTest.Visible, true, "Visible at 0 transparency"); 101 | 102 | RestoreGUIControls(); 103 | btnTest.TweenTransparency(0.5, 120); 104 | ExpectIntToBe(btnTest.Transparency, 100, "Max Transparency"); 105 | ExpectIntToBe(btnTest.Visible, false, "Not visible at 100 transparency"); 106 | 107 | btnTest.Transparency = 0; 108 | btnTest.Visible = true; 109 | btnTest.TweenTransparency(0.5, 50, eEaseLinearTween, eNoBlockTween); 110 | btnTest.StopTweenTransparency(eFinishTween); 111 | ExpectIntToBe(btnTest.Transparency, 50, "Stop Transparency"); 112 | 113 | btnTest.Transparency = 0; 114 | btnTest.TweenFadeOut(0.5); 115 | ExpectIntToBe(btnTest.Transparency, 100, "FadeOut"); 116 | 117 | btnTest.TweenFadeIn(0.5); 118 | ExpectIntToBe(btnTest.Transparency, 0, "FadeIn"); 119 | 120 | RestoreGUIControls(); 121 | #endif 122 | } 123 | 124 | function testButtonTextColor() { 125 | SaveGUIControls(); 126 | Test("Button.TextColor"); 127 | 128 | int expectedColor = UpdateRedInButtonTextColor(128); 129 | btnTest.TweenTextColorRed(0.5, 128, eEaseInBackTween); 130 | ExpectIntToBe(btnTest.TextColor, expectedColor, "Red"); 131 | 132 | RestoreGUIControls(); 133 | 134 | expectedColor = UpdateGreenInButtonTextColor(128); 135 | btnTest.TweenTextColorGreen(0.5, 128, eEaseInBackTween); 136 | ExpectIntToBe(btnTest.TextColor, expectedColor, "Green"); 137 | 138 | RestoreGUIControls(); 139 | 140 | expectedColor = UpdateBlueInButtonTextColor(128); 141 | btnTest.TweenTextColorBlue(0.5, 128, eEaseInBackTween); 142 | ExpectIntToBe(btnTest.TextColor, expectedColor, "Blue"); 143 | 144 | RestoreGUIControls(); 145 | 146 | int toColor = Game.GetColorFromRGB(64, 128, 255); 147 | 148 | btnTest.TweenTextColor(0.5, toColor, eEaseInBackTween); 149 | ExpectIntToBe(btnTest.TextColor, toColor, "Color"); 150 | 151 | RestoreGUIControls(); 152 | 153 | btnTest.TweenTextColorRGB(0.5, 64, 128, 255, eEaseInBackTween); 154 | ExpectIntToBe(btnTest.TextColor, toColor, "ColorRGB"); 155 | 156 | RestoreGUIControls(); 157 | 158 | expectedColor = UpdateRedInButtonTextColor(128); 159 | btnTest.TweenTextColorRed(0.5, 128, eEaseLinearTween, eNoBlockTween); 160 | btnTest.StopTweenTextColorRed(eFinishTween); 161 | ExpectIntToBe(btnTest.TextColor, expectedColor, "R Finish"); 162 | 163 | RestoreGUIControls(); 164 | 165 | expectedColor = UpdateGreenInButtonTextColor(128); 166 | btnTest.TweenTextColorGreen(0.5, 128, eEaseLinearTween, eNoBlockTween); 167 | btnTest.StopTweenTextColorGreen(eFinishTween); 168 | ExpectIntToBe(btnTest.TextColor, expectedColor, "G Finish"); 169 | 170 | RestoreGUIControls(); 171 | 172 | expectedColor = UpdateBlueInButtonTextColor(128); 173 | btnTest.TweenTextColorBlue(0.5, 128, eEaseLinearTween, eNoBlockTween); 174 | btnTest.StopTweenTextColorBlue(eFinishTween); 175 | ExpectIntToBe(btnTest.TextColor, expectedColor, "B Finish"); 176 | 177 | RestoreGUIControls(); 178 | 179 | btnTest.TweenTextColor(0.5, toColor, eEaseLinearTween, eNoBlockTween); 180 | btnTest.StopTweenTextColor(eFinishTween); 181 | ExpectIntToBe(btnTest.TextColor, toColor, "Color Finish"); 182 | 183 | RestoreGUIControls(); 184 | 185 | btnTest.TweenTextColorRGB(0.5, 64, 128, 255, eEaseLinearTween, eNoBlockTween); 186 | btnTest.StopTweenTextColor(eFinishTween); 187 | ExpectIntToBe(btnTest.TextColor, toColor, "ColorRGB Finish"); 188 | 189 | RestoreGUIControls(); 190 | } 191 | 192 | function testLabelTextColor() { 193 | SaveGUIControls(); 194 | Test("Label.TextColor"); 195 | 196 | int expectedColor = UpdateRedInLabelTextColor(128); 197 | lblTest.TweenTextColorRed(0.5, 128, eEaseInBackTween); 198 | ExpectIntToBe(lblTest.TextColor, expectedColor, "Red"); 199 | 200 | RestoreGUIControls(); 201 | 202 | expectedColor = UpdateGreenInLabelTextColor(128); 203 | lblTest.TweenTextColorGreen(0.5, 128, eEaseInBackTween); 204 | ExpectIntToBe(lblTest.TextColor, expectedColor, "Green"); 205 | 206 | RestoreGUIControls(); 207 | 208 | expectedColor = UpdateBlueInLabelTextColor(128); 209 | lblTest.TweenTextColorBlue(0.5, 128, eEaseInBackTween); 210 | ExpectIntToBe(lblTest.TextColor, expectedColor, "Blue"); 211 | 212 | RestoreGUIControls(); 213 | 214 | int toColor = Game.GetColorFromRGB(64, 128, 255); 215 | 216 | lblTest.TweenTextColor(0.5, toColor, eEaseInBackTween); 217 | ExpectIntToBe(lblTest.TextColor, toColor, "Color"); 218 | 219 | RestoreGUIControls(); 220 | 221 | lblTest.TweenTextColorRGB(0.5, 64, 128, 255, eEaseInBackTween); 222 | ExpectIntToBe(lblTest.TextColor, toColor, "ColorRGB"); 223 | 224 | RestoreGUIControls(); 225 | 226 | expectedColor = UpdateRedInLabelTextColor(128); 227 | lblTest.TweenTextColorRed(0.5, 128, eEaseLinearTween, eNoBlockTween); 228 | lblTest.StopTweenTextColorRed(eFinishTween); 229 | ExpectIntToBe(lblTest.TextColor, expectedColor, "R Finish"); 230 | 231 | RestoreGUIControls(); 232 | 233 | expectedColor = UpdateGreenInLabelTextColor(128); 234 | lblTest.TweenTextColorGreen(0.5, 128, eEaseLinearTween, eNoBlockTween); 235 | lblTest.StopTweenTextColorGreen(eFinishTween); 236 | ExpectIntToBe(lblTest.TextColor, expectedColor, "G Finish"); 237 | 238 | RestoreGUIControls(); 239 | 240 | expectedColor = UpdateBlueInLabelTextColor(128); 241 | lblTest.TweenTextColorBlue(0.5, 128, eEaseLinearTween, eNoBlockTween); 242 | lblTest.StopTweenTextColorBlue(eFinishTween); 243 | ExpectIntToBe(lblTest.TextColor, expectedColor, "B Finish"); 244 | 245 | RestoreGUIControls(); 246 | 247 | lblTest.TweenTextColor(0.5, toColor, eEaseLinearTween, eNoBlockTween); 248 | lblTest.StopTweenTextColor(eFinishTween); 249 | ExpectIntToBe(lblTest.TextColor, toColor, "Color Finish"); 250 | 251 | RestoreGUIControls(); 252 | 253 | lblTest.TweenTextColorRGB(0.5, 64, 128, 255, eEaseLinearTween, eNoBlockTween); 254 | lblTest.StopTweenTextColor(eFinishTween); 255 | ExpectIntToBe(lblTest.TextColor, toColor, "ColorRGB Finish"); 256 | 257 | RestoreGUIControls(); 258 | } 259 | 260 | function testTextBoxTextColor() { 261 | SaveGUIControls(); 262 | Test("TextBox.TextColor"); 263 | 264 | int expectedColor = UpdateRedInTextBoxTextColor(128); 265 | txtTest.TweenTextColorRed(0.5, 128, eEaseInBackTween); 266 | ExpectIntToBe(txtTest.TextColor, expectedColor, "Red"); 267 | 268 | RestoreGUIControls(); 269 | 270 | expectedColor = UpdateGreenInTextBoxTextColor(128); 271 | txtTest.TweenTextColorGreen(0.5, 128, eEaseInBackTween); 272 | ExpectIntToBe(txtTest.TextColor, expectedColor, "Green"); 273 | 274 | RestoreGUIControls(); 275 | 276 | expectedColor = UpdateBlueInTextBoxTextColor(128); 277 | txtTest.TweenTextColorBlue(0.5, 128, eEaseInBackTween); 278 | ExpectIntToBe(txtTest.TextColor, expectedColor, "Blue"); 279 | 280 | RestoreGUIControls(); 281 | 282 | int toColor = Game.GetColorFromRGB(64, 128, 255); 283 | 284 | txtTest.TweenTextColor(0.5, toColor, eEaseInBackTween); 285 | ExpectIntToBe(txtTest.TextColor, toColor, "Color"); 286 | 287 | RestoreGUIControls(); 288 | 289 | txtTest.TweenTextColorRGB(0.5, 64, 128, 255, eEaseInBackTween); 290 | ExpectIntToBe(txtTest.TextColor, toColor, "ColorRGB"); 291 | 292 | RestoreGUIControls(); 293 | 294 | expectedColor = UpdateRedInTextBoxTextColor(128); 295 | txtTest.TweenTextColorRed(0.5, 128, eEaseLinearTween, eNoBlockTween); 296 | txtTest.StopTweenTextColorRed(eFinishTween); 297 | ExpectIntToBe(txtTest.TextColor, expectedColor, "R Finish"); 298 | 299 | RestoreGUIControls(); 300 | 301 | expectedColor = UpdateGreenInTextBoxTextColor(128); 302 | txtTest.TweenTextColorGreen(0.5, 128, eEaseLinearTween, eNoBlockTween); 303 | txtTest.StopTweenTextColorGreen(eFinishTween); 304 | ExpectIntToBe(txtTest.TextColor, expectedColor, "G Finish"); 305 | 306 | RestoreGUIControls(); 307 | 308 | expectedColor = UpdateBlueInTextBoxTextColor(128); 309 | txtTest.TweenTextColorBlue(0.5, 128, eEaseLinearTween, eNoBlockTween); 310 | txtTest.StopTweenTextColorBlue(eFinishTween); 311 | ExpectIntToBe(txtTest.TextColor, expectedColor, "B Finish"); 312 | 313 | RestoreGUIControls(); 314 | 315 | txtTest.TweenTextColor(0.5, toColor, eEaseLinearTween, eNoBlockTween); 316 | txtTest.StopTweenTextColor(eFinishTween); 317 | ExpectIntToBe(txtTest.TextColor, toColor, "Color Finish"); 318 | 319 | RestoreGUIControls(); 320 | 321 | txtTest.TweenTextColorRGB(0.5, 64, 128, 255, eEaseLinearTween, eNoBlockTween); 322 | txtTest.StopTweenTextColor(eFinishTween); 323 | ExpectIntToBe(txtTest.TextColor, toColor, "ColorRGB Finish"); 324 | 325 | RestoreGUIControls(); 326 | } 327 | 328 | function testListBoxSelectedBackColor() { 329 | #ifdef SCRIPT_API_v350 330 | SaveGUIControls(); 331 | Test("ListBox.SelectedBackColor"); 332 | 333 | int expectedColor = UpdateRedInListBoxSeletedBackColor(128); 334 | lstTest.TweenSelectedBackColorRed(0.5, 128, eEaseInBackTween); 335 | ExpectIntToBe(lstTest.SelectedBackColor, expectedColor, "Red"); 336 | 337 | RestoreGUIControls(); 338 | 339 | expectedColor = UpdateGreenInListBoxSeletedBackColor(128); 340 | lstTest.TweenSelectedBackColorGreen(0.5, 128, eEaseInBackTween); 341 | ExpectIntToBe(lstTest.SelectedBackColor, expectedColor, "Green"); 342 | 343 | RestoreGUIControls(); 344 | 345 | expectedColor = UpdateBlueInListBoxSeletedBackColor(128); 346 | lstTest.TweenSelectedBackColorBlue(0.5, 128, eEaseInBackTween); 347 | ExpectIntToBe(lstTest.SelectedBackColor, expectedColor, "Blue"); 348 | 349 | RestoreGUIControls(); 350 | 351 | int toColor = Game.GetColorFromRGB(64, 128, 255); 352 | 353 | lstTest.TweenSelectedBackColor(0.5, toColor, eEaseInBackTween); 354 | ExpectIntToBe(lstTest.SelectedBackColor, toColor, "Color"); 355 | 356 | RestoreGUIControls(); 357 | 358 | lstTest.TweenSelectedBackColorRGB(0.5, 64, 128, 255, eEaseInBackTween); 359 | ExpectIntToBe(lstTest.SelectedBackColor, toColor, "ColorRGB"); 360 | 361 | RestoreGUIControls(); 362 | 363 | expectedColor = UpdateRedInListBoxSeletedBackColor(128); 364 | lstTest.TweenSelectedBackColorRed(0.5, 128, eEaseLinearTween, eNoBlockTween); 365 | lstTest.StopTweenSelectedBackColorRed(eFinishTween); 366 | ExpectIntToBe(lstTest.SelectedBackColor, expectedColor, "R Finish"); 367 | 368 | RestoreGUIControls(); 369 | 370 | expectedColor = UpdateGreenInListBoxSeletedBackColor(128); 371 | lstTest.TweenSelectedBackColorGreen(0.5, 128, eEaseLinearTween, eNoBlockTween); 372 | lstTest.StopTweenSelectedBackColorGreen(eFinishTween); 373 | ExpectIntToBe(lstTest.SelectedBackColor, expectedColor, "G Finish"); 374 | 375 | RestoreGUIControls(); 376 | 377 | expectedColor = UpdateBlueInListBoxSeletedBackColor(128); 378 | lstTest.TweenSelectedBackColorBlue(0.5, 128, eEaseLinearTween, eNoBlockTween); 379 | lstTest.StopTweenSelectedBackColorBlue(eFinishTween); 380 | ExpectIntToBe(lstTest.SelectedBackColor, expectedColor, "B Finish"); 381 | 382 | RestoreGUIControls(); 383 | 384 | lstTest.TweenSelectedBackColor(0.5, toColor, eEaseLinearTween, eNoBlockTween); 385 | lstTest.StopTweenSelectedBackColor(eFinishTween); 386 | ExpectIntToBe(lstTest.SelectedBackColor, toColor, "Color Finish"); 387 | 388 | RestoreGUIControls(); 389 | 390 | lstTest.TweenSelectedBackColorRGB(0.5, 64, 128, 255, eEaseLinearTween, eNoBlockTween); 391 | lstTest.StopTweenSelectedBackColor(eFinishTween); 392 | ExpectIntToBe(lstTest.SelectedBackColor, toColor, "ColorRGB Finish"); 393 | 394 | RestoreGUIControls(); 395 | #endif 396 | } 397 | 398 | function testListBoxSelectedTextColor() { 399 | #ifdef SCRIPT_API_v350 400 | SaveGUIControls(); 401 | Test("ListBox.SelectedTextColor"); 402 | 403 | int expectedColor = UpdateRedInListBoxSeletedTextColor(128); 404 | lstTest.TweenSelectedTextColorRed(0.5, 128, eEaseInBackTween); 405 | ExpectIntToBe(lstTest.SelectedTextColor, expectedColor, "Red"); 406 | 407 | RestoreGUIControls(); 408 | 409 | expectedColor = UpdateGreenInListBoxSeletedTextColor(128); 410 | lstTest.TweenSelectedTextColorGreen(0.5, 128, eEaseInBackTween); 411 | ExpectIntToBe(lstTest.SelectedTextColor, expectedColor, "Green"); 412 | 413 | RestoreGUIControls(); 414 | 415 | expectedColor = UpdateBlueInListBoxSeletedTextColor(128); 416 | lstTest.TweenSelectedTextColorBlue(0.5, 128, eEaseInBackTween); 417 | ExpectIntToBe(lstTest.SelectedTextColor, expectedColor, "Blue"); 418 | 419 | RestoreGUIControls(); 420 | 421 | int toColor = Game.GetColorFromRGB(64, 128, 255); 422 | 423 | lstTest.TweenSelectedTextColor(0.5, toColor, eEaseInBackTween); 424 | ExpectIntToBe(lstTest.SelectedTextColor, toColor, "Color"); 425 | 426 | RestoreGUIControls(); 427 | 428 | lstTest.TweenSelectedTextColorRGB(0.5, 64, 128, 255, eEaseInBackTween); 429 | ExpectIntToBe(lstTest.SelectedTextColor, toColor, "ColorRGB"); 430 | 431 | RestoreGUIControls(); 432 | 433 | expectedColor = UpdateRedInListBoxSeletedTextColor(128); 434 | lstTest.TweenSelectedTextColorRed(0.5, 128, eEaseLinearTween, eNoBlockTween); 435 | lstTest.StopTweenSelectedTextColorRed(eFinishTween); 436 | ExpectIntToBe(lstTest.SelectedTextColor, expectedColor, "R Finish"); 437 | 438 | RestoreGUIControls(); 439 | 440 | expectedColor = UpdateGreenInListBoxSeletedTextColor(128); 441 | lstTest.TweenSelectedTextColorGreen(0.5, 128, eEaseLinearTween, eNoBlockTween); 442 | lstTest.StopTweenSelectedTextColorGreen(eFinishTween); 443 | ExpectIntToBe(lstTest.SelectedTextColor, expectedColor, "G Finish"); 444 | 445 | RestoreGUIControls(); 446 | 447 | expectedColor = UpdateBlueInListBoxSeletedTextColor(128); 448 | lstTest.TweenSelectedTextColorBlue(0.5, 128, eEaseLinearTween, eNoBlockTween); 449 | lstTest.StopTweenSelectedTextColorBlue(eFinishTween); 450 | ExpectIntToBe(lstTest.SelectedTextColor, expectedColor, "B Finish"); 451 | 452 | RestoreGUIControls(); 453 | 454 | lstTest.TweenSelectedTextColor(0.5, toColor, eEaseLinearTween, eNoBlockTween); 455 | lstTest.StopTweenSelectedTextColor(eFinishTween); 456 | ExpectIntToBe(lstTest.SelectedTextColor, toColor, "Color Finish"); 457 | 458 | RestoreGUIControls(); 459 | 460 | lstTest.TweenSelectedTextColorRGB(0.5, 64, 128, 255, eEaseLinearTween, eNoBlockTween); 461 | lstTest.StopTweenSelectedTextColor(eFinishTween); 462 | ExpectIntToBe(lstTest.SelectedTextColor, toColor, "ColorRGB Finish"); 463 | 464 | RestoreGUIControls(); 465 | #endif 466 | } 467 | 468 | function testListBoxTextColor() { 469 | #ifdef SCRIPT_API_v350 470 | SaveGUIControls(); 471 | Test("ListBox.TextColor"); 472 | 473 | int expectedColor = UpdateRedInListBoxTextColor(128); 474 | lstTest.TweenTextColorRed(0.5, 128, eEaseInBackTween); 475 | ExpectIntToBe(lstTest.TextColor, expectedColor, "Red"); 476 | 477 | RestoreGUIControls(); 478 | 479 | expectedColor = UpdateGreenInListBoxTextColor(128); 480 | lstTest.TweenTextColorGreen(0.5, 128, eEaseInBackTween); 481 | ExpectIntToBe(lstTest.TextColor, expectedColor, "Green"); 482 | 483 | RestoreGUIControls(); 484 | 485 | expectedColor = UpdateBlueInListBoxTextColor(128); 486 | lstTest.TweenTextColorBlue(0.5, 128, eEaseInBackTween); 487 | ExpectIntToBe(lstTest.TextColor, expectedColor, "Blue"); 488 | 489 | RestoreGUIControls(); 490 | 491 | int toColor = Game.GetColorFromRGB(64, 128, 255); 492 | 493 | lstTest.TweenTextColor(0.5, toColor, eEaseInBackTween); 494 | ExpectIntToBe(lstTest.TextColor, toColor, "Color"); 495 | 496 | RestoreGUIControls(); 497 | 498 | lstTest.TweenTextColorRGB(0.5, 64, 128, 255, eEaseInBackTween); 499 | ExpectIntToBe(lstTest.TextColor, toColor, "ColorRGB"); 500 | 501 | RestoreGUIControls(); 502 | 503 | expectedColor = UpdateRedInListBoxTextColor(128); 504 | lstTest.TweenTextColorRed(0.5, 128, eEaseLinearTween, eNoBlockTween); 505 | lstTest.StopTweenTextColorRed(eFinishTween); 506 | ExpectIntToBe(lstTest.TextColor, expectedColor, "R Finish"); 507 | 508 | RestoreGUIControls(); 509 | 510 | expectedColor = UpdateGreenInListBoxTextColor(128); 511 | lstTest.TweenTextColorGreen(0.5, 128, eEaseLinearTween, eNoBlockTween); 512 | lstTest.StopTweenTextColorGreen(eFinishTween); 513 | ExpectIntToBe(lstTest.TextColor, expectedColor, "G Finish"); 514 | 515 | RestoreGUIControls(); 516 | 517 | expectedColor = UpdateBlueInListBoxTextColor(128); 518 | lstTest.TweenTextColorBlue(0.5, 128, eEaseLinearTween, eNoBlockTween); 519 | lstTest.StopTweenTextColorBlue(eFinishTween); 520 | ExpectIntToBe(lstTest.TextColor, expectedColor, "B Finish"); 521 | 522 | RestoreGUIControls(); 523 | 524 | lstTest.TweenTextColor(0.5, toColor, eEaseLinearTween, eNoBlockTween); 525 | lstTest.StopTweenTextColor(eFinishTween); 526 | ExpectIntToBe(lstTest.TextColor, toColor, "Color Finish"); 527 | 528 | RestoreGUIControls(); 529 | 530 | lstTest.TweenTextColorRGB(0.5, 64, 128, 255, eEaseLinearTween, eNoBlockTween); 531 | lstTest.StopTweenTextColor(eFinishTween); 532 | ExpectIntToBe(lstTest.TextColor, toColor, "ColorRGB Finish"); 533 | 534 | RestoreGUIControls(); 535 | #endif 536 | } 537 | 538 | function testStopAllTweens() { 539 | SaveGUIControls(); 540 | Test("GUIControl.StopAllTweens"); 541 | 542 | int toColor = Game.GetColorFromRGB(64, 128, 255); 543 | 544 | lblTest.TweenTextColor(0.5, toColor, eEaseInBackTween, eNoBlockTween); 545 | lblTest.StopAllTweens(eFinishTween); 546 | ExpectIntToBe(lblTest.TextColor, toColor, "Color"); 547 | 548 | RestoreGUIControls(); 549 | } 550 | 551 | function room_AfterFadeIn() 552 | { 553 | SaveGUIControls(); 554 | StartCutscene(eSkipESCOnly); 555 | 556 | testButtonTextColor(); 557 | testTransparency(); 558 | testLabelTextColor(); 559 | testTextBoxTextColor(); 560 | testListBoxSelectedBackColor(); 561 | testListBoxSelectedTextColor(); 562 | testListBoxTextColor(); 563 | testStopAllTweens(); 564 | 565 | EndCutscene(); 566 | RestoreGUIControls(); 567 | player.ChangeRoom(99); 568 | } 569 | 570 | function room_Load() 571 | { 572 | gControlsTest.Visible = true; 573 | } 574 | 575 | function room_FirstLoad() 576 | { 577 | SaveGUIControls(); 578 | lstTest.FillDirList("*"); 579 | lstTest.SelectedIndex = lstTest.ItemCount - 1; 580 | } 581 | 582 | function room_Leave() 583 | { 584 | RestoreGUIControls(); 585 | gControlsTest.Visible = false; 586 | } 587 | 588 | function room_RepExec() 589 | { 590 | 591 | } 592 | -------------------------------------------------------------------------------- /Tween/Tween.ash: -------------------------------------------------------------------------------- 1 | // ags-tween is open source under the MIT License. 2 | // Uses Robert Penner's easing equestions which are under the BSD License. 3 | // 4 | // TERMS OF USE - AGS TWEEN MODULE (ags-tween) 5 | // 6 | // Copyright (c) 2009-present Edmundo Ruiz Ghanem 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 9 | // this software and associated documentation files (the "Software"), to deal in 10 | // the Software without restriction, including without limitation the rights to 11 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 12 | // the Software, and to permit persons to whom the Software is furnished to do so, 13 | // subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in all 16 | // copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 20 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 21 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | #ifndef __TWEEN_MODULE__ 26 | #define __TWEEN_MODULE__ 27 | #define Tween_020400 28 | 29 | /////////////////////////////////////////////////////////////////////////////// 30 | // SETTINGS - Feel free to change this for your game! 31 | /////////////////////////////////////////////////////////////////////////////// 32 | 33 | // Max number of simultaneous tweens that this module can play 34 | // Feel free to change this number, but the higher it is, the slower it might be 35 | // So just increase or decrease it to however many you need. 36 | #define Tween_MAX_INSTANCES 64 37 | 38 | // If true, it stops all tweens upon leaving the room 39 | // If false, it stops most tweens except Audio, GUI, and some screen-related tweens. 40 | #define Tween_STOP_ALL_ON_LEAVE_ROOM false 41 | 42 | // Default TweenEasingType 43 | #define Tween_EASING_TYPE eEaseLinearTween // All Tweens Except GUI and GUI element Tweens 44 | #define Tween_EASING_TYPE_GUI eEaseLinearTween // For GUI and GUI element Tweens Only 45 | #define Tween_EASING_TYPE_AUDIO eEaseLinearTween // For Audio Tweens Only 46 | 47 | // Default TweenStyle 48 | #define Tween_STYLE eBlockTween // All Tweens Except GUI and GUI element Tweens 49 | #define Tween_STYLE_GUI eBlockTween // For GUI and GUI element Tweens Only 50 | #define Tween_STYLE_AUDIO eNoBlockTween // For Audio Tweens only 51 | #define Tween_STYLE_PROPERTY eNoBlockTween // For Property Tweening only 52 | 53 | // Default TweenStopResult 54 | #define Tween_STOP_RESULT ePauseTween // The expected behavior for stopping all tweens 55 | 56 | // Default startDelay 57 | #define Tween_START_DELAY 0 58 | #define Tween_START_DELAY_GUI 0 59 | #define Tween_START_DELAY_AUDIO 0 60 | 61 | // Default TweenTimingType 62 | #define Tween_TIMING eTweenSeconds 63 | #define Tween_TIMING_GUI eTweenSeconds 64 | #define Tween_TIMING_AUDIO eTweenSeconds 65 | 66 | /////////////////////////////////////////////////////////////////////////////// 67 | // ENUMERATIONS 68 | /////////////////////////////////////////////////////////////////////////////// 69 | 70 | enum TweenEasingType { 71 | eEaseLinearTween, 72 | eEaseInSineTween, 73 | eEaseOutSineTween, 74 | eEaseInOutSineTween, 75 | eEaseInQuadTween, 76 | eEaseOutQuadTween, 77 | eEaseInOutQuadTween, 78 | eEaseInCubicTween, 79 | eEaseOutCubicTween, 80 | eEaseInOutCubicTween, 81 | eEaseInQuartTween, 82 | eEaseOutQuartTween, 83 | eEaseInOutQuartTween, 84 | eEaseInQuintTween, 85 | eEaseOutQuintTween, 86 | eEaseInOutQuintTween, 87 | eEaseInCircTween, 88 | eEaseOutCircTween, 89 | eEaseInOutCircTween, 90 | eEaseInExpoTween, 91 | eEaseOutExpoTween, 92 | eEaseInOutExpoTween, 93 | eEaseInBackTween, 94 | eEaseOutBackTween, 95 | eEaseInOutBackTween, 96 | eEaseInElasticTween, 97 | eEaseOutElasticTween, 98 | eEaseInOutElasticTween, 99 | eEaseInBounceTween, 100 | eEaseOutBounceTween, 101 | eEaseInOutBounceTween 102 | }; 103 | 104 | enum TweenStyle { 105 | eBlockTween = eBlock, 106 | eNoBlockTween = eNoBlock, 107 | eRepeatTween = eRepeat, 108 | eReverseRepeatTween = 7002 109 | }; 110 | 111 | enum TweenTimingType { 112 | eTweenSeconds, 113 | eTweenSpeed, 114 | }; 115 | 116 | enum TweenStopResult { 117 | ePauseTween, 118 | eResetTween, 119 | eFinishTween 120 | }; 121 | 122 | /////////////////////////////////////////////////////////////////////////////// 123 | // TWEENS 124 | /////////////////////////////////////////////////////////////////////////////// 125 | 126 | struct TweenBase { 127 | writeprotected TweenEasingType EasingType; 128 | writeprotected TweenStyle Style; 129 | writeprotected float Duration; 130 | writeprotected float Elapsed; 131 | writeprotected float FromValue; 132 | writeprotected float ToValue; 133 | writeprotected float StartDelay; 134 | 135 | /// Reverses the direction of the tween. 136 | import function Reverse(); 137 | 138 | /// Restarts the tween. 139 | import function Restart(); 140 | 141 | /// Returns true if the tween is playing. 142 | import bool IsPlaying(); 143 | 144 | /// Initializes a tween. 145 | import int Init(float timing, int fromValue, int toValue, TweenEasingType easingType=eEaseLinearTween, TweenStyle style=eNoBlockTween, float startDelay=0, TweenTimingType timingType=eTweenSeconds); 146 | }; 147 | 148 | struct Tween extends TweenBase { 149 | /// Tweened Value (read only) 150 | writeprotected int Value; 151 | 152 | /// Moves the tween forward in time. 153 | import bool Update(); 154 | 155 | /// Stops the tween. 156 | import function Stop(TweenStopResult result=ePauseTween); 157 | 158 | /// Returns the progress from 0.0 to 1.0. 159 | import float GetProgress(); 160 | 161 | // STATIC FUNCTIONS: 162 | 163 | /// Increases the game speed to at least 60 for better tweening quality. 164 | import static function IncreaseGameSpeed(); 165 | 166 | /// Restores the game speed back to its original. 167 | import static function RestoreGameSpeed(); 168 | 169 | /// Increases the game speed when a blocking tween is playing. 170 | import static function IncreaseGameSpeedOnBlock(bool value); 171 | 172 | /// Stops all Tweens that are currently running. 173 | import static function StopAll(TweenStopResult result=Tween_STOP_RESULT); 174 | 175 | /// Waits until all non-looping Tweens are finished playing. 176 | import static function WaitForAllToFinish(); 177 | }; 178 | 179 | #ifdef SCRIPT_API_v3507 180 | import int TweenX(this Viewport*, float timing, int toX, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 181 | import int TweenY(this Viewport*, float timing, int toY, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 182 | import int TweenWidth(this Viewport*, float timing, int toWidth, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 183 | import int TweenHeight(this Viewport*, float timing, int toHeight, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 184 | import int TweenPosition(this Viewport*, float timing, int toX, int toY, int toWidth, int toHeight, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 185 | import function StopTweenPosition(this Viewport*, TweenStopResult result=Tween_STOP_RESULT); 186 | import function StopAllTweens(this Viewport*, TweenStopResult result=Tween_STOP_RESULT); 187 | 188 | import int TweenX(this Camera*, float timing, int toX, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 189 | import int TweenY(this Camera*, float timing, int toY, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 190 | import int TweenWidth(this Camera*, float timing, int toWidth, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 191 | import int TweenHeight(this Camera*, float timing, int toHeight, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 192 | import int TweenPosition(this Camera*, float timing, int toX, int toY, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 193 | import int TweenSize(this Camera*, float timing, int toWidth, int toHeight, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 194 | import int TweenZoom(this Camera*, float timing, float toZoom, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 195 | import int TweenZoomTo(this Camera*, float timing, float toZoom, int toX, int toY, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 196 | import function StopTweenPosition(this Camera*, TweenStopResult result=Tween_STOP_RESULT); 197 | import function StopTweenSize(this Camera*, TweenStopResult result=Tween_STOP_RESULT); 198 | import function StopAllTweens(this Camera*, TweenStopResult result=Tween_STOP_RESULT); 199 | 200 | import int TweenPosition(this Point*, float timing, int toX, int toY, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 201 | import int TweenX(this Point*, float timing, int toX, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 202 | import int TweenY(this Point*, float timing, int toY, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 203 | import function StopTweenPosition(this Point*, TweenStopResult result=Tween_STOP_RESULT); 204 | import function StopAllTweens(this Point*, TweenStopResult result=Tween_STOP_RESULT); 205 | #endif 206 | #ifndef SCRIPT_API_v3507 207 | import int TweenViewportX(float timing, int toX, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 208 | import int TweenViewportY(float timing, int toY, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 209 | import int TweenViewport(float timing, int toX, int toY, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 210 | import function StopTweenViewport(TweenStopResult result=Tween_STOP_RESULT); 211 | #endif 212 | 213 | import int TweenShakeScreen(float timing, int fromDelay, int toDelay, int fromAmount, int toAmount, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 214 | import function StopTweenShakeScreen(TweenStopResult result=Tween_STOP_RESULT); 215 | 216 | import int TweenAreaScaling(float timing, int area, int fromMin, int toMin, int fromMax, int toMax, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 217 | import function StopTweenAreaScaling(int area, TweenStopResult result=Tween_STOP_RESULT); 218 | 219 | import int TweenSpeechVolume(float timing, int fromVolume, int toVolume, TweenEasingType easingType=Tween_EASING_TYPE_AUDIO, TweenStyle style=Tween_STYLE_AUDIO, float startDelay=Tween_START_DELAY_AUDIO, TweenTimingType timingType=Tween_TIMING_AUDIO); 220 | import function StopTweenSpeechVolume(TweenStopResult result=Tween_STOP_RESULT); 221 | #ifndef STRICT_AUDIO 222 | // These apply to AGS 3.2 and above only if the Strict Audio setting is NOT enabled 223 | import int TweenMusicMasterVolume(float timing, int fromVolume, int toVolume, TweenEasingType easingType=Tween_EASING_TYPE_AUDIO, TweenStyle style=Tween_STYLE_AUDIO, float startDelay=Tween_START_DELAY_AUDIO, TweenTimingType timingType=Tween_TIMING_AUDIO); 224 | import int TweenDigitalMasterVolume(float timing, int fromVolume, int toVolume, TweenEasingType easingType=Tween_EASING_TYPE_AUDIO, TweenStyle style=Tween_STYLE_AUDIO, float startDelay=Tween_START_DELAY_AUDIO, TweenTimingType timingType=Tween_TIMING_AUDIO); 225 | import int TweenSoundVolume(float timing, int fromVolume, int toVolume, TweenEasingType easingType=Tween_EASING_TYPE_AUDIO, TweenStyle style=Tween_STYLE_AUDIO, float startDelay=Tween_START_DELAY_AUDIO, TweenTimingType timingType=Tween_TIMING_AUDIO); 226 | import int TweenChannelVolume(float timing, int channel, int fromVolume, int toVolume, TweenEasingType easingType=Tween_EASING_TYPE_AUDIO, TweenStyle style=Tween_STYLE_AUDIO, float startDelay=Tween_START_DELAY_AUDIO, TweenTimingType timingType=Tween_TIMING_AUDIO); 227 | import int TweenChannelFadeOut(float timing, int channel, TweenEasingType easingType=Tween_EASING_TYPE_AUDIO, TweenStyle style=Tween_STYLE_AUDIO, float startDelay=Tween_START_DELAY_AUDIO, TweenTimingType timingType=Tween_TIMING_AUDIO); 228 | import int TweenChannelFadeIn(float timing, int channel, TweenEasingType easingType=Tween_EASING_TYPE_AUDIO, TweenStyle style=Tween_STYLE_AUDIO, float startDelay=Tween_START_DELAY_AUDIO, TweenTimingType timingType=Tween_TIMING_AUDIO); 229 | import int TweenMusicVolume(float timing, int fromVolume, int toVolume, TweenEasingType easingType=Tween_EASING_TYPE_AUDIO, TweenStyle style=Tween_STYLE_AUDIO, float startDelay=Tween_START_DELAY_AUDIO, TweenTimingType timingType=Tween_TIMING_AUDIO); 230 | import int TweenMusicFadeOut(float timing, TweenEasingType easingType=Tween_EASING_TYPE_AUDIO, TweenStyle style=Tween_STYLE_AUDIO, float startDelay=Tween_START_DELAY_AUDIO, TweenTimingType timingType=Tween_TIMING_AUDIO); 231 | import int TweenMusicFadeIn(float timing, TweenEasingType easingType=Tween_EASING_TYPE_AUDIO, TweenStyle style=Tween_STYLE_AUDIO, float startDelay=Tween_START_DELAY_AUDIO, TweenTimingType timingType=Tween_TIMING_AUDIO); 232 | import function StopTweenMusicMasterVolume(TweenStopResult result=Tween_STOP_RESULT); 233 | import function StopTweenDigitalMasterVolume(TweenStopResult result=Tween_STOP_RESULT); 234 | import function StopTweenSoundVolume(TweenStopResult result=Tween_STOP_RESULT); 235 | import function StopTweenChannelVolume(int channel, TweenStopResult result=Tween_STOP_RESULT); 236 | import function StopTweenMusicVolume(TweenStopResult result=Tween_STOP_RESULT); 237 | #endif 238 | 239 | #ifdef STRICT_AUDIO 240 | import int TweenSpeed(this AudioChannel*, float timing, int toSpeed, TweenEasingType easingType=Tween_EASING_TYPE_AUDIO, TweenStyle style=Tween_STYLE_AUDIO, float startDelay=Tween_START_DELAY_AUDIO, TweenTimingType timingType=Tween_TIMING_AUDIO); 241 | import function StopTweenSpeed(this AudioChannel*, TweenStopResult result=Tween_STOP_RESULT); 242 | 243 | import int TweenVolume(static System, float timing, int toVolume, TweenEasingType easingType=Tween_EASING_TYPE_AUDIO, TweenStyle style=Tween_STYLE_AUDIO, float startDelay=Tween_START_DELAY_AUDIO, TweenTimingType timingType=Tween_TIMING_AUDIO); 244 | import function StopTweenVolume(static System, TweenStopResult result=Tween_STOP_RESULT); 245 | 246 | import int TweenPosition(this AudioChannel*, float timing, int toPosition, TweenEasingType easingType=Tween_EASING_TYPE_AUDIO, TweenStyle style=Tween_STYLE_AUDIO, float startDelay=Tween_START_DELAY_AUDIO, TweenTimingType timingType=Tween_TIMING_AUDIO); 247 | import int TweenPanning(this AudioChannel*, float timing, int toPanning, TweenEasingType easingType=Tween_EASING_TYPE_AUDIO, TweenStyle style=Tween_STYLE_AUDIO, float startDelay=Tween_START_DELAY_AUDIO, TweenTimingType timingType=Tween_TIMING_AUDIO); 248 | import int TweenVolume(this AudioChannel*, float timing, int toVolume, TweenEasingType easingType=Tween_EASING_TYPE_AUDIO, TweenStyle style=Tween_STYLE_AUDIO, float startDelay=Tween_START_DELAY_AUDIO, TweenTimingType timingType=Tween_TIMING_AUDIO); 249 | import int TweenFadeOut(this AudioChannel*, float timing, TweenEasingType easingType=Tween_EASING_TYPE_AUDIO, TweenStyle style=Tween_STYLE_AUDIO, float startDelay=Tween_START_DELAY_AUDIO, TweenTimingType timingType=Tween_TIMING_AUDIO); 250 | import int TweenFadeIn(this AudioChannel*, float timing, TweenEasingType easingType=Tween_EASING_TYPE_AUDIO, TweenStyle style=Tween_STYLE_AUDIO, float startDelay=Tween_START_DELAY_AUDIO, TweenTimingType timingType=Tween_TIMING_AUDIO); 251 | import int TweenRoomLocation(this AudioChannel*, float timing, int toX, int toY, int fromX, int fromY, TweenEasingType easingType=Tween_EASING_TYPE_AUDIO, TweenStyle style=Tween_STYLE_AUDIO, float startDelay=Tween_START_DELAY_AUDIO, TweenTimingType timingType=Tween_TIMING_AUDIO); 252 | import function StopTweenPosition(this AudioChannel*, TweenStopResult result=Tween_STOP_RESULT); 253 | import function StopTweenPanning(this AudioChannel*, TweenStopResult result=Tween_STOP_RESULT); 254 | import function StopTweenVolume(this AudioChannel*, TweenStopResult result=Tween_STOP_RESULT); 255 | import function StopTweenRoomLocation(this AudioChannel*, TweenStopResult result=Tween_STOP_RESULT); 256 | import function StopAllTweens(this AudioChannel*, TweenStopResult result=Tween_STOP_RESULT); 257 | #endif 258 | 259 | import int TweenX(this Character*, float timing, int toX, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 260 | import int TweenY(this Character*, float timing, int toY, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 261 | import int TweenX(this Object*, float timing, int toX, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 262 | import int TweenY(this Object*, float timing, int toY, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 263 | import int TweenX(this Overlay*, float timing, int toX, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 264 | import int TweenY(this Overlay*, float timing, int toY, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 265 | import int TweenX(this GUI*, float timing, int toX, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 266 | import int TweenY(this GUI*, float timing, int toY, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 267 | import int TweenX(this GUIControl*, float timing, int toX, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 268 | import int TweenY(this GUIControl*, float timing, int toY, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 269 | import int TweenX(this Label*, float timing, int toX, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 270 | import int TweenY(this Label*, float timing, int toY, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 271 | import int TweenX(this Button*, float timing, int toX, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 272 | import int TweenY(this Button*, float timing, int toY, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 273 | import int TweenX(this TextBox*, float timing, int toX, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 274 | import int TweenY(this TextBox*, float timing, int toY, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 275 | import int TweenX(this ListBox*, float timing, int toX, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 276 | import int TweenY(this ListBox*, float timing, int toY, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 277 | import int TweenX(this Slider*, float timing, int toX, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 278 | import int TweenY(this Slider*, float timing, int toY, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 279 | import int TweenX(this InvWindow*, float timing, int toX, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 280 | import int TweenY(this InvWindow*, float timing, int toY, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 281 | import int TweenPosition(this Character*, float timing, int toX, int toY, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 282 | import int TweenPosition(this Object*, float timing, int toX, int toY, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 283 | import int TweenPosition(this Overlay*, float timing, int toX, int toY, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 284 | import int TweenPosition(this GUI*, float timing, int toX, int toY, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 285 | import int TweenPosition(this GUIControl*, float timing, int toX, int toY, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 286 | import int TweenPosition(this Label*, float timing, int toX, int toY, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 287 | import int TweenPosition(this Button*, float timing, int toX, int toY, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 288 | import int TweenPosition(this TextBox*, float timing, int toX, int toY, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 289 | import int TweenPosition(this ListBox*, float timing, int toX, int toY, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 290 | import int TweenPosition(this Slider*, float timing, int toX, int toY, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 291 | import int TweenPosition(this InvWindow*, float timing, int toX, int toY, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 292 | import function StopTweenPosition(this Character*, TweenStopResult result=Tween_STOP_RESULT); 293 | import function StopTweenPosition(this Object*, TweenStopResult result=Tween_STOP_RESULT); 294 | import function StopTweenPosition(this Overlay*, TweenStopResult result=Tween_STOP_RESULT); 295 | import function StopTweenPosition(this GUI*, TweenStopResult result=Tween_STOP_RESULT); 296 | import function StopTweenPosition(this GUIControl*, TweenStopResult result=Tween_STOP_RESULT); 297 | import function StopTweenPosition(this Label*, TweenStopResult result=Tween_STOP_RESULT); 298 | import function StopTweenPosition(this Button*, TweenStopResult result=Tween_STOP_RESULT); 299 | import function StopTweenPosition(this TextBox*, TweenStopResult result=Tween_STOP_RESULT); 300 | import function StopTweenPosition(this ListBox*, TweenStopResult result=Tween_STOP_RESULT); 301 | import function StopTweenPosition(this Slider*, TweenStopResult result=Tween_STOP_RESULT); 302 | import function StopTweenPosition(this InvWindow*, TweenStopResult result=Tween_STOP_RESULT); 303 | 304 | import int TweenZ(this Character*, float timing, int toZ, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 305 | import function StopTweenZ(this Character*, TweenStopResult result=Tween_STOP_RESULT); 306 | 307 | #ifdef SCRIPT_API_v360 308 | import int TweenWidth(this Overlay*, float timing, int toWidth, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 309 | import int TweenHeight(this Overlay*, float timing, int toHeight, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 310 | import int TweenSize(this Overlay*, float timing, int toWidth, int toHeight, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 311 | import function StopTweenSize(this Overlay*, TweenStopResult result=Tween_STOP_RESULT); 312 | 313 | import int TweenTransparency(this Overlay*, float timing, int toTransparency, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 314 | import int TweenFadeIn(this Overlay*, float timing, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 315 | import int TweenFadeOut(this Overlay*, float timing, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 316 | import function StopTweenTransparency(this Overlay*, TweenStopResult result=Tween_STOP_RESULT); 317 | #endif 318 | 319 | /// Tweens the Transparency property. Note: This will update the Visible property if Transparency starts or ends at 100. 320 | import int TweenTransparency(this GUI*, float timing, int toTransparency, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 321 | /// Tweens the Transparency property. Note: This will update the Visible property if Transparency starts or ends at 100. 322 | import int TweenTransparency(this Object*, float timing, int toTransparency, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 323 | import int TweenTransparency(this Character*, float timing, int toTransparency, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 324 | /// Tweens the Transparency property to 100. Note: This will set the Visible property to false when the tween finishes playing. 325 | import int TweenFadeOut(this GUI*, float timing, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 326 | /// Tweens the Transparency property to 0. Note: This will set the Visible property to true if Transparency starts at 100. 327 | import int TweenFadeIn(this GUI*, float timing, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 328 | /// Tweens the Transparency property to 100. Note: This will set the Visible property to false when the tween finishes playing. 329 | import int TweenFadeOut(this Object*, float timing, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 330 | /// Tweens the Transparency property to 0. Note: This will set the Visible property to true if Transparency starts at 100. 331 | import int TweenFadeIn(this Object*, float timing, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 332 | import int TweenFadeOut(this Character*, float timing, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 333 | import int TweenFadeIn(this Character*, float timing, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 334 | import function StopTweenTransparency(this Character*, TweenStopResult result=Tween_STOP_RESULT); 335 | import function StopTweenTransparency(this Object*, TweenStopResult result=Tween_STOP_RESULT); 336 | import function StopTweenTransparency(this GUI*, TweenStopResult result=Tween_STOP_RESULT); 337 | #ifdef SCRIPT_API_v360 338 | /// Tweens the Transparency property. Note: This will update the Visible property if Transparency starts or ends at 100. 339 | import int TweenTransparency(this GUIControl*, float timing, int toTransparency, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 340 | /// Tweens the Transparency property to 100. This will set the Visible property to false when the tween finishes playing. 341 | import int TweenFadeOut(this GUIControl*, float timing, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 342 | /// Tweens the Transparency property to 0. Note: This will set the Visible property to true if Transparency starts at 100. 343 | import int TweenFadeIn(this GUIControl*, float timing, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 344 | import function StopTweenTransparency(this GUIControl*, TweenStopResult result=Tween_STOP_RESULT); 345 | #endif 346 | 347 | import int TweenZOrder(this GUI*, float timing, int toZOrder, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 348 | import function StopTweenZOrder(this GUI*, TweenStopResult result=Tween_STOP_RESULT); 349 | 350 | import int TweenSize(this GUI*, float timing, int toWidth, int toHeight, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 351 | import int TweenSize(this GUIControl*, float timing, int toWidth, int toHeight, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 352 | import int TweenSize(this Label*, float timing, int toWidth, int toHeight, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 353 | import int TweenSize(this Button*, float timing, int toWidth, int toHeight, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 354 | import int TweenSize(this TextBox*, float timing, int toWidth, int toHeight, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 355 | import int TweenSize(this ListBox*, float timing, int toWidth, int toHeight, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 356 | import int TweenSize(this Slider*, float timing, int toWidth, int toHeight, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 357 | import int TweenSize(this InvWindow*, float timing, int toWidth, int toHeight, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 358 | import function StopTweenSize(this GUI*, TweenStopResult result=Tween_STOP_RESULT); 359 | import function StopTweenSize(this GUIControl*, TweenStopResult result=Tween_STOP_RESULT); 360 | import function StopTweenSize(this Label*, TweenStopResult result=Tween_STOP_RESULT); 361 | import function StopTweenSize(this Button*, TweenStopResult result=Tween_STOP_RESULT); 362 | import function StopTweenSize(this TextBox*, TweenStopResult result=Tween_STOP_RESULT); 363 | import function StopTweenSize(this ListBox*, TweenStopResult result=Tween_STOP_RESULT); 364 | import function StopTweenSize(this Slider*, TweenStopResult result=Tween_STOP_RESULT); 365 | import function StopTweenSize(this InvWindow*, TweenStopResult result=Tween_STOP_RESULT); 366 | #ifdef SCRIPT_API_v350 367 | import int TweenBackgroundColorRed(this GUI*, float timing, int toRed, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 368 | import int TweenBackgroundColorGreen(this GUI*, float timing, int toGreen, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 369 | import int TweenBackgroundColorBlue(this GUI*, float timing, int toBlue, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 370 | import int TweenBackgroundColorRGB(this GUI*, float timing, int toRed, int toGreen, int toBlue, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 371 | import int TweenBackgroundColor(this GUI*, float timing, int toBackgroundColor, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 372 | import function StopTweenBackgroundColorRed(this GUI*, TweenStopResult result=Tween_STOP_RESULT); 373 | import function StopTweenBackgroundColorGreen(this GUI*, TweenStopResult result=Tween_STOP_RESULT); 374 | import function StopTweenBackgroundColorBlue(this GUI*, TweenStopResult result=Tween_STOP_RESULT); 375 | import function StopTweenBackgroundColorRGB(this GUI*, TweenStopResult result=Tween_STOP_RESULT); 376 | import function StopTweenBackgroundColor(this GUI*, TweenStopResult result=Tween_STOP_RESULT); 377 | 378 | import int TweenBorderColorRed(this GUI*, float timing, int toRed, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 379 | import int TweenBorderColorGreen(this GUI*, float timing, int toGreen, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 380 | import int TweenBorderColorBlue(this GUI*, float timing, int toBlue, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 381 | import int TweenBorderColorRGB(this GUI*, float timing, int toRed, int toGreen, int toBlue, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 382 | import int TweenBorderColor(this GUI*, float timing, int toBorderColor, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 383 | import function StopTweenBorderColorRed(this GUI*, TweenStopResult result=Tween_STOP_RESULT); 384 | import function StopTweenBorderColorGreen(this GUI*, TweenStopResult result=Tween_STOP_RESULT); 385 | import function StopTweenBorderColorBlue(this GUI*, TweenStopResult result=Tween_STOP_RESULT); 386 | import function StopTweenBorderColorRGB(this GUI*, TweenStopResult result=Tween_STOP_RESULT); 387 | import function StopTweenBorderColor(this GUI*, TweenStopResult result=Tween_STOP_RESULT); 388 | 389 | import int TweenSelectedBackColorRed(this ListBox*, float timing, int toRed, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 390 | import int TweenSelectedBackColorGreen(this ListBox*, float timing, int toGreen, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 391 | import int TweenSelectedBackColorBlue(this ListBox*, float timing, int toBlue, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 392 | import int TweenSelectedBackColorRGB(this ListBox*, float timing, int toRed, int toGreen, int toBlue, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 393 | import int TweenSelectedBackColor(this ListBox*, float timing, int toSelectedBackColor, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 394 | import function StopTweenSelectedBackColorRed(this ListBox*, TweenStopResult result=Tween_STOP_RESULT); 395 | import function StopTweenSelectedBackColorGreen(this ListBox*, TweenStopResult result=Tween_STOP_RESULT); 396 | import function StopTweenSelectedBackColorBlue(this ListBox*, TweenStopResult result=Tween_STOP_RESULT); 397 | import function StopTweenSelectedBackColorRGB(this ListBox*, TweenStopResult result=Tween_STOP_RESULT); 398 | import function StopTweenSelectedBackColor(this ListBox*, TweenStopResult result=Tween_STOP_RESULT); 399 | 400 | import int TweenSelectedTextColorRed(this ListBox*, float timing, int toRed, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 401 | import int TweenSelectedTextColorGreen(this ListBox*, float timing, int toGreen, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 402 | import int TweenSelectedTextColorBlue(this ListBox*, float timing, int toBlue, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 403 | import int TweenSelectedTextColorRGB(this ListBox*, float timing, int toRed, int toGreen, int toBlue, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 404 | import int TweenSelectedTextColor(this ListBox*, float timing, int toSelectedTextColor, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 405 | import function StopTweenSelectedTextColorRed(this ListBox*, TweenStopResult result=Tween_STOP_RESULT); 406 | import function StopTweenSelectedTextColorGreen(this ListBox*, TweenStopResult result=Tween_STOP_RESULT); 407 | import function StopTweenSelectedTextColorBlue(this ListBox*, TweenStopResult result=Tween_STOP_RESULT); 408 | import function StopTweenSelectedTextColorRGB(this ListBox*, TweenStopResult result=Tween_STOP_RESULT); 409 | import function StopTweenSelectedTextColor(this ListBox*, TweenStopResult result=Tween_STOP_RESULT); 410 | 411 | import int TweenTextColorRed(this ListBox*, float timing, int toRed, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 412 | import int TweenTextColorGreen(this ListBox*, float timing, int toGreen, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 413 | import int TweenTextColorBlue(this ListBox*, float timing, int toBlue, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 414 | import int TweenTextColorRGB(this ListBox*, float timing, int toRed, int toGreen, int toBlue, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 415 | import int TweenTextColor(this ListBox*, float timing, int toTextColor, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 416 | import function StopTweenTextColorRed(this ListBox*, TweenStopResult result=Tween_STOP_RESULT); 417 | import function StopTweenTextColorGreen(this ListBox*, TweenStopResult result=Tween_STOP_RESULT); 418 | import function StopTweenTextColorBlue(this ListBox*, TweenStopResult result=Tween_STOP_RESULT); 419 | import function StopTweenTextColorRGB(this ListBox*, TweenStopResult result=Tween_STOP_RESULT); 420 | import function StopTweenTextColor(this ListBox*, TweenStopResult result=Tween_STOP_RESULT); 421 | #endif 422 | 423 | /// Tweens the Scaling property. Note: This will set the ManualScaling property to true. 424 | import int TweenScaling(this Character*, float timing, int toScaling, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 425 | import function StopTweenScaling(this Character*, TweenStopResult result=Tween_STOP_RESULT); 426 | #ifdef SCRIPT_API_v360 427 | /// Tweens the Scaling property. Note: This will set the ManualScaling property to true. 428 | import int TweenScaling(this Object*, float timing, int toScaling, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 429 | import function StopTweenScaling(this Object*, TweenStopResult result=Tween_STOP_RESULT); 430 | #endif 431 | 432 | // Cross-fades the Graphic from one Sprite to another. Requires an extra dummy object to perform the transition. Note: This will set the Visible property to true. 433 | import int TweenImage(this Object*, Object* objectRef, float timing, int toSprite, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 434 | 435 | import int TweenAnimationSpeed(this Character*, float timing, int toAnimationSpeed, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 436 | import function StopTweenAnimationSpeed(this Character*, TweenStopResult result=Tween_STOP_RESULT); 437 | #ifdef SCRIPT_API_v360 438 | import int TweenAnimationVolume(this Character*, float timing, int toAnimationVolume, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE_AUDIO, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 439 | import function StopTweenAnimationVolume(this Character*, TweenStopResult result=Tween_STOP_RESULT); 440 | #endif 441 | 442 | #ifdef SCRIPT_API_v341 443 | import int TweenTintRed(this Character*, float timing, int toRed, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 444 | import int TweenTintGreen(this Character*, float timing, int toGreen, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 445 | import int TweenTintBlue(this Character*, float timing, int toBlue, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 446 | import int TweenTintSaturation(this Character*, float timing, int toSaturation, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 447 | import int TweenTintLuminance(this Character*, float timing, int toLuminance, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 448 | import int TweenTint(this Character*, float timing, int toRed, int toGreen, int toBlue, int toSaturation, int toLuminance, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 449 | import function StopTweenTintRed(this Character*, TweenStopResult result=Tween_STOP_RESULT); 450 | import function StopTweenTintGreen(this Character*, TweenStopResult result=Tween_STOP_RESULT); 451 | import function StopTweenTintBlue(this Character*, TweenStopResult result=Tween_STOP_RESULT); 452 | import function StopTweenTintSaturation(this Character*, TweenStopResult result=Tween_STOP_RESULT); 453 | import function StopTweenTintLuminance(this Character*, TweenStopResult result=Tween_STOP_RESULT); 454 | import function StopTweenTint(this Character*, TweenStopResult result=Tween_STOP_RESULT); 455 | 456 | import int TweenTintRed(this Object*, float timing, int toRed, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 457 | import int TweenTintGreen(this Object*, float timing, int toGreen, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 458 | import int TweenTintBlue(this Object*, float timing, int toBlue, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 459 | import int TweenTintSaturation(this Object*, float timing, int toSaturation, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 460 | import int TweenTintLuminance(this Object*, float timing, int toLuminance, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 461 | import int TweenTint(this Object*, float timing, int toRed, int toGreen, int toBlue, int toSaturation, int toLuminance, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 462 | import function StopTweenTintRed(this Object*, TweenStopResult result=Tween_STOP_RESULT); 463 | import function StopTweenTintGreen(this Object*, TweenStopResult result=Tween_STOP_RESULT); 464 | import function StopTweenTintBlue(this Object*, TweenStopResult result=Tween_STOP_RESULT); 465 | import function StopTweenTintSaturation(this Object*, TweenStopResult result=Tween_STOP_RESULT); 466 | import function StopTweenTintLuminance(this Object*, TweenStopResult result=Tween_STOP_RESULT); 467 | import function StopTweenTint(this Object*, TweenStopResult result=Tween_STOP_RESULT); 468 | #endif 469 | 470 | import int TweenLightLevel(this Region*, float timing, int toLightLevel, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 471 | import int TweenTintRed(this Region*, float timing, int toRed, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 472 | import int TweenTintGreen(this Region*, float timing, int toGreen, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 473 | import int TweenTintBlue(this Region*, float timing, int toBlue, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 474 | import int TweenTintSaturation(this Region*, float timing, int toSaturation, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 475 | import int TweenTintLuminance(this Region*, float timing, int toLuminance, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 476 | import int TweenTint(this Region*, float timing, int toRed, int toGreen, int toBlue, int toSaturation, int toLuminance, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 477 | import function StopTweenLightLevel(this Region*, TweenStopResult result=Tween_STOP_RESULT); 478 | import function StopTweenTintRed(this Region*, TweenStopResult result=Tween_STOP_RESULT); 479 | import function StopTweenTintGreen(this Region*, TweenStopResult result=Tween_STOP_RESULT); 480 | import function StopTweenTintBlue(this Region*, TweenStopResult result=Tween_STOP_RESULT); 481 | import function StopTweenTintSaturation(this Region*, TweenStopResult result=Tween_STOP_RESULT); 482 | import function StopTweenTintLuminance(this Region*, TweenStopResult result=Tween_STOP_RESULT); 483 | import function StopTweenTint(this Region*, TweenStopResult result=Tween_STOP_RESULT); 484 | 485 | import int TweenTextColor(this Label*, float timing, int toColor, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 486 | import int TweenTextColorRGB(this Label*, float timing, int toRed, int toGreen, int toBlue, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 487 | import int TweenTextColorRed(this Label*, float timing, int toRed, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 488 | import int TweenTextColorGreen(this Label*, float timing, int toGreen, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 489 | import int TweenTextColorBlue(this Label*, float timing, int toBlue, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 490 | import int TweenTextColor(this Button*, float timing, int toColor, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 491 | import int TweenTextColorRGB(this Button*, float timing, int toRed, int toGreen, int toBlue, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 492 | import int TweenTextColorRed(this Button*, float timing, int toRed, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 493 | import int TweenTextColorGreen(this Button*, float timing, int toGreen, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 494 | import int TweenTextColorBlue(this Button*, float timing, int toBlue, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 495 | import function StopTweenTextColor(this Label*, TweenStopResult result=Tween_STOP_RESULT); 496 | import function StopTweenTextColorRGB(this Label*, TweenStopResult result=Tween_STOP_RESULT); 497 | import function StopTweenTextColorRed(this Label*, TweenStopResult result=Tween_STOP_RESULT); 498 | import function StopTweenTextColorGreen(this Label*, TweenStopResult result=Tween_STOP_RESULT); 499 | import function StopTweenTextColorBlue(this Label*, TweenStopResult result=Tween_STOP_RESULT); 500 | import function StopTweenTextColor(this Button*, TweenStopResult result=Tween_STOP_RESULT); 501 | import function StopTweenTextColorRGB(this Button*, TweenStopResult result=Tween_STOP_RESULT); 502 | import function StopTweenTextColorRed(this Button*, TweenStopResult result=Tween_STOP_RESULT); 503 | import function StopTweenTextColorGreen(this Button*, TweenStopResult result=Tween_STOP_RESULT); 504 | import function StopTweenTextColorBlue(this Button*, TweenStopResult result=Tween_STOP_RESULT); 505 | 506 | import int TweenValue(this Slider*, float timing, int toValue, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 507 | import function StopTweenValue(this Slider*, TweenStopResult result=Tween_STOP_RESULT); 508 | 509 | import int TweenSelectedIndex(this ListBox*, float timing, int toSelectedIndex, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 510 | import function StopTweenSelectedIndex(this ListBox*, TweenStopResult result=Tween_STOP_RESULT); 511 | 512 | import int TweenTopItem(this ListBox*, float timing, int toTopItem, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 513 | import int TweenTopItem(this InvWindow*, float timing, int toTopItem, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 514 | import function StopTweenTopItem(this ListBox*, TweenStopResult result=Tween_STOP_RESULT); 515 | import function StopTweenTopItem(this InvWindow*, TweenStopResult result=Tween_STOP_RESULT); 516 | 517 | import function StopAllTweens(this GUI*, TweenStopResult result=Tween_STOP_RESULT); 518 | import function StopAllTweens(this Object*, TweenStopResult result=Tween_STOP_RESULT); 519 | import function StopAllTweens(this Character*, TweenStopResult result=Tween_STOP_RESULT); 520 | import function StopAllTweens(this Overlay*, TweenStopResult result=Tween_STOP_RESULT); 521 | import function StopAllTweens(this Region*, TweenStopResult result=Tween_STOP_RESULT); 522 | import function StopAllTweens(this GUIControl*, TweenStopResult result=Tween_STOP_RESULT); 523 | import function StopAllTweens(this Label*, TweenStopResult result=Tween_STOP_RESULT); 524 | import function StopAllTweens(this Button*, TweenStopResult result=Tween_STOP_RESULT); 525 | import function StopAllTweens(this TextBox*, TweenStopResult result=Tween_STOP_RESULT); 526 | import function StopAllTweens(this ListBox*, TweenStopResult result=Tween_STOP_RESULT); 527 | import function StopAllTweens(this Slider*, TweenStopResult result=Tween_STOP_RESULT); 528 | import function StopAllTweens(this InvWindow*, TweenStopResult result=Tween_STOP_RESULT); 529 | 530 | import int TweenTextColor(this TextBox*, float timing, int toColor, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 531 | import int TweenTextColorRGB(this TextBox*, float timing, int toRed, int toGreen, int toBlue, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 532 | import int TweenTextColorRed(this TextBox*, float timing, int toRed, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 533 | import int TweenTextColorGreen(this TextBox*, float timing, int toGreen, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 534 | import int TweenTextColorBlue(this TextBox*, float timing, int toBlue, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 535 | import function StopTweenTextColor(this TextBox*, TweenStopResult result=Tween_STOP_RESULT); 536 | import function StopTweenTextColorRGB(this TextBox*, TweenStopResult result=Tween_STOP_RESULT); 537 | import function StopTweenTextColorRed(this TextBox*, TweenStopResult result=Tween_STOP_RESULT); 538 | import function StopTweenTextColorGreen(this TextBox*, TweenStopResult result=Tween_STOP_RESULT); 539 | import function StopTweenTextColorBlue(this TextBox*, TweenStopResult result=Tween_STOP_RESULT); 540 | 541 | import int TweenHandleOffset(this Slider*, float timing, int toOffset, TweenEasingType easingType=Tween_EASING_TYPE_GUI, TweenStyle style=Tween_STYLE_GUI, float startDelay=Tween_START_DELAY_GUI, TweenTimingType timingType=Tween_TIMING_GUI); 542 | import function StopTweenHandleOffset(this Slider*, TweenStopResult result=Tween_STOP_RESULT); 543 | 544 | import int TweenLightLevel(this Character*, float timing, int fromLightLevel, int toLightLevel, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 545 | import int TweenLightLevel(this Object*, float timing, int fromLightLevel, int toLightLevel, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 546 | import function StopTweenLightLevel(this Character*, TweenStopResult result=Tween_STOP_RESULT); 547 | import function StopTweenLightLevel(this Object*, TweenStopResult result=Tween_STOP_RESULT); 548 | 549 | import int TweenAmbientLightLevel(float timing, int fromLightLevel, int toLightLevel, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 550 | import function StopTweenAmbientLightLevel(TweenStopResult result=Tween_STOP_RESULT); 551 | 552 | import int TweenGamma(static System, float timing, int toGamma, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 553 | import function StopTweenGamma(static System, TweenStopResult result=Tween_STOP_RESULT); 554 | 555 | import int TweenProperty(this Character*, float timing, String property, int toValue, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE_PROPERTY, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 556 | import int TweenProperty(this Hotspot*, float timing, String property, int toValue, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE_PROPERTY, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 557 | import int TweenProperty(this InventoryItem*, float timing, String property, int toValue, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE_PROPERTY, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 558 | import int TweenProperty(this Object*, float timing, String property, int toValue, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE_PROPERTY, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 559 | import int TweenProperty(static Room, float timing, String property, int toValue, TweenEasingType easingType=Tween_EASING_TYPE, TweenStyle style=Tween_STYLE_PROPERTY, float startDelay=Tween_START_DELAY, TweenTimingType timingType=Tween_TIMING); 560 | import function StopTweenProperty(this Character*, String property, TweenStopResult result=Tween_STOP_RESULT); 561 | import function StopTweenProperty(this Hotspot*, String property, TweenStopResult result=Tween_STOP_RESULT); 562 | import function StopTweenProperty(this InventoryItem*, String property, TweenStopResult result=Tween_STOP_RESULT); 563 | import function StopTweenProperty(this Object*, String property, TweenStopResult result=Tween_STOP_RESULT); 564 | import function StopTweenProperty(static Room, String property, TweenStopResult result=Tween_STOP_RESULT); 565 | 566 | 567 | /////////////////////////////////////////////////////////////////////////////// 568 | // ADVANCED USERS: HANDY-DANDY UTILITY FUNCTIONS 569 | /////////////////////////////////////////////////////////////////////////////// 570 | 571 | struct TweenGame { 572 | /// Returns the red value from a colour number. 573 | import static int GetRFromColor(int color); 574 | 575 | /// Returns the green value from a colour number. 576 | import static int GetGFromColor(int color); 577 | 578 | /// Returns the blue value from a colour number. 579 | import static int GetBFromColor(int color); 580 | }; 581 | 582 | struct TweenMaths { 583 | /// Returns the absolute value. 584 | import static float Abs(float value); 585 | 586 | /// Returns the distance (as a float) between two points. 587 | import static float GetDistance(int fromX, int fromY, int toX, int toY); 588 | 589 | /// Interpolates from one float to another based on a decimal factor. Returns int. 590 | import static int Lerp(float from, float to, float t); 591 | 592 | /// Returns the smallest int value. 593 | import static int MinInt(int a, int b); 594 | 595 | /// Returns the largest int value. 596 | import static int MaxInt(int a, int b); 597 | 598 | /// Returns an int between a min and max values. 599 | import static int ClampInt(int value, int min, int max); 600 | 601 | /// Returns the largest float value. 602 | import static float MaxFloat(float a, float b); 603 | 604 | /// Returns the largest float value. 605 | import static float MinFloat(float a, float b); 606 | 607 | /// Returns a float between a min and max values. 608 | import static float ClampFloat(float value, float min, float max); 609 | }; 610 | 611 | /// Converts number of seconds to number of game loops. (Part of the Tween module) 612 | import int SecondsToLoops(float seconds); 613 | 614 | /// Converts number of loops to number seconds. (Part of the Tween module) 615 | import float LoopsToSeconds(int loops); 616 | 617 | /// Waits a number of seconds. (Part of the Tween module) 618 | import function WaitSeconds(float amount); 619 | 620 | /// Waits for the longest duration (based on game loops). Supports up to 6 durations. (Part of the Tween module) 621 | import function WaitForLongest(int duration1, int duration2, int duration3=0, int duration4=0, int duration5=0, int duration6=0); 622 | 623 | /// Sets a Timer using seconds instead of game loops. (Part of the Tween module) 624 | import function SetTimerWithSeconds(int timerID, float amount); 625 | 626 | /// Sets the timer for the longest timeout (based on game loops). Supports up to 6 timeouts. (Part of the Tween module) 627 | import function SetTimerForLongest(int timerID, int timeout1, int timeout2, int timeout3=0, int timeout4=0, int timeout5=0, int timeout6=0); 628 | 629 | /////////////////////////////////////////////////////////////////////////////// 630 | // ADVANCED USERS: TWEEN EASING EQUATIONS 631 | /////////////////////////////////////////////////////////////////////////////// 632 | 633 | // TERMS OF USE - EASING EQUATIONS 634 | // 635 | // Open source under the BSD License. 636 | // 637 | // Copyright (c) 2001 Robert Penner 638 | // All rights reserved. 639 | // 640 | // Redistribution and use in source and binary forms, with or without modification, 641 | // are permitted provided that the following conditions are met: 642 | // 643 | // * Redistributions of source code must retain the above copyright notice, this 644 | // list of conditions and the following disclaimer. 645 | // * Redistributions in binary form must reproduce the above copyright notice, 646 | // this list of conditions and the following disclaimer in the documentation 647 | // and/or other materials provided with the distribution. 648 | // * Neither the name of the author nor the names of contributors may be used to 649 | // endorse or promote products derived from this software without 650 | // specific prior written permission. 651 | // 652 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 653 | // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 654 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 655 | // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 656 | // ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 657 | // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 658 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 659 | // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 660 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 661 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 662 | 663 | struct TweenEasing { 664 | import static float EaseLinear(float t, float d); 665 | import static float EaseInSine(float t, float b, float c, float d); 666 | import static float EaseOutSine(float t, float b, float c, float d); 667 | import static float EaseInOutSine(float t, float b, float c, float d); 668 | import static float EaseInQuad(float t, float b, float c, float d); 669 | import static float EaseOutQuad(float t, float b, float c, float d); 670 | import static float EaseInOutQuad(float t, float b, float c, float d); 671 | import static float EaseInPower(float t, float b, float c, float d, float power); 672 | import static float EaseOutPower(float t, float b, float c, float d, float power); 673 | import static float EaseInOutPower(float t, float b, float c, float d, float power); 674 | import static float EaseInExpo(float t, float b, float c, float d); 675 | import static float EaseOutExpo(float t, float b, float c, float d); 676 | import static float EaseInOutExpo(float t, float b, float c, float d); 677 | import static float EaseInCirc(float t, float b, float c, float d); 678 | import static float EaseOutCirc(float t, float b, float c, float d); 679 | import static float EaseInOutCirc(float t, float b, float c, float d); 680 | import static float EaseInBack(float t, float b, float c, float d); 681 | import static float EaseOutBack(float t, float b, float c, float d); 682 | import static float EaseInOutBack(float t, float b, float c, float d); 683 | import static float EaseInElastic(float t, float b, float c, float d); 684 | import static float EaseOutElastic(float t, float b, float c, float d); 685 | import static float EaseInOutElastic(float t, float b, float c, float d); 686 | import static float EaseInBounce(float t, float b, float c, float d); 687 | import static float EaseOutBounce(float t, float b, float c, float d); 688 | import static float EaseInOutBounce(float t, float b, float c, float d); 689 | 690 | /// Returns the value at elapsed over duration based on the TweenEasingType 691 | import static float GetValue(float elapsed, float duration, TweenEasingType easingType); 692 | }; 693 | 694 | // END BSD LICENSE 695 | 696 | #endif 697 | --------------------------------------------------------------------------------