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

Fix project running #415

Merged
merged 3 commits into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added spx-gui/src/assets/default-sprite.png
aofei marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
270 changes: 0 additions & 270 deletions spx-gui/src/assets/default-sprite.svg

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,6 @@ const addToLibrary = useAddAssetToLibrary()
display: flex;
gap: 4px;
align-items: center;
word-break: keep-all;
}
</style>
10 changes: 5 additions & 5 deletions spx-gui/src/components/project/ProjectCreateModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ import { useI18n } from '@/utils/i18n'
import { useMessageHandle } from '@/utils/exception'
import { useUserStore } from '@/stores/user'
import { ApiException, ApiExceptionCode } from '@/apis/common/exception'
import { Sprite } from '@/models/sprite'
import { Sprite, type SpriteInits } from '@/models/sprite'
import { Costume } from '@/models/costume'
import { File } from '@/models/common/file'
import { uploadFiles } from '@/models/common/cloud'
import { filename } from '@/utils/path'
import defaultSpriteSvg from '@/assets/default-sprite.svg'
import defaultSpritePng from '@/assets/default-sprite.png'
import defaultBackdropImg from '@/assets/default-backdrop.png'
import { Backdrop } from '@/models/backdrop'
import { Project } from '@/models/project'
Expand Down Expand Up @@ -96,9 +96,9 @@ function createFile(url: string) {
const handleSubmit = useMessageHandle(
async () => {
// make default project
const spriteFile = createFile(defaultSpriteSvg)
const spritePos = { x: -71, y: 75 } // offset to make sprite centered. depending on the size of spriteFile
const sprite = Sprite.create('', undefined, spritePos)
const spriteFile = createFile(defaultSpritePng)
const spriteInits: SpriteInits = { x: -71, y: 75, size: 0.5 } // offset & size to make sprite centered. depending on the size of spriteFile
const sprite = Sprite.create('', undefined, spriteInits)
sprite.addCostume(Costume.create('', spriteFile))
const backdropFile = createFile(defaultBackdropImg)
const backdrop = Backdrop.create('', backdropFile)
Expand Down
4 changes: 2 additions & 2 deletions spx-gui/src/components/project/ProjectItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { computed } from 'vue'
import dayjs from 'dayjs'
import { useFileUrl } from '@/utils/file'
import { Project } from '@/models/project'
import defaultSpriteSvg from '@/assets/default-sprite.svg'
import defaultSpritePng from '@/assets/default-sprite.png'

const props = defineProps<{
inHomepage?: boolean
Expand All @@ -25,7 +25,7 @@ const props = defineProps<{
const imgSrc = useFileUrl(() => props.project.sprites[0]?.costume?.img)

const imgStyle = computed(() => {
const backgroundImage = imgSrc.value || defaultSpriteSvg
const backgroundImage = imgSrc.value || defaultSpritePng
return { backgroundImage: `url("${backgroundImage}")` }
})

Expand Down
4 changes: 1 addition & 3 deletions spx-gui/src/models/sprite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ export class Sprite extends Disposble {
isDraggable: this.isDraggable,
costumes: costumeConfigs
}
if (this.code !== '') {
files[`${this.name}.spx`] = fromText(`${this.name}.spx`, this.code)
}
files[`${this.name}.spx`] = fromText(`${this.name}.spx`, this.code)
files[`${assetPath}/${spriteConfigFileName}`] = fromConfig(spriteConfigFileName, config)
return files
}
Expand Down
4 changes: 1 addition & 3 deletions spx-gui/src/models/stage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,7 @@ export class Stage {
export(): [RawStageConfig, Files] {
const files: Files = {}
const backdropConfigs: RawBackdropConfig[] = []
if (this.code !== '') {
files[stageCodeFilePath] = fromText(stageCodeFileName, this.code)
}
files[stageCodeFilePath] = fromText(stageCodeFileName, this.code)
for (const backdrop of this._backdrops) {
const [backdropConfig, backdropFiles] = backdrop.export()
backdropConfigs.push(backdropConfig)
Expand Down
2 changes: 2 additions & 0 deletions tools/ispx/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

//go:generate qexp -outdir pkg github.com/goplus/spx
//go:generate qexp -outdir pkg github.com/hajimehoshi/ebiten/v2

import (
"archive/zip"
Expand All @@ -10,6 +11,7 @@ import (
"syscall/js"

_ "github.com/goplus/builder/ispx/pkg/github.com/goplus/spx"
_ "github.com/goplus/builder/ispx/pkg/github.com/hajimehoshi/ebiten/v2"
"github.com/goplus/builder/ispx/zipfs"
"github.com/goplus/igop"
"github.com/goplus/igop/gopbuild"
Expand Down
406 changes: 406 additions & 0 deletions tools/ispx/pkg/github.com/hajimehoshi/ebiten/v2/export.go
aofei marked this conversation as resolved.
Show resolved Hide resolved

Large diffs are not rendered by default.

Loading