Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phaser3 the API this.load.image() don't support the base64 type #5080

Closed
tyust512 opened this issue Apr 6, 2020 · 3 comments
Closed

phaser3 the API this.load.image() don't support the base64 type #5080

tyust512 opened this issue Apr 6, 2020 · 3 comments

Comments

@tyust512
Copy link

tyust512 commented Apr 6, 2020

Version

Phaser 3

Description

when i use the vue-cli with "@vue/cli-service": "~4.2.0", the webpack url-loader will change small images into base64, but the phaser 3 isn't supported it, the phaser's canvas area becomes blank color with no error or warn in the chrome console

Example Test Code

import Phaser from 'phaser'
import background from '@/assets/images/background.png'
import player from '@/assets/images/player.png'

const config = {
  type: Phaser.AUTO,
  width: 200,
  height: 200,
  parent: '',
  dom: {
    // createContainer: true,
  },
  physics: {
    default: 'arcade',
    arcade: {
      // gravity: { y: 200 },
      debug: false,
    },
  },
  scene: { // 场景
    preload: preload, // () => alert('abc')
    create: create, //
    // update: _update,
    // render: _render,
  },
}

function preload () {
  this.load.image('background', background)
  this.load.image('player', player)
  // this.load.baseURL = ''
  // this.load.crossOrign = ''
}

Additional Information

when i only use the background image, it is good because it is a big image, the url-loader don't change it it to base64, but the player image is a small image. I alert it, it becomes the base64.
There is no error or warning in the Chrome console log, if i comment this.load.image('player', player), the phaser will be ok again.

Please tell me the solution, if there is no idear, i only can change the vue.config.js url-loader options.

thanks

@TheLucifurry
Copy link

#3897

@hexus
Copy link
Contributor

hexus commented Apr 7, 2020

Phaser 3 loaders won't be supporting base64 URIs natively. See #3897 for more information.

Thanks for the link Alexemarg. Closing this because it's a duplicate of #3897.

@hexus hexus closed this as completed Apr 7, 2020
@tyust512
Copy link
Author

tyust512 commented Apr 7, 2020

thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants