lcd raspberry

Piader v2 – views

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.

(more…)

Advertisements

LCD Manager – part 5: widget pane

Next widget we will add to our manager is pane (wrongly named panel before). It will allow us to create group of other widgets (label for now:)).

In this part we will focus on simple and quick implementation. In next part we will improve it.

After this we will rewrite Piader game to use manager and widgets. Somewhere between we will add event queue and probably refactor whole structure.

Download source

(more…)

Virtual display – part 2: offsets

We have a simple virtual display. It can join lcds in one virtual area. But there is one catch. Look at the following layouts (red area is virtual lcd):

layout_leftlayout_center

No problem. But what about:

layout_right

… we can’t do it ! And what if we want to use this small 4×4 as second virtual display ? We can’t !

When we add lcd its added at any (x,y) but always starts from (0,0). Lets add an offset, so we can specify area.

Update – error in code. see at the bottom

Download source

(more…)

Virtual display – part 1

We have a fully functional game that is quite primitive but don’t wory. We will do something about it and during this we will upgrade Lcd classes.

Remember draw function in game.py ? It was doing all kind of checks and distinctions between lcds. It shouldn’t be like that. Game class shouldn’t care about proper display, such task goes to lower level of code. From game perspective it should have some area to display and thats all. It should write on any (x, y) allowed by combined displays and don’t care which display is top, bottom, left or right.

Its time for Virtual Display ๐Ÿ™‚

Download source

(more…)

Piader โ€“ simple game โ€“ part 3

Today we will add player and it’s controls.

Controls, that’s something we will do a different way, we have no keyboard attached, no joystick and no pad. So what now ? Lets write a control server, a threaded class that will listen for control signals on some port. This way we will be able to use anything to move a player.

As first input we will use host keyboard, small class that will read keys and send them to game.

Download source code

(more…)