enigma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Enigma-devel] Placing buttons on the main screens border


From: Till Harbaum
Subject: [Enigma-devel] Placing buttons on the main screens border
Date: Tue, 9 Jun 2009 13:45:00 +0200 (MEST)

Hi,

i am still maintaing the maemo port and have just updated to svn revision 1724.
Everything still seems to be working fine ...

The next-gen maemo devices (formerly known as internet tablets) currently in 
the 
makings and two things are inportant for me:

- there won't be any hardware buttons anymore
- there's an accelerometer in the device

I am currently trying to work around the first problem. As you might remember, 
the
units have a 800x480 display and thus i have plenty of unused touchscreen space:
  http://www.harbaum.org/till/maemo/enigma.jpg

This is perfect for some buttons to replace the hardware keys. My question now 
is:
How do i place a button there? My borders/backgrounds are drawn in display.cc
like this:

void GameDisplay::draw_borders (GC &gc) {
    RectList rl;
    rl.push_back (gc.drawable->size());
    rl.sub (get_engine()->get_area());
    rl.sub (inventoryarea);

    for (RectList::iterator i=rl.begin(); i!=rl.end(); ++i) {
        clip(gc, *i);
        blit(gc, 0, 0, enigma::GetImage("menu_bg", ".jpg"));   // background 
image
        blit(gc, 0, 0, enigma::GetImage("enigma_logo3_small"));  // lop left 
enigma logo
    }
}

Now i'd need some little help. How do i add buttons to this? I'd at least like 
to have
them drawn to the borders. I have tried this:

void GameDisplay::draw_borders (GC &gc) {
    RectList rl;
    rl.push_back (gc.drawable->size());
    rl.sub (get_engine()->get_area());
    rl.sub (inventoryarea);

    printf("drawing borders\n");

    for (RectList::iterator i=rl.begin(); i!=rl.end(); ++i) {
        clip(gc, *i);
        blit(gc, 0, 0, enigma::GetImage("menu_bg", ".jpg"));
        blit(gc, 0, 0, enigma::GetImage("enigma_logo3_small"));

        gui::Widget *but = new gui::StaticTextButton(N_("ABC"));
        but->draw(gc, Rect(5,5,70,70));
    }
}

But this gives me the ABC centered on the top left screen edge (so only
the bottom half / left half of ABC is visible on screen). This is due to the
fact that get_area in the button draw routine returns 0,0,0,0 and the rectangle
i provide is just ignored. 

How do i draw buttons? I could add them statically to the background
image, but that's an ugly solution and e.g. doesn't work with internalization.
I'd really need some small help by someone with some knowledge about
the gui stuff. I don't need any actually handlers and actually i think it would
even be simpler if my touchscreen patched version of client.cc handles 
this itself. Does this make sense?

And once that's done i can easily add accelerometer support which could
make the game a real pearl on the maemo5 devices.

Till




reply via email to

[Prev in Thread] Current Thread [Next in Thread]