Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: Drawing things with U8G2lib

  1. #1
    Junior Member
    Join Date
    Jun 2017
    Posts
    2

    Drawing things with U8G2lib

    Good afternoon,

    I'm looking for some guidance on how to use u8g2lib.

    Long answer
    The goal is to draw some text on the screen with the print command, display some numbers next to that text, then display a shape next to those numbers.
    When the numbers change from a high value to a low value ill draw a triangle pointing down, when the numbers change from a low value to a high value the triangle will point up.

    What I cant figure out how to do, and I'm not quite sure if there is a way to do this... but draw a shape on the screen, then draw the same shape again with an inverted color clearing just that shape but not clearing the rest of the screen.

    Draw shape, wait some time, clear shape without clearing the rest of the screen.
    I kind of thought I could do something like
    Code:
    u8g2.drawTriangle(20,5, 27,50, 5,32); // Do this to draw the shape
    
    //Something else happens here
    
    
    
    u8g2.setDrawColor(SomeThing); // set the draw color to "SomeThing" decimal 1-3
    u8g2.drawTriangle(20,5, 27,50, 5,32); // draw the same shape in the same place to turn off only those pixels...
    This is my general idea... or theory how its supposed to work... Can it work like this? because I must be missing something very simple. You guys are the experts.
    Apologies if the answer is obvious I'm pretty beginner to C++ so having simple code snippets work really well to learn these things.

    Thank you much,
    --Aaron

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,559
    I know this approach works with the ILI3941 libs, just drawing it in black to "erase" the prior copy. Not sure why it wouldn't work in u8g2lib, but honestly I've never really used that library. Can't help with it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •