some minor fixes
This commit is contained in:
		
							
								
								
									
										37
									
								
								src/system.c
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								src/system.c
									
									
									
									
									
								
							@@ -27,20 +27,12 @@ static struct
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	struct
 | 
						struct
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		SDL_AudioSpec 		spec;
 | 
							SDL_Joystick* ports[TIC_GAMEPADS];
 | 
				
			||||||
		SDL_AudioDeviceID 	device;
 | 
							SDL_Texture* texture;
 | 
				
			||||||
		SDL_AudioCVT 		cvt;
 | 
					 | 
				
			||||||
	} audio;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SDL_Joystick* joysticks[TIC_GAMEPADS];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	struct
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		tic80_gamepads touch;
 | 
							tic80_gamepads touch;
 | 
				
			||||||
		tic80_gamepads joystick;
 | 
							tic80_gamepads joystick;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		SDL_Texture* texture;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		bool show;
 | 
							bool show;
 | 
				
			||||||
		s32 counter;
 | 
							s32 counter;
 | 
				
			||||||
		s32 alpha;
 | 
							s32 alpha;
 | 
				
			||||||
@@ -66,6 +58,13 @@ static struct
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	bool missedFrame;
 | 
						bool missedFrame;
 | 
				
			||||||
	bool fullscreen;
 | 
						bool fullscreen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						struct
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							SDL_AudioSpec 		spec;
 | 
				
			||||||
 | 
							SDL_AudioDeviceID 	device;
 | 
				
			||||||
 | 
							SDL_AudioCVT 		cvt;
 | 
				
			||||||
 | 
						} audio;
 | 
				
			||||||
} platform;
 | 
					} platform;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void initSound()
 | 
					static void initSound()
 | 
				
			||||||
@@ -436,9 +435,9 @@ static void processJoysticks()
 | 
				
			|||||||
	platform.gamepad.joystick.data = 0;
 | 
						platform.gamepad.joystick.data = 0;
 | 
				
			||||||
	s32 index = 0;
 | 
						s32 index = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for(s32 i = 0; i < COUNT_OF(platform.joysticks); i++)
 | 
						for(s32 i = 0; i < COUNT_OF(platform.gamepad.ports); i++)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		SDL_Joystick* joystick = platform.joysticks[i];
 | 
							SDL_Joystick* joystick = platform.gamepad.ports[i];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if(joystick && SDL_JoystickGetAttached(joystick))
 | 
							if(joystick && SDL_JoystickGetAttached(joystick))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -520,7 +519,7 @@ static void pollEvent()
 | 
				
			|||||||
		input->mouse.btns = 0;
 | 
							input->mouse.btns = 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	static SDL_Event event;
 | 
						SDL_Event event;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while(SDL_PollEvent(&event))
 | 
						while(SDL_PollEvent(&event))
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@@ -538,10 +537,10 @@ static void pollEvent()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				if (id < TIC_GAMEPADS)
 | 
									if (id < TIC_GAMEPADS)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					if(platform.joysticks[id])
 | 
										if(platform.gamepad.ports[id])
 | 
				
			||||||
						SDL_JoystickClose(platform.joysticks[id]);
 | 
											SDL_JoystickClose(platform.gamepad.ports[id]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					platform.joysticks[id] = SDL_JoystickOpen(id);
 | 
										platform.gamepad.ports[id] = SDL_JoystickOpen(id);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
@@ -550,10 +549,10 @@ static void pollEvent()
 | 
				
			|||||||
			{
 | 
								{
 | 
				
			||||||
				s32 id = event.jdevice.which;
 | 
									s32 id = event.jdevice.which;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (id < TIC_GAMEPADS && platform.joysticks[id])
 | 
									if (id < TIC_GAMEPADS && platform.gamepad.ports[id])
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					SDL_JoystickClose(platform.joysticks[id]);
 | 
										SDL_JoystickClose(platform.gamepad.ports[id]);
 | 
				
			||||||
					platform.joysticks[id] = NULL;
 | 
										platform.gamepad.ports[id] = NULL;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,8 +27,8 @@
 | 
				
			|||||||
#include "defines.h"
 | 
					#include "defines.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define TIC_VERSION_MAJOR 0
 | 
					#define TIC_VERSION_MAJOR 0
 | 
				
			||||||
#define TIC_VERSION_MINOR 60
 | 
					#define TIC_VERSION_MINOR 70
 | 
				
			||||||
#define TIC_VERSION_PATCH 3
 | 
					#define TIC_VERSION_PATCH 0
 | 
				
			||||||
#define TIC_VERSION_STATUS " dev"
 | 
					#define TIC_VERSION_STATUS " dev"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(TIC80_PRO)
 | 
					#if defined(TIC80_PRO)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user