screen resolution
bleepBlop

I am working on a little game and I had a question about screen resolutions.

I can make the display 800 by 600 for example, but the image is stretched if I make a resolution which is bigger then the planned images or, if smaller, it only shows parts of images.

How do "real" games make it so that when you change resolution it affects more the clarity and the amount of pixels then the size of the screen itself? Is there a place to study this subject, some sort of link any of you could offer or some advice on how to have the same effect games have? Is there a certain suggested resolution?

For me basically in allegro resolution becomes a question of size, while in image editors, it is more about pixels per inch, I just want to understand how to apply pixels per inch to my games not just size.

I hope I was explicit enough to receive an answer, thank you for your time.

l j

Use different images for different resolutions or use vector graphics as those tend to scale way better.

You can abandon using pixels as an unit, like for example position.x = 0.0 -> Left border of screen; position.x = 1.0; -> right border of the screen instead of 0 and 800 respectively. Although it's certainly not necessary.

Nidrax

Use Hi-Res images + Hi-Res Buffer. Then scale the buffer to desired screen resolution.

#SelectExpand
1const int WIDTH = 2048; 2const int HEIGHT = 1536; 3 4float MULT_X = 800 / WIDTH; 5float MULT_Y = 600 / HEIGHT; 6 7ALLEGRO_DISPLAY *display = NULL; 8ALLEGRO_BITMAP *buffer = NULL; 9 10al_init_image_addon(); 11 12display = al_create_display((int)(WIDTH*MULT_X), (int)(HEIGHT*MULT_Y)); //create our display object 13buffer = al_create_bitmap(WIDTH, HEIGHT); 14 15//some code 16 17al_set_target_bitmap(buffer); 18 19//draw instructions go here 20 21al_set_target_backbuffer(display); 22al_draw_scaled_bitmap(buffer, 0, 0, WIDTH, HEIGHT, 0, 0, (int)(WIDTH*MULT_X), (int)(HEIGHT*MULT_Y), 0); 23 24al_flip_display(); 25 26//some more code

bleepBlop

thanks everyone, I'll follow Nidrax's idea since I had a similar thought, I was just afraid it would slow the game down or something, thank you very much

Thread #613386. Printed from Allegro.cc