🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    M5Dial and graphics and canvas and sprite: why so hard to figure out??

    General
    1
    1
    1.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • U
      uberdweeb
      last edited by

      I am trying to do sprites or canvas or something in the M5 Dial and had a hell of a time getting it to work. In the end I am not sure I did it right.

      I see things about canvas and sprites but I don't know the relationship, and I can't figure out what is a M5Dial call, M5Canvas or what.

      In the end I did:

      M5GFX display;
      M5Canvas canvas(&display);

      then followed with:
      auto cfg = M5.config();
      M5Dial.begin(cfg, true, true);
      display.begin();

      seems inconsistent but worked.

      In my loop I did:
      display.startWrite();
      canvas.createSprite(240, 240);
      canvas.fillScreen(0xABE1);
      canvas.setTextColor(WHITE);
      canvas.setTextDatum(middle_center);
      canvas.setFont(&fonts::Orbitron_Light_32);
      canvas.setTextSize(1);
      canvas.drawString("The Title", M5Dial.Display.width() / 2, 15);
      canvas.pushSprite(0,0);
      display.endWrite();

      In the rest of my code I always did stuff like:
      M5Dial.Display.drawString("To Print", 30, 90);

      Are there M5Dial.Display equivalents to what I am trying to do?

      The display is silky smooth without flickering now but I don't quite get it.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post