Pandora improved SDL for pandora

Discussion in 'General Discussions' started by notaz, Nov 24, 2011.

  1. ekianjo

    ekianjo Hardcore Member

    Joined:
    May 7, 2012
    Messages:
    8,261
    Location:
    神戸市、日本 (Japan)
    I solved the problem - i realized that I compiled dgen with the optimized sdl already so maybe it caused a conflict to call it twice.
     
  2. ptitSeb

    ptitSeb Serial Porter

    Joined:
    Aug 15, 2012
    Messages:
    8,179
    Location:
    France, near Lyon
    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: Nov 25, 2013
  3. notaz

    notaz Certified Guru

    Joined:
    Aug 23, 2005
    Messages:
    4,910
    Location:
    Lithuania
    It's missing then, yes.
     
  4. Michoko

    Michoko Member

    Joined:
    May 13, 2008
    Messages:
    456
    Location:
    France
    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: Feb 6, 2016
  5. notaz

    notaz Certified Guru

    Joined:
    Aug 23, 2005
    Messages:
    4,910
    Location:
    Lithuania
    Probably, I'm pressed with work lately so I don't know when I can do it.
     
  6. Michoko

    Michoko Member

    Joined:
    May 13, 2008
    Messages:
    456
    Location:
    France
    That's great! Thank you for your time, it's much appreciated.
     
  7. -Z-

    -Z- Still Fresh

    Joined:
    Sep 11, 2008
    Messages:
    26
    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: Dec 8, 2013
  8. ptitSeb

    ptitSeb Serial Porter

    Joined:
    Aug 15, 2012
    Messages:
    8,179
    Location:
    France, near Lyon
    Are you developping from a FAT32 Formated SDCard? If yes, try creating an Ext2 partition and try again.
     
  9. notaz

    notaz Certified Guru

    Joined:
    Aug 23, 2005
    Messages:
    4,910
    Location:
    Lithuania
    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.
     
  10. -Z-

    -Z- Still Fresh

    Joined:
    Sep 11, 2008
    Messages:
    26
    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: Dec 8, 2013
  11. WizardStan

    WizardStan Mega GP Mania

    Joined:
    May 24, 2008
    Messages:
    16,589
    It's probably looking for "#include <SDL/SDL.h>"
     
    Last edited by a moderator: Dec 8, 2013
  12. _wb_

    _wb_ Microbe Staff Member

    Joined:
    Apr 5, 2012
    Messages:
    5,387
    Location:
    Brussels, Belgium
    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.
     
  13. Ziz

    Ziz Advanced Member

    Joined:
    Sep 10, 2006
    Messages:
    1,584
    Or in a virtual machine like Virtual Box.
     
    Rockthesmurf likes this.
  14. Rockthesmurf

    Rockthesmurf Advanced Member

    Joined:
    Jul 18, 2003
    Messages:
    1,093
    Location:
    Manchester, UK
    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).
     
  15. _wb_

    _wb_ Microbe Staff Member

    Joined:
    Apr 5, 2012
    Messages:
    5,387
    Location:
    Brussels, Belgium
    Last edited by a moderator: Feb 6, 2016
  16. KillRoXx

    KillRoXx Member

    Joined:
    Aug 10, 2013
    Messages:
    223
    Location:
    Somewhere on Earth
    Finally...

    also 100TH POST WOOOOOOOO
     
  17. alxm

    alxm Still making GP2X and Pandora games, stay tuned!

    Joined:
    Jul 11, 2013
    Messages:
    163
    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.
     
  18. _wb_

    _wb_ Microbe Staff Member

    Joined:
    Apr 5, 2012
    Messages:
    5,387
    Location:
    Brussels, Belgium
    You can set the kind of scaling in the LCD settings menu.
     
  19. alxm

    alxm Still making GP2X and Pandora games, stay tuned!

    Joined:
    Jul 11, 2013
    Messages:
    163
    Great, thanks!
     
  20. notaz

    notaz Certified Guru

    Joined:
    Aug 23, 2005
    Messages:
    4,910
    Location:
    Lithuania
    You can also set it up from your launch script, if you feel your game should be played like that by others, or you can add ingame option that later runs system("sudo -n ..").

    http://pandorawiki.org/Kernel_interface#using_predefined_filters

    Oh and welcome back to the dev scene, looking forward for your new releases.
     
    sebt3 likes this.

Share This Page

Loading...