The TextureRegion class specifies a texture and a rectangular region in it. Using texture atlases instead of individual textures helps in reducing bind operations. Rendering from a texture atlas is usually faster.Įach texture is bound to OpenGL just before rendering it and binding is a costly operation. Texture atlases usually have power-of-two dimensions and therefore don’t need to be enlarged.Ģ. That’s where the texture atlas becomes handy. For example, an image with dimensions of 100x200 becomes a texture with dimensions of 128x256 in memory. Gideros automatically increase the texture size to conform to this rule. To use an image as a texture, its width and height always have to be a power of two. Texture atlases usually consume less memory. There are two main reasons for using a texture atlas instead of many independent textures:ġ. When Gideros starts, the display list hierarchy contains one item (the global Stage instance) only and we can add more: You can access this global variable with the name stage. The root of the scene tree is an instance of the Stage class which is automatically created and set as a global variable when Gideros starts. The scene tree is the hierarchy of all graphical objects currently displayed and this hierarchy needs a root. Therefore if you add a child object that already has a different sprite as a parent, the sprite is removed from the child list of the other sprite and then added to this sprite. new () - Add the new Sprite as a child : mySprite : addChild ( childSprite ) - Set the position : mySprite : setPosition ( 10, 20 ) - Set the scaling : mySprite : setScale ( 0.5, 1 ) - Set the rotation angle : mySprite : setRotation ( 90 ) - Set the alpha transparency : mySprite : setAlpha ( 0.7 ) - Get the first child : mySprite : getChildAt ( 1 ) - Remove the child : mySprite : removeChild ( childSprite ) Create a new Sprite instance : local childSprite = Sprite. ![]() Hierarchy is an important feature in graphics - when you move your parent sprite, all the child (and grandchild) sprites also move simultaneously. Sprites can have other sprites as their children and these children inherit properties such as position, scaling, and transparency from their parent sprite. It’s the main construction element and used to create display hierarchies. Sprite is the base class of all display classes and has no visual representation. ![]() Sprite class is used to group and transform these instances. For example, the Bitmap class is used to display bitmap graphics, and TextField is used to display text object. In Gideros Studio, all graphical content is constructed by creating graphical instances and adding them to the scene tree. Graphics and animation Introduction to graphics 5.3 Getting Texture Regions from Texture Packs.5.2.1 Dynamic Creation of Texture Packs.You will learn how to quickly create game prototypes in Gideros, how to test and set up projects to automatically target devices with different resolutions, and how to polish your prototype with animations, sounds, tweens, and even physics to create your very first cross-platform game.īy the end of this book, you will have learned everything you need to create visually stunning physics and exciting cross-platform games using Gideros. This book teaches you everything you need to know about Gideros, from installing Gideros on your operating system to creating and efficiently managing your Gideros projects and creating your very first game, all with the help of well explained examples. Gideros Mobile Game Development shows you how to develop an original and exciting game in Gideros, helping you create your very first project and guiding you through the configuration of settings and assets to help you target devices with different resolutions. Gideros also comes with a built-in box2D physics engine and extended memory management features to make mobile game development a breeze. Gideros is a Lua-based framework that facilitates effortless native iOS and Android application development along with hardware acceleration. Have you ever had an interesting idea for a mobile game? Have you ever wanted to jump on the mobile app bandwagon? Developing a mobile game has never been so fun and easy, and with the vast amount of smartphone users, it may also become a profitable thing to do. Full of code examples and descriptions to help you master the basics of mobile game development.Build your very first game following practical and easy to understand instructions.Develop engaging iOS and Android mobile games quickly and efficiently.All that’s required is a little familiarity with Lua. This book shows you how with a real-life project you undertake yourself. ![]() With Gideros you can develop games for both iOS and Android faster and more simply.
0 Comments
Leave a Reply. |