Ver código fonte

Update input code

Correctly include portmidi in tests.
master
TheoryOfNekomata 1 ano atrás
pai
commit
f4799aa679
5 arquivos alterados com 6 adições e 31 exclusões
  1. +1
    -0
      TODO.md
  2. +1
    -24
      __mocks__/subprojects/portmidi/portmidi.mock.h
  3. +1
    -1
      src/packages/game/input/IZ_action.h
  4. +3
    -2
      src/packages/game/input/IZ_joystick.h
  5. +0
    -4
      src/packages/game/input/IZ_midi.h

+ 1
- 0
TODO.md Ver arquivo

@@ -1,6 +1,7 @@
- [X] Improve logging (remove SDL/lws dependency)
- [X] Unify memset/memcpy/free/malloc functions (remove SDL/lws dependency)
- [ ] Revisit unit tests
- [ ] Implement character sprites + animations
- [ ] Implement memory pool
- [ ] Fix gamepad mapping
- [ ] Provide default mapping


+ 1
- 24
__mocks__/subprojects/portmidi/portmidi.mock.h Ver arquivo

@@ -1,32 +1,9 @@
#ifndef PORTMIDI_MOCK_H
#define PORTMIDI_MOCK_H

#define PORTMIDI_INCLUDED

#include <portmidi.h>
#include "../../../src/packages/common/IZ_common.h"

typedef i32 PmDeviceID;
typedef void PortMidiStream;
typedef i32 PmTimestamp;
typedef PmTimestamp (*PmTimeProcPtr)(void *time_info);
typedef i32 PmMessage;
typedef struct {
PmMessage message;
PmTimestamp timestamp;
} PmEvent;
typedef struct {
int structVersion; /**< @brief this internal structure version */
const char *interf; /**< @brief underlying MIDI API, e.g.
"MMSystem" or "DirectX" */
char *name; /**< @brief device name, e.g. "USB MidiSport 1x1" */
int input; /**< @brief true iff input is available */
int output; /**< @brief true iff output is available */
int opened; /**< @brief used by generic PortMidi for error checking */
int is_virtual; /**< @brief true iff this is/was a virtual device */
} PmDeviceInfo;

#define PmStream PortMidiStream

static PmDeviceInfo MOCK_DEVICE_INFO = {
.output = 1,
.input = 1,


+ 1
- 1
src/packages/game/input/IZ_action.h Ver arquivo

@@ -3,7 +3,7 @@

#include "../../common/IZ_common.h"

#define IZ_CONTROLS (unsigned char) 16
#define IZ_CONTROLS ((u8) 16)

typedef u16 IZ_Action;



+ 3
- 2
src/packages/game/input/IZ_joystick.h Ver arquivo

@@ -5,6 +5,7 @@
#include <SDL_gamecontroller.h>
#include <SDL_events.h>
#include <minIni.h>
#include "../../common/IZ_common.h"
#include "../../config/IZ_config.h"
#include "../../stdinc/IZ_string.h"
#include "../../stdinc/IZ_stdlib.h"
@@ -12,7 +13,7 @@

typedef u8 IZ_PadButton;

static const u16 IZ_DEFAULT_AXIS_THRESHOLD = 8000;
#define IZ_DEFAULT_AXIS_THRESHOLD ((u16) 8000)

typedef enum {
IZ_JOY_AXIS_DIRECTION_HORIZONTAL1 = 0,
@@ -56,7 +57,7 @@ static const IZ_JoystickState IZ_JOYSTICK_DEFAULT_STATE[IZ_PLAYERS] = {
13,
14,
},
.axis_threshold = 8000u,
.axis_threshold = IZ_DEFAULT_AXIS_THRESHOLD,
.device_id = 0,
.guid = {
.data = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }


+ 0
- 4
src/packages/game/input/IZ_midi.h Ver arquivo

@@ -2,11 +2,7 @@
#define IZ_MIDI_H

#include <string.h>

#ifndef PORTMIDI_INCLUDED
#define PORTMIDI_INCLUDED
#include <portmidi.h>
#endif

#include <minIni.h>
#include "../../config/IZ_config.h"


Carregando…
Cancelar
Salvar