コード例 #1
0
ファイル: event.c プロジェクト: h4xxel/birdie26
void ui_events(struct UI_PANE_LIST *panes, int render) {
	//override for dialogues such as message boxes.
	if(ui_panelist_dialogue.pane) {
		ui_panelist_render(panes);
		panes = &ui_panelist_dialogue;
	}

	UI_EVENT e;
	UI_EVENT_MOUSE e_m;
	UI_EVENT_BUTTONS e_b;
	UI_EVENT_UI e_u;
	static UI_EVENT_KEYBOARD e_k = {0, 0, 0}, e_k_repeat = {0, 0, 0};
	static int repeat = 0;

	DARNIT_KEYS buttons;
	buttons = d_keys_get();
	memcpy(&e_b, &buttons, sizeof(UI_EVENT_BUTTONS));

	DARNIT_MOUSE mouse;
	mouse = d_mouse_get();

	e_m.x = mouse.x;
	e_m.y = mouse.y;
	e_m.buttons = (mouse.lmb) | (mouse.rmb << 2);
	e_m.wheel = mouse.wheel;

	int key_action = 0;
	DARNIT_KEY_RAW rawkey = d_key_raw_pop();
	key_action = rawkey.action;
	e_k.keysym = rawkey.keysym;

	switch(e_k.keysym) {
		case KEY(LCTRL):
			SETMOD(LCTRL);
			break;
		case KEY(RCTRL):
			SETMOD(RCTRL);
			break;
		case KEY(LSHIFT):
			SETMOD(LSHIFT);
			break;
		case KEY(RSHIFT):
			SETMOD(RSHIFT);
			break;
		case KEY(LALT):
			SETMOD(LALT);
			break;
		case KEY(RALT):
			SETMOD(RALT);
			break;
		case KEY(LSUPER):
			SETMOD(LSUPER);
			break;
		case KEY(RSUPER):
			SETMOD(RSUPER);
			break;
	}

	e_k.character = rawkey.unicode;


	e.keyboard = &e_k;
	if(ui_selected_widget) {
		//Keyboard events for selected widget
		if(e_k_repeat.character || e_k_repeat.keysym == 8) {
			if(repeat > KEYBOARD_REPEAT_DELAY && !((repeat - KEYBOARD_REPEAT_DELAY) % KEYBOARD_REPEAT_SPEED)) {
				UI_EVENT e_repeat = {.keyboard = &e_k_repeat};
				ui_selected_widget->event_handler->send(ui_selected_widget, UI_EVENT_TYPE_KEYBOARD_PRESS, &e_repeat);
			}
			repeat++;
		}
		if(key_action == DARNIT_KEYACTION_PRESS) {
			if(e_k.character || e_k.keysym == 8) {
				e_k_repeat = e_k;
				repeat = 0;
			}
			ui_selected_widget->event_handler->send(ui_selected_widget, UI_EVENT_TYPE_KEYBOARD_PRESS, &e);
		} else if(key_action == DARNIT_KEYACTION_RELEASE) {
			if(e_k.keysym == e_k_repeat.keysym) {
				e_k_repeat.character = 0;
				e_k_repeat.keysym = 0;
				e_k_repeat.modifiers = 0;
				repeat = 0;
			}
			ui_selected_widget->event_handler->send(ui_selected_widget, UI_EVENT_TYPE_KEYBOARD_RELEASE, &e);
		}
	} else {
コード例 #2
0
/* PWM2 and TOGGLE3 register offsets */
#define LED_PWM2ON		0x03
#define LED_PWM2OFF		0x04
#define TWL6030_TOGGLE3		0x92

#define TPS62361_GPIO   7

#define PHYS_ADDR_SMC_SIZE	(SZ_1M * 3)
#define PHYS_ADDR_SMC_MEM	(0x80000000 + SZ_1G - PHYS_ADDR_SMC_SIZE)
#define OMAP_ION_HEAP_SECURE_INPUT_SIZE	(SZ_1M * 90)
#define PHYS_ADDR_DUCATI_SIZE	(SZ_1M * 105)
#define PHYS_ADDR_DUCATI_MEM	(PHYS_ADDR_SMC_MEM - PHYS_ADDR_DUCATI_SIZE - \
				OMAP_ION_HEAP_SECURE_INPUT_SIZE)

static const int sdp4430_keymap[] = {
	KEY(0, 0, KEY_E),
	KEY(0, 1, KEY_R),
	KEY(0, 2, KEY_T),
	KEY(0, 3, KEY_HOME),
	KEY(0, 4, KEY_F5),
	KEY(0, 5, KEY_UNKNOWN),
	KEY(0, 6, KEY_I),
	KEY(0, 7, KEY_LEFTSHIFT),

	KEY(1, 0, KEY_D),
	KEY(1, 1, KEY_F),
	KEY(1, 2, KEY_G),
	KEY(1, 3, KEY_SEND),
	KEY(1, 4, KEY_F6),
	KEY(1, 5, KEY_UNKNOWN),
	KEY(1, 6, KEY_K),
コード例 #3
0
	uint32_t ver; /* version */
	enum hs_ext_cmd_type id; /* command id */
	uint32_t handle; /* handle returned from subscribe proc */
	enum hs_ext_cmd_type disc_id1; /* discriminator id */
	uint32_t input_ptr; /* input ptr length */
	uint32_t input_val; /* command specific data */
	uint32_t input_len; /* length of command input */
	enum hs_ext_cmd_type disc_id2; /* discriminator id */
	uint32_t output_len; /* length of output data */
	uint32_t delayed; /* execution context for modem
				true - caller context
				false - hs task context*/
};

static const uint32_t hs_key_map[] = {
	KEY(HS_PWR_K, KEY_POWER),
	KEY(HS_END_K, KEY_END),
	KEY(HS_STEREO_HEADSET_K, SW_HEADPHONE_INSERT),
#ifndef CONFIG_MACH_MSM7X27_ALOHAV
	KEY(HS_ON_HOOK_K, KEY_MEDIA),
	KEY(HS_DESKDOCK_DETECT, KEY_CONNECT),
#else
	KEY(HS_HEADSET_SWITCH_K, KEY_MEDIA),
	KEY(HS_HEADSET_SWITCH_2_K, KEY_VOLUMEUP),
	KEY(HS_HEADSET_SWITCH_3_K, KEY_VOLUMEDOWN),
#endif
	0
};

enum {
	NO_DEVICE	= 0,
コード例 #4
0
ファイル: mach-mx27_3ds.c プロジェクト: roscarv/linux-2.6
	PD24_PF_CSPI2_MOSI,
	/* I2C1 */
	PD17_PF_I2C_DATA,
	PD18_PF_I2C_CLK,
};

static const struct imxuart_platform_data uart_pdata __initconst = {
	.flags = IMXUART_HAVE_RTSCTS,
};

/*
 * Matrix keyboard
 */

static const uint32_t mx27_3ds_keymap[] = {
	KEY(0, 0, KEY_UP),
	KEY(0, 1, KEY_DOWN),
	KEY(1, 0, KEY_RIGHT),
	KEY(1, 1, KEY_LEFT),
	KEY(1, 2, KEY_ENTER),
	KEY(2, 0, KEY_F6),
	KEY(2, 1, KEY_F8),
	KEY(2, 2, KEY_F9),
	KEY(2, 3, KEY_F10),
};

static const struct matrix_keymap_data mx27_3ds_keymap_data __initconst = {
	.keymap		= mx27_3ds_keymap,
	.keymap_size	= ARRAY_SIZE(mx27_3ds_keymap),
};
コード例 #5
0
ファイル: board-palmz71.c プロジェクト: ForayJones/iods
#include <asm/arch/common.h>
#include <asm/arch/omap-alsa.h>

#include <linux/spi/spi.h>
#include <linux/spi/ads7846.h>

static void __init
omap_palmz71_init_irq(void)
{
	omap1_init_common_hw();
	omap_init_irq();
	omap_gpio_init();
}

static int palmz71_keymap[] = {
	KEY(0, 0, KEY_F1),
	KEY(0, 1, KEY_F2),
	KEY(0, 2, KEY_F3),
	KEY(0, 3, KEY_F4),
	KEY(0, 4, KEY_POWER),
	KEY(1, 0, KEY_LEFT),
	KEY(1, 1, KEY_DOWN),
	KEY(1, 2, KEY_UP),
	KEY(1, 3, KEY_RIGHT),
	KEY(1, 4, KEY_CENTER),
	KEY(2, 0, KEY_CAMERA),
	0,
};

static struct omap_kp_platform_data palmz71_kp_data = {
	.rows	= 8,
コード例 #6
0
	uint32_t ver; /* version */
	enum hs_ext_cmd_type id; /* command id */
	uint32_t handle; /* handle returned from subscribe proc */
	enum hs_ext_cmd_type disc_id1; /* discriminator id */
	uint32_t input_ptr; /* input ptr length */
	uint32_t input_val; /* command specific data */
	uint32_t input_len; /* length of command input */
	enum hs_ext_cmd_type disc_id2; /* discriminator id */
	uint32_t output_len; /* length of output data */
	uint32_t delayed; /* execution context for modem
				true - caller context
				false - hs task context*/
};

static const uint32_t hs_key_map[] = {
	KEY(HS_PWR_K, KEY_POWER),
	KEY(HS_END_K, KEY_END),
	KEY(HS_STEREO_HEADSET_K, SW_HEADPHONE_INSERT),
	KEY(HS_HEADSET_SWITCH_K, KEY_MEDIA),
	KEY(HS_HEADSET_SWITCH_2_K, KEY_VOLUMEUP),
	KEY(HS_HEADSET_SWITCH_3_K, KEY_VOLUMEDOWN),
	0
};

enum {
	NO_DEVICE	= 0,
	MSM_HEADSET	= 1,
	MSM_HEADPHONE	= 2,
};
/* Add newer versions at the top of array */
static const unsigned int rpc_vers[] = {
コード例 #7
0
ファイル: mach-athena.c プロジェクト: andyliu/ak98_kernel
	       .data_len = 0xF5C5C,	//0x91517
	      // .data_len = 0x91717,
	       }
};

