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 game paths #85

Merged
merged 5 commits into from
Sep 20, 2023
Merged

Fix game paths #85

merged 5 commits into from
Sep 20, 2023

Conversation

PalumboN
Copy link
Contributor

@PalumboN PalumboN commented Sep 17, 2023

Fix #53
Fix #61

  • Le agregamos un parámetro para pasarle el directorio con las assets.
  • También hicimos que si no se lo pasás lo saque de un archivo package.json (nos quedamos con eso o sugieren otro nombre?)
  • Cuando carga las imágenes lo hace recursivamente, cosa que desde el objecto puedas apuntar a "subfolder/image.png".

w/ @ivojawer

TODO: Tener algunos tests con un proyecto de ejemplo. Testear el server?

Hay otro TODO más grande para revisar / mejorar

Copy link
Contributor

@fdodino fdodino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

te dejé comentarios, por ahora de newbie, necesito hacer más gimnasia para revisar a conciencia estos PRs. La radio está buenísima!!

src/commands/run.ts Outdated Show resolved Hide resolved
@@ -108,6 +112,8 @@ export default async function (programFQN: Name, { project, skipValidations, por
socket.on('keyPressed', key => {
queueEvent(interp, buildKeyPressEvent(interp, wKeyCode(key.key, key.keyCode)), buildKeyPressEvent(interp, 'ANY'))
})

if (!folderImages) logger.warn(failureDescription('Folder for assets not found!'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acá no la tengo tan clara como para ver cómo funciona un programa con Wollok Game. Pero quizás estaría bueno diferenciar:

  • ejecutar un programa común
  • ejecutar un Wollok Game, donde yo directamente rompería si no tenés una carpeta assets (mientras que en el primer caso no lo necesitamos)

Igual no tengo una opinión muy fuerte, solo tengo el sentimiento de que ese logger.warn puede llegar a ser pasado por alto si no somos explícitos.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eso lo discutimos con Ivo. Por ahora toma como carpeta el base del proyecto.
Lo podemos retomar cuando podamos ejecutar un programa común sin ruido #86

}
})
const baseFolder = folderImages ?? pathProject
const loadImagesIn = (basePath: string) => fs.readdirSync(basePath, { withFileTypes: true })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uh, me hiciste buscar a ver si hay alguna alternativa de readdirSync que me permita obtener todos los archivos recursivamente, para poder hacer un map y meterlo directamente en la const images

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pero bueno... por ahora puedo bajar la manija y hacerme el gil. 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jajaja lo buscamos y no lo encontramos 😞

src/utils.ts Show resolved Hide resolved
src/utils.ts Show resolved Hide resolved
@PalumboN PalumboN merged commit 3f87096 into master Sep 20, 2023
1 check passed
@PalumboN PalumboN deleted the fix-game-paths branch September 20, 2023 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

error al correr juego de repo Serve assets de wollok game
2 participants