Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » ak_create_display problem in Android

This thread is locked; no one can reply to it. rss feed Print
ak_create_display problem in Android
drajin.cho
Member #17,558
March 2020

Simply I tried to create display with size (1280, 720). But, actual display was created with size (2094, 1080) as the attached png.

Is any option or flag required?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Simply I tried to create display with size (1280, 720). But, actual display was created with size (2094, 1080) as the attached png.

Is any option or flag required?

On Android, you can generally only get a display the size of the physical screen.

There may have been a development with ALLEGRO_FRAMELESS and ALLEGRO_FULLSCREEN_WINDOW, which is preferred to ALLEGRO_FULLSCREEN. You should probably be happy with what you get, and use a simple transform to draw everything.

Some links ;

http://docs.liballeg.org/transformations.html#al_get_current_transform

https://liballeg.org/a5docs/trunk/display.html#al_set_new_display_flags

Then in your drawing code, you use the transform to scale your graphics up to the screen dimensions.

#SelectExpand
1 if (redraw) { 2 al_clear_to_color(al_map_rgb(255,255,255)); 3 ALLEGRO_TRANSFORM old; 4 al_get_view_transform(&old); 5 al_use_transform(&t); 6 /// Draw normally here 7 al_draw_my_cool_stuff(); 8 al_flip_display(); 9 al_use_transform(&old); 10 redraw = false; 11 } 12 do { 13 ALLEGRO_EVENT ev; 14 al_wait_for_event(queue , &ev); 15 if (ev.type == ALLEGRO_EVENT_WHATEVER) { 16 DoStuff(); 17 } 18 } while (!al_is_event_queue_empty(queue));

8-)

drajin.cho
Member #17,558
March 2020

Thanks for your kind support!!! I fixed the problem.

I have more questions.

1. is it possible to convert y-coordinate from top-to-bottom to bottom-to-top?
I tried it as below.
ALLEGRO_TRANSFORM t;
al_identity_transform(&t);
al_scale_transform(&t, 1.f, -1.f);
al_translate_transform(&t, 0, (float)al_get_display_height(display));
al_use_transform(&t);
it makes everything reversed.^^

I'd like to change coordinate only. image and drawing should be drawn in the normal way.

2. isn't "video" supported in Android release?

3. I tried to play audio (the attached) using al_load_audio_stream().
even though I set play mode to once, it is not stopped, playing again and again.
it doesn't give any event also.

stream = al_load_audio_stream(filename.c_str(), 4, 2048);
al_set_audio_stream_playmode(stream, ALLEGRO_PLAYMODE_ONCE);
al_attach_audio_stream_to_mixer(stream, al_get_default_mixer());

playing other files is OK. I guess that it's too short. ???
i tried to convert mp3 to wav. it is also fine to play.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

I'd like to change coordinate only. image and drawing should be drawn in the normal way.

Then you don't need to use the transform, but rather apply it.

Use

https://liballeg.org/a5docs/trunk/transformations.html#al_transform_coordinates

To transform *x and *y into right side up coordinates. But don't change your drawing coordinates or the drawing transform.

drajin.cho said:

2. isn't "video" supported in Android release?

I don't know. Right now you only have support for theora, if it was compiled in.

Go to: