Pandora improved SDL for pandora


About mouse, I (too quickly maybe) analysed the code and found that Mouse event are treated here for omapdss (omapdss/sdlif.c):


static void omap_PumpEvents(SDL_VideoDevice *this)
{
    struct SDL_PrivateVideoData *pdata = this->hidden;
    int read_tslib = 1;

    trace();

    if (pdata->xenv_up) {
        if (!pdata->cfg_ts_force_tslib) {
            xenv_update(xkey_cb, xmouseb_event_cb, xmousem_event_cb, this);
            if (pdata->xenv_mouse)
                read_tslib = 0;
        }
        else {
            /* just flush X event queue */
            xenv_update(NULL, NULL, NULL, NULL);
        }
    }

    omapsdl_input_get_events(0, key_event_cb,
        read_tslib ? ts_event_cb : NULL, this);
}
with the relevent functions are:


/* clamp x to min..max-1 */
#define clamp(x, min, max) \
    if (x < (min)) x = min; \
    if (x >= (max)) x = max

static void translate_mouse(SDL_VideoDevice *this, int *x, int *y)
{
    struct SDL_PrivateVideoData *pdata = this->hidden;

    if (!pdata->cfg_no_ts_translate && pdata->layer_w != 0 && pdata->layer_h != 0) {
        *x = pdata->border_l + ((*x - pdata->layer_x) * pdata->ts_xmul >> 16);
        *y = pdata->border_t + ((*y - pdata->layer_y) * pdata->ts_ymul >> 16);
        clamp(*x, 0, this->screen->w);
        clamp(*y, 0, this->screen->h);
    }
}
 
static int xmouseb_event_cb(void *cb_arg, int x, int y, int button, int is_pressed)
{
    SDL_VideoDevice *this = cb_arg;
    struct SDL_PrivateVideoData *pdata = this->hidden;

    translate_mouse(this, &x, &y);
    SDL_PrivateMouseButton(is_pressed ? SDL_PRESSED : SDL_RELEASED, button, x, y);
}

static int xmousem_event_cb(void *cb_arg, int x, int y)
{
    SDL_VideoDevice *this = cb_arg;
    struct SDL_PrivateVideoData *pdata = this->hidden;

    translate_mouse(this, &x, &y);
    SDL_PrivateMouseMotion(0, 0, x, y);
}
I don't see any relative mode code, I was expecting something like in the vanilla x11 event pump, function X11_DispatchEvents (x11/x11_events.c)


        /* Mouse motion? */
        case MotionNotify: {
        if ( SDL_VideoSurface ) {
            if ( mouse_relative ) {
                if ( using_dga & DGA_MOUSE ) {
#ifdef DEBUG_MOTION
  printf("DGA motion: %d,%d\n", xevent.xmotion.x_root, xevent.xmotion.y_root);
#endif
                    posted = SDL_PrivateMouseMotion(0, 1,
                            xevent.xmotion.x_root,
                            xevent.xmotion.y_root);
                } else {
                    posted = X11_WarpedMotion(this,&xevent);
                }
            } else {
#ifdef DEBUG_MOTION
  printf("X11 motion: %d,%d\n", xevent.xmotion.x, xevent.xmotion.y);
#endif
                posted = SDL_PrivateMouseMotion(0, 0,
                        xevent.xmotion.x,
                        xevent.xmotion.y);
            }
        }
        }
        break;
Where there is some SDL_PrivateMouseMotion code with second argument to "1" for releative move.
 
Last edited by a moderator:
Hi Notaz,

Do you feel like adding this to your SDL version? Or is it something you're not really interested in? Among various things, it would allow playing DosBox games in fullscreen (like explained at the bottom of this page: http://boards.openpandora.org/topic/14409-dosbox-ex-ultimate/page-11/URL]), which would be just amazing! :)

Thank you for all you do for the community!
 
Last edited by a moderator:
Hi all, looking for some help getting this thing running. Let me first say that I'm very new with Gnu/Linux (Received my pandora last week is how new exactly).

