analog clock on watchface

Hi
I'm very new to Monkey C development and creating my first WatchFace.
I would like to add an analog clock.
There must be a lot of samples how to do this, but i can't seem to find them.
Does anyone have tips and/or samples on how to achieve this?
Thanx in advance

Henk

  • 1) In VS Code, open command palette (CTRL-SHIFT-P on Windows, CMD-SHIFT-P on Mac)

    2) Select "Monkey C: Open Samples" (this will open the samples folder for the currently selected SDK)

    3) Open Analog sample folder

  • Will try that. 

    Thanks!

  • What watch do you have?  Last I looked the analog sample doesn't work on CIQ4+ watches which use createBufferedBitmap without a couple changes.

  • Look in Settings>system>about on your watch and you'll see the version of CIQ it's running.  You can also run the analog sample in the sim for your device and see what happens.

  • 5.0.2.
    And yes it's running fine in the sim.
    So, should be ok

  • Last I looked the analog sample doesn't work on CIQ4+ watches which use createBufferedBitmap without a couple changes.

    Looks like this was fixed in SDK 6.4.0 (2023-11-15).

    The relevant code looks like this now:

            if (Graphics has :createBufferedBitmap) {
                // get() used to return resource as Graphics.BufferedBitmap
                _offscreenBuffer = Graphics.createBufferedBitmap(offscreenBufferOptions).get();
    
                _dateBuffer = Graphics.createBufferedBitmap(dateBufferOptions).get();
            } else if (Graphics has :BufferedBitmap) { // If this device supports BufferedBitmap, allocate the buffers we use for drawing
                // Allocate a full screen size buffer with a palette of only 4 colors to draw
                // the background image of the watchface.  This is used to facilitate blanking
                // the second hand during partial updates of the display
                _offscreenBuffer = new Graphics.BufferedBitmap(offscreenBufferOptions);
    
                // Allocate a buffer tall enough to draw the date into the full width of the
                // screen. This buffer is also used for blanking the second hand. This full
                // color buffer is needed because anti-aliased fonts cannot be drawn into
                // a buffer with a reduced color palette
                _dateBuffer = new Graphics.BufferedBitmap(dateBufferOptions);
            } else {
                _offscreenBuffer = null;
                _dateBuffer = null;
            }

    Ofc if it was still broken for CIQ 4+ watches, that would be a huge bug especially considering that almost all currently "supported" watches (e.g. supported by monetization, supported with feature updates) are CIQ 4+ devices. (Only exception afaik is the Fenix 6 pro series).

  • It's working ine on my Epix now. Great!
    One more question. Strange thing.
    I added the Height to my Face It. On my Epix Pro Gen2 it shows nicely.

    But my wife has the same Epix Pro Gen2.
    When I added the Height there it shows ok in Connect IQ. But on her watch, it shows the height with a lot of numbers behind the comma.
    Couldn't find any settings for that in Connect IQ.

    Any idea why this happens?

  • Sounds to me in one case you are displaying a Number and in the other case a Float.  Maybe a difference in how you calculate things and values used

    When you display the value, add toNumber() or use format("%d") if you always want it to always show as an integer