Book Image

Expert Delphi - Second Edition

By : Marco Cantù, Paweł Głowacki
Book Image

Expert Delphi - Second Edition

By: Marco Cantù, Paweł Głowacki

Overview of this book

Master Delphi, the most powerful Object Pascal IDE and versatile component library for cross-platform native app development, by harnessing its capabilities for building natively compiled, blazingly fast apps for all major platforms, including Android, iOS, Windows, Mac, and Linux. Expert Delphi begins with a quick overview of Delphi, helping you get acquainted with the IDE and the Object Pascal language. The book then quickly progresses to more advanced concepts, followed by the architecture of applications and the FireMonkey library, guiding you through building server-side services, parallel programming, and database access. Toward the end, you’ll learn how to integrate your app with various web services and deploy them effectively. By the end of this book, you’ll be adept at building powerful, cross-platform, native apps for iOS, Android, Windows, and macOS—all from a single code base.
Table of Contents (21 chapters)
Free Chapter
1
Part 1: Building Blocks
6
Part 2: Going Mobile
12
Part 3: From Data to Services
19
Index

Building the main form of the game

In our game, we have a visual grid of tiles. The most natural component to use in this context is the TGridLayout component. Drop it on the main form of our app, change its Name property to GridLayoutTiles, and align it with Client so that it occupies the whole screen of the main form under the toolbar. Now, we can add other visual controls to the grid layout. The size of each item in the grid layout can be controlled with its ItemHeight and ItemWidth properties.

We are going to use the TGlyph component to display bitmaps from our image list in the data module. There is also the TImage component, which we could have used, but in this case, we would need to load bitmaps directly to every TImage, which is not as effective as using just one set of bitmaps. Let’s get started:

  1. Change the background color of the main form to white. Expand Fill, then change Color to White and Kind to Solid.
  2. Add the uDMGameOfMem unit to the uses clause...