Game Menu -> Gamepad Config configures only 2 gamepads #494

This commit is contained in:
BADIM-PC\Vadim 2018-01-10 11:54:54 +03:00
parent 53ccf8fba0
commit b3c3b401d1
3 changed files with 6 additions and 17 deletions

View File

@ -224,10 +224,9 @@ static void drawPlayerButtons(Menu* menu, s32 x, s32 y)
static void drawGamepadSetupTabs(Menu* menu, s32 x, s32 y) static void drawGamepadSetupTabs(Menu* menu, s32 x, s32 y)
{ {
enum{Width = 90, Height = 41, Tabs = 2}; enum{Width = 90, Height = 41, Tabs = TIC_GAMEPADS, TabWidth = 16};
tic_mem* tic = menu->tic; tic_mem* tic = menu->tic;
tic->api.rect(tic, x, y, Width, Height, (tic_color_white)); tic->api.rect(tic, x, y, Width, Height, (tic_color_white));
tic->api.pixel(tic, x, y, (tic_color_blue)); tic->api.pixel(tic, x, y, (tic_color_blue));
tic->api.pixel(tic, x+Width-1, y, (tic_color_blue)); tic->api.pixel(tic, x+Width-1, y, (tic_color_blue));
@ -236,12 +235,7 @@ static void drawGamepadSetupTabs(Menu* menu, s32 x, s32 y)
tic->api.rect(tic, x+1, y+Height, Width-2 , 1, (tic_color_black)); tic->api.rect(tic, x+1, y+Height, Width-2 , 1, (tic_color_black));
for(s32 i = 0; i < Tabs; i++) for(s32 i = 0; i < Tabs; i++)
{ (menu->gamepad.tab == i ? drawTab : drawTabDisabled)(menu, x + 73 - i*TabWidth, y + 43, i);
if(menu->gamepad.tab == i)
drawTab(menu, x + 73 - i*17, y + 43, i);
else
drawTabDisabled(menu, x + 73 - i*17, y + 43, i);
}
drawPlayerButtons(menu, x + 3, y + 3); drawPlayerButtons(menu, x + 3, y + 3);
} }

View File

@ -45,17 +45,11 @@
#include "ext/md5.h" #include "ext/md5.h"
#define STUDIO_UI_SCALE 3 #define STUDIO_UI_SCALE 3
#define TEXTURE_SIZE (TIC80_FULLWIDTH) #define TEXTURE_SIZE (TIC80_FULLWIDTH)
#define MAX_CONTROLLERS (sizeof(tic80_gamepads))
#define STUDIO_PIXEL_FORMAT SDL_PIXELFORMAT_ARGB8888 #define STUDIO_PIXEL_FORMAT SDL_PIXELFORMAT_ARGB8888
#define FRAME_SIZE (TIC80_FULLWIDTH * TIC80_FULLHEIGHT * sizeof(u32)) #define FRAME_SIZE (TIC80_FULLWIDTH * TIC80_FULLHEIGHT * sizeof(u32))
#define OFFSET_LEFT ((TIC80_FULLWIDTH-TIC80_WIDTH)/2) #define OFFSET_LEFT ((TIC80_FULLWIDTH-TIC80_WIDTH)/2)
#define OFFSET_TOP ((TIC80_FULLHEIGHT-TIC80_HEIGHT)/2) #define OFFSET_TOP ((TIC80_FULLHEIGHT-TIC80_HEIGHT)/2)
#define POPUP_DUR (TIC_FRAMERATE*2) #define POPUP_DUR (TIC_FRAMERATE*2)
#if defined(TIC80_PRO) #if defined(TIC80_PRO)
@ -110,7 +104,7 @@ static struct
SDL_AudioCVT cvt; SDL_AudioCVT cvt;
} audio; } audio;
SDL_Joystick* joysticks[MAX_CONTROLLERS]; SDL_Joystick* joysticks[TIC_GAMEPADS];
EditorMode mode; EditorMode mode;
EditorMode prevMode; EditorMode prevMode;
@ -1936,7 +1930,7 @@ SDL_Event* pollEvent()
{ {
s32 id = event.jdevice.which; s32 id = event.jdevice.which;
if (id < MAX_CONTROLLERS) if (id < TIC_GAMEPADS)
{ {
if(studio.joysticks[id]) if(studio.joysticks[id])
SDL_JoystickClose(studio.joysticks[id]); SDL_JoystickClose(studio.joysticks[id]);
@ -1950,7 +1944,7 @@ SDL_Event* pollEvent()
{ {
s32 id = event.jdevice.which; s32 id = event.jdevice.which;
if (id < MAX_CONTROLLERS && studio.joysticks[id]) if (id < TIC_GAMEPADS && studio.joysticks[id])
{ {
SDL_JoystickClose(studio.joysticks[id]); SDL_JoystickClose(studio.joysticks[id]);
studio.joysticks[id] = NULL; studio.joysticks[id] = NULL;

View File

@ -108,6 +108,7 @@
#define TIC_BANK_BITS 3 #define TIC_BANK_BITS 3
#define TIC_BANKS (1 << TIC_BANK_BITS) #define TIC_BANKS (1 << TIC_BANK_BITS)
#define TIC_GAMEPADS (sizeof(tic80_gamepads) / sizeof(tic80_gamepad))
#define SFX_NOTES {"C-", "C#", "D-", "D#", "E-", "F-", "F#", "G-", "G#", "A-", "A#", "B-"} #define SFX_NOTES {"C-", "C#", "D-", "D#", "E-", "F-", "F#", "G-", "G#", "A-", "A#", "B-"}
#define TIC_FONT_CHARS 128 #define TIC_FONT_CHARS 128