You've already forked FullScreenPokemon
mirror of
https://github.com/FullScreenShenanigans/FullScreenPokemon.git
synced 2026-04-28 12:58:40 -07:00
90646a8b16
* Started moving components to gulp-shenanigans This is a first round of refactoring. All non-reset functions in `FullScreenPokemon.ts` have been moved to dedicated classes, though many haven't had the references updated. * Brought in .files, BattleMovr, MenuGraphr * Fixed up imported files for tslint * Fixed test dependencies to run * Added settings files to compilation * Added necessary prototypes in FSP.ts * Converted settings classes to Generate* functions This way, `src\FullScreenPokemon.ts` can decide when to call the generators. It does so immediately after defining the `FullScreenPokemon` class and its prototype values. * Refactored settings into generators This fixes most scoping issues with settings files. Note that a few modules have local updates that will need to be pushed for this to build successfully. * Fixed scoping for menus * Removed Function::bind usages No more! * Fleshed out html build settings lib\index.html works now * Fixed reference issues with MapScreenr's variables They're no longer direct members of MapScreenr itself, but rather of its `variables` member. * Bump gulp-shenanigans to 0.4.0 * Fixed some case sensitivity * Fixed some more case sensitivity * Fixed case sensitivity for main settings * Bump gulp-shenanigans to 0.4.1 * Added and removed logs in src/main.ts (#296) * Added test logs to main.ts * Removed src/main.ts logs * Moved sounds into the correct src\ directory These were pulled in from master but not moved accordingly. * Fixed new tslint errors from gulp-shenanigans From updating to a newer tslint.json with the setup task, the more strict rules are now being violated. * Bumped gulp-shenanigans to 0.4.2 * Bump gulp-shenanigans to 0.4.3 * Onboarded shenanigans.json The biggest change is that LevelEditr and UserWrappr are no longer pre-packaged with GameStartr. They're now separately defined in FSP. * Brought in recent module updates Also fixed some scoping issues with battles. * Fixed the pause menu to open on pause buttons Previously they were calling the GamesRunnr pause functions, which aren't what was intended. * Bumped UserWrappr to 0.5.4 * Fixed onload listeners in src\main.ts (#300) * Added test throw for body innerHTML * Put main.ts logic behind a load event * Removed remaining main.ts throw * Moved require logic out of onload in main.ts * Fix load listener placement * Bumped MapsCreatr to 0.5.3 Fixed scoping issues with macros * Removed LevelEditor reference from Storage.ts Since LevelEditor is no longer defined on FSP, saving a game can't use its beautification function * Changed saving dialog to delete all menus when done * Fixed TimeHandlr scope issues for battle cutscenes
247 lines
7.5 KiB
TypeScript
247 lines
7.5 KiB
TypeScript
declare namespace MapScreenr {
|
|
/**
|
|
* Functions to compute new variable values, keyed by their variable's names.
|
|
*/
|
|
interface IVariableFunctions {
|
|
[i: string]: Function;
|
|
}
|
|
/**
|
|
* Known variables, keyed by name.
|
|
*/
|
|
interface IVariables {
|
|
[i: string]: any;
|
|
}
|
|
/**
|
|
* Settings to initialize a new instance of the MapScreenr class.
|
|
*/
|
|
interface IMapScreenrSettings {
|
|
/**
|
|
* How wide the MapScreenr should be.
|
|
*/
|
|
width: number;
|
|
/**
|
|
* How tall the MapScreenr should be.
|
|
*/
|
|
height: number;
|
|
/**
|
|
* A mapping of functions to generate member variables that should be
|
|
* recomputed on screen change, keyed by variable name.
|
|
*/
|
|
variableFunctions?: IVariableFunctions;
|
|
/**
|
|
* Arguments to be passed to variable Functions.
|
|
*/
|
|
variableArgs?: any[];
|
|
/**
|
|
* Assorted known variables, keyed by name.
|
|
*/
|
|
variables?: IVariables;
|
|
/**
|
|
* A scope to run functions in, if not this IMapScreenr.
|
|
*/
|
|
scope?: any;
|
|
}
|
|
/**
|
|
* A flexible container for map attributes and viewport.
|
|
*/
|
|
interface IMapScreenr {
|
|
/**
|
|
* Top border measurement of the bounding box.
|
|
*/
|
|
top: number;
|
|
/**
|
|
* Right border measurement of the bounding box.
|
|
*/
|
|
right: number;
|
|
/**
|
|
* Bottom border measurement of the bounding box.
|
|
*/
|
|
bottom: number;
|
|
/**
|
|
* Left border measurement of the bounding box.
|
|
*/
|
|
left: number;
|
|
/**
|
|
* Constant horizontal midpoint of the bounding box, equal to (left + right) / 2.
|
|
*/
|
|
middleX: number;
|
|
/**
|
|
* Constant vertical midpoint of the bounding box, equal to (top + bottom) / 2.
|
|
*/
|
|
middleY: number;
|
|
/**
|
|
* Constant width of the bounding box.
|
|
*/
|
|
width: number;
|
|
/**
|
|
* Constant height of the bounding box.
|
|
*/
|
|
height: number;
|
|
/**
|
|
* A listing of variable Functions to be calculated on screen resets.
|
|
*/
|
|
variableFunctions: IVariableFunctions;
|
|
/**
|
|
* Arguments to be passed into variable computation Functions.
|
|
*/
|
|
variableArgs: any[];
|
|
/**
|
|
* Known variables, keyed by name.
|
|
*/
|
|
variables: IVariables;
|
|
/**
|
|
* Completely clears the MapScreenr for use in a new Area. Positioning is
|
|
* reset to (0,0) and user-configured variables are recalculated.
|
|
*/
|
|
clearScreen(): void;
|
|
/**
|
|
* Computes middleX as the midpoint between left and right.
|
|
*/
|
|
setMiddleX(): void;
|
|
/**
|
|
* Computes middleY as the midpoint between top and bottom.
|
|
*/
|
|
setMiddleY(): void;
|
|
/**
|
|
* Recalculates all variables by passing variableArgs to their Functions.
|
|
*/
|
|
setVariables(): void;
|
|
/**
|
|
* Recalculates a variable by passing variableArgs to its Function.
|
|
*
|
|
* @param name The name of the variable to recalculate.
|
|
* @param value A new value for the variable instead of its Function's result.
|
|
* @returns The new value of the variable.
|
|
*/
|
|
setVariable(name: string, value?: any): any;
|
|
/**
|
|
* Shifts the MapScreenr horizontally and vertically via shiftX and shiftY.
|
|
*
|
|
* @param dx How far to scroll horizontally.
|
|
* @param dy How far to scroll vertically.
|
|
*/
|
|
shift(dx: number, dy: number): void;
|
|
/**
|
|
* Shifts the MapScreenr horizontally by changing left and right by the dx.
|
|
*
|
|
* @param dx How far to scroll horizontally.
|
|
*/
|
|
shiftX(dx: number): void;
|
|
/**
|
|
* Shifts the MapScreenr vertically by changing top and bottom by the dy.
|
|
*
|
|
* @param dy How far to scroll vertically.
|
|
*/
|
|
shiftY(dy: number): void;
|
|
}
|
|
/**
|
|
* A flexible container for map attributes and viewport.
|
|
*/
|
|
class MapScreenr implements IMapScreenr {
|
|
/**
|
|
* A listing of variable Functions to be calculated on screen resets.
|
|
*/
|
|
variableFunctions: IVariableFunctions;
|
|
/**
|
|
* Arguments to be passed into variable computation Functions.
|
|
*/
|
|
variableArgs: any[];
|
|
/**
|
|
* Top border measurement of the bounding box.
|
|
*/
|
|
top: number;
|
|
/**
|
|
* Right border measurement of the bounding box.
|
|
*/
|
|
right: number;
|
|
/**
|
|
* Bottom border measurement of the bounding box.
|
|
*/
|
|
bottom: number;
|
|
/**
|
|
* Left border measurement of the bounding box.
|
|
*/
|
|
left: number;
|
|
/**
|
|
* Constant horizontal midpoint of the bounding box, equal to (left + right) / 2.
|
|
*/
|
|
middleX: number;
|
|
/**
|
|
* Constant vertical midpoint of the bounding box, equal to (top + bottom) / 2.
|
|
*/
|
|
middleY: number;
|
|
/**
|
|
* Constant width of the bounding box.
|
|
*/
|
|
width: number;
|
|
/**
|
|
* Constant height of the bounding box.
|
|
*/
|
|
height: number;
|
|
/**
|
|
* Assorted known variables, keyed by name.
|
|
*/
|
|
variables: IVariables;
|
|
/**
|
|
* A scope to run functions in, if not this MapScreenr.
|
|
*/
|
|
private scope;
|
|
/**
|
|
* Resets the MapScreenr. All members of the settings argument are copied
|
|
* to the MapScreenr itself, though only width and height are required.
|
|
*
|
|
* @param {IMapScreenrSettings} settings
|
|
*/
|
|
constructor(settings: IMapScreenrSettings);
|
|
/**
|
|
* Completely clears the MapScreenr for use in a new Area. Positioning is
|
|
* reset to (0,0) and user-configured variables are recalculated.
|
|
*/
|
|
clearScreen(): void;
|
|
/**
|
|
* Computes middleX as the midpoint between left and right.
|
|
*/
|
|
setMiddleX(): void;
|
|
/**
|
|
* Computes middleY as the midpoint between top and bottom.
|
|
*/
|
|
setMiddleY(): void;
|
|
/**
|
|
* Recalculates all variables by passing variableArgs to their Functions.
|
|
*/
|
|
setVariables(): void;
|
|
/**
|
|
* Recalculates a variable by passing variableArgs to its Function.
|
|
*
|
|
* @param name The name of the variable to recalculate.
|
|
* @param value A new value for the variable instead of its Function's result.
|
|
* @returns The new value of the variable.
|
|
*/
|
|
setVariable(name: string, value?: any): any;
|
|
/**
|
|
* Shifts the MapScreenr horizontally and vertically via shiftX and shiftY.
|
|
*
|
|
* @param dx How far to scroll horizontally.
|
|
* @param dy How far to scroll vertically.
|
|
*/
|
|
shift(dx: number, dy: number): void;
|
|
/**
|
|
* Shifts the MapScreenr horizontally by changing left and right by the dx.
|
|
*
|
|
* @param dx How far to scroll horizontally.
|
|
*/
|
|
shiftX(dx: number): void;
|
|
/**
|
|
* Shifts the MapScreenr vertically by changing top and bottom by the dy.
|
|
*
|
|
* @param dy How far to scroll vertically.
|
|
*/
|
|
shiftY(dy: number): void;
|
|
/**
|
|
* Known variables, keyed by name.
|
|
*/
|
|
[i: string]: any;
|
|
}
|
|
}
|
|
declare var module: any;
|