static struct ak98_platform_nand athena_evt_nand_info = {
	.nr_sets = ARRAY_SIZE(athena_evt_nand_sets),
	.sets = athena_evt_nand_sets,
};

/*
 * AK98 matrix Keyboard Device
 */
#define KEY_CENTER	KEY_REPLY
static const uint32_t athena_keypad_keymap[] = {
	KEY(0, 0, KEY_VOLUMEUP),
	KEY(0, 1, KEY_RIGHT),
	KEY(0, 2, KEY_MENU),
	KEY(1, 0, KEY_UP),
	KEY(1, 1, KEY_CENTER),
	KEY(1, 2, KEY_DOWN),
	KEY(2, 0, KEY_VOLUMEDOWN),
	KEY(2, 1, KEY_LEFT),
	KEY(2, 2, KEY_HOME),
};

static struct matrix_keymap_data athena_keypad_keymap_data = {
	.keymap		= athena_keypad_keymap,
	.keymap_size	= ARRAY_SIZE(athena_keypad_keymap),
};
コード例 #8
0
ファイル: kingdom.c プロジェクト: borlak/umgw
///////// I/O FUNCTIONS //////////////
void read_kingdoms(void)
{
	KINGDOM_DATA *kingdom = 0;
	FILE *fp;
	char buf[MAX_STRING_LENGTH];
	char *word;
	bool end = FALSE;
	long i = 0;

	fclose(fpReserve);

	if((fp = fopen(KINGDOM_FILE, "r")) == 0)
	{
		log_string("Error opening kingdom.txt for reading");
		fpReserve = fopen(NULL_FILE, "r");
		return;
	}

	while(!end)
	{
		word = fread_word(fp);

		switch (UPPER(word[0]))
		{
		case 'A':
			KEY("Assists", kingdom->assists, fread_number(fp));
			break;

		case 'E':
			if(!str_cmp(word, "End"))
			{
				end = TRUE;
				break;
			}
			break;

		case 'K':
			if(!str_cmp(word, "KingdomID"))
			{
				kingdom = create_kingdom();
				kingdom->id = fread_number(fp);
				continue;
			}
			break;

		case 'L':
			KEY("Leader", kingdom->leader, fread_string(fp));
			break;

		case 'M':
			KEY("Members", kingdom->members, fread_string(fp));
			break;

		case 'N':
			KEY("Name", kingdom->name, fread_string(fp));
			KEY("Noansiname", kingdom->noansiname, fread_string(fp));
			break;

		case 'P':
			KEY("Pks", kingdom->pks, fread_number(fp));
			KEY("Pds", kingdom->pds, fread_number(fp));
			KEY("Points", kingdom->points, fread_number(fp));
			break;

		case 'R':
			KEY("Realpoints", kingdom->realpoints, fread_number(fp));
			KEY("Recall", kingdom->recall, fread_number(fp));
			break;

		case 'T':
			KEY("Trustees", kingdom->trustees, fread_string(fp));

			if(!str_cmp(word, "Treaties"))
			{
				i = fread_number(fp);
				if(i > 0)
				{
					kingdom->treaties = malloc(sizeof(long) * (i+1));
					memset(kingdom->treaties,1,sizeof(long) * (i+1));
					kingdom->treaties[i] = 0;
					for(i = 0; kingdom->treaties[i]; i++)
						kingdom->treaties[i] = fread_number(fp);
				}
				else
				{
					kingdom->treaties = malloc(sizeof(long) * 1);
					kingdom->treaties[0] = 0;
				}
				break;
			}
			break;

		case 'U':
			KEY("Upkeep", kingdom->upkeep, fread_number(fp));
			break;

		case 'W':
			if(!str_cmp(word, "Wars"))
			{
				i = fread_number(fp);
				if(i > 0)
				{
					kingdom->wars = malloc(sizeof(long) * (i+1));
					memset(kingdom->wars,1,sizeof(long) * (i+1));
					kingdom->wars[i] = 0;
					for(i = 0; kingdom->wars[i]; i++)
						kingdom->wars[i] = fread_number(fp);
				}
				else
				{
					kingdom->wars = malloc(sizeof(long) * 1);
					kingdom->wars[0] = 0;
				}
				break;
			}
			break;

		default:
			sprintf(buf, "Bad word while reading kingdom.txt -> %s", word);
			bug(buf, 0);
			exit(1);
		}
	}

	fclose(fp);
	fpReserve = fopen(NULL_FILE, "r");
	update_kingdoms();
}
コード例 #9
0
ファイル: board-palmtt.c プロジェクト: 0-T-0/ps4-linux
#include <linux/platform_data/keypad-omap.h>

