Help updating touchscreen faster?

Discussion in '3DS - Homebrew Development and Emulators' started by Moocow9m, Dec 30, 2016.

  1. Moocow9m
    OP

    Moocow9m Newbie

    Newcomer
    8
    0
    Dec 29, 2016
    United States
    I am trying to be able to "color" on the touch screen by updating the touched pixels however it "jumps" positions when moving too fast. is there a way to tell when and where the screen is touched/pen moves along screen? Or a way to update touchPosition faster?

    More Info EDIT:
    Currently I am running the code below (which was found in ctrulib's hidScanInput) about 700 times a frame on a new thread with no ill effects to get touchPosition without checking others as to not disturb the checks on main thread. However even with this the problem is it doesn't check fast enough or the code is missing something.

    Code:
    touchPosition tPos;
    u32 Id = hidSharedMem[42 + 4];
    if(Id>7)Id=7;
      memset(&tPos, 0, sizeof(touchPosition));
      tPos = *(touchPosition*)&hidSharedMem[42 + 8 + Id*2];
    return tPos;
    
    END EDIT

    Couldn't focus the camera but here is a picture of moving too fast with 3 attempts:
    Large Pic
     
    Last edited by Moocow9m, Dec 30, 2016
  2. Zabhahs

    Zabhahs Goron

    Member
    201
    47
    Sep 20, 2015
    United States
    Seattle area
    i dont know much about programming and all that but could you make it so that it jumps between the 2 last points to make a line?
     
  3. Moocow9m
    OP

    Moocow9m Newbie

    Newcomer
    8
    0
    Dec 29, 2016
    United States
    What if it wasn't a line between the points? That would be inaccurate. Thanks for suggestion though.
     
  4. PabloMK7

    PabloMK7 Red Yoshi! ^ω^

    Member
    1,807
    1,113
    Feb 21, 2014
    Spain
    Yoshi's Island
    iirc, there is a function to know if the screen is being pressed. You can just draw a line if that's true.
     
  5. Moocow9m
    OP

    Moocow9m Newbie

    Newcomer
    8
    0
    Dec 29, 2016
    United States
    I do not see such a function and I also need to know where the touch was. I am currently running some code that checks every 10000 nanoseconds.
     
    Last edited by Moocow9m, Dec 30, 2016
  6. mironicurse

    mironicurse GBAtemp Regular

    Member
    119
    37
    Sep 28, 2015
    Russia
    Displaying a line instead of dots while freehand drawing is common practice in drawing apps, such as colors on DS. Why not try both reduce the timer and draw the line? I think that'll do nicely
     
  7. Moocow9m
    OP

    Moocow9m Newbie

    Newcomer
    8
    0
    Dec 29, 2016
    United States
    they become dots because it does not detect the next movement fast enough. I did move across the screen in a line (2nd attempt was not straight). My timer checks every 10000 nanoseconds which should be more than enough I think considering any lower freezes the 3DS.
     
    Last edited by Moocow9m, Dec 30, 2016
  8. Moocow9m
    OP

    Moocow9m Newbie

    Newcomer
    8
    0
    Dec 29, 2016
    United States
    I believe something else is not updating as fast as I execute the code. My guess is that hidSharedMem has something to do with it however I don't see where it is updated, only where it is initialized. Can anyone tell me what updates this?