Ver código fonte

Update references to configs

Update documentation.
feature/data-structs
TheoryOfNekomata 2 anos atrás
pai
commit
488626938a
8 arquivos alterados com 87 adições e 79 exclusões
  1. +60
    -57
      docs/reference/files/config-game.ini
  2. +4
    -0
      docs/reference/files/config-server.ini
  3. +0
    -6
      src/packages/game/input/IZ_midi.h
  4. +14
    -14
      src/packages/game/input/input.test.c
  5. +1
    -0
      src/packages/game/net/IZ_net.h
  6. +1
    -1
      src/packages/game/output/output.test.c
  7. +7
    -0
      src/packages/game/util/IZ_midi.h
  8. +0
    -1
      src/packages/server/net/IZ_net.h

docs/reference/files/config.ini → docs/reference/files/config-game.ini Ver arquivo

@@ -1,57 +1,60 @@
[Video]
Width=320
Height=240
MaxFps=30
[Joystick.0.ControlMapping]
Affirm=11
Negate=10
Action0=1
Action1=0
Action2=4
Action3=3
Action4=6
Action5=7
Action6=8
Action7=9
Action8=13
Action9=14
[Joystick.0]
DeviceID=0
AxisThreshold=8000
[Keyboard.0.ControlMapping]
Up=Up
Right=Right
Down=Down
Left=Left
Affirm=Return
Negate=Backspace
Action0=A
Action1=S
Action2=D
Action3=F
Action4=Z
Action5=X
Action6=C
Action7=V
Action8=W
Action9=E
[MIDIInput.0.ControlMapping]
Up="A#5"
Right=C6
Down=B5
Left=A5
Affirm=F5
Negate=E5
Action0=C4
Action1="C#4"
Action2=D4
Action3="D#4"
Action4=E4
Action5=F4
Action6="F#4"
Action7=G4
Action8="G#4"
Action9=A4
[MIDIInput.0]
Channel=0
DeviceID=0
[Video]
Width=320
Height=240
MaxFps=30
[Joystick.0.ControlMapping]
Affirm=11
Negate=10
Action0=1
Action1=0
Action2=4
Action3=3
Action4=6
Action5=7
Action6=8
Action7=9
Action8=13
Action9=14
[Joystick.0]
DeviceID=0
AxisThreshold=8000
[Keyboard.0.ControlMapping]
Up=Up
Right=Right
Down=Down
Left=Left
Affirm=Return
Negate=Backspace
Action0=A
Action1=S
Action2=D
Action3=F
Action4=Z
Action5=X
Action6=C
Action7=V
Action8=W
Action9=E
[MIDIInput.0.ControlMapping]
Up="A#5"
Right=C6
Down=B5
Left=A5
Affirm=F5
Negate=E5
Action0=C4
Action1="C#4"
Action2=D4
Action3="D#4"
Action4=E4
Action5=F4
Action6="F#4"
Action7=G4
Action8="G#4"
Action9=A4
[MIDIInput.0]
Channel=0
DeviceID=0
[Network]
Username=Player
Interval=200

+ 4
- 0
docs/reference/files/config-server.ini Ver arquivo

@@ -0,0 +1,4 @@
[Network]
Name=Izanagi
Motd=
Port=42069

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

@@ -15,12 +15,6 @@

#define MIDI_EVENT_BUFFER_SIZE 1024

typedef u8 IZ_MIDINote;

static const u8 IZ_MIDI_NOTE_ON = 0x90u;

static const u8 IZ_MIDI_NOTE_OFF = 0x80u;

