Unable to load image for more than one second in bangle js emulator #7811
-
Hello, I'm very new to making clocks in bangle js. I wanted to try making a simple clock face with a background. However, when I test it in the emulator, the image either doesn't load (in flash or storage) or it appears for one second and disappears (in ram). How do I ensure that it remains as a permanent background? I have used the following string as per the tutorial on the espruino website but I don't know why it is not loading properly.There are also no errors in the terminal itself. : Any assistance would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I don't think you can have a permanent background image, this would imply layers, I don't believe this is implemented. Maybe this is your problem? Maybe you are drawing the image, and then you are drawing something else on top of it, and the image is now gone? the way it works, is you draw something, an image for instance, and if you want something on top of it, then you draw that something too. But if you then want to change something, there is no way to delete and redraw something without redrawing the image from start. It is one layer. But maybe I am wrong, I only replied to keep you company till someone that uses the emulator gives a better answer :) |
Beta Was this translation helpful? Give feedback.
-
If you share your code here, ideally as a gist or the like, I'd be happy to take a look. So, just the entire piece of code you're loading into the emulator, or alternatively, stripped back to the essentials while still demonstrating your issue. |
Beta Was this translation helpful? Give feedback.
-
As others have said, it might be you're drawing the background once in the main code, but then the clock code is doing You could also look at the 'Clock Backgrounds' library which is designed to make it easier to add backgrounds to clocks: https://banglejs.com/apps/?id=clockbg&readme Once you add and use it in your clock, you can then upload new backgrounds from the app loader |
Beta Was this translation helpful? Give feedback.
As others have said, it might be you're drawing the background once in the main code, but then the clock code is doing
g.clear()
org.clearRect()
and overwriting it almost immediately.You could also look at the 'Clock Backgrounds' library which is designed to make it easier to add backgrounds to clocks: https://banglejs.com/apps/?id=clockbg&readme
Once you add and use it in your clock, you can then upload new backgrounds from the app loader