Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setCursor function suggestion - setCursorX(x) and setCursorY(y) #439

Open
PeakeElectronicInnovation opened this issue Nov 7, 2023 · 0 comments

Comments

@PeakeElectronicInnovation

Just a quick suggestion, could we add setCursorX(uint16_t x) and setCursorY(uint16_t y) to Adafruit_GFX.h?

Often I find myself having to get the cursor X or Y position when populating a screen with text, which looks a bit like:

uint16_t RH_text_x_pos = 55;
tft.print("Some text");
tft.setCursor(RH_text_x_pos , tft.getCursorY());
tft.println("RH text at a consistant X co-ord");

if we had the following added to Adafruit_GFX.h then it would clean up the main code a bit... Just a suggestion of course :-)

Line 126

//
/
!
@brief Set text cursor location
@param x X coordinate in pixels
@param y Y coordinate in pixels
/
/
/
void setCursor(int16_t x, int16_t y) {
cursor_x = x;
cursor_y = y;
}

// Custom cursor functions...
void setCursorX(int16_t x) {
cursor_x = x;
}

void setCursorY(int16_t y) {
cursor_y = y;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant