Skip to content

Commit

Permalink
Merge pull request #1296 from solaris-games/dev
Browse files Browse the repository at this point in the history
Update 249.1
  • Loading branch information
SpacialCircumstances authored Jan 5, 2025
2 parents 93fc956 + 460bff2 commit 1ab5a24
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 19 deletions.
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"mitt": "^3.0.1",
"moment": "^2.29.1",
"pixi-viewport": "6.0.3",
"pixi.js": "8.6.3",
"pixi.js": "8.6.6",
"random-seed": "^0.3.0",
"socket.io-client": "2.5.0",
"uuid": "^10.0.0",
Expand Down
11 changes: 7 additions & 4 deletions client/src/game/animation.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import * as PIXI from 'pixi.js'
import type { Location } from '@solaris-common';
import {Application, Ticker, Container, Graphics} from 'pixi.js';

class AnimationService {
drawSelectedCircle (app, container, location) {
drawSelectedCircle (app: Application, container: Container, location: Location) {
// It ain't pretty, but it works.
let graphics = new PIXI.Graphics()
let graphics = new Graphics()

let radius = 1

const animation = (delta) => {
const animation = (ticker: Ticker) => {
if (graphics.alpha <= 0) {
return
}

const delta = ticker.deltaTime;

graphics.clear()

radius = radius + delta
Expand Down
2 changes: 1 addition & 1 deletion client/src/game/star.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Application, BitmapText, Circle, Container, Graphics, Sprite, TextStyle} from 'pixi.js';
import {Application, BitmapText, Circle, Container, Graphics, Sprite} from 'pixi.js';
import TextureService from './texture'
import gameHelper from '../services/gameHelper.js'
import seededRandom from 'random-seed'
Expand Down
3 changes: 2 additions & 1 deletion client/src/game/territories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ export class Territories {
territoryLines.stroke({
width: LINE_WIDTH,
color,
alpha: 1
alpha: 1,
cap: 'round',
})
}
}
Expand Down
28 changes: 19 additions & 9 deletions client/src/game/texture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ const SPECIALIST_TEXTURES = [
'bolter-gun'
];

const loadTextureAsset = (url: string) => {
return Assets.load({
src: url,
data: {
autoGenerateMipmaps: true
}
});
}

class TextureService {

static WARP_GATE_INDEX = 1
Expand All @@ -114,13 +123,13 @@ class TextureService {
await Promise.all(Object.keys(TEXTURE_URLS).map(spec => {
const val = TEXTURE_URLS[spec];
if (Array.isArray(val)) {
return Promise.all(val.map(url => Assets.load(url)));
return Promise.all(val.map(url => loadTextureAsset(url)));
} else if (typeof val === 'string') {
return Assets.load(val);
return loadTextureAsset(val);
}
}));

await Promise.all(SPECIALIST_TEXTURES.map(specTex => Assets.load(new URL(`../assets/specialists/${specTex}.svg`, import.meta.url).href)));
await Promise.all(SPECIALIST_TEXTURES.map(specTex => loadTextureAsset(new URL(`../assets/specialists/${specTex}.svg`, import.meta.url).href)));
}

initialize() {
Expand All @@ -134,18 +143,19 @@ class TextureService {
padding: 3
})

BitmapFont.install({
name: 'chakrapetch',
style: this.DEFAULT_FONT_STYLE
});

this.DEFAULT_FONT_STYLE_BOLD = new TextStyle({
fontFamily: `Chakra Petch,sans-serif;`,
fill: 0xFFFFFF,
fontWeight: "bold",
fontWeight: 'bold',
padding: 3
})

BitmapFont.install({
name: 'chakrapetch',
style: this.DEFAULT_FONT_STYLE,
resolution: 4,
});

this.STAR_TEXTURE = Texture.from(TEXTURE_URLS.STAR)

// STARLESS NEBULAS
Expand Down
7 changes: 4 additions & 3 deletions package-lock.json

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

0 comments on commit 1ab5a24

Please sign in to comment.