Difference between revisions of "SDL Development"

From ArmadeusWiki
Jump to: navigation, search
m (Tested SDL applications)
m
 
(12 intermediate revisions by 2 users not shown)
Line 7: Line 7:
  
 
* Launch Buildroot configuration
 
* Launch Buildroot configuration
  # make menuconfig
+
<pre class="host">
 +
  $ make menuconfig
 +
</pre>
 
and choose SDL package in:<br>
 
and choose SDL package in:<br>
[[Image:menuconfig_package.png]]<br>
+
<pre class="config">
 
+
Package Selection for the target  --->
[[Image:menuconfig_package_graphics.png]]<br>
+
    Graphic libraries and applications (graphic/text)  --->
 
+
        ...
you can choose packages like SDL_Image too; then save your configuration
+
        [*] SDL
 +
        [*]   SDL framebuffer console video driver
 +
        ...
 +
</pre>
 +
You can also choose SDL extension packages like SDL_Image; then save your configuration
  
 
* Regenerate your rootfs
 
* Regenerate your rootfs
  # make
+
<pre class="host">
 +
  $ make
 +
</pre>
 
and reflash it on your board
 
and reflash it on your board
  
 
==Configuration==
 
==Configuration==
Our SDL version is using the [[FrameBuffer]] interface and so '''it's very important to have a ''/etc/fb.modes'' file up to date with the framebuffer parameters supported by your configuration''' (otherwise SDL try to use the VESA parameters which may misprogram the i.MXL LCD controller).
+
Our SDL version is using the [[FrameBuffer]] interface and so '''it's very important to have a ''/etc/fb.modes'' file up to date with the framebuffer parameters supported by your configuration''' (otherwise SDL try to use the VESA parameters which may misprogram the i.MX LCD controller).
  
For example for the Sharp LQ057, put in ''/etc/fb.modes'':
+
For example for the Sharp LQ057, ''/etc/fb.modes'' should contain:
 
  mode "320x240-176"
 
  mode "320x240-176"
 
     # D: 16.000 MHz, H: 43.836 kHz, V: 176.047 Hz
 
     # D: 16.000 MHz, H: 43.836 kHz, V: 176.047 Hz
Line 29: Line 37:
 
     rgba 5/11,6/5,5/0,0/0
 
     rgba 5/11,6/5,5/0,0/0
 
  endmode
 
  endmode
By default the ([[MTF-T035|Microtips]]) LCD parameters are used in ''/etc/fb.modes''. '''<-- TO BE REPLACED WITH LQ043 SOON !!'''
+
{{Note| ''/etc/fb.modes'' is now automatically generated at first boot of your rootfs by ''/etc/init.d/S01fb'' script.}}
  
* If you want to get the parameters for your currently running LCD, then you can do:
+
* If you want to update your ''fb.modes'' for your currently running LCD, then do:
 +
<pre class="apf">
 
  # fbset > /etc/fb.modes
 
  # fbset > /etc/fb.modes
 +
</pre>
  
 
==Adding Tslib (Touchscreen library) support to SDL==
 
==Adding Tslib (Touchscreen library) support to SDL==
 
SDL is by default compiled with Tslib support in current Buildroot distribution. You just have to make SDL knows the presence of Tslib when launching your  application (assuming you have correct [[Tslib | Tslib envt variables]] set):
 
SDL is by default compiled with Tslib support in current Buildroot distribution. You just have to make SDL knows the presence of Tslib when launching your  application (assuming you have correct [[Tslib | Tslib envt variables]] set):
 +
<pre class="apf">
 
  export SDL_MOUSEDRV=TSLIB
 
  export SDL_MOUSEDRV=TSLIB
 
  export SDL_MOUSEDEV=$TSLIB_TSDEVICE
 
  export SDL_MOUSEDEV=$TSLIB_TSDEVICE
export SDL_NOMOUSE=1
+
</pre>
  
 
==Usage==
 
==Usage==
  