#include <mach/hardware.h>
#include <mach/usb.h>

#include "common.h"

#define PALMTT_USBDETECT_GPIO	0
#define PALMTT_CABLE_GPIO	1
#define PALMTT_LED_GPIO		3
#define PALMTT_PENIRQ_GPIO	6
#define PALMTT_MMC_WP_GPIO	8
#define PALMTT_HDQ_GPIO		11

static const unsigned int palmtt_keymap[] = {
	KEY(0, 0, KEY_ESC),
	KEY(1, 0, KEY_SPACE),
	KEY(2, 0, KEY_LEFTCTRL),
	KEY(3, 0, KEY_TAB),
	KEY(4, 0, KEY_ENTER),
	KEY(0, 1, KEY_LEFT),
	KEY(1, 1, KEY_DOWN),
	KEY(2, 1, KEY_UP),
	KEY(3, 1, KEY_RIGHT),
	KEY(0, 2, KEY_SLEEP),
	KEY(4, 2, KEY_Y),
};

static struct mtd_partition palmtt_partitions[] = {
	{
		.name		= "write8k",
コード例 #10
0
ファイル: mioa701.c プロジェクト: E-LLP/n900
{
	gpio_set_value(GPIO87_LCD_POWER, on);
}

static struct pxafb_mach_info mioa701_pxafb_info = {
	.modes			= &mioa701_ltm0305a776c,
	.num_modes		= 1,
	.lcd_conn		= LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
	.pxafb_lcd_power	= mioa701_lcd_power,
};

/*
 * Keyboard configuration
 */
static unsigned int mioa701_matrix_keys[] = {
	KEY(0, 0, KEY_UP),
	KEY(0, 1, KEY_RIGHT),
	KEY(0, 2, KEY_MEDIA),
	KEY(1, 0, KEY_DOWN),
	KEY(1, 1, KEY_ENTER),
	KEY(1, 2, KEY_CONNECT),	/* GPS key */
	KEY(2, 0, KEY_LEFT),
	KEY(2, 1, KEY_PHONE),	/* Phone Green key */
	KEY(2, 2, KEY_CAMERA)	/* Camera key */
};
static struct pxa27x_keypad_platform_data mioa701_keypad_info = {
	.matrix_key_rows = 3,
	.matrix_key_cols = 3,
	.matrix_key_map = mioa701_matrix_keys,
	.matrix_key_map_size = ARRAY_SIZE(mioa701_matrix_keys),
};
コード例 #11
0
	enum hs_subs_req	req;   /* subscribe or unsubscribe  */
	uint32_t		host_os;
	enum hs_subs_req	disc;  /* discriminator    */
	union hs_subs_class      id;
};

struct hs_event_cb_recv {
	uint32_t cb_id;
	uint32_t hs_key_data_ptr;
	struct hs_key_data key;
};
#endif

static const uint32_t hs_key_map[] = {
#if defined(CONFIG_MACH_MOT)
	KEY(HS_END_K, KEY_POWER),
#else
	KEY(HS_PWR_K, KEY_POWER),
	KEY(HS_END_K, KEY_END),
	KEY(HS_STEREO_HEADSET_K, SW_HEADPHONE_INSERT),
#endif
	KEY(HS_HEADSET_SWITCH_K, KEY_MEDIA),
	0
};

#if defined(CONFIG_MACH_MOT)
static struct input_dev *kpdev;
#else
enum {
	NO_DEVICE	= 0,
	MSM_HEADSET	= 1,
コード例 #12
0
ファイル: board-igep0030.c プロジェクト: soap-DEIM/L4Reap
static struct omap_dss_device *igep2_dss_devices[] = {
	&igep2_dvi_device
};

static struct omap_dss_board_info igep2_dss_data = {
	.num_devices	= ARRAY_SIZE(igep2_dss_devices),
	.devices	= igep2_dss_devices,
	.default_device	= &igep2_dvi_device,
};

static struct platform_device *igep_devices[] __initdata = {
	&igep_vwlan_device,
};

static int igep2_keymap[] = {
	KEY(0, 0, KEY_LEFT),
	KEY(0, 1, KEY_RIGHT),
	KEY(0, 2, KEY_A),
	KEY(0, 3, KEY_B),
	KEY(1, 0, KEY_DOWN),
	KEY(1, 1, KEY_UP),
	KEY(1, 2, KEY_E),
	KEY(1, 3, KEY_F),
	KEY(2, 0, KEY_ENTER),
	KEY(2, 1, KEY_I),
	KEY(2, 2, KEY_J),
	KEY(2, 3, KEY_K),
	KEY(3, 0, KEY_M),
	KEY(3, 1, KEY_N),
	KEY(3, 2, KEY_O),
	KEY(3, 3, KEY_P)
コード例 #13
0
ファイル: palmtreo.c プロジェクト: 303750856/linux-3.1
	GPIO43_BTUART_TXD,
	GPIO44_BTUART_CTS,
	GPIO45_BTUART_RTS,

	/* MATRIX KEYPAD - different wake up source */
	GPIO100_KP_MKIN_0,
	GPIO99_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH,
};
#endif /* CONFIG_MACH_CENTRO */

/******************************************************************************
 * GPIO keyboard
 ******************************************************************************/
#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
static unsigned int treo680_matrix_keys[] = {
	KEY(0, 0, KEY_F8),		/* Red/Off/Power */
	KEY(0, 1, KEY_LEFT),
	KEY(0, 2, KEY_LEFTCTRL),	/* Alternate */
	KEY(0, 3, KEY_L),
	KEY(0, 4, KEY_A),
	KEY(0, 5, KEY_Q),
	KEY(0, 6, KEY_P),

	KEY(1, 0, KEY_RIGHTCTRL),	/* Menu */
	KEY(1, 1, KEY_RIGHT),
	KEY(1, 2, KEY_LEFTSHIFT),	/* Left shift */
	KEY(1, 3, KEY_Z),
	KEY(1, 4, KEY_S),
	KEY(1, 5, KEY_W),

	KEY(2, 0, KEY_F1),		/* Phone */
コード例 #14
0
#include <plat/mcspi.h>
#include <plat/mux.h>
#include <plat/board.h>
#include <plat/common.h>
#include <plat/dma.h>
#include <plat/gpmc.h>
#include <plat/onenand.h>
#include <plat/gpmc-smc91x.h>

#include "mmc-twl4030.h"

#define SYSTEM_REV_B_USES_VAUX3	0x1699
#define SYSTEM_REV_S_USES_VAUX3 0x8

static int board_keymap[] = {
	KEY(0, 0, KEY_Q),
	KEY(0, 1, KEY_O),
	KEY(0, 2, KEY_P),
	KEY(0, 3, KEY_COMMA),
	KEY(0, 4, KEY_BACKSPACE),
	KEY(0, 6, KEY_A),
	KEY(0, 7, KEY_S),
	KEY(1, 0, KEY_W),
	KEY(1, 1, KEY_D),
	KEY(1, 2, KEY_F),
	KEY(1, 3, KEY_G),
	KEY(1, 4, KEY_H),
	KEY(1, 5, KEY_J),
	KEY(1, 6, KEY_K),
	KEY(1, 7, KEY_L),
	KEY(2, 0, KEY_E),
コード例 #15
0
 * published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 */
#include <linux/input/pmic8xxx-keypad.h>
#include <mach/board-msm8660.h>
#include "gpiomux-semc_fuji.h"
#ifdef CONFIG_FUJI_PMIC_KEYPAD
#include <linux/mfd/pmic8058.h>
#include "keypad-pmic-fuji.h"
#endif /* CONFIG_FUJI_PMIC_KEYPAD */
#ifdef CONFIG_FUJI_GPIO_KEYPAD
#include <linux/gpio_event.h>
#endif /* CONFIG_FUJI_GPIO_KEYPAD */

static const unsigned int fuji_keymap[] = {
	KEY(1, 0, KEY_CAMERA),
	KEY(1, 1, KEY_CAMERA_FOCUS),
};

static struct matrix_keymap_data fuji_keymap_data = {
	.keymap_size	= ARRAY_SIZE(fuji_keymap),
	.keymap		= fuji_keymap,
};

struct pm8xxx_keypad_platform_data fuji_keypad_data = {
	.input_name		= "fuji-keypad",
	.input_phys_device	= "fuji-keypad/input0",
	.num_rows		= 5,
	.num_cols		= 5,
	.rows_gpio_start	= PM8058_GPIO_PM_TO_SYS(8),
	.cols_gpio_start	= PM8058_GPIO_PM_TO_SYS(0),
コード例 #16
0
ファイル: board-palmz71.c プロジェクト: GerardGarcia/linux
#define PALMZ71_HDQ_GPIO 	11

#define PALMZ71_HOTSYNC_GPIO	OMAP_MPUIO(1)
#define PALMZ71_CABLE_GPIO	OMAP_MPUIO(2)
#define PALMZ71_SLIDER_GPIO	OMAP_MPUIO(3)
#define PALMZ71_MMC_IN_GPIO	OMAP_MPUIO(4)

static void __init
omap_palmz71_init_irq(void)
{
	omap1_init_common_hw();
	omap1_init_irq();
}

static const unsigned int palmz71_keymap[] = {
	KEY(0, 0, KEY_F1),
	KEY(1, 0, KEY_F2),
	KEY(2, 0, KEY_F3),
	KEY(3, 0, KEY_F4),
	KEY(4, 0, KEY_POWER),
	KEY(0, 1, KEY_LEFT),
	KEY(1, 1, KEY_DOWN),
	KEY(2, 1, KEY_UP),
	KEY(3, 1, KEY_RIGHT),
	KEY(4, 1, KEY_ENTER),
	KEY(0, 2, KEY_CAMERA),
};

static const struct matrix_keymap_data palmz71_keymap_data = {
	.keymap		= palmz71_keymap,
	.keymap_size	= ARRAY_SIZE(palmz71_keymap),
コード例 #17
0
ファイル: main_loop.cpp プロジェクト: Panzerschrek/MicroW
LRESULT CALLBACK MainLoop::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{

    if( uMsg == WM_CLOSE )
        PostQuitMessage(0);
    switch( uMsg )
    {
    case WM_SIZE:
      current_main_loop->ResizeWindow();
     break;
    case WM_CLOSE:
        exit(0);

    case WM_KEYUP:
        if( wParam < 256 )
            current_main_loop->keys[ wParam ]= false;
        break;

    case WM_SETFOCUS:
        current_main_loop->use_mouse= true;
        ShowCursor( false );
        break;
    case WM_KILLFOCUS:
        current_main_loop->use_mouse= false;
        ShowCursor( true );
        break;

    case WM_KEYDOWN:
    {
        if( wParam < 256 )
            current_main_loop->keys[ wParam ]= true;

		switch( wParam )
		{
            case KEY(' '):
            current_main_loop->player->Jump();
            break;

           /* case KEY('M'):
            ShowCursor( current_main_loop->use_mouse );
            current_main_loop->use_mouse = !current_main_loop->use_mouse;
            break;*/

			case VK_ESCAPE:
			exit(0);
            break;

			default:
                 if( wParam <= 57 && wParam>= 49 )
                    current_main_loop->player->SetWeapon( wParam - 49 );
			break;
		}

      
    }//key down
    break;

    case WM_LBUTTONDOWN://shot button
           // current_main_loop->player->Shot();
            current_main_loop->mouse_keys[0]= true;
            break;
     case WM_LBUTTONUP://shot button
         current_main_loop->mouse_keys[0]= false;
         break;
     case WM_RBUTTONUP:
         current_main_loop->renderer->Zoom();
         break;

        case WM_MOUSEWHEEL:
            if( GET_WHEEL_DELTA_WPARAM(wParam) > 0 )
                current_main_loop->player->PreviousWeapon();
            else
                current_main_loop->player->NextWeapon();
        break;

#ifdef MRPG_DEBUG
        printf( "key: %d\n", wParam );
#endif
        break;


    default:
        break;
    }

    return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
コード例 #18
0
ファイル: spitz.c プロジェクト: BorisTw/BBB-kernel
#define SPITZ_KEY_ADDRESS	KEY_F2
#define SPITZ_KEY_FN		KEY_F3
#define SPITZ_KEY_CANCEL	KEY_F4
#define SPITZ_KEY_EXOK		KEY_F5
#define SPITZ_KEY_EXCANCEL	KEY_F6
#define SPITZ_KEY_EXJOGDOWN	KEY_F7
#define SPITZ_KEY_EXJOGUP	KEY_F8
#define SPITZ_KEY_JAP1		KEY_LEFTALT
#define SPITZ_KEY_JAP2		KEY_RIGHTCTRL
#define SPITZ_KEY_SYNC		KEY_F9
#define SPITZ_KEY_MAIL		KEY_F10
#define SPITZ_KEY_OK		KEY_F11
#define SPITZ_KEY_MENU		KEY_F12

static const uint32_t spitz_keymap[] = {
	KEY(0, 0, KEY_LEFTCTRL),
	KEY(0, 1, KEY_1),
	KEY(0, 2, KEY_3),
	KEY(0, 3, KEY_5),
	KEY(0, 4, KEY_6),
	KEY(0, 5, KEY_7),
	KEY(0, 6, KEY_9),
	KEY(0, 7, KEY_0),
	KEY(0, 8, KEY_BACKSPACE),
	KEY(0, 9, SPITZ_KEY_EXOK),	/* EXOK */
	KEY(0, 10, SPITZ_KEY_EXCANCEL),	/* EXCANCEL */
	KEY(1, 1, KEY_2),
	KEY(1, 2, KEY_4),
	KEY(1, 3, KEY_R),
	KEY(1, 4, KEY_Y),
	KEY(1, 5, KEY_8),
コード例 #19
0
ファイル: main_loop.cpp プロジェクト: Panzerschrek/MicroW
void MainLoop::MovePlayer()
{
    static unsigned int prev_time= 0;
    unsigned int dt= clock() - prev_time;
    float f_dt= float( dt ) / float( CLOCKS_PER_SEC );

    prev_time+= dt;

    float move_vec[3]= { 0.0f, 0.0f, 0.0f };

    const float speed_xy= 1.0f;
    const float speed_z= 1.0f;

    if( keys[ KEY( key_forward ) ] )
        move_vec[1]+= speed_xy;
    if( keys[ KEY( key_back ) ] )
        move_vec[1]-= speed_xy;
    if( keys[ KEY( key_left ) ] )
        move_vec[0]-= speed_xy;
    if( keys[ KEY( key_right ) ] )
        move_vec[0]+= speed_xy;
    if( keys[ KEY('C') ] )
        move_vec[2]-= speed_xy;
   
      

     move_vec[0]*= f_dt;
     move_vec[1]*= f_dt;
     move_vec[2]*= f_dt;

     float rot_mat[16];
     
     Mat4RotateXY( rot_mat, player->AngXY()  );

     Vec3Mat4Mul( move_vec, rot_mat );

     player->Accelerate( move_vec );

     const float rot_speed_xy= 0.2f * mouse_speed;
     const float rot_speed_z= 0.2f * mouse_speed;

     if( keys[ VK_UP ] )
         player->RotateZ( f_dt * rot_speed_z );
     if( keys[ VK_DOWN ] )
         player->RotateZ( -f_dt * rot_speed_z );
     if( keys[ VK_LEFT ] )
         player->RotateXY( f_dt * rot_speed_xy );
     if( keys[ VK_RIGHT ] )
         player->RotateXY( -f_dt * rot_speed_xy );

     if( use_mouse )
     {
        
#ifdef MW_OS_WINDOWS
         POINT p;
         GetCursorPos(&p);
         float dx= float( p.x - screen_x/2 ), dy= float( p.y - screen_y/2 );
         SetCursorPos( screen_x/2, screen_y/2 );
       
#else
         
#endif
         player->RotateXY( dx * (-0.005f) );
         player->RotateZ( dy * (-0.005f) );


     }

     if( mouse_keys[0] )
         player->Shot();
}
コード例 #20
0
ファイル: mach-smdk4x12.c プロジェクト: rslotte/OGS-Arm
	/* nothing here yet */
};

static struct samsung_bl_gpio_info smdk4x12_bl_gpio_info = {
	.no = EXYNOS4_GPD0(1),
	.func = S3C_GPIO_SFN(2),
};

static struct platform_pwm_backlight_data smdk4x12_bl_data = {
	.pwm_id = 1,
	.pwm_period_ns  = 1000,
};

static uint32_t smdk4x12_keymap[] __initdata = {
	/* KEY(row, col, keycode) */
	KEY(1, 3, KEY_1), KEY(1, 4, KEY_2), KEY(1, 5, KEY_3),
	KEY(1, 6, KEY_4), KEY(1, 7, KEY_5),
	KEY(2, 5, KEY_D), KEY(2, 6, KEY_A), KEY(2, 7, KEY_B),
	KEY(0, 7, KEY_E), KEY(0, 5, KEY_C)
};

static struct matrix_keymap_data smdk4x12_keymap_data __initdata = {
	.keymap		= smdk4x12_keymap,
	.keymap_size	= ARRAY_SIZE(smdk4x12_keymap),
};

static struct samsung_keypad_platdata smdk4x12_keypad_data __initdata = {
	.keymap_data	= &smdk4x12_keymap_data,
	.rows		= 3,
	.cols		= 8,
};
コード例 #21
0
ファイル: board-htcherald.c プロジェクト: dana/linux
#define HTCPLD_IRQ_RIGHT_KBD		HTCPLD_IRQ(0, 7)
#define HTCPLD_IRQ_UP_KBD		HTCPLD_IRQ(0, 6)
#define HTCPLD_IRQ_LEFT_KBD		HTCPLD_IRQ(0, 5)
#define HTCPLD_IRQ_DOWN_KBD		HTCPLD_IRQ(0, 4)

/* Chip 6 */
#define HTCPLD_IRQ_RIGHT_DPAD		HTCPLD_IRQ(1, 7)
#define HTCPLD_IRQ_UP_DPAD		HTCPLD_IRQ(1, 6)
#define HTCPLD_IRQ_LEFT_DPAD		HTCPLD_IRQ(1, 5)
#define HTCPLD_IRQ_DOWN_DPAD		HTCPLD_IRQ(1, 4)
#define HTCPLD_IRQ_ENTER_DPAD		HTCPLD_IRQ(1, 3)

/* Keyboard definition */

static const unsigned int htc_herald_keymap[] = {
	KEY(0, 0, KEY_RECORD), /* Mail button */
	KEY(1, 0, KEY_CAMERA), /* Camera */
	KEY(2, 0, KEY_PHONE), /* Send key */
	KEY(3, 0, KEY_VOLUMEUP), /* Volume up */
	KEY(4, 0, KEY_F2),  /* Right bar (landscape) */
	KEY(5, 0, KEY_MAIL), /* Win key (portrait) */
	KEY(6, 0, KEY_DIRECTORY), /* Right bar (protrait) */
	KEY(0, 1, KEY_LEFTCTRL), /* Windows key */
	KEY(1, 1, KEY_COMMA),
	KEY(2, 1, KEY_M),
	KEY(3, 1, KEY_K),
	KEY(4, 1, KEY_SLASH), /* OK key */
	KEY(5, 1, KEY_I),
	KEY(6, 1, KEY_U),
	KEY(0, 2, KEY_LEFTALT),
	KEY(1, 2, KEY_TAB),