cancel
Showing results for 
Search instead for 
Did you mean: 

Any way to have in the same project Landscape and Portrait orientation?

Zui
Senior

Since the new TouchGFX 4.12.3 came out, i saw it's finally possible to swtch from landscape to portrait orientation, which is great because i was asked to develop my project with both orientations.

i saw the orientation is changed by this line of code :

touchgfx::HAL::getInstance()->setDisplayOrientation(touchgfx::ORIENTATION_LANDSCAPE);

just switching the function argument.

so i changed my code calling that function changing that parameter, and the effective orientation of the simulator changed, but the problems are the images0690X00000AqMdEQAV.png

as you can see the images are rotated if are square, and just a mess if are rectangle.

i saw you can change the image oriantation in the designer, but that make all the images cpp file recompiled, so impracticable for changing orientation runtime...

Any way to accomplish what i'm looking for?

Thanks

Stefano

13 REPLIES 13

When you don't change the hardware configuration to draw natively how you want to, you must do so in software - That's what we're doing right now with e.g. telling the image manager to rotate the images when it generates code for an image.

Yes, you need to recompile your application either way. They're two different applications, more or less. What i'm saying is that you need to maintain either two applications or just one where your screens check for what the orientation is - Either through code (if(Hal::getInstance()->getDisplayOrientation()==...) which would add support for dynamic rotation - or by using preprocessor directives #ifdef PORTRAIT or something like that.

I guess maybe it would be interesting to have a canvas for both landscape and orientation and then choose which you wanted to generate code for?

/Martin

atm i have 2 #Ifdef​ , portrait and landscape, which sets up the gui accordingly, but ofc i need to recompile after turning all the images via TouchGfx, original idea was having a flag instead of those defines and no need to recompile the whole project...

Aling.1
Associate

Dear Martin KJELDSEN :

I'm trying to create an application oriented natively to landscape. But I don't know how to generate my images in that format ,because I can't open the website you offered before .Can you give me a new website ? And my device is F429 Discovery . I only need landscape mode .0693W000001szL7QAI.jpg

Hi, the new documentation site is https://support.touchgfx.com

In regards to your issue: Go to the "Config" tab in the designer and you can specify "display orientation" of the application itself and also rotation for images.

/Martin