Skip to content

Commit

Permalink
sdl-controls.xml generator script with variable direction button width
Browse files Browse the repository at this point in the history
  • Loading branch information
NichtJens committed Apr 18, 2012
1 parent 24f6439 commit ad761bc
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 69 deletions.
76 changes: 21 additions & 55 deletions sdl-controls.xml
@@ -1,55 +1,21 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<emulation version="1">



<!-- direction buttons -->

<!-- up -->
<key x="20" y="26" width="842" height="20" sym="273" scancode="273"/>

<!-- down -->
<key x="20" y="580" width="842" height="20" sym="274" scancode="274"/>

<!-- right -->
<key x="862" y="26" width="20" height="574" sym="275" scancode="275"/>

<!-- left -->
<key x="0" y="26" width="20" height="574" sym="276" scancode="276"/>





<!-- top bar -->
<!--<touchscreen x="0" y="0" width="1024" height="26"/>-->
<touchscreen x="0" y="0" width="882" height="26"/>

<!-- main window -->
<!--<touchscreen x="0" y="26" width="882" height="574"/>-->
<touchscreen x="20" y="46" width="842" height="534"/>

<!-- right boxes -->
<touchscreen x="882" y="26" width="142" height="574"/>





<!-- escape button -->
<key x="882" y="0" width="142" height="26" sym="27" scancode="27"/>





<!--<key x="550" y="550" width="48" height="48" sym="275" scancode="275">-->
<!--<label x="0" y="0" width="48" height="48" image="bbicon.png"/>-->
<!--</key>-->



</emulation>



<?xml version="1.0" encoding="ISO-8859-1"?>
<emulation version="1">
<!-- direction buttons -->
<!-- up -->
<key x="50" y="26" width="782" height="50" sym="273" scancode="273"/>
<!-- down -->
<key x="50" y="550" width="782" height="50" sym="274" scancode="274"/>
<!-- right -->
<key x="832" y="26" width="50" height="574" sym="275" scancode="275"/>
<!-- left -->
<key x="0" y="26" width="50" height="574" sym="276" scancode="276"/>
<!-- touchareas -->
<!-- top bar -->
<touchscreen x="0" y="0" width="882" height="26"/>
<!-- main window -->
<touchscreen x="50" y="76" width="782" height="474"/>
<!-- right boxes -->
<touchscreen x="882" y="26" width="142" height="574"/>
<!-- escape button -->
<key x="882" y="0" width="142" height="26" sym="27" scancode="27"/>
</emulation>
34 changes: 20 additions & 14 deletions sdlcontrolxml.sh
@@ -1,18 +1,24 @@
#!/bin/bash

output="sdl-controls.xml.test"
output="sdl-controls.xml"


dirbutton_width=50

screen_width=1024
screen_height=600
topbar_height=26
panel_width=142

main_width=$screen_width-$panel_width
main_height=$screen_height-$topbar_height

scancode_up=273
scancode_down=274
scancode_right=275
scancode_left=276
scancode_esc=27

screen_width=1024
screen_height=600
dirbutton_width=20
topbar_height=26



function tofile()
Expand Down Expand Up @@ -75,17 +81,17 @@ rm $output
addheader

addcomment direction buttons
addcomment up; addkey 20 26 842 20 $scancode_up
addcomment down; addkey 20 580 842 20 $scancode_down
addcomment right; addkey 862 26 20 574 $scancode_right
addcomment left; addkey 0 26 20 574 $scancode_left
addcomment up; addkey $dirbutton_width $topbar_height $main_width-$dirbutton_width-$dirbutton_width $dirbutton_width $scancode_up
addcomment down; addkey $dirbutton_width $screen_height-$dirbutton_width $main_width-$dirbutton_width-$dirbutton_width $dirbutton_width $scancode_down
addcomment right; addkey $main_width-$dirbutton_width $topbar_height $dirbutton_width $screen_height-$topbar_height $scancode_right
addcomment left; addkey 0 $topbar_height $dirbutton_width $screen_height-$topbar_height $scancode_left

addcomment touchareas
addcomment top bar; addtouch 0 0 882 26
addcomment main window; addtouch 20 46 842 534
addcomment right boxes; addtouch 882 26 142 574
addcomment top bar; addtouch 0 0 $main_width $topbar_height
addcomment main window; addtouch $dirbutton_width $topbar_height+$dirbutton_width $main_width-$dirbutton_width-$dirbutton_width $main_height-$dirbutton_width-$dirbutton_width
addcomment right boxes; addtouch $main_width $topbar_height $panel_width $main_height

addcomment escape button; addkey 882 0 142 26 $scancode_esc
addcomment escape button; addkey $main_width 0 $panel_width $topbar_height $scancode_esc

addfooter

Expand Down

0 comments on commit ad761bc

Please sign in to comment.