diff options
| author | scarab <scarab@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-07-29 15:05:21 +0000 |
|---|---|---|
| committer | scarab <scarab@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-07-29 15:05:21 +0000 |
| commit | 3b66d10f0f0f47894a2cc0aba81035fa534a2b06 (patch) | |
| tree | ca0cba6d82f7dfba7c2584584aab5ae5808a8bf6 | |
| parent | c86df412753dc8e05eb1495ce82909a050b32d5a (diff) | |
- dalsi upravy pro win32 a nastavovani klaves
git-svn-id: http://opensvn.csie.org/tuxanci_ng@179 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
| -rw-r--r-- | config.h | 2 | ||||
| -rw-r--r-- | src/base/modules.h | 4 | ||||
| -rw-r--r-- | src/base/myTimer.c | 10 | ||||
| -rw-r--r-- | src/screen/screen_settingKeys.c | 40 | ||||
| -rw-r--r-- | src/widget/widget_catchkey.c | 2 | ||||
| -rw-r--r-- | src/widget/widget_catchkey.h | 2 |
6 files changed, 20 insertions, 40 deletions
@@ -1 +1 @@ -#define TUXANCI_NG_VERSION "svn178" +#define TUXANCI_NG_VERSION "svn179" diff --git a/src/base/modules.h b/src/base/modules.h index 1437c52..9329dbd 100644 --- a/src/base/modules.h +++ b/src/base/modules.h @@ -31,11 +31,7 @@ typedef struct export_fce_s int (*fce_getNetTypeGame)(); int (*fce_loadDepModule)(char *name); -#ifndef __WIN32__ void (*fce_addToExportFce)(char *name, void *function); -#else - void (*fce_addToExportFce)(char *name, HINSTANCE *function); -#endif void* (*fce_getExportFce)(char *name); void (*fce_getTuxProportion)(tux_t *tux, int *x,int *y, int *w, int *h); diff --git a/src/base/myTimer.c b/src/base/myTimer.c index 114f9d7..2fbee7b 100644 --- a/src/base/myTimer.c +++ b/src/base/myTimer.c @@ -13,11 +13,14 @@ #ifndef PUBLIC_SERVER #include "interface.h" #endif - #ifdef __WIN32__ #include <windows.h> #include <time.h> +#endif +/* // uncoment when having issues with gettimeofday in Windows +#ifdef __WIN32__ #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL + struct timezone { int tz_minuteswest; @@ -34,8 +37,7 @@ int gettimeofday(struct timeval *tv, struct timezone *tz) tmpres |= ft.dwHighDateTime; tmpres <<= 32; tmpres |= ft.dwLowDateTime; - /*converting file time to unix epoch*/ - tmpres /= 10; /*convert into microseconds*/ + tmpres /= 10; tmpres -= DELTA_EPOCH_IN_MICROSECS; tv->tv_sec = (long)(tmpres / 1000000UL); tv->tv_usec = (long)(tmpres % 1000000UL); @@ -51,7 +53,7 @@ int gettimeofday(struct timeval *tv, struct timezone *tz) return 0; } #endif - +*/ static struct timeval start = { .tv_sec = 0, .tv_usec = 0 }; list_t* newTimer() diff --git a/src/screen/screen_settingKeys.c b/src/screen/screen_settingKeys.c index e4003ce..b4ec19f 100644 --- a/src/screen/screen_settingKeys.c +++ b/src/screen/screen_settingKeys.c @@ -1,3 +1,4 @@ +
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
@@ -72,12 +73,9 @@ void startScreenSettingKeys() playMusic("menu", MUSIC_GROUP_BASE);
#endif
}
-
static void setKeytableFromConfigFile(textFile_t *configFile)
{
char val[STR_SIZE];
-
- loadValueFromConfigFile(configFile, "TUX_RIGHT_MOVE_UP", val, STR_SIZE, "273");
keytable[ KEY_TUX_RIGHT_MOVE_UP ] = atoi(val);
loadValueFromConfigFile(configFile, "TUX_RIGHT_MOVE_RIGHT", val, STR_SIZE, "275");
keytable[ KEY_TUX_RIGHT_MOVE_RIGHT ] = atoi(val);
@@ -102,27 +100,24 @@ static void setKeytableFromConfigFile(textFile_t *configFile) loadValueFromConfigFile(configFile, "TUX_LEFT_SWITCH_WEAPON", val, STR_SIZE, "9");
keytable[ KEY_TUX_LEFT_SWITCH_WEAPON ] = atoi(val);
}
-
void initKeyTable()
{
char path[STR_PATH_SIZE];
-
+/*
+ int i;
+*/
sprintf(path, "%s/keycontrol.conf", getHomeDirector());
keycontrolFile = loadTextFile(path);
-
- if(keycontrolFile == NULL) {
+ if (keycontrolFile == NULL) {
fprintf(stderr, "Don't load %s\n", path);
fprintf(stderr, "I create %s\n", path);
keycontrolFile = newTextFile(path);
}
-
- if(keycontrolFile == NULL) {
+ if (keycontrolFile == NULL) {
fprintf(stderr, "Don't create %s\n", path);
return;
}
-
setKeytableFromConfigFile(keycontrolFile);
-
/*
for( i = 0 ; i < KEY_LENGTH ; i++)
{
@@ -130,16 +125,11 @@ void initKeyTable() }
*/
}
-
int getKey(int n)
{
- assert( n >= 0 && n < KEY_LENGTH );
-
// printf("keytable[n] = %d\n", keytable[n]);
-
return keytable[n];
}
-
void drawScreenSettingKeys()
{
drawWidgetImage(image_backgorund);
@@ -173,7 +163,6 @@ void drawScreenSettingKeys() drawWidgetCatchkey(tux_left_keyswitch_val);
drawWidgetCatchkey(tux_left_keyfire_val);
}
-
static void refreshKeytable()
{
keytable[6] = getWidgetCatchKey(tux_left_keyup_val);
@@ -190,7 +179,6 @@ static void refreshKeytable() keytable[4] = getWidgetCatchKey(tux_right_keyfire_val);
keytable[5] = getWidgetCatchKey(tux_right_keyswitch_val);
}
-
static void eventWidget(void *p)
{
widget_button_t *button;
@@ -198,13 +186,11 @@ static void eventWidget(void *p) button = (widget_button_t *)(p);
catcher = (widget_catchkey_t *)(p);
-
- if(button == button_back) {
+ if (button == button_back) {
setScreen("setting");
}
-
//events on value
- if( (catcher == tux_left_keyup_val) ||
+ if ((catcher == tux_left_keyup_val) ||
(catcher == tux_left_keydown_val) ||
(catcher == tux_left_keyleft_val) ||
(catcher == tux_left_keyright_val) ||
@@ -215,16 +201,16 @@ static void eventWidget(void *p) (catcher == tux_right_keyleft_val) ||
(catcher == tux_right_keyright_val) ||
(catcher == tux_right_keyswitch_val) ||
- (catcher == tux_right_keyfire_val) ) {
+ (catcher == tux_right_keyfire_val)) {
// draw press any key picture
+ //this will be done by widget catchkey
// check if there is no other key with new value (what to revert if yes?)
// allow ony one key per time change HOW THE HELL IS THIS EVEN POSSIBLE
-
+ // this will fix disabling mouse while waiting for keypress
//printf("catcher->key = %d\n", catcher->key);
refreshKeytable();
}
}
-
void eventScreenSettingKeys()
{
eventWidgetButton(button_back);
@@ -283,6 +269,7 @@ void initScreenSettingKeys() tux_right_keyfire_val = newWidgetCatchkey(keytable[4], WINDOW_SIZE_X/2 + tux_left_keyup_val->x, tux_left_keyright->y + 20, eventWidget);
tux_right_keyswitch_val = newWidgetCatchkey(keytable[5], WINDOW_SIZE_X/2 + tux_left_keyup_val->x, tux_left_keyfire->y + 20, eventWidget);
+
registerScreen( newScreen("settingKeys", startScreenSettingKeys, eventScreenSettingKeys,
drawScreenSettingKeys, stopScreenSettingKeys) );
}
@@ -290,7 +277,6 @@ void quitKeyTable() {
destroyTextFile(keycontrolFile);
}
-
void saveKeyTable(textFile_t *configFile) {
char str[STR_SIZE];
sprintf(str,"%d",tux_left_keyup_val->key);
@@ -321,12 +307,10 @@ void saveKeyTable(textFile_t *configFile) { saveTextFile(configFile);
}
-
void quitScreenSettingKeys()
{
saveKeyTable(keycontrolFile);
quitKeyTable();
-
// key names
destroyWidgetImage(image_backgorund);
destroyWidgetLabel(tux_right);
diff --git a/src/widget/widget_catchkey.c b/src/widget/widget_catchkey.c index 099a4e9..df5a537 100644 --- a/src/widget/widget_catchkey.c +++ b/src/widget/widget_catchkey.c @@ -70,7 +70,7 @@ static int getPessAnyKey() void eventWidgetCatchkey(widget_catchkey_t *p) { int x, y; - + getMousePosition(&x, &y); if( isMouseClicked() ) diff --git a/src/widget/widget_catchkey.h b/src/widget/widget_catchkey.h index d5f9a36..4b09d20 100644 --- a/src/widget/widget_catchkey.h +++ b/src/widget/widget_catchkey.h @@ -1,4 +1,3 @@ - #ifndef WIDGET_CATCHKEY_H #define WIDGET_CATCHKEY_H @@ -27,4 +26,3 @@ extern void eventWidgetCatchkey(widget_catchkey_t *p); extern void destroyWidgetCatchkey(widget_catchkey_t *p); #endif - |