* Take a look at ''armadeus/target/demos/armanoid/'' and ''armadeus/target/demos/backlight_control/'' sources in your SVN view.
+
* Take a look at ''armadeus/target/demos/armanoid/'', ''armadeus/target/demos/backlight_control/'' or ''armadeus/target/demos/input_control/'' sources in your Armadeus view.
 
* If SDL is complaining because it can't find any mouse (''Unable to init SDL: Unable to open mouse'') then, before launching the program, do:
 
* If SDL is complaining because it can't find any mouse (''Unable to init SDL: Unable to open mouse'') then, before launching the program, do:
 +
<pre class="apf">
 
  # export SDL_NOMOUSE=1
 
  # export SDL_NOMOUSE=1
 +
</pre>
  
 
==Tested SDL applications==
 
==Tested SDL applications==
Line 51: Line 64:
 
* Armanoid :-)
 
* Armanoid :-)
 
* [[SDL Water|Water]]
 
* [[SDL Water|Water]]
 +
* [[Exemple_d'application_SDL:_un_lecteur_audio_(Fr)]] [[Image:FrenchFlag.png]]
  
 
==Troubleshots==
 
==Troubleshots==
Line 56: Line 70:
 
==Links==
 
==Links==
 
* [http://www.opentom.org/LibSDL SDL & Tslib page of the OpenTomTom project]
 
* [http://www.opentom.org/LibSDL SDL & Tslib page of the OpenTomTom project]
 +
* [http://www.gnurou.org/writing/linuxmag/sdl Tutoriel paru dans Linux Magazine France, entre les numéros 65 et 73.] [[Image:FrenchFlag.png]]
  
{{LanguageBar|SDL|Développement SDL|SDL Entwicklung}}
 
 
<br>
 
<br>
  
 
[[Category: Software]]
 
[[Category: Software]]
[[Category:Graphical User Interface|SDL]]
+
[[Category:Graphical User Interface]]
 +
[[Category: SDL]]

Latest revision as of 19:35, 14 February 2012

On this page, you will find usefull informations to setup and develop SDL based applications for your Armadeus board.

Introduction

Simple DirectMedia Layer (SDL) is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. For more informations -> http://www.libsdl.org/

Installation

  • Launch Buildroot configuration
 $ make menuconfig

and choose SDL package in:

Package Selection for the target  --->
    Graphic libraries and applications (graphic/text)  --->
        ...
        [*] SDL
        [*]   SDL framebuffer console video driver
        ...

You can also choose SDL extension packages like SDL_Image; then save your configuration

  • Regenerate your rootfs
 $ make

and reflash it on your board

Configuration

Our SDL version is using the FrameBuffer interface and so it's very important to have a /etc/fb.modes file up to date with the framebuffer parameters supported by your configuration (otherwise SDL try to use the VESA parameters which may misprogram the i.MX LCD controller).

For example for the Sharp LQ057, /etc/fb.modes should contain:

mode "320x240-176"
   # D: 16.000 MHz, H: 43.836 kHz, V: 176.047 Hz
   geometry 320 240 320 240 16
   timings 62500 9 27 0 7 9 2
   rgba 5/11,6/5,5/0,0/0
endmode
Note Note: /etc/fb.modes is now automatically generated at first boot of your rootfs by /etc/init.d/S01fb script.


  • If you want to update your fb.modes for your currently running LCD, then do:
 # fbset > /etc/fb.modes

Adding Tslib (Touchscreen library) support to SDL

SDL is by default compiled with Tslib support in current Buildroot distribution. You just have to make SDL knows the presence of Tslib when launching your application (assuming you have correct Tslib envt variables set):

 export SDL_MOUSEDRV=TSLIB
 export SDL_MOUSEDEV=$TSLIB_TSDEVICE

Usage

  • Take a look at armadeus/target/demos/armanoid/, armadeus/target/demos/backlight_control/ or armadeus/target/demos/input_control/ sources in your Armadeus view.
  • If SDL is complaining because it can't find any mouse (Unable to init SDL: Unable to open mouse) then, before launching the program, do:
 # export SDL_NOMOUSE=1

Tested SDL applications

Troubleshots

Links