typedef struct {
PmDeviceID device_id;
u8 channel;


+ 14
- 14
src/packages/game/input/input.test.c Ver arquivo

@@ -41,7 +41,7 @@ spec("input") {
}

it("sets initial state") {
IZ_JoystickInitialize(&state, "config.ini", 0, NULL);
IZ_JoystickInitialize(&state, "config-game.ini", 0, NULL);

check(mock_is_called(SDL_memcpy), "Initial state not loaded.");
check(mock_is_called(SDL_NumJoysticks), "Connected joysticks not checked.");
@@ -50,7 +50,7 @@ spec("input") {
it("calls load method") {
mock_set_expected_calls(ini_getl, ((CONTROLS - 4) + 2) * IZ_PLAYERS);

IZ_JoystickInitialize(&state, "config.ini", 0, NULL);
IZ_JoystickInitialize(&state, "config-game.ini", 0, NULL);

check(
mock_get_expected_calls(ini_getl) == mock_get_actual_calls(ini_getl),
@@ -63,7 +63,7 @@ spec("input") {
it("calls save method") {
mock_set_expected_calls(ini_putl, ((CONTROLS - 4) + 2) * IZ_PLAYERS);

IZ_JoystickInitialize(&state, "config.ini", 0, NULL);
IZ_JoystickInitialize(&state, "config-game.ini", 0, NULL);

check(
mock_get_expected_calls(ini_putl) == mock_get_actual_calls(ini_putl),
@@ -76,7 +76,7 @@ spec("input") {
it("opens device handles") {
mock_set_expected_calls(SDL_JoystickOpen, MOCK_OPEN_JOYSTICKS);

IZ_JoystickInitialize(&state, "config.ini", 0, NULL);
IZ_JoystickInitialize(&state, "config-game.ini", 0, NULL);

check(
mock_get_expected_calls(SDL_JoystickOpen) == mock_get_actual_calls(SDL_JoystickOpen),
@@ -351,7 +351,7 @@ spec("input") {
it("calls save method") {
mock_set_expected_calls(ini_putl, ((CONTROLS - 4) + 2) * IZ_PLAYERS);

IZ_JoystickSaveConfig(&state, "config.ini");
IZ_JoystickSaveConfig(&state, "config-game.ini");

check(
mock_get_expected_calls(ini_putl) == mock_get_actual_calls(ini_putl),
@@ -416,7 +416,7 @@ spec("input") {
}

it("sets initial state") {
IZ_KeyboardInitialize(&state, "config.ini", 0, NULL);
IZ_KeyboardInitialize(&state, "config-game.ini", 0, NULL);

check(mock_is_called(SDL_memcpy), "Initial state not loaded.");
}
@@ -424,7 +424,7 @@ spec("input") {
it("calls load method") {
mock_set_expected_calls(ini_gets, CONTROLS * IZ_PLAYERS);

IZ_KeyboardInitialize(&state, "config.ini", 0, NULL);
IZ_KeyboardInitialize(&state, "config-game.ini", 0, NULL);

check(
mock_get_expected_calls(ini_gets) == mock_get_actual_calls(ini_gets),
@@ -437,7 +437,7 @@ spec("input") {
it("calls save method") {
mock_set_expected_calls(ini_puts, CONTROLS * IZ_PLAYERS);

IZ_KeyboardInitialize(&state, "config.ini", 0, NULL);
IZ_KeyboardInitialize(&state, "config-game.ini", 0, NULL);

check(
mock_get_expected_calls(ini_puts) == mock_get_actual_calls(ini_puts),
@@ -504,7 +504,7 @@ spec("input") {
it("calls save method") {
mock_set_expected_calls(ini_puts, CONTROLS * IZ_PLAYERS);

IZ_KeyboardSaveConfig("config.ini", &state);
IZ_KeyboardSaveConfig("config-game.ini", &state);

check(
mock_get_expected_calls(ini_puts) == mock_get_actual_calls(ini_puts),
@@ -549,7 +549,7 @@ spec("input") {
}

it("sets initial state") {
IZ_MIDIInputInitialize(&state, "config.ini", 0, NULL);
IZ_MIDIInputInitialize(&state, "config-game.ini", 0, NULL);

check(mock_is_called(SDL_memcpy), "Initial state not loaded.");
check(mock_is_called(Pm_CountDevices), "Connected MIDI devices not checked.");
@@ -559,7 +559,7 @@ spec("input") {
mock_set_expected_calls(ini_gets, CONTROLS * IZ_PLAYERS);
mock_set_expected_calls(ini_getl, 2 * IZ_PLAYERS);

IZ_MIDIInputInitialize(&state, "config.ini", 0, NULL);
IZ_MIDIInputInitialize(&state, "config-game.ini", 0, NULL);

check(
mock_get_expected_calls(ini_gets) == mock_get_actual_calls(ini_gets),
@@ -580,7 +580,7 @@ spec("input") {
mock_set_expected_calls(ini_puts, CONTROLS * IZ_PLAYERS);
mock_set_expected_calls(ini_putl, 2 * IZ_PLAYERS);

IZ_MIDIInputInitialize(&state, "config.ini", 0, NULL);
IZ_MIDIInputInitialize(&state, "config-game.ini", 0, NULL);

check(
mock_get_expected_calls(ini_puts) == mock_get_actual_calls(ini_puts),
@@ -600,7 +600,7 @@ spec("input") {
it("opens device handles") {
mock_set_expected_calls(Pm_OpenInput, MOCK_OPEN_JOYSTICKS);

IZ_MIDIInputInitialize(&state, "config.ini", 0, NULL);
IZ_MIDIInputInitialize(&state, "config-game.ini", 0, NULL);

check(
mock_get_expected_calls(Pm_OpenInput) == mock_get_actual_calls(Pm_OpenInput),
@@ -626,7 +626,7 @@ spec("input") {
mock_set_expected_calls(ini_puts, CONTROLS * IZ_PLAYERS);
mock_set_expected_calls(ini_putl, 2 * IZ_PLAYERS);

IZ_MIDIInputSaveConfig("config.ini", &state);
IZ_MIDIInputSaveConfig("config-game.ini", &state);

check(
mock_get_expected_calls(ini_puts) == mock_get_actual_calls(ini_puts),


+ 1
- 0
src/packages/game/net/IZ_net.h Ver arquivo

@@ -21,6 +21,7 @@ typedef struct {
IZ_WSClientInitializeParams params;
void* callback;
IZ_Action action[IZ_PLAYERS];
// TODO add message queue
} IZ_NetState;

static IZ_NetState IZ_NET_DEFAULT_STATE = {


+ 1
- 1
src/packages/game/output/output.test.c Ver arquivo

@@ -21,7 +21,7 @@ spec("output") {
it("calls save method") {
mock_set_expected_calls(ini_putl, 3);

IZ_VideoSaveConfig(&config, "config.ini");
IZ_VideoSaveConfig(&config, "config-game.ini");

check(
mock_get_expected_calls(ini_putl) == mock_get_actual_calls(ini_putl),


+ 7
- 0
src/packages/game/util/IZ_midi.h Ver arquivo

@@ -5,7 +5,14 @@
#include <string.h>
#include "../IZ_common.h"

typedef u8 IZ_MIDINote;

static const u8 IZ_MIDI_NOTE_ON = 0x90u;

static const u8 IZ_MIDI_NOTE_OFF = 0x80u;

char* IZ_MIDIGetNoteName(u8);

u8 IZ_MIDIGetNoteFromName(char*);

#endif

+ 0
- 1
src/packages/server/net/IZ_net.h Ver arquivo

@@ -18,7 +18,6 @@ typedef struct {
typedef struct {
IZ_NetConfig config;
IZ_Websocket ws;
// TODO add message queue
} IZ_NetState;

static IZ_NetState IZ_NET_DEFAULT_STATE = {


Carregando…
Cancelar
Salvar