android-js / androidjs

Platform to build android app using node js
MIT License
466 stars 109 forks source link

Loading Images from storage which can be put under assets. #212

Open Johnny-John-John opened 3 years ago

Johnny-John-John commented 3 years ago

Is your feature request related to a problem? Please describe. Hello I am making a game using Androidjs with a little bit of this thing called p5.js which is a liberary for artists, it seems there are issues to load images from the local storage even after the permissions "android.permission.READ_EXTERNAL_STORAGE" is given given.

Describe the solution you'd like Can we make it so that we can do a simple loadImage("Image.png") like what can be done with other node apps? Can this be hidden? Meaning i dont want it to appear in gallery ( if possible ). Like a sandbox just for the game and the sprites which the game would be using. Apart from that Androidjs is absoluletly amazing! Really enjoying it!

JKDos commented 2 years ago

Someone can correct me if I am wrong: Assets folder can only be accessed through node.js, such as /main.js.

p5.js is regular Javascript. That stuff is isolated under /views. That means anything p5.js needs access to must also be in /views. It cannot access anything in root.

Chhekur commented 2 years ago

@JKDos correct, @Johnny-John-John what you can do is you can load the images in the main.js and send them over the IPC to front process and there you can load them in p5.js.