Hello,
it is possible to create an animation element?
I want to create an animation like a watch Casio G Shock G-2500FL
Thank you
Hello,
it is possible to create an animation element?
I want to create an animation like a watch Casio G Shock G-2500FL
Thank you
Yes. You have to write code to change the displayed information over time.
Hi please, how can I easily split an on part circle so that you don't have to add complicated lines?
Thank you
hi,
you can use DrawArc function and set the pen width (dc.setPenWidth)
Hi, please, an example?
var gW = dc.getWidth(); dc.setPenWidth(gW/20.0); dc.fillCircle(gW/2, gW/2, gW/30); for (var i = 0;i<12;i++){ var start = 360 - ( 4 + (30*i)); var end = start - 22; dc.drawArc(gW/2,gW/2, gW/15.0, 1, start+90, end+90); }
The "1" is actually "Graphics.ARC_CLOCKWISE" and it's probably better for clarity not to hard code the value in sample code.
Counterpoint: Monkey C enums take up code space (RAM), so if memory is at a premium, I would do something like this:
Sure, it's "just" 4 bytes or so each time you use an enum, but it can really add up, especially on older watches with less memory. And especially when coding data fields, which have the least amount of available memory of all the app types.
You posted a sample for a new developer. Even I had to check what "1" was!
There's also a readability factor to it. Try reading someone else's code that hard codes things.
BTW, I don't hardcode these values, and haven't since CIQ 1.0. I can spare an extra 24 bytes. for 6 of them.
I didn't post a sample for a new developer. Shent-Aurkhan (SHN) did.
I just posted my own follow-up opinion in response to your comment, which I happen to agree with.
Thanks for the feedback tho.
I *do* hardcode these values (along with comments as above), because I can save 100s of bytes in some cases. And sometimes 100 bytes buys me a whole feature.
On a platform where an app can have 16/32 KB of available memory, 100 bytes is a huge amount of savings.
And I actually have an app where I started out not hardcoding enums, then when I wanted to add new features on old watches, I was able to free up the memory I needed by changing enums to constants.
There's actually many times where I started out writing "nice", maintainable code, and ended up changing it to use awful anti-patterns like hardcoded constants, just to save memory.
This kind of thing could be avoided if the monkey c compiler would resolve enums at compile-time and replace them with constants (when possible).