LinkIt Smart MT7688 >> C/C++

移植SDL 1.2.15


步驟如下:

$ git clone https://github.com/steward-fu/gh_mt7688_toolchain.git
$ sudo cp -ap gh_mt7688_toiolchain/x64_mipsel-openwrt-linux /opt/mt7688
$ export PATH=$PATH:/opt/mt7688
$ cd
$ wget https://www.libsdl.org/release/SDL-1.2.15.tar.gz
$ tar xvf SDL-1.2.15.tar.gz
$ cd SDL-1.2.15
$ export TARGETMACH=mipsel-openwrt-linux
$ export BUILDMACH=i686-pc-linux-gnu
$ export CROSS=mipsel-openwrt-linux
$ export CC=${CROSS}-gcc
$ export LD=${CROSS}-ld
$ export AS=${CROSS}-as
$ export CXX=${CROSS}-g++
$ ./configure --host=$TARGETMACH --disable-static --disable-pulseaudio
$ vim Makefile
  EXTRA_LDFLAGS =  -lm -ldl -lpthread -lrt

$ make

src/video/fbcon/SDL_fbvideo.c

static SDL_Surface *FB_SetVideoMode(_THIS, SDL_Surface *current,
        int width, int height, int bpp, Uint32 flags)
{
  ...
  /* Set the terminal into graphics mode */
  // comment by Steward
  /*
  if ( FB_EnterGraphicsMode(this) < 0 ) {
    return(NULL);
  }
  */
  ...
}

static int FB_VideoInit(_THIS, SDL_PixelFormat *vformat)
{
  ...
  /* Enable mouse and keyboard support */
  // comment by Steward
  /*
  if ( FB_OpenKeyboard(this) < 0 ) {
    FB_VideoQuit(this);
    return(-1);
  }
  if ( FB_OpenMouse(this) < 0 ) {
    const char *sdl_nomouse;

    sdl_nomouse = SDL_getenv("SDL_NOMOUSE");
    if ( ! sdl_nomouse ) {
      SDL_SetError("Unable to open mouse");
      FB_VideoQuit(this);
      return(-1);
    }
  }
  */
  /* We're done! */
  return(0);
}

完成



假如不想要把Keyboard和Mouse註解掉的話,只要打開如下兩個選項即可。



或者使用如下指令即可:

$ export SDL_NOMOUSE=1


返回上一頁