Some time ago we made a WiFi keyboard on ESP 8266. Long time ago we made a Piader game. From their combined powers comes Piader controlled by WiFi keyboard 😀
We need to change Piader a little, to be precise, event listener and keyboard server needs to use JSON packet not string. Why ? Because wifi keyboard is using it.
Piader will also move from TCP to UDP and this allows us to use broadcast.
What about keyboard changes ? Yey! No changes!
Piader source code
We have a nice game and we may play it. But there is one problem we don’t see number of lives and our score. In this article we will create another view and position it on second display. I played with 40×4 for game and 20×4 for score but ended with one lcd with two vlcds 🙂
We will also do something with difficulty as we have such setting it would be nice that it would do something
And of course we can’t forget about bugs, we will fix few along the way.
We have all bricks to build a game view. It is the most important view in game 🙂
We have a home view now lets work on options and option view. We want to be able to set maximum lives and difficulty level. Still I have no idea what would be difference between easy and hard 🙂
In this article we will work on views and create our first view for home tab. We could put all code into one file but it would be a mess. So lets take a different approach, we will create a separate file for each view. Next we will work on button widget and create quit game action. Don’t forget that Piader is a tool to improve LCDManager.
LCDmanger doesn’t care about application logic its job is to display. So its up to us and application to use events and change views. Each app may have different actions and effects.
So what now ?
Simple we will create new project Piader and use LCD Manager as external package. This way we will have two separate projects. And we may focus on develop them separately.
Time for something new, imagine that we rewrite Piader to use LCD Manager. We want simple start screen, game screen and maybe options. We can use pane widget to simulate tabs. But how to change between them ? On main screen how to create actions like start game or quit ?
This will require buttons 🙂 But using buttons imply using events and this goes well with event server. And this is something interesting.
Imagine out start screen. With 3 buttons, first to start game, second with options and third to quit. First problem how to change between them and call action? And before that, what to use as input ?
We need to write an event server, a thread that will wait for events and propagate them to manager and widgets.
But easy things first. We will create widget button and attach action to it.