1 #include "config.h"
2 
3 #include <stdio.h>
4 #include <glib.h>
5 
6 #include "portab.h"
7 #include "system.h"
8 #include "counter.h"
9 #include "menu.h"
10 #include "imput.h"
11 #include "nact.h"
12 #include "key.h"
13 #include "night.h"
14 #include "sprite.h"
15 
16 /*
17   Message���������Ԥ�����
18 */
cb_waitkey_message(agsevent_t * e)19 static void cb_waitkey_message(agsevent_t *e) {
20 	switch (e->type) {
21 	case AGSEVENT_BUTTON_RELEASE:
22 	case AGSEVENT_KEY_RELEASE:
23 		night.msg.cbrelease(e);
24 		break;
25 	case AGSEVENT_MOUSE_MOTION:
26 		night.msg.cbmove(e);
27 		break;
28 	}
29 }
30 
31 /*
32   WaitKeySimple��callback
33 */
cb_waitkey_simple(agsevent_t * e)34 static void cb_waitkey_simple(agsevent_t *e) {
35 	switch (e->type) {
36 	case AGSEVENT_BUTTON_RELEASE:
37 	case AGSEVENT_KEY_RELEASE:
38 		night.waitkey = e->d3;
39 		break;
40 	}
41 }
42 
43 /*
44   ����� Window Open ���� callback
45 */
cb_waitkey_selection(agsevent_t * e)46 static void cb_waitkey_selection(agsevent_t *e) {
47 	switch (e->type) {
48 	case AGSEVENT_BUTTON_RELEASE:
49 		night.sel.cbrelease(e);
50 		break;
51 
52 	case AGSEVENT_MOUSE_MOTION:
53 		night.sel.cbmove(e);
54 		break;
55 	}
56 }
57 
ntev_callback(agsevent_t * e)58 void ntev_callback(agsevent_t *e) {
59 	// menu open���̵��
60 	if (nact->popupmenu_opened) {
61 		return;
62 	}
63 
64 	if (e->type == AGSEVENT_KEY_PRESS && e->d3 == KEY_CTRL) {
65 		night.waitskiplv = 2;
66 		night.waitkey = e->d3;
67 		return;
68 	}
69 
70 	if (e->type == AGSEVENT_KEY_RELEASE && e->d3 == KEY_CTRL) {
71 		night.waitskiplv = 0;
72 		night.waitkey = e->d3;
73 		return;
74 	}
75 
76 	switch (night.waittype) {
77 	case KEYWAIT_MESSAGE:
78 		cb_waitkey_message(e);
79 		break;
80 
81 	case KEYWAIT_SIMPLE:
82 		cb_waitkey_simple(e);
83 		break;
84 
85 	case KEYWAIT_SPRITE:
86 		cb_waitkey_sprite(e);
87 		break;
88 
89 	case KEYWAIT_SELECT:
90 		cb_waitkey_selection(e);
91 		break;
92 
93 	default:
94 		return;
95 	}
96 
97 }
98 
99 /*
100   system35�Υᥤ��롼�פ���ǸƤФ�륳����Хå�
101 */
ntev_main()102 void ntev_main() {
103         // �ǥե���ȤΥ�����Хå��Τ�����������ɬ�פʤ�Τ���������
104         if (nact->popupmenu_opened) {
105                 menu_gtkmainiteration();
106                 if (nact->is_quit) sys_exit(0);
107         }
108 }
109