@@ -60,7 +60,8 @@ static void print_lvgl_version(void)
6060 */
6161static void print_usage (void )
6262{
63- fprintf (stdout , "\nlvglsim [-V] [-B] [-f] [-m] [-b backend_name] [-W window_width] [-H window_height]\n\n" );
63+ fprintf (stdout ,
64+ "\nlvglsim [-V] [-B] [-f] [-m] [-b backend_name] [-W window_width] [-H window_height] [-R rotation]\n\n" );
6465 fprintf (stdout , "-V print LVGL version\n" );
6566 fprintf (stdout , "-B list supported backends\n" );
6667 fprintf (stdout , "-f fullscreen\n" );
@@ -88,7 +89,7 @@ static void configure_simulator(int argc, char ** argv)
8889 settings .window_height = atoi (env_h ? env_h : "480" );
8990
9091 /* Parse the command-line options. */
91- while ((opt = getopt (argc , argv , "b:fmW:H:BVh" )) != -1 ) {
92+ while ((opt = getopt (argc , argv , "b:fmW:H:R: BVh" )) != -1 ) {
9293 switch (opt ) {
9394 case 'h' :
9495 print_usage ();
@@ -120,6 +121,25 @@ static void configure_simulator(int argc, char ** argv)
120121 case 'H' :
121122 settings .window_height = atoi (optarg );
122123 break ;
124+ case 'R' :
125+ switch (atoi (optarg )) {
126+ case 0 :
127+ settings .rotation = LV_DISPLAY_ROTATION_0 ;
128+ break ;
129+ case 90 :
130+ settings .rotation = LV_DISPLAY_ROTATION_90 ;
131+ break ;
132+ case 180 :
133+ settings .rotation = LV_DISPLAY_ROTATION_180 ;
134+ break ;
135+ case 270 :
136+ settings .rotation = LV_DISPLAY_ROTATION_270 ;
137+ break ;
138+ default :
139+ LV_LOG_WARN ("Invalid rotation angle. Valid angles are {0, 90, 180, 270}" );
140+ break ;
141+ }
142+ break ;
123143 case ':' :
124144 print_usage ();
125145 die ("Option -%c requires an argument.\n" , optopt );
@@ -149,6 +169,12 @@ int main(int argc, char ** argv)
149169 if (driver_backends_init_backend (selected_backend ) == -1 ) {
150170 die ("Failed to initialize display backend" );
151171 }
172+ if (settings .rotation ) {
173+ #if LV_DRAW_TRANSFORM_USE_MATRIX
174+ lv_display_set_matrix_rotation (NULL , true);
175+ #endif
176+ lv_display_set_rotation (NULL , settings .rotation );
177+ }
152178
153179 /* Enable for EVDEV support */
154180#if LV_USE_EVDEV
0 commit comments