From 1a76b4a18e7a54519390ba4531d2dcb3427f0278 Mon Sep 17 00:00:00 2001 From: lajbel Date: Wed, 18 Dec 2024 12:22:21 -0300 Subject: [PATCH 1/2] doc: better changelog using Keep a Changelog --- CHANGELOG.md | 114 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 69 insertions(+), 45 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6579ed42..1e5ca413 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,22 @@ -# v4000.0.0 (unreleased) +# Changelog + +All notable changes to this project will be documented in this file. + +The format is (mostly) based on +[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project +adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [4000.0.0] - TBD + +### Added - Added `clipLineToRect()` -- Replaced the Separating Axis Theorem (SAT) with the "Gilbert–Johnson–Keerthi" - (`GJK`) distance algorithm. - Added circle and (rotated) ellipse collision shapes. - Added `ellipse()` component. -- Circle area is no longer a box. +- Added support to circle shapes in `area()`. +- Added `GameObjRaw.setParent()` to change the parent of a game object. +- Added `fakeMouse()` to create a fake mouse cursor. - Added restitution and friction. -- Objects can switch parent by assigning the parent property or using setParent. -- Added a fake cursor API. ```js const myCursor = add([fakeMouse(), sprite("kat"), pos(100, 100)]); @@ -18,22 +26,38 @@ myCursor.move(vec2(100, 200)); // move as your wish ``` -# v3001.0.5 +### Changed + +- Replaced the Separating Axis Theorem (SAT) with the "Gilbert–Johnson–Keerthi" + (`GJK`) distance algorithm. +- Changed default behaviour of `KAPLAYOpt.tagsAsComponents` to `false`. + +## [3001.0.5] - TBD + +### Added - Added many JSDoc specifiers on many functions (@require, @deprecated, @since, - @group, etc) -- Fixed artifacts present in some TrueType fonts. + @group, etc) - **experimental** +- Added `getDefaultLayer()` to get the default layer (experimental) +- Added `getLayers()` to get the layers list (experimental) + +### Changed + +### Deprecated + - Deprecated camera methods `camScale()`, `camPos()` and `camRot()` in favor of `setCamScale()`, `getCamScale()`, `setCamPos()`, `getCamPos()`, `setCamRot()` and `getCamRot`. - Deprecated `camTransform()` in favor of `getCamTransform()`. - Deprecated `camFlash()` in favor of `flash()`, for a `shake()`-like name. -- Added `getLayers()` to get the layers list (experimental) -- Added `getDefaultLayer()` to get the default layer (experimental) -# v3001.0.0: Spooky Beans! +### Fixed + +- Fixed artifacts present in some TrueType fonts. + +## [3001.0.0] "Spooky Beans!" - 2024-10-31 -## Input +### Input - Added input bindings, `onButtonPress`, `onButtonRelease`, `onButtonDown`, and it's corresponding boolean versions, `isButtonPressed`, `isButtonDown` and @@ -102,7 +126,7 @@ }); ``` -## Physics +### Physics - added effector components: `areaEffector()`, `buoyancyEffector()`, `pointEffector()`, `surfaceEffector()`. @@ -113,7 +137,7 @@ - added `pathfinder()` component to calculate a list of waypoints on a graph. - now collision checks are only done if there's area objects. -## Game Object +### Game Object - added `getTreeRoot()` to get the game's root object, which is the parent of all other objects @@ -134,7 +158,7 @@ debug.log(obj.tags); // ["enemy", "dangerous"] ``` -## Components +### Components - added support to setters/getters syntax in `ScaleComp` and `SpriteComp` components @@ -147,7 +171,7 @@ obj.sprite = "bag"; ``` -## Rendering and Animation +### Rendering and Animation - added the `animate()` component to _animate_ the properties of an object using keyframes. Check out @@ -247,7 +271,7 @@ - Added `SpriteComp.animFrame` to get the frame of the current animation (not on the spritesheet) -## Audio +### Audio - now you can pass an `AudioBuffer` to `loadSound()` - added `loadMusic()` to load streaming audio (doesn't block in loading screen). @@ -259,7 +283,7 @@ play("bgm"); ``` -## Math +### Math - added `Vec2.fromArray()` to convert an array to a `Vec2`. @@ -288,7 +312,7 @@ shuffle(numbers); // [3, 1, 5, 2, 4] ``` -## Debug mode +### Debug mode - added `outline()`, `shader()`, and `area()` properties to `debug.inspect`. - added `KAPLAYOpt.debugKey` for customizing the key used to toggle debug mode. @@ -319,7 +343,7 @@ - Now `debug.log()` accepts multiple argument of any type, like `console.log()`. -## Helpers +### Helpers - added `getSceneName()` to get the current scene name - added `Color.toArray()` to convert a color to an array @@ -334,7 +358,7 @@ - added evaluation of the first and second derivatives for all splines - added higher order easing functions linear, steps and cubic-bezier -## TypeScript +### TypeScript - Now you can type `get()` with a type parameter and passing component types. (**v4000**) @@ -350,7 +374,7 @@ - Now `loadShader()` and `loadShaderURL()` accepts null for unused parameters. - Now `RectCompOpt` accepts a array of numbers for `radius`. -## Deprecations +### Deprecations > All changes applies for both v3001 and v4000 @@ -360,7 +384,7 @@ - deprecated `Event`, `EventHandler` and `EventController` in favor of `KEvent`, `KEventHandler` and `KEventController` -## Bug fixes +### Bug fixes > All changes applies for both v3001 and v4000 @@ -492,7 +516,7 @@ getSprite("bean").then((spr) => { - fixed some indirect `fixed` related issues -## v3000.1 +## [3000.1.0] - 2023-08-18 (kaboom.js) - added game object level input handling @@ -576,9 +600,9 @@ ui.add([rect(100, 100)]); reset it? - fixed incorrect touch position when canvas is not at top left of page -# v3000 +## [3000.0.0] - 2023-05-25 (kaboom.js) -## Game Objects +### Game Objects - added scene graph, game objects are now stored in a tree-like structure and can have children with `obj.add()` @@ -632,7 +656,7 @@ console.log(enemies.length); // 4 - added `onAdd()` and `onDestroy()` events to listen to added / destroyed game objects -## Components +### Components - added support for getter and setters in component properties @@ -753,7 +777,7 @@ const player = add([ ]); ``` -## Assets +### Assets - added `loadProgress()` that returns a `0.0 - 1.0` that indicates current asset loading progress @@ -786,7 +810,7 @@ loadSprite("player", [ - (**BREAK**) added `loadShaderURL()`, `loadShader()` now only load shader code not files -## Text +### Text - added `loadFont()` to load `.ttf`, `.otf`, `.woff2` or any font supported by browser `FontFace` @@ -815,7 +839,7 @@ loadFont("apl386", "/examples/fonts/apl386.ttf", { "[green]oh hi[/green] here's some [wavy]styled[/wavy] text"; ``` -## Graphics +### Graphics - fixed visual artifacts on text rendering - added `colors` option to `drawPolygon()` that controls the color of each @@ -867,7 +891,7 @@ onMouseMove(() => { }); ``` -## Audio +### Audio - added option `kaboom({ backgroundAudio: false })` to not pause audio when tab not active @@ -889,7 +913,7 @@ music.volume = 0.5; music.loop = true; ``` -## Input +### Input - added `onScroll(action: (delta: Vec2) => void)` to listen mouse wheel scroll - fixed touches not treated as mouse @@ -905,7 +929,7 @@ music.loop = true; - added `onGamepadConnect()` and `onGamepadDisconnect()` - added `gamepads` option to `kaboom()` to define custom gamepads -## Level +### Level - (**BREAK**) changed `addLevel()` options API - renamed `width` and `height` to `tileWidth` and `tileHeight` @@ -946,7 +970,7 @@ addLevel(["@ ^ $$", "======="], { }); ``` -## Misc +### Misc - sprites are now automatically packed, improving performance - (**BREAK**) renamed `gravity()` into `getGravity()` and `setGravity()` @@ -1052,7 +1076,7 @@ timer.resume(); - (**BREAK**) removed `debug.objCount()` in favor of `getAll().length` - added `debug.numFrames()` to get the current frame count -### v2000.2.6 +## [2000.2.6] - 2022-01-27 (kaboom.js) - fixed text always being wrapped if updated - fixed text comp properties `letterSpacing`, `charSpacing`, `transform`, @@ -1079,7 +1103,7 @@ timer.resume(); - fixed updates not running at all when `kaboom({ debug: false })` -## v2000.2 "Fancy Text Mode" +## [2000.2.0] "Fancy Text Mode" 2022-01-23 (kaboom.js) - added `formatText()` and `drawFormattedText()` - added `charSpacing` and `lineSpacing` in `TextCompOpt` and `DrawTextOpt` @@ -1103,7 +1127,7 @@ timer.resume(); - allow non-stretch letterbox - fixed mouse position malfunction in fullscreen, stretch and letterbox mode -### v2000.1.8 +### [2000.1.8] - fixed `Color#eq()` not giving correct result @@ -1133,7 +1157,7 @@ timer.resume(); - fixed `StateComp#enterState()` not accepting any state -## v2000.1 "Record Mode" +## [2000.1.0] "Record Mode" - 2021-11-04 (kaboom.js) - added `hsl2rgb()` for converting HSL color to kaboom RGB - added `record()` to start a screen recording @@ -1194,7 +1218,7 @@ timer.resume(); - `AudioPlay#isStopped()` - `AudioPlay#isPaused()` -# v2000 "Burp Mode" +## [2000.0.0] "Burp Mode" - 2021-10-20 (kaboom.js) - version jumped to v2000.0.0 (still semver, just big) - added `burp()` for easy burping @@ -1426,7 +1450,7 @@ if (area.shape === "rect") { - added plugins npm package support e.g. `import asepritePlugin from "kaboom/plugins/aseprite"` -# v0.5 "Sticky Type" +## [0.5.0] "Sticky Type" - 2021-05-11 (kaboom.js) - platforms are now sticky - moved to TypeScript @@ -1468,7 +1492,7 @@ if (area.shape === "rect") { - fixed `on("destroy")` handler getting called twice - fixed sprite `play()` not playing -# v0.4 "Multiboom" +## [0.4.0] "Multiboom" - UNKNOWN (kaboom.js) - **BREAK** removed `init()` and `kaboom.global()`, in favor of `kaboom()`, also allows multiple kaboom games on one page @@ -1505,7 +1529,7 @@ k.vec2(); - added `numFrames()` by `sprite()` - added `screenshot()` that returns of a png base64 data url for a screenshot -# v0.3 "King Dedede...Bug!" +## [0.3.0] "King Dedede...Bug!" - UNKNOWN - **BREAK** removed `pause()` and `paused()` in favor to `kaboom.debug.paused` - **BREAK** removed `velY`, `curPlatform` and `maxVel` fields by `body()` @@ -1523,7 +1547,7 @@ k.vec2(); - added on screen logging with `log()` and `error()` - fixed `loadRoot()` sometimes doesn't work in async tasks -# v0.2 "Hear the Tremble" +## [0.2.0] "Hear the Tremble" - UNKNOWN - **BREAK** removed `aseSpriteSheet` conf field from `loadSprite(name, src, conf)` @@ -1548,7 +1572,7 @@ k.vec2(); - added `readd()` to re-add an object to the scene without triggering events - added `level.spawn()` -# v0.1 "Oh Hi Mark" +## [0.1.0] "Oh Hi Mark" - - **BREAK** changed default origin point to `"topleft"`, so if you want object origin point to be at center you'll need to manual `origin("center")` From c37c21522189b60e19fa04bcdea4f6f6ba04ce64 Mon Sep 17 00:00:00 2001 From: lajbel Date: Wed, 18 Dec 2024 13:20:47 -0300 Subject: [PATCH 2/2] improve --- CHANGELOG.md | 45 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e5ca413..7850d299 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,13 +10,12 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Added -- Added `clipLineToRect()` -- Added circle and (rotated) ellipse collision shapes. - Added `ellipse()` component. +- Added circle and (rotated) ellipse collision shapes. +- Added `clipLineToRect()` - Added support to circle shapes in `area()`. -- Added `GameObjRaw.setParent()` to change the parent of a game object. +- Added `obj.setParent()` to change the parent of a game object. - Added `fakeMouse()` to create a fake mouse cursor. -- Added restitution and friction. ```js const myCursor = add([fakeMouse(), sprite("kat"), pos(100, 100)]); @@ -25,24 +24,53 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). myCursor.release(); myCursor.move(vec2(100, 200)); // move as your wish ``` +- Added restitution and friction. +- Added `k.system()` to replace internal events or create new. + + ```js + system("collision", () => { + // system code + }, [LCEvents.AfterFixedUpdate, LCEvents.AfterUpdate]), + ``` +- Added LCEvents enum for identify different lifecycle events. ### Changed - Replaced the Separating Axis Theorem (SAT) with the "Gilbert–Johnson–Keerthi" (`GJK`) distance algorithm. -- Changed default behaviour of `KAPLAYOpt.tagsAsComponents` to `false`. +- Changed default behaviour of `kaplay({ tagsAsComponents: false })` to `false`. ## [3001.0.5] - TBD ### Added -- Added many JSDoc specifiers on many functions (@require, @deprecated, @since, - @group, etc) - **experimental** +- Added tags and components separation in `KAPLAYOpt.tagsAsComponents` + **experimental** +- Added `.is()`, `.tag()` and `.untag()` to `GameObjRaw`, check, add and remove +- Added `.has()` to `GameObjRaw`, to check if a game object has a component tags + **experimental** +- Added events for listen to comps being removed or added `onUse()` and + `onUnused()` **experimental** +- Added `k.cancel()` to cancel the current event **experimental** +- ```js + onKeyPress("space", () => { + // do something + // cancel the event + return cancel(); + }); + ``` - Added `getDefaultLayer()` to get the default layer (experimental) -- Added `getLayers()` to get the layers list (experimental) + **experimental** +- Added `getLayers()` to get the layers list (experimental) **experimental** +- Added many JSDoc specifiers on many functions (@require, @deprecated, @since, + @group, etc) ### Changed +- Added `.use()`, `.unuse()` and `.has()` to `GameObjRaw`, to add, remove and + check components. This only works with `KAPLAYOpt.tagsAsComponents` set to + `true` **experimental** + ### Deprecated - Deprecated camera methods `camScale()`, `camPos()` and `camRot()` in favor of @@ -54,6 +82,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Fixed - Fixed artifacts present in some TrueType fonts. +- Fixed `.use()` and `.unuse()` with area components. ## [3001.0.0] "Spooky Beans!" - 2024-10-31