can run simple animations in simulator. random support for simulator still needs work.
This commit is contained in:
parent
a7b074a889
commit
1598091e0c
2
Makefile
2
Makefile
|
@ -120,7 +120,7 @@ SUBDIROBJECTS_SIM = $(foreach subdir,$(SUBDIRS_SIM),$(foreach object,$(shell cat
|
|||
OBJECTS_SIM = $(patsubst %.c,obj_sim/%.o,${SRC_SIM})
|
||||
|
||||
$(TARGET_SIM): $(OBJECTS_SIM) $(SUBDIROBJECTS_SIM)
|
||||
$(HOSTCC) $(LDFLAGS_SIM) $(LIBS_SIM) -o $@ $(SUBDIROBJECTS_SIM)
|
||||
$(HOSTCC) $(LDFLAGS_SIM) -o $@ $(OBJECTS_SIM) $(SUBDIROBJECTS_SIM) $(LIBS_SIM)
|
||||
|
||||
./obj_sim/%.o: %.c
|
||||
@ if [ ! -d obj_sim ]; then mkdir obj_sim ; fi
|
||||
|
|
|
@ -3,7 +3,7 @@ TOPDIR = ..
|
|||
|
||||
include $(TOPDIR)/defaults.mk
|
||||
|
||||
SRC_SIM = main.c trackball.c
|
||||
SRC_SIM = main.c trackball.c util.c
|
||||
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
#include "joystick.h"
|
||||
|
||||
// fake function since our keybord doesn't need any initialisation
|
||||
void joy_init()
|
||||
{
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef JOYSTICK_H_
|
||||
#define JOYSTICK_H_
|
||||
|
||||
unsigned char fakeport;
|
||||
|
||||
#define JOYISFIRE (0x01 & fakeport)
|
||||
#define JOYISLEFT (0x02 & fakeport)
|
||||
#define JOYISRIGHT (0x04 & fakeport)
|
||||
#define JOYISDOWN (0x08 & fakeport)
|
||||
#define JOYISUP (0x10 & fakeport)
|
||||
|
||||
unsigned char waitForFire;
|
||||
|
||||
|
||||
#endif /*JOYSTICK_H_*/
|
|
@ -0,0 +1,26 @@
|
|||
#include <stdlib.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <setjmp.h>
|
||||
#include "joystick.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
extern jmp_buf newmode_jmpbuf;
|
||||
|
||||
void wait(unsigned int ms) {
|
||||
if (waitForFire) {
|
||||
if (JOYISFIRE) {
|
||||
longjmp(newmode_jmpbuf, 43);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
Sleep(ms);
|
||||
#else
|
||||
usleep(ms*1000);
|
||||
#endif
|
||||
}
|
Loading…
Reference in New Issue