[win32, wip] Pong sample running on win32 (but debug overlay crashes the app).
This commit is contained in:
parent
0312c7c56a
commit
be84dbc6d1
2
milepost
2
milepost
|
@ -1 +1 @@
|
||||||
Subproject commit d2c4acf6e2e13d251c036ab8bd51e70d9c28505f
|
Subproject commit 2fe683b79d25a1b1ef7c3b1777f651358cce09ca
|
|
@ -0,0 +1,17 @@
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
:: compile wasm module
|
||||||
|
set wasmFlags=--target=wasm32^
|
||||||
|
--no-standard-libraries ^
|
||||||
|
-fno-builtin ^
|
||||||
|
-Wl,--no-entry ^
|
||||||
|
-Wl,--export-all ^
|
||||||
|
-Wl,--allow-undefined ^
|
||||||
|
-g ^
|
||||||
|
-D__ORCA__ ^
|
||||||
|
-I ..\.. -I ..\..\src -I ..\..\sdk -I..\..\milepost -I ..\..\milepost\src
|
||||||
|
|
||||||
|
clang %wasmFlags% -o .\module.wasm ..\..\sdk\orca.c src\main.c
|
||||||
|
|
||||||
|
|
||||||
|
python3 ..\..\scripts\mkapp.py --orca-dir ../.. --name Pong --icon icon.png --data-dir dir1 module.wasm
|
|
@ -78,7 +78,7 @@ void OnInit(void)
|
||||||
#endif // TEST_IMAGE
|
#endif // TEST_IMAGE
|
||||||
|
|
||||||
//NOTE: testing file io
|
//NOTE: testing file io
|
||||||
file_handle file = file_open(STR8("/test_write.txt"), FILE_OPEN_CREATE | FILE_OPEN_WRITE);
|
file_handle file = file_open(STR8("/test_write.txt"), FILE_ACCESS_WRITE, FILE_OPEN_CREATE);
|
||||||
if(file_last_error(file) == IO_OK)
|
if(file_last_error(file) == IO_OK)
|
||||||
{
|
{
|
||||||
str8 string = STR8("Hello, file!\n");
|
str8 string = STR8("Hello, file!\n");
|
||||||
|
@ -90,7 +90,7 @@ void OnInit(void)
|
||||||
log_error("Couldn't open file test_write.txt\n");
|
log_error("Couldn't open file test_write.txt\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
file = file_open(STR8("/dir1/test_read.txt"), FILE_OPEN_READ);
|
file = file_open(STR8("/dir1/test_read.txt"), FILE_ACCESS_READ, 0);
|
||||||
u64 size = file_size(file);
|
u64 size = file_size(file);
|
||||||
char* buffer = mem_arena_alloc(mem_scratch(), size);
|
char* buffer = mem_arena_alloc(mem_scratch(), size);
|
||||||
file_read(file, size, buffer);
|
file_read(file, size, buffer);
|
||||||
|
|
401
scripts/mkapp.py
401
scripts/mkapp.py
|
@ -1,162 +1,239 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import platform
|
||||||
import subprocess
|
import shutil
|
||||||
from argparse import ArgumentParser
|
import subprocess
|
||||||
|
from argparse import ArgumentParser
|
||||||
#---------------------------------------------------------------------------------------------
|
|
||||||
# NOTE: get args
|
def macos_make_app(args):
|
||||||
#
|
#-----------------------------------------------------------
|
||||||
# mkapp.py [options] module
|
#NOTE: make bundle directory structure
|
||||||
#
|
#-----------------------------------------------------------
|
||||||
# -n, --name the name of the app
|
app_name = args.name
|
||||||
# -r, --res-file copies a file to the app bundle's resource directory
|
bundle_name = app_name + '.app'
|
||||||
# -R, --res-dir copies the contents of a directory to the bundle's resource directory
|
bundle_path = args.out_dir + '/' + bundle_name
|
||||||
# -i, --icon icon file
|
contents_dir = bundle_path + '/Contents'
|
||||||
# -D, --out-dir output directory
|
exe_dir = contents_dir + '/MacOS'
|
||||||
#----------------------------------------------------------------------------------------------
|
res_dir = contents_dir + '/resources'
|
||||||
|
guest_dir = contents_dir + '/app'
|
||||||
parser = ArgumentParser(prog='mkapp')
|
wasm_dir = guest_dir + '/wasm'
|
||||||
parser.add_argument("-d", "--data-file", action='append', dest='data_files')
|
data_dir = guest_dir + '/data'
|
||||||
parser.add_argument("-D", "--data-dir", action='append', dest='data_dirs')
|
|
||||||
parser.add_argument("-i", "--icon")
|
if os.path.exists(bundle_path):
|
||||||
parser.add_argument("-C", "--out-dir", default=os.getcwd())
|
shutil.rmtree(bundle_path)
|
||||||
parser.add_argument("-n", "--name", default='out')
|
os.mkdir(bundle_path)
|
||||||
parser.add_argument("-O", "--orca-dir", default='.')
|
os.mkdir(contents_dir)
|
||||||
parser.add_argument("--version", default='0.0.0')
|
os.mkdir(exe_dir)
|
||||||
parser.add_argument("module")
|
os.mkdir(res_dir)
|
||||||
|
os.mkdir(guest_dir)
|
||||||
args = parser.parse_args()
|
os.mkdir(wasm_dir)
|
||||||
|
os.mkdir(data_dir)
|
||||||
#-----------------------------------------------------------
|
|
||||||
#NOTE: make bundle directory structure
|
#-----------------------------------------------------------
|
||||||
#-----------------------------------------------------------
|
#NOTE: copy orca runtime executable and libraries
|
||||||
app_name = args.name
|
#-----------------------------------------------------------
|
||||||
bundle_name = app_name + '.app'
|
orca_exe = args.orca_dir + '/bin/orca'
|
||||||
bundle_path = args.out_dir + '/' + bundle_name
|
milepost_lib = args.orca_dir + '/bin/libmilepost.dylib'
|
||||||
contents_dir = bundle_path + '/Contents'
|
gles_lib = args.orca_dir + '/bin/libGLESv2.dylib'
|
||||||
exe_dir = contents_dir + '/MacOS'
|
egl_lib = args.orca_dir + '/bin/libEGL.dylib'
|
||||||
res_dir = contents_dir + '/resources'
|
renderer_lib = args.orca_dir + '/bin/mtl_renderer.metallib'
|
||||||
guest_dir = contents_dir + '/app'
|
|
||||||
wasm_dir = guest_dir + '/wasm'
|
shutil.copy(orca_exe, exe_dir)
|
||||||
data_dir = guest_dir + '/data'
|
shutil.copy(milepost_lib, exe_dir)
|
||||||
|
shutil.copy(gles_lib, exe_dir)
|
||||||
if os.path.exists(bundle_path):
|
shutil.copy(egl_lib, exe_dir)
|
||||||
shutil.rmtree(bundle_path)
|
shutil.copy(renderer_lib, exe_dir)
|
||||||
os.mkdir(bundle_path)
|
|
||||||
os.mkdir(contents_dir)
|
#-----------------------------------------------------------
|
||||||
os.mkdir(exe_dir)
|
#NOTE: copy wasm module and data
|
||||||
os.mkdir(res_dir)
|
#-----------------------------------------------------------
|
||||||
os.mkdir(guest_dir)
|
shutil.copy(args.module, wasm_dir + '/module.wasm')
|
||||||
os.mkdir(wasm_dir)
|
|
||||||
os.mkdir(data_dir)
|
if args.data_files != None:
|
||||||
|
for data in args.data_files:
|
||||||
#-----------------------------------------------------------
|
shutil.copy(data, data_dir)
|
||||||
#NOTE: copy orca runtime executable and libraries
|
|
||||||
#-----------------------------------------------------------
|
if args.data_dirs != None:
|
||||||
orca_exe = args.orca_dir + '/bin/orca'
|
for data in args.data_dirs:
|
||||||
milepost_lib = args.orca_dir + '/bin/libmilepost.dylib'
|
shutil.copytree(data, data_dir + '/' + os.path.basename(data), dirs_exist_ok=True)
|
||||||
gles_lib = args.orca_dir + '/bin/libGLESv2.dylib'
|
|
||||||
egl_lib = args.orca_dir + '/bin/libEGL.dylib'
|
#-----------------------------------------------------------
|
||||||
renderer_lib = args.orca_dir + '/bin/mtl_renderer.metallib'
|
#NOTE: copy runtime resources
|
||||||
|
#-----------------------------------------------------------
|
||||||
shutil.copy(orca_exe, exe_dir)
|
# default fonts
|
||||||
shutil.copy(milepost_lib, exe_dir)
|
shutil.copy(args.orca_dir + '/resources/OpenSansLatinSubset.ttf', res_dir)
|
||||||
shutil.copy(gles_lib, exe_dir)
|
shutil.copy(args.orca_dir + '/resources/Menlo.ttf', res_dir)
|
||||||
shutil.copy(egl_lib, exe_dir)
|
shutil.copy(args.orca_dir + '/resources/Menlo Bold.ttf', res_dir)
|
||||||
shutil.copy(renderer_lib, exe_dir)
|
shutil.copy(args.orca_dir + '/resources/Menlo Italics.ttf', res_dir)
|
||||||
|
|
||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------
|
||||||
#NOTE: copy wasm module and data
|
#NOTE make icon
|
||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------
|
||||||
shutil.copy(args.module, wasm_dir + '/module.wasm')
|
src_image=args.icon
|
||||||
|
|
||||||
if args.data_files != None:
|
#if src_image == None:
|
||||||
for data in args.data_files:
|
# src_image = orca_dir + '/resources/default_app_icon.png'
|
||||||
shutil.copy(data, data_dir)
|
|
||||||
|
if src_image != None:
|
||||||
if args.data_dirs != None:
|
iconset = os.path.splitext(src_image)[0] + '.iconset'
|
||||||
for data in args.data_dirs:
|
|
||||||
shutil.copytree(data, data_dir + '/' + os.path.basename(data), dirs_exist_ok=True)
|
if os.path.exists(iconset):
|
||||||
|
shutil.rmtree(iconset)
|
||||||
#-----------------------------------------------------------
|
|
||||||
#NOTE: copy runtime resources
|
os.mkdir(iconset)
|
||||||
#-----------------------------------------------------------
|
|
||||||
# default fonts
|
size = 16
|
||||||
shutil.copy(args.orca_dir + '/resources/OpenSansLatinSubset.ttf', res_dir)
|
for i in range(0, 7):
|
||||||
shutil.copy(args.orca_dir + '/resources/Menlo.ttf', res_dir)
|
size_str = str(size)
|
||||||
shutil.copy(args.orca_dir + '/resources/Menlo Bold.ttf', res_dir)
|
icon = 'icon_' + size_str + 'x' + size_str + '.png'
|
||||||
shutil.copy(args.orca_dir + '/resources/Menlo Italics.ttf', res_dir)
|
subprocess.run(['sips', '-z', size_str, size_str, src_image, '--out', iconset + '/' + icon],
|
||||||
|
stdout = subprocess.DEVNULL,
|
||||||
#-----------------------------------------------------------
|
stderr = subprocess.DEVNULL)
|
||||||
#NOTE make icon
|
|
||||||
#-----------------------------------------------------------
|
size_str_retina = str(size*2)
|
||||||
src_image=args.icon
|
icon = 'icon_' + size_str + 'x' + size_str + '@2x.png'
|
||||||
|
subprocess.run(['sips', '-z', size_str_retina, size_str_retina, src_image, '--out', iconset + '/' + icon],
|
||||||
#if src_image == None:
|
stdout = subprocess.DEVNULL,
|
||||||
# src_image = orca_dir + '/resources/default_app_icon.png'
|
stderr = subprocess.DEVNULL)
|
||||||
|
|
||||||
if src_image != None:
|
size = size*2
|
||||||
iconset = os.path.splitext(src_image)[0] + '.iconset'
|
|
||||||
|
subprocess.run(['iconutil', '-c', 'icns', '-o', res_dir + '/icon.icns', iconset])
|
||||||
if os.path.exists(iconset):
|
shutil.rmtree(iconset)
|
||||||
shutil.rmtree(iconset)
|
|
||||||
|
#-----------------------------------------------------------
|
||||||
os.mkdir(iconset)
|
#NOTE: write plist file
|
||||||
|
#-----------------------------------------------------------
|
||||||
size = 16
|
version = args.version
|
||||||
for i in range(0, 7):
|
bundle_sig = "????"
|
||||||
size_str = str(size)
|
icon_file = ''
|
||||||
icon = 'icon_' + size_str + 'x' + size_str + '.png'
|
|
||||||
subprocess.run(['sips', '-z', size_str, size_str, src_image, '--out', iconset + '/' + icon],
|
plist_contents = """
|
||||||
stdout = subprocess.DEVNULL,
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
stderr = subprocess.DEVNULL)
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
size_str_retina = str(size*2)
|
<dict>
|
||||||
icon = 'icon_' + size_str + 'x' + size_str + '@2x.png'
|
<key>CFBundleName</key>
|
||||||
subprocess.run(['sips', '-z', size_str_retina, size_str_retina, src_image, '--out', iconset + '/' + icon],
|
<string>{app_name}</string>
|
||||||
stdout = subprocess.DEVNULL,
|
<key>CFBundleDisplayName</key>
|
||||||
stderr = subprocess.DEVNULL)
|
<string>{app_name}</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
size = size*2
|
<string>{app_name}</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
subprocess.run(['iconutil', '-c', 'icns', '-o', res_dir + '/icon.icns', iconset])
|
<string>{version}</string>
|
||||||
shutil.rmtree(iconset)
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
#-----------------------------------------------------------
|
<key>CFBundleSignature</key>
|
||||||
#NOTE: write plist file
|
<string>{bundle_sig}</string>
|
||||||
#-----------------------------------------------------------
|
<key>CFBundleExecutable</key>
|
||||||
version = args.version
|
<string>orca</string>
|
||||||
bundle_sig = "????"
|
<key>CFBundleIconFile</key>
|
||||||
icon_file = ''
|
<string>icon.icns</string>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
plist_contents = """
|
<string>True</string>
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
</dict>
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
</plist>
|
||||||
<plist version="1.0">
|
""".format(app_name=app_name, version=version, bundle_sig=bundle_sig, icon_file=icon_file)
|
||||||
<dict>
|
|
||||||
<key>CFBundleName</key>
|
plist_file = open(contents_dir + '/Info.plist', 'w')
|
||||||
<string>{app_name}</string>
|
print(plist_contents, file=plist_file)
|
||||||
<key>CFBundleDisplayName</key>
|
|
||||||
<string>{app_name}</string>
|
def windows_make_app(args):
|
||||||
<key>CFBundleIdentifier</key>
|
#-----------------------------------------------------------
|
||||||
<string>{app_name}</string>
|
#NOTE: make bundle directory structure
|
||||||
<key>CFBundleVersion</key>
|
#-----------------------------------------------------------
|
||||||
<string>{version}</string>
|
app_name = args.name
|
||||||
<key>CFBundlePackageType</key>
|
bundle_name = app_name
|
||||||
<string>APPL</string>
|
bundle_dir = args.out_dir + '/' + bundle_name
|
||||||
<key>CFBundleSignature</key>
|
exe_dir = bundle_dir + '/bin'
|
||||||
<string>{bundle_sig}</string>
|
res_dir = bundle_dir + '/resources'
|
||||||
<key>CFBundleExecutable</key>
|
guest_dir = bundle_dir + '/app'
|
||||||
<string>orca</string>
|
wasm_dir = guest_dir + '/wasm'
|
||||||
<key>CFBundleIconFile</key>
|
data_dir = guest_dir + '/data'
|
||||||
<string>icon.icns</string>
|
|
||||||
<key>NSHighResolutionCapable</key>
|
if os.path.exists(bundle_dir):
|
||||||
<string>True</string>
|
shutil.rmtree(bundle_dir)
|
||||||
</dict>
|
os.mkdir(bundle_dir)
|
||||||
</plist>
|
os.mkdir(exe_dir)
|
||||||
""".format(app_name=app_name, version=version, bundle_sig=bundle_sig, icon_file=icon_file)
|
os.mkdir(res_dir)
|
||||||
|
os.mkdir(guest_dir)
|
||||||
plist_file = open(contents_dir + '/Info.plist', 'w')
|
os.mkdir(wasm_dir)
|
||||||
print(plist_contents, file=plist_file)
|
os.mkdir(data_dir)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------
|
||||||
|
#NOTE: copy orca runtime executable and libraries
|
||||||
|
#-----------------------------------------------------------
|
||||||
|
orca_exe = args.orca_dir + '/bin/orca.exe'
|
||||||
|
milepost_lib = args.orca_dir + '/bin/milepost.dll'
|
||||||
|
gles_lib = args.orca_dir + '/milepost/bin/libGLESv2.dll'
|
||||||
|
egl_lib = args.orca_dir + '/milepost/bin/libEGL.dll'
|
||||||
|
pthread_lib = args.orca_dir + '/bin/pthreadVC3.dll'
|
||||||
|
|
||||||
|
shutil.copy(orca_exe, exe_dir)
|
||||||
|
shutil.copy(milepost_lib, exe_dir)
|
||||||
|
shutil.copy(gles_lib, exe_dir)
|
||||||
|
shutil.copy(egl_lib, exe_dir)
|
||||||
|
shutil.copy(pthread_lib, exe_dir)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------
|
||||||
|
#NOTE: copy wasm module and data
|
||||||
|
#-----------------------------------------------------------
|
||||||
|
shutil.copy(args.module, wasm_dir + '/module.wasm')
|
||||||
|
|
||||||
|
if args.data_files != None:
|
||||||
|
for data in args.data_files:
|
||||||
|
shutil.copy(data, data_dir)
|
||||||
|
|
||||||
|
if args.data_dirs != None:
|
||||||
|
for data in args.data_dirs:
|
||||||
|
shutil.copytree(data, data_dir + '/' + os.path.basename(data), dirs_exist_ok=True)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------
|
||||||
|
#NOTE: copy runtime resources
|
||||||
|
#-----------------------------------------------------------
|
||||||
|
# default fonts
|
||||||
|
shutil.copy(args.orca_dir + '/resources/OpenSansLatinSubset.ttf', res_dir)
|
||||||
|
shutil.copy(args.orca_dir + '/resources/Menlo.ttf', res_dir)
|
||||||
|
shutil.copy(args.orca_dir + '/resources/Menlo Bold.ttf', res_dir)
|
||||||
|
shutil.copy(args.orca_dir + '/resources/Menlo Italics.ttf', res_dir)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------
|
||||||
|
#NOTE make icon
|
||||||
|
#-----------------------------------------------------------
|
||||||
|
#TODO
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------------
|
||||||
|
# NOTE: get args
|
||||||
|
#
|
||||||
|
# mkapp.py [options] module
|
||||||
|
#
|
||||||
|
# -n, --name the name of the app
|
||||||
|
# -r, --res-file copies a file to the app bundle's resource directory
|
||||||
|
# -R, --res-dir copies the contents of a directory to the bundle's resource directory
|
||||||
|
# -i, --icon icon file
|
||||||
|
# -D, --out-dir output directory
|
||||||
|
#----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
parser = ArgumentParser(prog='mkapp')
|
||||||
|
parser.add_argument("-d", "--data-file", action='append', dest='data_files')
|
||||||
|
parser.add_argument("-D", "--data-dir", action='append', dest='data_dirs')
|
||||||
|
parser.add_argument("-i", "--icon")
|
||||||
|
parser.add_argument("-C", "--out-dir", default=os.getcwd())
|
||||||
|
parser.add_argument("-n", "--name", default='out')
|
||||||
|
parser.add_argument("-O", "--orca-dir", default='.')
|
||||||
|
parser.add_argument("--version", default='0.0.0')
|
||||||
|
parser.add_argument("module")
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------------------------
|
||||||
|
# Dispatch to platform-specific function
|
||||||
|
#----------------------------------------------------------------------------------------------
|
||||||
|
platformName = platform.system()
|
||||||
|
if platformName == 'Darwin':
|
||||||
|
macos_make_app(args)
|
||||||
|
elif platformName == 'Windows':
|
||||||
|
windows_make_app(args)
|
||||||
|
else:
|
||||||
|
print("Platform '" + platformName + "' is not supported for now...")
|
||||||
|
|
280
sdk/keys.h
280
sdk/keys.h
|
@ -1,140 +1,140 @@
|
||||||
/************************************************************//**
|
/************************************************************//**
|
||||||
*
|
*
|
||||||
* @file: keys.h
|
* @file: keys.h
|
||||||
* @author: Martin Fouilleul
|
* @author: Martin Fouilleul
|
||||||
* @date: 26/08/2022
|
* @date: 26/08/2022
|
||||||
* @revision:
|
* @revision:
|
||||||
*
|
*
|
||||||
*****************************************************************/
|
*****************************************************************/
|
||||||
#ifndef __KEYS_H_
|
#ifndef __KEYS_H_
|
||||||
#define __KEYS_H_
|
#define __KEYS_H_
|
||||||
|
|
||||||
#include"typedefs.h"
|
#include"util/typedefs.h"
|
||||||
|
|
||||||
typedef i32 key_code;
|
typedef i32 key_code;
|
||||||
static const key_code KEY_UNKNOWN = -1,
|
static const key_code KEY_UNKNOWN = -1,
|
||||||
KEY_SPACE = 32,
|
KEY_SPACE = 32,
|
||||||
KEY_APOSTROPHE = 39, // '
|
KEY_APOSTROPHE = 39, // '
|
||||||
KEY_COMMA = 44, // ,
|
KEY_COMMA = 44, // ,
|
||||||
KEY_MINUS = 45, // -
|
KEY_MINUS = 45, // -
|
||||||
KEY_PERIOD = 46, // .
|
KEY_PERIOD = 46, // .
|
||||||
KEY_SLASH = 47, // /
|
KEY_SLASH = 47, // /
|
||||||
KEY_0 = 48,
|
KEY_0 = 48,
|
||||||
KEY_1 = 49,
|
KEY_1 = 49,
|
||||||
KEY_2 = 50,
|
KEY_2 = 50,
|
||||||
KEY_3 = 51,
|
KEY_3 = 51,
|
||||||
KEY_4 = 52,
|
KEY_4 = 52,
|
||||||
KEY_5 = 53,
|
KEY_5 = 53,
|
||||||
KEY_6 = 54,
|
KEY_6 = 54,
|
||||||
KEY_7 = 55,
|
KEY_7 = 55,
|
||||||
KEY_8 = 56,
|
KEY_8 = 56,
|
||||||
KEY_9 = 57,
|
KEY_9 = 57,
|
||||||
KEY_SEMICOLON = 59, // ;
|
KEY_SEMICOLON = 59, // ;
|
||||||
KEY_EQUAL = 61, // =
|
KEY_EQUAL = 61, // =
|
||||||
KEY_A = 65,
|
KEY_A = 65,
|
||||||
KEY_B = 66,
|
KEY_B = 66,
|
||||||
KEY_C = 67,
|
KEY_C = 67,
|
||||||
KEY_D = 68,
|
KEY_D = 68,
|
||||||
KEY_E = 69,
|
KEY_E = 69,
|
||||||
KEY_F = 70,
|
KEY_F = 70,
|
||||||
KEY_G = 71,
|
KEY_G = 71,
|
||||||
KEY_H = 72,
|
KEY_H = 72,
|
||||||
KEY_I = 73,
|
KEY_I = 73,
|
||||||
KEY_J = 74,
|
KEY_J = 74,
|
||||||
KEY_K = 75,
|
KEY_K = 75,
|
||||||
KEY_L = 76,
|
KEY_L = 76,
|
||||||
KEY_M = 77,
|
KEY_M = 77,
|
||||||
KEY_N = 78,
|
KEY_N = 78,
|
||||||
KEY_O = 79,
|
KEY_O = 79,
|
||||||
KEY_P = 80,
|
KEY_P = 80,
|
||||||
KEY_Q = 81,
|
KEY_Q = 81,
|
||||||
KEY_R = 82,
|
KEY_R = 82,
|
||||||
KEY_S = 83,
|
KEY_S = 83,
|
||||||
KEY_T = 84,
|
KEY_T = 84,
|
||||||
KEY_U = 85,
|
KEY_U = 85,
|
||||||
KEY_V = 86,
|
KEY_V = 86,
|
||||||
KEY_W = 87,
|
KEY_W = 87,
|
||||||
KEY_X = 88,
|
KEY_X = 88,
|
||||||
KEY_Y = 89,
|
KEY_Y = 89,
|
||||||
KEY_Z = 90,
|
KEY_Z = 90,
|
||||||
KEY_LEFT_BRACKET = 91, // [
|
KEY_LEFT_BRACKET = 91, // [
|
||||||
KEY_BACKSLASH = 92, // \ */
|
KEY_BACKSLASH = 92, // \ */
|
||||||
KEY_RIGHT_BRACKET = 93, // ]
|
KEY_RIGHT_BRACKET = 93, // ]
|
||||||
KEY_GRAVE_ACCENT = 96, // `
|
KEY_GRAVE_ACCENT = 96, // `
|
||||||
KEY_WORLD_1 = 161, // non-US #1
|
KEY_WORLD_1 = 161, // non-US #1
|
||||||
KEY_WORLD_2 = 162, // non-US #2
|
KEY_WORLD_2 = 162, // non-US #2
|
||||||
KEY_ESCAPE = 256,
|
KEY_ESCAPE = 256,
|
||||||
KEY_ENTER = 257,
|
KEY_ENTER = 257,
|
||||||
KEY_TAB = 258,
|
KEY_TAB = 258,
|
||||||
KEY_BACKSPACE = 259,
|
KEY_BACKSPACE = 259,
|
||||||
KEY_INSERT = 260,
|
KEY_INSERT = 260,
|
||||||
KEY_DELETE = 261,
|
KEY_DELETE = 261,
|
||||||
KEY_RIGHT = 262,
|
KEY_RIGHT = 262,
|
||||||
KEY_LEFT = 263,
|
KEY_LEFT = 263,
|
||||||
KEY_DOWN = 264,
|
KEY_DOWN = 264,
|
||||||
KEY_UP = 265,
|
KEY_UP = 265,
|
||||||
KEY_PAGE_UP = 266,
|
KEY_PAGE_UP = 266,
|
||||||
KEY_PAGE_DOWN = 267,
|
KEY_PAGE_DOWN = 267,
|
||||||
KEY_HOME = 268,
|
KEY_HOME = 268,
|
||||||
KEY_END = 269,
|
KEY_END = 269,
|
||||||
KEY_CAPS_LOCK = 280,
|
KEY_CAPS_LOCK = 280,
|
||||||
KEY_SCROLL_LOCK = 281,
|
KEY_SCROLL_LOCK = 281,
|
||||||
KEY_NUM_LOCK = 282,
|
KEY_NUM_LOCK = 282,
|
||||||
KEY_PRINT_SCREEN = 283,
|
KEY_PRINT_SCREEN = 283,
|
||||||
KEY_PAUSE = 284,
|
KEY_PAUSE = 284,
|
||||||
KEY_F1 = 290,
|
KEY_F1 = 290,
|
||||||
KEY_F2 = 291,
|
KEY_F2 = 291,
|
||||||
KEY_F3 = 292,
|
KEY_F3 = 292,
|
||||||
KEY_F4 = 293,
|
KEY_F4 = 293,
|
||||||
KEY_F5 = 294,
|
KEY_F5 = 294,
|
||||||
KEY_F6 = 295,
|
KEY_F6 = 295,
|
||||||
KEY_F7 = 296,
|
KEY_F7 = 296,
|
||||||
KEY_F8 = 297,
|
KEY_F8 = 297,
|
||||||
KEY_F9 = 298,
|
KEY_F9 = 298,
|
||||||
KEY_F10 = 299,
|
KEY_F10 = 299,
|
||||||
KEY_F11 = 300,
|
KEY_F11 = 300,
|
||||||
KEY_F12 = 301,
|
KEY_F12 = 301,
|
||||||
KEY_F13 = 302,
|
KEY_F13 = 302,
|
||||||
KEY_F14 = 303,
|
KEY_F14 = 303,
|
||||||
KEY_F15 = 304,
|
KEY_F15 = 304,
|
||||||
KEY_F16 = 305,
|
KEY_F16 = 305,
|
||||||
KEY_F17 = 306,
|
KEY_F17 = 306,
|
||||||
KEY_F18 = 307,
|
KEY_F18 = 307,
|
||||||
KEY_F19 = 308,
|
KEY_F19 = 308,
|
||||||
KEY_F20 = 309,
|
KEY_F20 = 309,
|
||||||
KEY_F21 = 310,
|
KEY_F21 = 310,
|
||||||
KEY_F22 = 311,
|
KEY_F22 = 311,
|
||||||
KEY_F23 = 312,
|
KEY_F23 = 312,
|
||||||
KEY_F24 = 313,
|
KEY_F24 = 313,
|
||||||
KEY_F25 = 314,
|
KEY_F25 = 314,
|
||||||
KEY_KP_0 = 320,
|
KEY_KP_0 = 320,
|
||||||
KEY_KP_1 = 321,
|
KEY_KP_1 = 321,
|
||||||
KEY_KP_2 = 322,
|
KEY_KP_2 = 322,
|
||||||
KEY_KP_3 = 323,
|
KEY_KP_3 = 323,
|
||||||
KEY_KP_4 = 324,
|
KEY_KP_4 = 324,
|
||||||
KEY_KP_5 = 325,
|
KEY_KP_5 = 325,
|
||||||
KEY_KP_6 = 326,
|
KEY_KP_6 = 326,
|
||||||
KEY_KP_7 = 327,
|
KEY_KP_7 = 327,
|
||||||
KEY_KP_8 = 328,
|
KEY_KP_8 = 328,
|
||||||
KEY_KP_9 = 329,
|
KEY_KP_9 = 329,
|
||||||
KEY_KP_DECIMAL = 330,
|
KEY_KP_DECIMAL = 330,
|
||||||
KEY_KP_DIVIDE = 331,
|
KEY_KP_DIVIDE = 331,
|
||||||
KEY_KP_MULTIPLY = 332,
|
KEY_KP_MULTIPLY = 332,
|
||||||
KEY_KP_SUBTRACT = 333,
|
KEY_KP_SUBTRACT = 333,
|
||||||
KEY_KP_ADD = 334,
|
KEY_KP_ADD = 334,
|
||||||
KEY_KP_ENTER = 335,
|
KEY_KP_ENTER = 335,
|
||||||
KEY_KP_EQUAL = 336,
|
KEY_KP_EQUAL = 336,
|
||||||
KEY_LEFT_SHIFT = 340,
|
KEY_LEFT_SHIFT = 340,
|
||||||
KEY_LEFT_CONTROL = 341,
|
KEY_LEFT_CONTROL = 341,
|
||||||
KEY_LEFT_ALT = 342,
|
KEY_LEFT_ALT = 342,
|
||||||
KEY_LEFT_SUPER = 343,
|
KEY_LEFT_SUPER = 343,
|
||||||
KEY_RIGHT_SHIFT = 344,
|
KEY_RIGHT_SHIFT = 344,
|
||||||
KEY_RIGHT_CONTROL = 345,
|
KEY_RIGHT_CONTROL = 345,
|
||||||
KEY_RIGHT_ALT = 346,
|
KEY_RIGHT_ALT = 346,
|
||||||
KEY_RIGHT_SUPER = 347,
|
KEY_RIGHT_SUPER = 347,
|
||||||
KEY_MENU = 348;
|
KEY_MENU = 348;
|
||||||
|
|
||||||
static const key_code KEY_MAX = KEY_MENU;
|
static const key_code KEY_MAX = KEY_MENU;
|
||||||
|
|
||||||
|
|
||||||
#endif //__KEYS_H_
|
#endif //__KEYS_H_
|
||||||
|
|
|
@ -42,7 +42,7 @@ typedef struct g_event_handler_desc
|
||||||
} g_event_handler_desc;
|
} g_event_handler_desc;
|
||||||
|
|
||||||
const g_event_handler_desc G_EVENT_HANDLER_DESC[] = {
|
const g_event_handler_desc G_EVENT_HANDLER_DESC[] = {
|
||||||
#define STR8LIT(s) {sizeof(s), s} //NOTE: msvc doesn't accept STR8(s) as compile-time constant...
|
#define STR8LIT(s) {sizeof(s)-1, s} //NOTE: msvc doesn't accept STR8(s) as compile-time constant...
|
||||||
#define G_EVENT_HANDLER_DESC_ENTRY(kind, name, rets, args) {STR8LIT(name), STR8LIT(rets), STR8LIT(args)},
|
#define G_EVENT_HANDLER_DESC_ENTRY(kind, name, rets, args) {STR8LIT(name), STR8LIT(rets), STR8LIT(args)},
|
||||||
|
|
||||||
G_EVENTS(G_EVENT_HANDLER_DESC_ENTRY)
|
G_EVENTS(G_EVENT_HANDLER_DESC_ENTRY)
|
||||||
|
|
Loading…
Reference in New Issue