mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-10-06 21:58:04 +03:00
Rename sdl_input.c to sdl_keytable.h
And move xsyskey.pl to tools/.
This commit is contained in:
+2
-2
@@ -137,7 +137,7 @@ endif()
|
||||
|
||||
# FIXME: set up dependency for xsystem35 on this
|
||||
if (ENABLE_SDL AND NOT EMSCRIPTEN AND NOT ANDROID)
|
||||
add_custom_target(sdl_input.c
|
||||
COMMAND perl xsyskey.pl ${SDL2_INCLUDE_DIRS} > sdl_input.c
|
||||
add_custom_target(sdl_keytable.h
|
||||
COMMAND perl ../tools/xsyskey.pl ${SDL2_INCLUDE_DIRS} > sdl_keytable.h
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@
|
||||
#include "menu.h"
|
||||
#include "input.h"
|
||||
#include "joystick.h"
|
||||
#include "sdl_input.c"
|
||||
#include "sdl_keytable.h"
|
||||
#include "texthook.h"
|
||||
|
||||
static void sdl_getEvent(void);
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
#! /usr/bin/perl
|
||||
|
||||
@key_list=();
|
||||
%keyh_list=();
|
||||
open(FX,"<key.h") || exit;
|
||||
while(<FX>) {
|
||||
if( /^#define KEY_([^\s]*)\s+[(]([^)]*)[)]/ ) {
|
||||
$key_list[eval($2)]="$1";
|
||||
$keyh_list{$1}=eval($2);
|
||||
}
|
||||
}
|
||||
close(fp);
|
||||
|
||||
@sdlk_list=();
|
||||
open(FS,"<$ARGV[0]/SDL_scancode.h") || exit;
|
||||
while(<FS>) {
|
||||
if( /SDL_SCANCODE_([^\s]+)\s+=\s*([^,]*),/ ) {
|
||||
$sdlk_list[eval($2)]="$1";
|
||||
}
|
||||
}
|
||||
close(FS);
|
||||
|
||||
|
||||
print "static int sdl_keytable[SDL_NUM_SCANCODES] = {\n\t";
|
||||
for( $i = 0 ; $i < scalar(@sdlk_list) ; $i ++ ) {
|
||||
#print "$i @sdlk_list[$i] $keyh_list{@sdlk_list[$i]}\n";
|
||||
$x = @sdlk_list[$i];
|
||||
if( length($x) == 0 ) {
|
||||
print "KEY_UNDEFINED, ";
|
||||
} elsif ( $keyh_list{$x} ) {
|
||||
print "KEY_@key_list[$keyh_list{$x}], ";
|
||||
} elsif ( $x =~ /[a-z]/ ) {
|
||||
print "KEY_".uc($x).", ";
|
||||
} elsif ( $x =~ /KP_/ ) {
|
||||
$x =~ s/^KP_/PAD_/;
|
||||
if ( $keyh_list{$x} ) {
|
||||
print "KEY_$x, ";
|
||||
} else {
|
||||
print "0 /* SDL_$x */, ";
|
||||
}
|
||||
} elsif ( $i < 0x61) {
|
||||
print "$i, ";
|
||||
} else {
|
||||
print "0 /* SDL_$x */, ";
|
||||
}
|
||||
if(($i % 4) == 3 ) {
|
||||
print "\n\t";
|
||||
}
|
||||
}
|
||||
print "};\n";
|
||||
Reference in New Issue
Block a user