From 8609c06ab11fec13f98f862addeea8ef6b44d436 Mon Sep 17 00:00:00 2001 From: lajbel Date: Wed, 15 Jan 2025 08:32:06 -0300 Subject: [PATCH] chore: changelog --- CHANGELOG.md | 19 +++++++++++++++++-- LICENSE.md | 41 ++++++++++++++++++++++++++--------------- src/constants.ts | 22 +++++++++++----------- src/gfx/formatText.ts | 18 +++++++++--------- 4 files changed, 63 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d815f670..08124783 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,12 +41,27 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Changed default behaviour of `kaplay({ tagsAsComponents: false })` to `false`. - Now if you pass a nullish value to `.use()` it throws an error -## [3001.0.7] - TBD +## [3001.0.7] - 2025-01-15 + +### Added + +- Added `kaplay({ spriteAtlasPadding })` for setting the space between the + sprites in the sprite atlas - @marianyp + + ```js + kaplay({ + spriteAtlasPadding: 10, // 10 pixels of space between each sprite + }); + ``` ### Changed - Now you cannot pass parameters that are not a component or string to `.use()`. - Otherwise it will throw an error + Otherwise it will throw an error - @lajbel + +### Fixed + +- Fixed a bug where font atlas were working strange - @mflerackers ## [3001.0.6] "Santa Events" - 2024-12-27 diff --git a/LICENSE.md b/LICENSE.md index 0c17b703..474d0e2d 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,24 +1,35 @@ Copyright (c) 2025, KAPLAY Team and contributers -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions. -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. In addition, the following restrictions apply: -1. The Software and any modifications made to it may not be used for the purpose of training or improving machine learning algorithms, -including but not limited to artificial intelligence, natural language processing, or data mining. This condition applies to any derivatives, -modifications, or updates based on the Software code. Any usage of the Software in an AI-training dataset is considered a breach of this License. +1. The Software and any modifications made to it may not be used for the purpose + of training or improving machine learning algorithms, including but not + limited to artificial intelligence, natural language processing, or data + mining. This condition applies to any derivatives, modifications, or updates + based on the Software code. Any usage of the Software in an AI-training + dataset is considered a breach of this License. -2. The Software may not be included in any dataset used for training or improving machine learning algorithms, -including but not limited to artificial intelligence, natural language processing, or data mining. +2. The Software may not be included in any dataset used for training or + improving machine learning algorithms, including but not limited to + artificial intelligence, natural language processing, or data mining. -3. Any person or organization found to be in violation of these restrictions will be subject to legal action and may be held liable -for any damages resulting from such use. +3. Any person or organization found to be in violation of these restrictions + will be subject to legal action and may be held liable for any damages + resulting from such use. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/src/constants.ts b/src/constants.ts index da3ae67a..b1d5c13b 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,6 +1,6 @@ // some default charsets for loading bitmap fonts export const ASCII_CHARS = - " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; + " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; export const DEF_ANCHOR = "topleft"; export const BG_GRID_SIZE = 64; export const DEF_FONT = "monospace"; @@ -19,9 +19,9 @@ export const DEF_FONT_FILTER = "linear"; export const LOG_MAX = 8; export const LOG_TIME = 4; export const VERTEX_FORMAT = [ - { name: "a_pos", size: 2 }, - { name: "a_uv", size: 2 }, - { name: "a_color", size: 4 }, + { name: "a_pos", size: 2 }, + { name: "a_uv", size: 2 }, + { name: "a_color", size: 4 }, ]; const STRIDE = VERTEX_FORMAT.reduce((sum, f) => sum + f.size, 0); const MAX_BATCHED_QUAD = 2048; @@ -89,13 +89,13 @@ vec4 frag(vec2 pos, vec2 uv, vec4 color, sampler2D tex) { `; export const COMP_DESC = new Set(["id", "require"]); export const COMP_EVENTS = new Set([ - "add", - "fixedUpdate", - "update", - "draw", - "destroy", - "inspect", - "drawInspect", + "add", + "fixedUpdate", + "update", + "draw", + "destroy", + "inspect", + "drawInspect", ]); export const DEF_OFFSCREEN_DIS = 200; // maximum y velocity with body() diff --git a/src/gfx/formatText.ts b/src/gfx/formatText.ts index 75950674..d733d0b9 100644 --- a/src/gfx/formatText.ts +++ b/src/gfx/formatText.ts @@ -85,7 +85,7 @@ export function compileStyledText(txt: string): { if (x !== undefined) { throw new Error( "Styled text error: mismatched tags. " - + `Expected [/${x}], got [/${gn}]`, + + `Expected [/${x}], got [/${gn}]`, ); } else { @@ -145,14 +145,14 @@ export function formatText(opt: DrawTextOpt): FormattedText { outline: Outline | null; filter: TexFilter; } = font instanceof FontData - ? { - outline: font.outline, - filter: font.filter, - } - : { - outline: null, - filter: DEF_FONT_FILTER, - }; + ? { + outline: font.outline, + filter: font.filter, + } + : { + outline: null, + filter: DEF_FONT_FILTER, + }; // TODO: customizable font tex filter const atlas: FontAtlas = fontAtlases[fontName] ?? {