Creating TetrisView

So far, so good. We have successfully implemented classes to model blocks, frames, and shapes of different tetrominoes that will be used within the application, as well as implemented an AppModel class to coordinate all the interactions between views and these programmatic components created. Without this view existing, there is no means by which a user can interact with AppModel. If a user cannot interact with the game, the game might as well not exist. In this section, we will implement TetrisView, the user interface by which a user will play Tetris.

Create a package named view in your source package and add a TetrisView.kt file in it. As we want TestrisView to be a View, we must declare it to extend the View class. ...

Get Kotlin Programming By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.