![]() |
|
Half of the landscape mode's width only on Android |
CRAZY CONDITIONS
Member #16,385
June 2016
![]() |
Hello, I'm using the C4droid c compiler app from Play Store and its Allegro Plugin to write Android Apps on the Android phone itself. The portrait Mode works, in the landscape mode only the left Side (half of the Display width) is used by the Allegro graphics Commands. It seems the width and height of the portrait Mode is used and Not of the landscape mode. And: how can I geht the real device Display Resolution (real width and height of the device) with Allegro?
|
Elias
Member #358
May 2000
|
It sounds like maybe an unhandled ALLEGRO_EVENT_DISPLAY_RESIZE event? The screen size will not change until you respond to that event. Otherwise, can you describe in more detail when this is happening? Is the phone in portrait mode and the app starts in landscape mode? If you have some example project to reproduce that could also be helpful. -- |
CRAZY CONDITIONS
Member #16,385
June 2016
![]() |
After al_init() I only have: al_set_new_display_option(ALLEGRO_SUPPORTED_ORIENTATIONS,ALLEGRO_DISPLAY_ORIENTATION_LANDSCAPE,ALLEGRO_REQUIRE); ALLEGRO_DISPLAY__App=al_create_display(1440,720); al_clear_to_color(al_map_rgba(0,0,63,255)); al_flip_display(); That's all. Another problem:
|
Elias
Member #358
May 2000
|
Try adding this to the <activity> element in your AndroidManifest.xml: android:screenOrientation="landscape" So for example it will look like this: <activity android:name=".MainActivity" android:screenOrientation="landscape"> This will tell Android that the app can only work in landscape mode. (It may be a bug that al_set_new_display_option can't force the initial orientation currently.) Also, for mobile platforms it does not make sense creating a display with a fixed size because every phone will have a different size. Instead you should create your window with ALLEGRO_FULLSCREEN_WINDOW and pass 0/0 for the width/height parameters, so for example: al_set_new_display_flags(ALLEGRO_FULLSCREEN_WINDOW); al_create_display(0, 0);
[Edit:] -- |
CRAZY CONDITIONS
Member #16,385
June 2016
![]() |
I can Not manipulate the manifest file, C4droid c compiler Managers all Android specific parts of the program, I Just write a c program in 'Allegro mode' and the Compiler does the rest to produce an installable APK. So how can I handle the Problem with the resize in Startup alternatively?
|
Elias
Member #358
May 2000
|
Yes, basically remove the ALLEGRO_SUPPORTED_ORIENTATIONS line and then react to ALLEGRO_EVENT_DISPLAY_RESIZE, like here: https://github.com/liballeg/allegro5/blob/master/examples/ex_android.c#L211 There is still some other manifest settings required by Allegro apps though, hopefully c4droid makes them for you, for example it needs to listen to some config changes: android:configChanges="screenLayout|uiMode|orientation|screenSize" -- |
CRAZY CONDITIONS
Member #16,385
June 2016
![]() |
There is definately a bug in Allegro for Android. It's simple: When starting in landscape mode (SUPPORTED ORIENTATIONS LANDSCAPE), Sometimes the width and height are correct and Sometimes wrong (al_get_display_width/al_get_display_height).
|
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
The screen dimensions won't change until you call al_acknowledge_resize. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
CRAZY CONDITIONS
Member #16,385
June 2016
![]() |
Now it seems the width and height returned by the get display width and height are always correct (in display structure?), but the actual width and height available is still that of portrait mode... Okay there is No solution Allegro sucks and is of No use to me, I can Not Post anymore, too don't Know why I'm Out Here.
|
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Relax, would ya? Can you provide basic test code for us? Also, Allegro is under development, that means not everything always works. But the sooner you cooperate with us, and learn to be patient, we can help you. By the way, you can post now. (You can't double post on this forum, only edit and send to top) My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
CRAZY CONDITIONS
Member #16,385
June 2016
![]() |
Thanks, I decided to restart with Allegro and I'll post my program Code and comment it, can screenshots be posted Here? That would be useful in that Case.
|
amarillion
Member #940
January 2001
![]() |
Yes, you can post screenshots. Use the 'Drop attachments here' button in the comment form. You can embed an attached image using <img src=...>, and fill in the link to the attachment. -- |
|