I first downloaded this c/c++ dev tools package from the repo and learned some basics in C-language. My first experience with a command line compiler (I guess it's called?) but I got it working fine and managed to make a text adventure and some other very simple stuff.

So next I download the SDL package and unpack it with the "tar" command. "Configure.in" tells me to use autoconf to produce a configure file, that works fine as well. When I input "./configure" It starts out fine, however when it starts writing files ("configure: creating ./config.status") it gives me an error:


chmod: changing permissions of './config.status': Operation not permitted
configure: error: write failure creating ./config.status

No makefile is produced, Inputting the "make"-command just gives me "make: *** No targets specified and no makefile found. Stop." Might this have something to do with how my pandora sometimes doesn't let me rename files ('file exists'-message)? Am I just slightly off-ways or doing something completely wrong? And (just so I possibly don't have to make another post) after this whole installation hullabaloo is over, should I be able to use the SDL just by putting the "#include" and SDL commands in my code, and running it through the same compiler (gcc)? Sorry for the dumb questions but I'm taking in a lot of new info, so there's some overall confusion and Google fails me this time...

Thanks in advance for any help, hope I can join in on the pandora deving soon :)

Edit: Tried some other stuff, using chmod before configure gives me the same "operation not permitted" error message. Trying su gives authentication failure every time..
 
Last edited by a moderator:
And if you just want to write a game you don't need to compile this SDL, you just need proper libraries and headers. Those headers usually come with the toolchain, I'm quite sure most dev tools packages from the repo already have it.
 
This is the thing I'm using, and it does indeed say something about SDL being included. Writing #include <SDL.h> or any SDL commands in the code throws an error though, hence why I went on this whole installation adventure.

Allright... Found the folder where I think I should copy the libraries, but it's not letting me (Failed to open "x" for writing, operation not permitted). Apparently this has to do with the filesystem stuff, which I also failed to set up properly (couldn't get fdisk to do anything, making the Ext2 partition on my windows PC made it read only with me finding no way to change it).

Anyway, that is enough time and energy spent on this for today... Big thanks to both of you for the help, I'll be sure to bother you again tomorrow if I still can't figure it out :p
 
Last edited by a moderator:
This is the thing I'm using, and it does indeed say something about SDL being included. Writing #include <SDL.h> or any SDL commands in the code throws an error though, hence why I went on this whole installation adventure.

Allright... Found the folder where I think I should copy the libraries, but it's not letting me (Failed to open "x" for writing, operation not permitted). Apparently this has to do with the filesystem stuff, which I also failed to set up properly (couldn't get fdisk to do anything, making the Ext2 partition on my windows PC made it read only with me finding no way to change it).

Anyway, that is enough time and energy spent on this for today... Big thanks to both of you for the help, I'll be sure to bother you again tomorrow if I still can't figure it out :p
It's probably a good idea to install a GNU/Linux distro on your PC too (e.g. in a dual boot setup). GNU/Linux on the Pandora is like GNU/Linux on any other hardware, but it might be more easy to learn on your PC because full PC distros tend to include more documentation etc.
 
I have been surprised/impressed/please with how good Virtual Box is. Installed it a little while ago, had to do some weird 'fixes' to get it properly graphically accelerated (running Ubuntu as I wanted something very easy and well supported) but when everything is set up it feels quite similar to developing natively on the hardware (and is a lot more convenient in my opinion).
 
Hi Notaz,

Is there a way to scale a 320x240 screen to 640x480 with nearest neighbour interpolation? The hardware scaling performance is amazing (better fps than on my laptop!), but the image looks a little blurry.
 
Hi Notaz,

Is there a way to scale a 320x240 screen to 640x480 with nearest neighbour interpolation? The hardware scaling performance is amazing (better fps than on my laptop!), but the image looks a little blurry.
You can set the kind of scaling in the LCD settings menu.
 
Hi Notaz,

Is there a way to scale a 320x240 screen to 640x480 with nearest neighbour interpolation? The hardware scaling performance is amazing (better fps than on my laptop!), but the image looks a little blurry.
You can set the kind of scaling in the LCD settings menu.
Great, thanks!
 
Back
Top