CodeBase - Universal AGK Display Setup Code for Beginners (T1)

Return to the CodeBase listing

Category: Display

Version: 1.1

1
0

Information

Uploaded: 24th Nov 2011 11:42

Modified: 24th Nov 2011 14:20

Author:  Marl

Summary

Basic display setup function which handles resolution, orientation and zoom.

Full Description

Starting out with AGK, one of the trickiest parts for me was getting to grips with the screen sizes, orientations, zooms and whatnot;<br /> <br /> - The device screen width and height returned by my phone do not change with orientation<br /> - Windows returns orientation 1, even in landscape mode<br /> - Object scaling seemed very arbitrary.<br /> <br /> I needed some way to get on top of all this.<br /> <br /> After a bit of trial and error I came up with a function which just takes care of it, allowing me to get on with the actual app. This has now been split into two functions, one to set everything up, the other to check orientation and zoom and update as necessary.<br /> <br /> I provide this here for the community in the hope it will help others avoid some of the pitfalls I encountered.<br /> <br /> Everything is stored in one custom type variable "myDisplay"<br /> <br /> Simply provide the "short-edge" resolution and frame rate required and the function sets up the display to use the full screen irrespective of orientation. There should be no black bars and no wasted space.<br /> <br /> Includes an optional function to display variable contents.<br /> <br /> Tested on Samsung Galaxy SII<br /> Testing on other devices welcomed and appreciated.<br /> <br /> --- Update 1.1 ---<br /> <br /> Added .vWidthVis & .vHeightVis to custom type to store Visible Display Area<br /> Added test routine to demonstrate zoom effect - used Virtual Joystick / sprite

Comments

No comments yet.