Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Hyomoto/FASTv33
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyomoto committed Nov 25, 2020
2 parents 6e4494d + 740893a commit adcbb87
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 11 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Flexible Assistant Toolkit for GMS2.3+
<p align="center">
by Devon Mullane<br>
<a href="https://github.com/Hyomoto/FASTv33/wiki"><img src="https://user-images.githubusercontent.com/6281477/95689209-359b9a00-0bdd-11eb-8f94-850252d47c68.png" align="center"></a><br>
Check the <a href="https://github.com/Hyomoto/FASTv33/wiki">Wiki</a> for the most up-to-date documentation on each module.
Check the <a href="https://github.com/Hyomoto/FASTv33/wiki">Wiki</a> for the most up-to-date documentation on each module.<br>
You can also visit the <a href="https://discord.gg/wXas44zw">FAST Discord</a> for more interactive help!
</p>
<br>
FAST is a modular library that provides easy-to-use tools to get GMS developers away from boilerplate tasks and onto building their games. There is no genre-specific code or implementation found here. Instead, FAST focuses powerful, common-use tools that provide general utility to fill the gaps in GML functions and tedious framework tasks. The Core library offers up publisher, event and file frameworks, while modules extend it into more specific tasks such as input handling and resolution scaling, or power-user features such as scripting and databases. In short, FAST can work with every game, and compliment any game made with GMS2.3 or later.
Expand Down
4 changes: 1 addition & 3 deletions options/ios/options_ios.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions options/tvos/options_tvos.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions options/windows/options_windows.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions scripts/DsMap/DsMap.gml
Original file line number Diff line number Diff line change
@@ -1,22 +1,46 @@
/// @func DsMap
/// @wiki Core-Index Data Structures
function DsMap() constructor {
/// @param {string} key The key that will be used to retrieve this value.
/// @param {mixed} value The value to be assigned to the key.
/// @desc Adds the specified key-value pair to the map.
/// @returns mixed
static add = function( _key, _value ) {
ds_map_add( pointer, _key, _value );

return _value;

}
/// @param {string} key The key that will be used to retrieve this value.
/// @param {mixed} value The value to be assigned to the key.
/// @desc Adds the specified key-value pair if it doesn't exist, and replaces it if it does.
/// @returns mixed
static replace = function( _key, _value ) {
ds_map_replace( pointer, _key, _value );

return _value;

}
/// @param key
/// @param value to set if key does not have a value already
/// @desc If the value read at {key} is undefined, the value at {key} assumes the value of {value}
/// @returns mixed
static assume = function( _key, _value ) {
var _read = get( _key );

if ( _read == undefined ) {
_read = replace( _key, _value );

}
return _read;

}
/// @desc Returns true if the DsMap is empty
static empty = function() {
return ds_map_empty( pointer );

}
/// @desc Returns the number of elements in the DsMap
static size = function() {
return ds_map_size( pointer );

Expand Down
44 changes: 42 additions & 2 deletions scripts/Vec2/Vec2.gml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ function Vec2( _x, _y ) constructor {
y = _y;

}
/// @returns real
/// @desc Used to get the vectors length.
static len = function() {
return sqrt( x * x + y * y );
}
/// @returns real
/// @desc Used to get the vectors squared length.
static lensqr = function() {
return (x * x + y * y);
}
/// @param {Vec2} Vec2 The vector to subtract from this one.
/// @returns Vec2
static add = function( _Vec2 ) { return new Vec2( x + _Vec2.x, y + _Vec2.y ); }
Expand All @@ -23,13 +33,13 @@ function Vec2( _x, _y ) constructor {
return new Vec2( x - _Vec2.x, y - _Vec2.y );

}
/// @param {Vec2} Vec2 The vector to multiply this one with.
/// @param {Vec2} Vec2 The vector to multiply this one component wise with.
/// @returns Vec2
static multiply = function( _Vec2 ) {
return new Vec2( x * _Vec2.x, y * _Vec2.y );

}
/// @param {Vec2} Vec2 The vector to divide this one by.
/// @param {Vec2} Vec2 The vector to divide this one one component wise by.
/// @returns Vec2
static divide = function( _Vec2 ) {
return new Vec2( x / _Vec2.x, y / _Vec2.y );
Expand All @@ -41,6 +51,36 @@ function Vec2( _x, _y ) constructor {
return x * _Vec2.x + y * _Vec2.y;

}
/// @param {Vec2} Vec2 The vector to get the cross product with.
/// @returns Vec2
static cross = function( _Vec2 ) {
return (x * _Vec2.x - y * _Vec2.y);
}
/// @param {Vec2} Vec2 The vector to get the distance to.
/// @returns real
static dist_to = function( _Vec2 ) {
return sqrt((x - _Vec2.x) * (x - _Vec2.x) + (y - _Vec2.y) * (y - _Vec2.y));
}
/// @param {Vec2} Vec2 The vector to get the squared distance to.
/// @returns real
static dist_to_sqr = function( _Vec2 ) {
return ((x - _Vec2.x) * (x - _Vec2.x) + (y - _Vec2.y) * (y - _Vec2.y));
}

/// @returns Vec2
/// @desc Used to normalise the vector to unit length.
static normalize = function() {
var _len_sqr = lensqr();
var _len = 0;

if ( _len_sqr != 0 ) {
_len = sqrt( _len );

set( x / _len, y / _len);
}

return self;
}
/// @desc Returns this vector as an array.
/// @returns array `[ x, y ]`
static toArray = function() {
Expand Down

0 comments on commit adcbb87

Please sign in to comment.