jjdjd
a
This commit is contained in:
parent
9db68c9754
commit
1dcea1a2cf
3
.vscode/c_cpp_properties.json
vendored
3
.vscode/c_cpp_properties.json
vendored
|
@ -3,7 +3,8 @@
|
||||||
{
|
{
|
||||||
"name": "Win32",
|
"name": "Win32",
|
||||||
"includePath": [
|
"includePath": [
|
||||||
"${workspaceFolder}/**"
|
"${workspaceFolder}/**",
|
||||||
|
"${workspaceFolder}/source/fumoengine/input"
|
||||||
],
|
],
|
||||||
"defines": [
|
"defines": [
|
||||||
"_DEBUG",
|
"_DEBUG",
|
||||||
|
|
|
@ -57,7 +57,8 @@
|
||||||
"streambuf": "cpp",
|
"streambuf": "cpp",
|
||||||
"typeinfo": "cpp",
|
"typeinfo": "cpp",
|
||||||
"execution": "cpp",
|
"execution": "cpp",
|
||||||
"stdbool.h": "c"
|
"stdbool.h": "c",
|
||||||
|
"fumoengine.h": "c"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,11 @@
|
||||||
#include "gametime.h"
|
#include "fumocommon.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#define ONE_E_9 1000000000
|
|
||||||
|
size_t MinSize(size_t a, size_t b)
|
||||||
|
{
|
||||||
|
return a < b ? a : b;
|
||||||
|
}
|
||||||
|
|
||||||
Time TimeNow()
|
Time TimeNow()
|
||||||
{
|
{
|
|
@ -1,9 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define nullptr ((void *)0)
|
#define nullptr ((void *)0)
|
||||||
|
|
||||||
|
#define ONE_E_9 1000000000
|
||||||
|
|
||||||
|
|
||||||
typedef uint8_t u8;
|
typedef uint8_t u8;
|
||||||
typedef uint_fast8_t u8f;
|
typedef uint_fast8_t u8f;
|
||||||
|
@ -31,47 +32,11 @@ typedef int64_t i64;
|
||||||
typedef int_fast64_t i64f;
|
typedef int_fast64_t i64f;
|
||||||
|
|
||||||
|
|
||||||
size_t min_size(size_t a, size_t b);
|
typedef u64 Time;
|
||||||
|
|
||||||
|
|
||||||
/*const u8 I[16] = {
|
size_t MinSize(size_t a, size_t b);
|
||||||
0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0,
|
|
||||||
1, 1, 1, 1,
|
|
||||||
0, 0, 0, 0
|
|
||||||
};
|
|
||||||
|
|
||||||
const u8 O[4] = {
|
Time TimeNow();
|
||||||
1, 1,
|
|
||||||
1, 1
|
|
||||||
};
|
|
||||||
|
|
||||||
const u8 T[9] = {
|
double TimeNowD();
|
||||||
0, 1, 0,
|
|
||||||
1, 1, 1,
|
|
||||||
0, 0, 0
|
|
||||||
};
|
|
||||||
|
|
||||||
const u8 S[9] = {
|
|
||||||
0, 1, 1,
|
|
||||||
1, 1, 0,
|
|
||||||
0, 0, 0
|
|
||||||
};
|
|
||||||
|
|
||||||
const u8 Z[9] = {
|
|
||||||
1, 1, 0,
|
|
||||||
0, 1, 1,
|
|
||||||
0, 0, 0
|
|
||||||
};
|
|
||||||
|
|
||||||
const u8 J[9] = {
|
|
||||||
1, 0, 0,
|
|
||||||
1, 1, 1,
|
|
||||||
0, 0, 0
|
|
||||||
};
|
|
||||||
|
|
||||||
const u8 L[9] = {
|
|
||||||
0, 0, 1,
|
|
||||||
1, 1, 1,
|
|
||||||
0, 0, 0
|
|
||||||
};*/
|
|
|
@ -1,17 +1,8 @@
|
||||||
#include <iso646.h>
|
|
||||||
#include <pthread.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "ctrl.h"
|
#include "ctrl.h"
|
||||||
#include "input.h"
|
|
||||||
#include "fumotris.h"
|
|
||||||
#include "term.h"
|
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
#include "platform.h"
|
#include "fumocommon.h"
|
||||||
|
|
||||||
|
|
||||||
void ErrorExit(char *message)
|
void ErrorExit(char *message)
|
||||||
{
|
{
|
||||||
|
@ -19,32 +10,30 @@ void ErrorExit(char *message)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Game {
|
struct FumoGame {
|
||||||
struct Event Start;
|
struct Controller ctrl;
|
||||||
struct Event Draw;
|
struct InputHandle input_hand;
|
||||||
struct Event Update;
|
|
||||||
|
struct Event start;
|
||||||
|
struct Event draw;
|
||||||
|
struct Event update;
|
||||||
|
|
||||||
Time time;
|
Time time;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Event hi;
|
bool FumoEngineInit(struct FumoGame *game)
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
{
|
||||||
if (!PlatformInit())
|
if (!PlatformInit())
|
||||||
ErrorExit("Platform failed to initialize");
|
ErrorExit("Platform failed to initialize");
|
||||||
|
|
||||||
struct Controller ctrl;
|
if (!CreateCtrl(&game->ctrl))
|
||||||
if (!CreateCtrl(&ctrl))
|
|
||||||
ErrorExit("Out of memory");
|
ErrorExit("Out of memory");
|
||||||
|
|
||||||
CtrlMap(&ctrl, 0, BUTTON, 'A');
|
//CtrlMap(&ctrl, 0, BUTTON, 'A');
|
||||||
|
|
||||||
struct Game game;
|
CreateEvent(&game->update);
|
||||||
CreateEvent(&game.Update);
|
|
||||||
|
|
||||||
struct InputHandle input_hand;
|
if (!BeginInputThread(&game->input_hand, &game->input_hand.recs, &ctrl.str))
|
||||||
if (!BeginInputThread(&input_hand, &ctrl.recs, &ctrl.str))
|
|
||||||
ErrorExit("Input handle failed to initialize");
|
ErrorExit("Input handle failed to initialize");
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -56,9 +45,7 @@ int main()
|
||||||
if (!InputRelease(&input_hand))
|
if (!InputRelease(&input_hand))
|
||||||
ErrorExit("Release failed");
|
ErrorExit("Release failed");
|
||||||
|
|
||||||
_sleep(100);
|
EventInvokeUpdate(&game.update, 0);
|
||||||
|
|
||||||
EventInvokeUpdate(&game.Update, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
|
@ -5,8 +5,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "fumotris.h"
|
#include "fumocommon.h"
|
||||||
#include "gametime.h"
|
|
||||||
|
|
||||||
union func {
|
union func {
|
||||||
void (*generic)(void *arg);
|
void (*generic)(void *arg);
|
|
@ -4,7 +4,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "fumotris.h"
|
#include "fumocommon.h"
|
||||||
|
|
||||||
|
|
||||||
typedef u32 hashtype;
|
typedef u32 hashtype;
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "fumotris.h"
|
#include "fumocommon.h"
|
||||||
|
|
||||||
|
|
||||||
typedef u32 hashtype;
|
typedef u32 hashtype;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include "ringbuffer.h"
|
#include "ringbuffer.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
void *get_ptr(RingBufferT T, struct RingBufferHead *head, size_t i)
|
void *get_ptr(RingBufferT T, struct RingBufferHead *head, size_t i)
|
||||||
{
|
{
|
||||||
u8 *bytes = (u8 *)head;
|
u8 *bytes = (u8 *)head;
|
||||||
|
@ -35,7 +37,7 @@ void RingBufferTransfer(
|
||||||
struct RingBufferHead *dest,
|
struct RingBufferHead *dest,
|
||||||
struct RingBufferHead *tmp
|
struct RingBufferHead *tmp
|
||||||
) {
|
) {
|
||||||
size_t copy_max = min_size(T->LEN - dest->len, tmp->len);
|
size_t copy_max = MinSize(T->LEN - dest->len, tmp->len);
|
||||||
|
|
||||||
for (size_t i = 0; i < copy_max; i++) {
|
for (size_t i = 0; i < copy_max; i++) {
|
||||||
void *to = RingBufferGet(T, dest, dest->len + i);
|
void *to = RingBufferGet(T, dest, dest->len + i);
|
||||||
|
@ -53,7 +55,7 @@ size_t RingBufferOut(
|
||||||
void *dest,
|
void *dest,
|
||||||
struct RingBufferHead *src
|
struct RingBufferHead *src
|
||||||
) {
|
) {
|
||||||
size_t copy_max = min_size(n, src->len);
|
size_t copy_max = MinSize(n, src->len);
|
||||||
|
|
||||||
for (size_t i = 0; i < copy_max; i++) {
|
for (size_t i = 0; i < copy_max; i++) {
|
||||||
void *to = (u8 *)dest + i * T->SIZE;
|
void *to = (u8 *)dest + i * T->SIZE;
|
|
@ -2,10 +2,9 @@
|
||||||
#include <iso646.h>
|
#include <iso646.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "fumotris.h"
|
#include "fumocommon.h"
|
||||||
|
|
||||||
|
|
||||||
typedef const struct RingBufferT {
|
typedef const struct RingBufferT {
|
||||||
size_t OFFSET;
|
size_t OFFSET;
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#define INIT_SIZE 16
|
#define INIT_SIZE 16
|
||||||
|
|
||||||
|
|
||||||
bool CreateCtrl(struct Controller *ctrl)
|
bool CreateCtrl(struct Controller *ctrl)
|
||||||
{
|
{
|
||||||
struct ctrl_bkt *code_bkts = calloc(INIT_SIZE, sizeof(struct ctrl_bkt));
|
struct ctrl_bkt *code_bkts = calloc(INIT_SIZE, sizeof(struct ctrl_bkt));
|
||||||
|
@ -14,7 +15,6 @@ bool CreateCtrl(struct Controller *ctrl)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
*ctrl = (struct Controller) {
|
*ctrl = (struct Controller) {
|
||||||
.recs.head = RINGBUF_HEAD_INIT,
|
|
||||||
.pending_buf.len = 0,
|
.pending_buf.len = 0,
|
||||||
|
|
||||||
.axis_vec = (struct ctrl_axis_vec) {
|
.axis_vec = (struct ctrl_axis_vec) {
|
||||||
|
@ -144,7 +144,7 @@ void dispatch_update(struct InputAxis *axis, struct InputRecord *rec)
|
||||||
axis->data = rec->data;
|
axis->data = rec->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CtrlPoll(struct Controller *ctrl)
|
void CtrlPoll(struct Controller *ctrl, struct InputRecordBuf *recs)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < ctrl->pending_buf.len; i++) {
|
for (size_t i = 0; i < ctrl->pending_buf.len; i++) {
|
||||||
struct InputAxis *axis = ctrl->pending_buf.axes[i];
|
struct InputAxis *axis = ctrl->pending_buf.axes[i];
|
||||||
|
@ -154,8 +154,8 @@ void CtrlPoll(struct Controller *ctrl)
|
||||||
}
|
}
|
||||||
ctrl->pending_buf.len = 0;
|
ctrl->pending_buf.len = 0;
|
||||||
|
|
||||||
for (size_t i = 0; i < ctrl->recs.head.len; i++) {
|
for (size_t i = 0; i < recs->head.len; i++) {
|
||||||
struct InputRecord *rec = &ctrl->recs.buf[i];
|
struct InputRecord *rec = &recs->buf[i];
|
||||||
|
|
||||||
struct InputAxis *axis = find_axis(&ctrl->binds, rec->id);
|
struct InputAxis *axis = find_axis(&ctrl->binds, rec->id);
|
||||||
if (axis == nullptr)
|
if (axis == nullptr)
|
||||||
|
@ -165,12 +165,7 @@ void CtrlPoll(struct Controller *ctrl)
|
||||||
ctrl->pending_buf.axes[ctrl->pending_buf.len++] = axis;
|
ctrl->pending_buf.axes[ctrl->pending_buf.len++] = axis;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctrl->recs.head.len = 0;
|
recs->head.len = 0;
|
||||||
}
|
|
||||||
|
|
||||||
size_t CtrlInputString(struct Controller *ctrl, size_t n, char *buf)
|
|
||||||
{
|
|
||||||
return RingBufferOut(&STR_BUF_T, n, buf, &ctrl->str.head);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*int main()
|
/*int main()
|
|
@ -5,10 +5,10 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "fumotris.h"
|
#include "fumocommon.h"
|
||||||
#include "gametime.h"
|
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
|
||||||
|
|
||||||
struct InputAxis {
|
struct InputAxis {
|
||||||
Time last_pressed;
|
Time last_pressed;
|
||||||
Time last_released;
|
Time last_released;
|
||||||
|
@ -47,9 +47,6 @@ struct ctrl_axis_vec {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Controller {
|
struct Controller {
|
||||||
struct InputRecordBuf recs;
|
|
||||||
struct InputStringBuf str;
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct InputAxis *axes[IO_BUF_SIZE];
|
struct InputAxis *axes[IO_BUF_SIZE];
|
||||||
u8f len;
|
u8f len;
|
||||||
|
@ -68,9 +65,7 @@ bool CtrlMap(struct Controller *ctrl, u16f code, u16f type, u16f bind);
|
||||||
|
|
||||||
struct InputAxis *CtrlGet(struct Controller *ctrl, u16f code, u16f type);
|
struct InputAxis *CtrlGet(struct Controller *ctrl, u16f code, u16f type);
|
||||||
|
|
||||||
void CtrlPoll(struct Controller *ctrl);
|
void CtrlPoll(struct Controller *ctrl, struct InputRecordBuf *recs);
|
||||||
|
|
||||||
size_t CtrlInputString(struct Controller *ctrl, size_t n, char *buf);
|
|
||||||
|
|
||||||
enum ControlCode {
|
enum ControlCode {
|
||||||
LEFT,
|
LEFT,
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
|
|
||||||
const struct RingBufferT IO_BUF_T = {
|
const struct RingBufferT IO_BUF_T = {
|
||||||
.OFFSET = offsetof(struct InputRecordBuf, buf),
|
.OFFSET = offsetof(struct InputRecordBuf, buf),
|
||||||
.SIZE = sizeof(struct InputRecord),
|
.SIZE = sizeof(struct InputRecord),
|
||||||
|
@ -15,6 +16,7 @@ const struct RingBufferT STR_BUF_T = {
|
||||||
.LEN = STR_BUF_SIZE
|
.LEN = STR_BUF_SIZE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void *input_worker(void *arg)
|
void *input_worker(void *arg)
|
||||||
{
|
{
|
||||||
struct InputHandle *hand = arg;
|
struct InputHandle *hand = arg;
|
||||||
|
@ -111,3 +113,8 @@ bool InputRelease(struct InputHandle *hand)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t InputString(struct InputStringBuf *str, size_t n, char *buf)
|
||||||
|
{
|
||||||
|
return RingBufferOut(&STR_BUF_T, n, buf, &str->head);
|
||||||
|
}
|
|
@ -6,13 +6,17 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
#include "fumotris.h"
|
#include "fumocommon.h"
|
||||||
#include "gametime.h"
|
|
||||||
#include "ringbuffer.h"
|
#include "ringbuffer.h"
|
||||||
|
|
||||||
#define IO_BUF_SIZE 16
|
#define IO_BUF_SIZE 16
|
||||||
#define STR_BUF_SIZE (IO_BUF_SIZE * 4)
|
#define STR_BUF_SIZE (IO_BUF_SIZE * 4)
|
||||||
|
|
||||||
|
|
||||||
|
extern const struct RingBufferT IO_BUF_T;
|
||||||
|
extern const struct RingBufferT STR_BUF_T;
|
||||||
|
|
||||||
|
|
||||||
enum InputType {
|
enum InputType {
|
||||||
BUTTON,
|
BUTTON,
|
||||||
AXIS,
|
AXIS,
|
||||||
|
@ -32,12 +36,15 @@ union InputID {
|
||||||
u32 hash;
|
u32 hash;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct Button {
|
struct Button {
|
||||||
u64 value;
|
u64 value;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Axis {
|
struct Axis {
|
||||||
i64 value;
|
i64 value;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Joystick {
|
struct Joystick {
|
||||||
i32 x;
|
i32 x;
|
||||||
i32 y;
|
i32 y;
|
||||||
|
@ -49,6 +56,7 @@ union InputData {
|
||||||
struct Joystick input_js;
|
struct Joystick input_js;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct InputRecord {
|
struct InputRecord {
|
||||||
Time time;
|
Time time;
|
||||||
|
|
||||||
|
@ -68,22 +76,20 @@ struct InputRecord {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const struct RingBufferT IO_BUF_T;
|
struct InputBuffer {
|
||||||
extern const struct RingBufferT STR_BUF_T;
|
struct {
|
||||||
|
|
||||||
struct InputRecordBuf {
|
|
||||||
struct RingBufferHead head;
|
struct RingBufferHead head;
|
||||||
struct InputRecord buf[IO_BUF_SIZE];
|
struct InputRecord buf[IO_BUF_SIZE];
|
||||||
};
|
} recs;
|
||||||
|
|
||||||
struct InputStringBuf {
|
struct {
|
||||||
struct RingBufferHead head;
|
struct RingBufferHead head;
|
||||||
char buf[STR_BUF_SIZE];
|
char buf[STR_BUF_SIZE];
|
||||||
|
} str;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct InputHandle {
|
struct InputHandle {
|
||||||
struct InputRecordBuf *recs;
|
struct InputBuffer in;
|
||||||
struct InputStringBuf *str;
|
|
||||||
|
|
||||||
pthread_t thread;
|
pthread_t thread;
|
||||||
pthread_mutex_t mutex;
|
pthread_mutex_t mutex;
|
||||||
|
@ -95,8 +101,7 @@ struct InputHandle {
|
||||||
|
|
||||||
bool BeginInputThread(
|
bool BeginInputThread(
|
||||||
struct InputHandle *hand,
|
struct InputHandle *hand,
|
||||||
struct InputRecordBuf *in,
|
struct InputBuffer *in,
|
||||||
struct InputStringBuf *str
|
|
||||||
);
|
);
|
||||||
|
|
||||||
bool EndInputThread(struct InputHandle *hand);
|
bool EndInputThread(struct InputHandle *hand);
|
||||||
|
@ -104,3 +109,5 @@ bool EndInputThread(struct InputHandle *hand);
|
||||||
bool InputAquire(struct InputHandle *hand);
|
bool InputAquire(struct InputHandle *hand);
|
||||||
|
|
||||||
bool InputRelease(struct InputHandle *hand);
|
bool InputRelease(struct InputHandle *hand);
|
||||||
|
|
||||||
|
size_t InputString(struct Controller *ctrl, size_t n, char *buf);
|
|
@ -1,5 +1,6 @@
|
||||||
#include "parseinput.h"
|
#include "parseinput.h"
|
||||||
|
|
||||||
|
|
||||||
void ReadButton(struct InputRecord *rec, u16f bind, bool is_down)
|
void ReadButton(struct InputRecord *rec, u16f bind, bool is_down)
|
||||||
{
|
{
|
||||||
rec->id = (union InputID) { .bind = bind, .type = BUTTON };
|
rec->id = (union InputID) { .bind = bind, .type = BUTTON };
|
|
@ -4,9 +4,10 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "fumotris.h"
|
#include "fumocommon.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
|
||||||
|
|
||||||
void ReadButton(struct InputRecord *rec, u16f bind, bool is_down);
|
void ReadButton(struct InputRecord *rec, u16f bind, bool is_down);
|
||||||
|
|
||||||
void ReadAxis(struct InputRecord *rec, u16f bind, u64 value);
|
void ReadAxis(struct InputRecord *rec, u16f bind, u64 value);
|
|
@ -5,13 +5,13 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "fumotris.h"
|
#include "fumocommon.h"
|
||||||
#include "gametime.h"
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
bool PlatformInit();
|
bool PlatformInit();
|
||||||
|
|
||||||
bool PlatformGetRefreshRate(u16f *out);
|
bool PlatformGetRefreshRate(u16f *out);
|
|
@ -1,9 +1,6 @@
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#include "gametime.h"
|
|
||||||
#include "input.h"
|
|
||||||
#include "parseinput.h"
|
#include "parseinput.h"
|
||||||
#include "ringbuffer.h"
|
#include "ringbuffer.h"
|
||||||
|
|
|
@ -5,4 +5,4 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "fumotris.h"
|
#include "fumocommon.h"
|
|
@ -1,13 +1,12 @@
|
||||||
#include <iso646.h>
|
#include <iso646.h>
|
||||||
#include <pthread.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <pthread.h>
|
|
||||||
|
|
||||||
#include "fumotris.h"
|
#include "fumocommon.h"
|
||||||
|
|
||||||
|
|
||||||
struct TChar4 {
|
struct TChar4 {
|
||||||
char ch;
|
char ch;
|
|
@ -6,9 +6,9 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <pthread.h>
|
|
||||||
|
|
||||||
#include "fumotris.h"
|
#include "fumocommon.h"
|
||||||
|
|
||||||
|
|
||||||
struct TChar4 {
|
struct TChar4 {
|
||||||
char ch;
|
char ch;
|
|
@ -1,6 +1,43 @@
|
||||||
#include "fumotris.h"
|
|
||||||
|
|
||||||
size_t min_size(size_t a, size_t b)
|
|
||||||
{
|
/*const u8 I[16] = {
|
||||||
return a < b ? a : b;
|
0, 0, 0, 0,
|
||||||
}
|
0, 0, 0, 0,
|
||||||
|
1, 1, 1, 1,
|
||||||
|
0, 0, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
const u8 O[4] = {
|
||||||
|
1, 1,
|
||||||
|
1, 1
|
||||||
|
};
|
||||||
|
|
||||||
|
const u8 T[9] = {
|
||||||
|
0, 1, 0,
|
||||||
|
1, 1, 1,
|
||||||
|
0, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
const u8 S[9] = {
|
||||||
|
0, 1, 1,
|
||||||
|
1, 1, 0,
|
||||||
|
0, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
const u8 Z[9] = {
|
||||||
|
1, 1, 0,
|
||||||
|
0, 1, 1,
|
||||||
|
0, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
const u8 J[9] = {
|
||||||
|
1, 0, 0,
|
||||||
|
1, 1, 1,
|
||||||
|
0, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
const u8 L[9] = {
|
||||||
|
0, 0, 1,
|
||||||
|
1, 1, 1,
|
||||||
|
0, 0, 0
|
||||||
|
};*/
|
|
@ -6,9 +6,10 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "fumotris.h"
|
#include "fumocommon.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
|
||||||
|
|
||||||
struct TetrMap {
|
struct TetrMap {
|
||||||
size_t wid;
|
size_t wid;
|
||||||
size_t hgt;
|
size_t hgt;
|
|
@ -6,9 +6,10 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "fumotris.h"
|
#include "fumocommon.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
|
||||||
|
|
||||||
struct TetrMap {
|
struct TetrMap {
|
||||||
size_t wid;
|
size_t wid;
|
||||||
size_t hgt;
|
size_t hgt;
|
|
@ -1,11 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include "fumotris.h"
|
|
||||||
|
|
||||||
typedef u64 Time;
|
|
||||||
|
|
||||||
Time TimeNow();
|
|
||||||
|
|
||||||
double TimeNowD();
|
|
Loading…
Reference in a new issue