Another question about CYD and the tutorials/eBook for LVGL
You always set the screen size as 240 wide and 320 tall. That makes me think the screen would then be in portrait orientation. But the text and buttons are always shown with the screen in landscape mode (as I would expect).
I am trying to wrap my head around is the screen rotated 90 degrees in the code?
Further I am trying to get my touch rotation correct, but I have no idea where 0,0 should be and which way is positive for each axis.
here is what the coordinates are for each corner in all 4 different rotations.
rotation 0
27,273 30,15
Turn On
Toggle
205,276 212,8
———————————–
Rotation 1
199,257 15,273
Turn ON
Toggle
208,28 13,22
———————————–
rotation 2
203,28 211,288
Turn On
Toggle
26,23 27,290
———————————–
Rotation 3
25,29 222,26
Turn On
Toggle
24,277 220,271
———————————–
As you can see, rotation 0 and 2 seem to have X as the vertical direction and Y as the horizontal axis. Sorry I am sure there is a simple explanation so that I will understand it, but it escapes me right now.
Is the answer that we hold it sideways form the X/Y perspective? And the controls are drawn sideways?
Hi.
The settings we set in the code are required to display in that orientation.
For me, it also doesn’t make sense to set the widht and height like that and then, rotate the display (yes, we rotate the display 90 degrees in the code).
But because the library is set in a certain way, if we set the width and height differently, the display would not display as expected.)
Are the examples working as expected for you?
Regards,
Sara
I think they are working as expected. So far everything is in the center so it would work no matter what. My question is because when I no longer want to just play with the examples, I am trying to understand how to predict where things will be on the screen.
So I think the answer is the LVGL is set up in portrait mode. Then rotated 90 degrees.after that we rotate the touchscreen to match the original screen orientation. LVGL handles the rotation for that?