Skip to content

Commit

Permalink
Fixed missing background color in sprite.
Browse files Browse the repository at this point in the history
  • Loading branch information
michielvandergeest committed Jan 12, 2024
1 parent 2f4cb04 commit c22a41d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/Sprite.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import symbols from '../lib/symbols.js'
export default () =>
Component('Sprite', {
template: `
<Element w="$w" h="$h" :texture="$texture" />
<Element w="$w" h="$h" color="#fff" :texture="$texture" />
`,
props: ['image', 'map', 'frame', 'w', 'h'],
state() {
Expand All @@ -32,6 +32,7 @@ export default () =>
},
computed: {
texture() {
console.log('texture')
const options =
'frames' in this.map
? { ...(this.map.defaults || {}), ...this.map.frames[this.frame] }
Expand All @@ -50,6 +51,7 @@ export default () =>
},
hooks: {
ready() {
console.log('sprite!')
this.spriteTexture = this[symbols.renderer].createTexture('ImageTexture', {
src: `${window.location.protocol}//${window.location.host}/${this.image}`,
})
Expand Down

0 comments on commit c22a41d

Please sign in to comment.