integrating simulator
This commit is contained in:
parent
b66067f50e
commit
a7b074a889
46
Makefile
46
Makefile
|
@ -4,16 +4,29 @@ TOPDIR = .
|
||||||
|
|
||||||
SRC = \
|
SRC = \
|
||||||
main.c \
|
main.c \
|
||||||
|
display_loop.c \
|
||||||
eeprom_reserve.c \
|
eeprom_reserve.c \
|
||||||
pixel.c \
|
pixel.c \
|
||||||
util.c \
|
util.c \
|
||||||
|
|
||||||
|
SRC_SIM = \
|
||||||
|
display_loop.c \
|
||||||
|
pixel.c \
|
||||||
|
|
||||||
|
|
||||||
LAUNCH_BOOTLOADER = launch-bootloader
|
LAUNCH_BOOTLOADER = launch-bootloader
|
||||||
SERIAL = /dev/ttyUSB0
|
SERIAL = /dev/ttyUSB0
|
||||||
|
|
||||||
export TOPDIR
|
export TOPDIR
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
|
all: compile-$(TARGET)
|
||||||
|
@echo "==============================="
|
||||||
|
@echo "$(TARGET) compiled for: $(MCU)"
|
||||||
|
@echo "size is: "
|
||||||
|
@${TOPDIR}/scripts/size $(TARGET)
|
||||||
|
@echo "==============================="
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# generic fluff
|
# generic fluff
|
||||||
include defaults.mk
|
include defaults.mk
|
||||||
|
@ -26,7 +39,6 @@ include defaults.mk
|
||||||
.subdirs: autoconf.h
|
.subdirs: autoconf.h
|
||||||
@ echo "checking in which subdirs to build"
|
@ echo "checking in which subdirs to build"
|
||||||
@ $(RM) -f $@
|
@ $(RM) -f $@
|
||||||
@ echo "SUBDIRS += borg_hw" >> $@
|
|
||||||
@ echo "SUBDIRS += animations" >> $@
|
@ echo "SUBDIRS += animations" >> $@
|
||||||
@ (for subdir in `grep -e "^#define .*_SUPPORT" autoconf.h \
|
@ (for subdir in `grep -e "^#define .*_SUPPORT" autoconf.h \
|
||||||
| sed -e "s/^#define //" -e "s/_SUPPORT.*//" \
|
| sed -e "s/^#define //" -e "s/_SUPPORT.*//" \
|
||||||
|
@ -39,7 +51,7 @@ ifneq ($(MAKECMDGOALS),clean)
|
||||||
ifneq ($(MAKECMDGOALS),mrproper)
|
ifneq ($(MAKECMDGOALS),mrproper)
|
||||||
ifneq ($(MAKECMDGOALS),menuconfig)
|
ifneq ($(MAKECMDGOALS),menuconfig)
|
||||||
|
|
||||||
-include $(TOPDIR)/.subdirs
|
include $(TOPDIR)/.subdirs
|
||||||
-include $(TOPDIR)/.config
|
-include $(TOPDIR)/.config
|
||||||
|
|
||||||
endif # MAKECMDGOALS!=menuconfig
|
endif # MAKECMDGOALS!=menuconfig
|
||||||
|
@ -48,23 +60,21 @@ endif # MAKECMDGOALS!=clean
|
||||||
endif # no_deps!=t
|
endif # no_deps!=t
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
all: compile-$(TARGET)
|
|
||||||
@echo "==============================="
|
|
||||||
@echo "$(TARGET) compiled for: $(MCU)"
|
|
||||||
@echo "size is: "
|
|
||||||
@${TOPDIR}/scripts/size $(TARGET)
|
|
||||||
@echo "==============================="
|
|
||||||
|
|
||||||
|
SUBDIRS_AVR = borg_hw
|
||||||
|
SUBDIRS_AVR += $(SUBDIRS)
|
||||||
|
|
||||||
.PHONY: compile-subdirs_avr
|
.PHONY: compile-subdirs_avr
|
||||||
compile-subdirs_avr:
|
compile-subdirs_avr:
|
||||||
@ for dir in $(SUBDIRS); do make -C $$dir objects_avr || exit 5; done
|
@ for dir in $(SUBDIRS_AVR); do make -C $$dir objects_avr || exit 5; done
|
||||||
|
|
||||||
.PHONY: compile-$(TARGET)
|
.PHONY: compile-$(TARGET)
|
||||||
compile-$(TARGET): compile-subdirs_avr $(TARGET).hex $(TARGET).bin $(TARGET).lst
|
compile-$(TARGET): compile-subdirs_avr $(TARGET).hex $(TARGET).bin $(TARGET).lst
|
||||||
|
@ echo "foobar"
|
||||||
|
|
||||||
|
|
||||||
OBJECTS += $(patsubst %.c,./obj_avr/%.o,${SRC})
|
OBJECTS += $(patsubst %.c,./obj_avr/%.o,${SRC})
|
||||||
SUBDIROBJECTS = $(foreach subdir,$(SUBDIRS),$(foreach object,$(shell cat $(subdir)/obj_avr/.objects),$(subdir)/$(object)))
|
SUBDIROBJECTS = $(foreach subdir,$(SUBDIRS_AVR),$(foreach object,$(shell cat $(subdir)/obj_avr/.objects),$(subdir)/$(object)))
|
||||||
|
|
||||||
$(TARGET): $(OBJECTS) $(SUBDIROBJECTS)
|
$(TARGET): $(OBJECTS) $(SUBDIROBJECTS)
|
||||||
$(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(SUBDIROBJECTS)
|
$(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(SUBDIROBJECTS)
|
||||||
|
@ -95,18 +105,28 @@ $(TARGET): $(OBJECTS) $(SUBDIROBJECTS)
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#Rules for simulator build
|
#Rules for simulator build
|
||||||
|
|
||||||
|
SUBDIRS_SIM = simulator
|
||||||
|
SUBDIRS_SIM += $(SUBDIRS)
|
||||||
|
|
||||||
.PHONY: compile-subdirs_sim
|
.PHONY: compile-subdirs_sim
|
||||||
compile-subdirs_sim:
|
compile-subdirs_sim:
|
||||||
@ for dir in $(SUBDIRS); do make -C $$dir objects_sim || exit 5; done
|
@ for dir in $(SUBDIRS_SIM); do make -C $$dir objects_sim || exit 5; done
|
||||||
@ make -C ./simulator/ objects_sim || exit 5;
|
@ make -C ./simulator/ objects_sim || exit 5;
|
||||||
|
|
||||||
simulator: autoconf.h .config .subdirs compile-subdirs_sim $(TARGET_SIM)
|
simulator: autoconf.h .config .subdirs compile-subdirs_sim $(TARGET_SIM)
|
||||||
|
|
||||||
SUBDIROBJECTS_SIM = $(foreach subdir,$(SUBDIRS),$(foreach object,$(shell cat $(subdir)/obj_sim/.objects),$(subdir)/$(object)))
|
SUBDIROBJECTS_SIM = $(foreach subdir,$(SUBDIRS_SIM),$(foreach object,$(shell cat $(subdir)/obj_sim/.objects),$(subdir)/$(object)))
|
||||||
|
|
||||||
$(TARGET_SIM): $(SUBDIROBJECTS_SIM)
|
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) $(LIBS_SIM) -o $@ $(SUBDIROBJECTS_SIM)
|
||||||
|
|
||||||
|
./obj_sim/%.o: %.c
|
||||||
|
@ if [ ! -d obj_sim ]; then mkdir obj_sim ; fi
|
||||||
|
@ echo "compiling $<"
|
||||||
|
@ $(HOSTCC) -o $@ $(CFLAGS_SIM) -c $<
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
|
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
|
||||||
else if [ -x /bin/bash ]; then echo /bin/bash; \
|
else if [ -x /bin/bash ]; then echo /bin/bash; \
|
||||||
|
|
|
@ -4,10 +4,6 @@
|
||||||
#include "../pixel.h"
|
#include "../pixel.h"
|
||||||
#include "../util.h"
|
#include "../util.h"
|
||||||
|
|
||||||
#ifdef AVR
|
|
||||||
#include <avr/io.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define RANDOM8() (random8())
|
#define RANDOM8() (random8())
|
||||||
|
|
||||||
#ifdef ANIMATION_TESTS
|
#ifdef ANIMATION_TESTS
|
||||||
|
|
|
@ -29,7 +29,8 @@ LDFLAGS += -mmcu=$(MCU)
|
||||||
#Settings for Simulator build
|
#Settings for Simulator build
|
||||||
CFLAGS_SIM = -g -Wall -pedantic -std=c99 -O2
|
CFLAGS_SIM = -g -Wall -pedantic -std=c99 -O2
|
||||||
LDFLAGS_SIM = -Wl
|
LDFLAGS_SIM = -Wl
|
||||||
LIBS_SIM = LIBS = -lglut -lpthread -lGL -lGLU
|
#LIBS_SIM = -lglut -lpthread -lGL -lGLU
|
||||||
|
LIBS_SIM = -lglut32 -lglu32 -lopengl32
|
||||||
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
|
@ -0,0 +1,124 @@
|
||||||
|
|
||||||
|
#include <setjmp.h>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "scrolltext/scrolltext.h"
|
||||||
|
#include "animations/programm.h"
|
||||||
|
#include "animations/matrix.h"
|
||||||
|
#include "animations/gameoflife.h"
|
||||||
|
#include "borg_hw/borg_hw.h"
|
||||||
|
#include "can/borg_can.h"
|
||||||
|
#include "random/prng.h"
|
||||||
|
#include "random/persistentCounter.h"
|
||||||
|
#include "mcuf/mcuf.h"
|
||||||
|
#include "menu/menu.h"
|
||||||
|
#include "pixel.h"
|
||||||
|
#include "joystick.h"
|
||||||
|
|
||||||
|
|
||||||
|
volatile unsigned char oldMode, oldOldmode, mode;
|
||||||
|
|
||||||
|
jmp_buf newmode_jmpbuf;
|
||||||
|
|
||||||
|
void display_loop(){
|
||||||
|
// mcuf_serial_mode();
|
||||||
|
|
||||||
|
mode = setjmp(newmode_jmpbuf);
|
||||||
|
oldOldmode = oldMode;
|
||||||
|
waitForFire = 1;
|
||||||
|
for(;;){
|
||||||
|
oldMode = mode;
|
||||||
|
switch(mode++) {
|
||||||
|
|
||||||
|
#ifdef ANIMATION_SCROLLTEXT
|
||||||
|
case 1:
|
||||||
|
scrolltext(scrolltext_text);
|
||||||
|
{ char a[14];
|
||||||
|
sprintf(a,"</# counter == %lu ", percnt_get());
|
||||||
|
scrolltext(a);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ANIMATION_SPIRALE
|
||||||
|
case 2:
|
||||||
|
spirale(5);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ANIMATION_JOERN1
|
||||||
|
case 3:
|
||||||
|
joern1();
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ANIMATION_SNAKE
|
||||||
|
case 4:
|
||||||
|
snake();
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ANIMATION_SCHACHBRETT
|
||||||
|
case 5:
|
||||||
|
schachbrett(20);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ANIMATION_FEUER
|
||||||
|
case 6:
|
||||||
|
feuer();
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ANIMATION_MATRIX
|
||||||
|
case 7:
|
||||||
|
matrix();
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ANIMATION_RANDOM_BRIGHT
|
||||||
|
case 8:
|
||||||
|
random_bright(200);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ANIMATION_GAMEOFLIFE
|
||||||
|
case 9:
|
||||||
|
gameoflife();
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
case 29:
|
||||||
|
mode = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#ifdef ANIMATION_TESTS
|
||||||
|
case 31:
|
||||||
|
test_level1();
|
||||||
|
break;
|
||||||
|
case 32:
|
||||||
|
test_level2();
|
||||||
|
break;
|
||||||
|
case 33:
|
||||||
|
test_level3();
|
||||||
|
break;
|
||||||
|
case 35:
|
||||||
|
test1();
|
||||||
|
while(1);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ANIMATION_OFF
|
||||||
|
case 0xFF:
|
||||||
|
off();
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MENU_SUPPORT
|
||||||
|
case 43:
|
||||||
|
menu();
|
||||||
|
mode = oldOldmode;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
void display_loop();
|
||||||
|
|
||||||
|
extern jmp_buf newmode_jmpbuf;
|
|
@ -1,8 +1,6 @@
|
||||||
#ifndef JOYSTICK_H
|
#ifndef JOYSTICK_H
|
||||||
#define JOYSTICK_H
|
#define JOYSTICK_H
|
||||||
|
|
||||||
#include <avr/io.h>
|
|
||||||
|
|
||||||
unsigned char waitForFire;
|
unsigned char waitForFire;
|
||||||
void joy_init();
|
void joy_init();
|
||||||
|
|
||||||
|
|
116
main.c
116
main.c
|
@ -3,24 +3,12 @@
|
||||||
#include <avr/interrupt.h>
|
#include <avr/interrupt.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "autoconf.h"
|
#include "config.h"
|
||||||
//#include "config.h"
|
|
||||||
#include "scrolltext/scrolltext.h"
|
|
||||||
#include "animations/programm.h"
|
|
||||||
#include "animations/matrix.h"
|
|
||||||
#include "animations/gameoflife.h"
|
|
||||||
#include "borg_hw/borg_hw.h"
|
#include "borg_hw/borg_hw.h"
|
||||||
#include "can/borg_can.h"
|
#include "can/borg_can.h"
|
||||||
#include "random/prng.h"
|
#include "random/prng.h"
|
||||||
#include "random/persistentCounter.h"
|
#include "random/persistentCounter.h"
|
||||||
#include "mcuf/mcuf.h"
|
#include "display_loop.h"
|
||||||
#include "menu/menu.h"
|
|
||||||
#include "pixel.h"
|
|
||||||
#include "joystick.h"
|
|
||||||
|
|
||||||
volatile unsigned char oldMode, oldOldmode, mode;
|
|
||||||
|
|
||||||
jmp_buf newmode_jmpbuf;
|
|
||||||
|
|
||||||
int main (void){
|
int main (void){
|
||||||
clear_screen(0);
|
clear_screen(0);
|
||||||
|
@ -46,104 +34,6 @@ int main (void){
|
||||||
|
|
||||||
sei();
|
sei();
|
||||||
|
|
||||||
// mcuf_serial_mode();
|
display_loop();
|
||||||
|
|
||||||
mode = setjmp(newmode_jmpbuf);
|
|
||||||
oldOldmode = oldMode;
|
|
||||||
waitForFire = 1;
|
|
||||||
for(;;){
|
|
||||||
oldMode = mode;
|
|
||||||
switch(mode++) {
|
|
||||||
|
|
||||||
#ifdef ANIMATION_SCROLLTEXT
|
|
||||||
case 1:
|
|
||||||
scrolltext(scrolltext_text);
|
|
||||||
{ char a[14];
|
|
||||||
sprintf(a,"</# counter == %lu ", percnt_get());
|
|
||||||
scrolltext(a);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ANIMATION_SPIRALE
|
|
||||||
case 2:
|
|
||||||
spirale(5);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ANIMATION_JOERN1
|
|
||||||
case 3:
|
|
||||||
joern1();
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ANIMATION_SNAKE
|
|
||||||
case 4:
|
|
||||||
snake();
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ANIMATION_SCHACHBRETT
|
|
||||||
case 5:
|
|
||||||
schachbrett(20);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ANIMATION_FEUER
|
|
||||||
case 6:
|
|
||||||
feuer();
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ANIMATION_MATRIX
|
|
||||||
case 7:
|
|
||||||
matrix();
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ANIMATION_RANDOM_BRIGHT
|
|
||||||
case 8:
|
|
||||||
random_bright(200);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ANIMATION_GAMEOFLIFE
|
|
||||||
case 9:
|
|
||||||
gameoflife();
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case 29:
|
|
||||||
mode = 1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
#ifdef ANIMATION_TESTS
|
|
||||||
case 31:
|
|
||||||
test_level1();
|
|
||||||
break;
|
|
||||||
case 32:
|
|
||||||
test_level2();
|
|
||||||
break;
|
|
||||||
case 33:
|
|
||||||
test_level3();
|
|
||||||
break;
|
|
||||||
case 35:
|
|
||||||
test1();
|
|
||||||
while(1);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ANIMATION_OFF
|
|
||||||
case 0xFF:
|
|
||||||
off();
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef MENU_SUPPORT
|
|
||||||
case 43:
|
|
||||||
menu();
|
|
||||||
mode = oldOldmode;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
5
rules.mk
5
rules.mk
|
@ -24,7 +24,7 @@ objects_avr: $(OBJECTS)
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# rules for buildung simulator objects
|
# rules for buildung simulator objects
|
||||||
|
|
||||||
SRC_SIM = $(SRC)
|
SRC_SIM ?= $(SRC)
|
||||||
OBJECTS_SIM += $(patsubst %.c,obj_sim/%.o,${SRC_SIM})
|
OBJECTS_SIM += $(patsubst %.c,obj_sim/%.o,${SRC_SIM})
|
||||||
|
|
||||||
./obj_sim/%.o: %.c
|
./obj_sim/%.o: %.c
|
||||||
|
@ -34,7 +34,8 @@ OBJECTS_SIM += $(patsubst %.c,obj_sim/%.o,${SRC_SIM})
|
||||||
|
|
||||||
objects_sim: $(OBJECTS_SIM)
|
objects_sim: $(OBJECTS_SIM)
|
||||||
@ echo "writing object ineventory"
|
@ echo "writing object ineventory"
|
||||||
@ echo $(OBJECTS) > obj_sim/.objects
|
@ if [ ! -d obj_sim ]; then mkdir obj_sim ; fi
|
||||||
|
@ echo $(OBJECTS_SIM) > obj_sim/.objects
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,111 +1,9 @@
|
||||||
PRG = borgSim
|
TARGET = libanimations.a
|
||||||
OPTIMIZE = -O0
|
TOPDIR = ..
|
||||||
LIBS = -lglut -lpthread -lGL -lGLU
|
|
||||||
CC = gcc
|
|
||||||
LD = ld
|
|
||||||
|
|
||||||
override CFLAGS = -g -Wall -pedantic -std=c99 $(OPTIMIZE)
|
include $(TOPDIR)/defaults.mk
|
||||||
$(DEFS)
|
|
||||||
override LDFLAGS = -Wl,-Map,$(PRG).map
|
|
||||||
|
|
||||||
OBJ = breakpoint.o font_arial8.o font_small6.o font_uni53.o invader_draw.o \
|
SRC_SIM = main.c trackball.c
|
||||||
invader_init.o invader_proc.o invaders2.o joystick.o main.o menu.o pixel.o \
|
|
||||||
programm.o scrolltext3.o snake.o trackball.o util.o tetris/input.o \
|
|
||||||
tetris/logic.o tetris/piece.o tetris/playfield.o tetris/view.o prng.o \
|
|
||||||
memxor_c.o noekeon.o stonefly.o
|
|
||||||
|
|
||||||
all: $(PRG)
|
|
||||||
|
|
||||||
$(PRG): $(OBJ)
|
include $(TOPDIR)/rules.mk
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJ) -o $@
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf $(OBJ) $(PRG) $(PRG).map
|
|
||||||
|
|
||||||
breakpoint.o: breakpoint.c pixel.h util.h config.h
|
|
||||||
$(CC) $(CFLAGS) -c -o breakpoint.o breakpoint.c
|
|
||||||
|
|
||||||
font_arial8.o: font_arial8.c font.h
|
|
||||||
$(CC) $(CFLAGS) -c -o font_arial8.o font_arial8.c
|
|
||||||
|
|
||||||
font_small6.o: font_small6.c font.h
|
|
||||||
$(CC) $(CFLAGS) -c -o font_small6.o font_small6.c
|
|
||||||
|
|
||||||
font_uni53.o: font_uni53.c font.h
|
|
||||||
$(CC) $(CFLAGS) -c -o font_uni53.o font_uni53.c
|
|
||||||
|
|
||||||
invader_draw.o: invader_draw.c invaders2.h pixel.h util.h config.h \
|
|
||||||
scrolltext.h joystick.h
|
|
||||||
$(CC) $(CFLAGS) -c -o invader_draw.o invader_draw.c
|
|
||||||
|
|
||||||
invader_init.o: invader_init.c invaders2.h pixel.h util.h config.h \
|
|
||||||
scrolltext.h joystick.h
|
|
||||||
$(CC) $(CFLAGS) -c -o invader_init.o invader_init.c
|
|
||||||
|
|
||||||
invader_proc.o: invader_proc.c invaders2.h pixel.h util.h config.h \
|
|
||||||
scrolltext.h joystick.h
|
|
||||||
$(CC) $(CFLAGS) -c -o invader_proc.o invader_proc.c
|
|
||||||
|
|
||||||
invaders2.o: invaders2.c util.h invaders2.h pixel.h config.h scrolltext.h \
|
|
||||||
joystick.h
|
|
||||||
$(CC) $(CFLAGS) -c -o invaders2.o invaders2.c
|
|
||||||
|
|
||||||
joystick.o: joystick.c joystick.h
|
|
||||||
$(CC) $(CFLAGS) -c -o joystick.o joystick.c
|
|
||||||
|
|
||||||
main.o: main.c config.h pixel.h util.h programm.h menu.h tetris/logic.h \
|
|
||||||
tetris/piece.h trackball.h snake.h scrolltext.h
|
|
||||||
$(CC) $(CFLAGS) -c -o main.o main.c
|
|
||||||
|
|
||||||
menu.o: menu.c menu.h config.h util.h pixel.h joystick.h snake.h \
|
|
||||||
tetris/logic.h tetris/piece.h invaders2.h scrolltext.h
|
|
||||||
$(CC) $(CFLAGS) -c -o menu.o menu.c
|
|
||||||
|
|
||||||
pixel.o: pixel.c pixel.h util.h config.h
|
|
||||||
$(CC) $(CFLAGS) -c -o pixel.o pixel.c
|
|
||||||
|
|
||||||
programm.o: programm.c pixel.h util.h config.h programm.h joystick.h
|
|
||||||
$(CC) $(CFLAGS) -c -o programm.o programm.c
|
|
||||||
|
|
||||||
scrolltext3.o: scrolltext3.c config.h scrolltext.h pixel.h util.h \
|
|
||||||
font_arial8.h font.h font_small6.h font_uni53.h
|
|
||||||
$(CC) $(CFLAGS) -c -o scrolltext3.o scrolltext3.c
|
|
||||||
|
|
||||||
snake.o: snake.c pixel.h util.h config.h joystick.h
|
|
||||||
$(CC) $(CFLAGS) -c -o snake.o snake.c
|
|
||||||
|
|
||||||
trackball.o: trackball.c trackball.h
|
|
||||||
$(CC) $(CFLAGS) -c -o trackball.o trackball.c
|
|
||||||
|
|
||||||
util.o: util.c joystick.h
|
|
||||||
$(CC) $(CFLAGS) -c -o util.o util.c
|
|
||||||
|
|
||||||
noekeon.o: noekeon.c noekeon.h memxor.h
|
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
memxor_c.o: memxor_c.c memxor.h
|
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
prng.o: prng.c prng.h noekeon.h memxor.h
|
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
tetris/input.o: tetris/input.c joystick.h util.h tetris/input.h
|
|
||||||
$(CC) $(CFLAGS) -c -o tetris/input.o tetris/input.c
|
|
||||||
|
|
||||||
logic.o: tetris/logic.c tetris/logic.h tetris/piece.h tetris/playfield.h \
|
|
||||||
tetris/view.h tetris/input.h prng.h ../borg-base/prng.h
|
|
||||||
$(CC) $(CFLAGS) -c -o tetris/logic.o tetris/logic.c
|
|
||||||
|
|
||||||
tetris/piece.o: tetris/piece.c tetris/piece.h
|
|
||||||
$(CC) $(CFLAGS) -c -o tetris/piece.o tetris/piece.c
|
|
||||||
|
|
||||||
tetris/playfield.o: tetris/playfield.c tetris/playfield.h tetris/piece.h
|
|
||||||
$(CC) $(CFLAGS) -c -o tetris/playfield.o tetris/playfield.c
|
|
||||||
|
|
||||||
tetris/view.o: tetris/view.c config.h pixel.h util.h scrolltext.h \
|
|
||||||
tetris/logic.h tetris/piece.h tetris/playfield.h tetris/view.h
|
|
||||||
$(CC) $(CFLAGS) -c -o tetris/view.o tetris/view.c
|
|
||||||
|
|
||||||
stonefly.o: stonefly.h stonefly.c pixel.h util.h config.h prng.h \
|
|
||||||
../borg-base/prng.h tetris/piece.h
|
|
||||||
$(CC) $(CFLAGS) -c -o stonefly.o stonefly.c
|
|
||||||
|
|
556
simulator/main.c
556
simulator/main.c
|
@ -1,309 +1,259 @@
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# include <GL/glut.h>
|
# include <GL/glut.h>
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <process.h>
|
# include <process.h>
|
||||||
# define pthread_t int
|
# define pthread_t int
|
||||||
#else
|
#else
|
||||||
# ifdef OSX_
|
# ifdef OSX_
|
||||||
# include <GLUT/glut.h>
|
# include <GLUT/glut.h>
|
||||||
# else
|
# else
|
||||||
# include <GL/glut.h>
|
# include <GL/glut.h>
|
||||||
# endif
|
# endif
|
||||||
# include <pthread.h> // for threads in linux
|
# include <pthread.h> // for threads in linux
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#include "config.h"
|
#include "../config.h"
|
||||||
#include "pixel.h"
|
#include "../display_loop.h"
|
||||||
#include "programm.h"
|
#include "../pixel.h"
|
||||||
#include "menu.h"
|
//#include "programm.h"
|
||||||
#include "tetris/logic.h"
|
//#include "menu.h"
|
||||||
#include "trackball.h"
|
//#include "../tetris/logic.h"
|
||||||
#include "snake.h"
|
#include "trackball.h"
|
||||||
#include "stonefly.h"
|
//#include "../games/snake.h"
|
||||||
|
//#include "stonefly.h"
|
||||||
#include "scrolltext.h"
|
|
||||||
|
//#include "scrolltext.h"
|
||||||
|
|
||||||
|
|
||||||
unsigned char fakeport;
|
|
||||||
jmp_buf newmode_jmpbuf;
|
unsigned char fakeport;
|
||||||
volatile unsigned char oldMode, oldOldmode, mode;
|
jmp_buf newmode_jmpbuf;
|
||||||
extern unsigned char waitForFire;
|
volatile unsigned char oldMode, oldOldmode, mode;
|
||||||
|
extern unsigned char waitForFire;
|
||||||
|
|
||||||
int WindWidth, WindHeight;
|
|
||||||
|
int WindWidth, WindHeight;
|
||||||
unsigned char pixmap[NUMPLANE][NUM_ROWS][LINEBYTES];
|
|
||||||
unsigned char joystick;
|
unsigned char pixmap[NUMPLANE][NUM_ROWS][LINEBYTES];
|
||||||
|
unsigned char joystick;
|
||||||
float view_rotx = 0, view_roty = 0, view_rotz = 0;
|
|
||||||
int win;
|
float view_rotx = 0, view_roty = 0, view_rotz = 0;
|
||||||
|
int win;
|
||||||
|
|
||||||
pthread_t simthread;
|
|
||||||
GLUquadric* quad;
|
pthread_t simthread;
|
||||||
|
GLUquadric* quad;
|
||||||
void drawLED(int color, float pos_x, float pos_y, float pos_z) {
|
|
||||||
glPushMatrix();
|
void drawLED(int color, float pos_x, float pos_y, float pos_z) {
|
||||||
glTranslatef(pos_x, pos_y, pos_z);
|
glPushMatrix();
|
||||||
glCallList(color);
|
glTranslatef(pos_x, pos_y, pos_z);
|
||||||
glPopMatrix();
|
glCallList(color);
|
||||||
}
|
glPopMatrix();
|
||||||
|
}
|
||||||
void display(void){
|
|
||||||
int x, y, z, level, color;
|
void display(void){
|
||||||
tbReshape(WindWidth, WindHeight);
|
int x, y, z, level, color;
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
tbReshape(WindWidth, WindHeight);
|
||||||
glPushMatrix();
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
glTranslatef(NUM_COLS*2., 0., NUM_ROWS*2.);
|
glPushMatrix();
|
||||||
tbMatrix();
|
glTranslatef(NUM_COLS*2., 0., NUM_ROWS*2.);
|
||||||
glRotatef(view_rotx, 1.0, 0.0, 0.0);
|
tbMatrix();
|
||||||
glRotatef(view_roty, 0.0, 1.0, 0.0);
|
glRotatef(view_rotx, 1.0, 0.0, 0.0);
|
||||||
glRotatef(view_rotz, 0.0, 0.0, 1.0);
|
glRotatef(view_roty, 0.0, 1.0, 0.0);
|
||||||
glTranslatef(-NUM_COLS*2, 0., -NUM_ROWS*2.);
|
glRotatef(view_rotz, 0.0, 0.0, 1.0);
|
||||||
for (x = 0; x < 1; x++) {
|
glTranslatef(-NUM_COLS*2, 0., -NUM_ROWS*2.);
|
||||||
for (y = 0; y < NUM_COLS; y++) {
|
for (x = 0; x < 1; x++) {
|
||||||
for (z = 0; z < NUM_ROWS; z++) {
|
for (y = 0; y < NUM_COLS; y++) {
|
||||||
color = 0;
|
for (z = 0; z < NUM_ROWS; z++) {
|
||||||
for (level = 0; level < NUMPLANE; level++) {
|
color = 0;
|
||||||
if (pixmap[level][z%NUM_ROWS][y/8] & (1 << y % 8)) {
|
for (level = 0; level < NUMPLANE; level++) {
|
||||||
color = level+1;
|
if (pixmap[level][z%NUM_ROWS][y/8] & (1 << y % 8)) {
|
||||||
}
|
color = level+1;
|
||||||
}
|
}
|
||||||
drawLED(color, (float)y*4.0,
|
}
|
||||||
(float)x*4.0,
|
drawLED(color, (float)y*4.0,
|
||||||
(float)(NUM_ROWS-1-z)*4.0);
|
(float)x*4.0,
|
||||||
}
|
(float)(NUM_ROWS-1-z)*4.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glPopMatrix();
|
}
|
||||||
glutSwapBuffers();
|
glPopMatrix();
|
||||||
#ifdef _WIN32
|
glutSwapBuffers();
|
||||||
Sleep(10);
|
#ifdef _WIN32
|
||||||
#else
|
Sleep(10);
|
||||||
usleep(20000);
|
#else
|
||||||
#endif
|
usleep(20000);
|
||||||
joystick = 255;
|
#endif
|
||||||
}
|
joystick = 255;
|
||||||
|
}
|
||||||
void keyboard(unsigned char key, int x, int y){
|
|
||||||
switch (key) {
|
void keyboard(unsigned char key, int x, int y){
|
||||||
case 'q': printf("Quit\n");
|
switch (key) {
|
||||||
glutDestroyWindow(win);
|
case 'q': printf("Quit\n");
|
||||||
exit(0);
|
glutDestroyWindow(win);
|
||||||
break;
|
exit(0);
|
||||||
case ' ':
|
break;
|
||||||
fakeport |= 0x01;
|
case ' ':
|
||||||
break;
|
fakeport |= 0x01;
|
||||||
case 'a':
|
break;
|
||||||
fakeport |= 0x02;
|
case 'a':
|
||||||
break;
|
fakeport |= 0x02;
|
||||||
case 'd':
|
break;
|
||||||
fakeport |= 0x04;
|
case 'd':
|
||||||
break;
|
fakeport |= 0x04;
|
||||||
case 's':
|
break;
|
||||||
fakeport |= 0x08;
|
case 's':
|
||||||
break;
|
fakeport |= 0x08;
|
||||||
case 'w':
|
break;
|
||||||
fakeport |= 0x10;
|
case 'w':
|
||||||
break;
|
fakeport |= 0x10;
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void keyboardup(unsigned char key, int x, int y){
|
|
||||||
switch (key) {
|
void keyboardup(unsigned char key, int x, int y){
|
||||||
case ' ':
|
switch (key) {
|
||||||
fakeport &= ~0x01;
|
case ' ':
|
||||||
break;
|
fakeport &= ~0x01;
|
||||||
case 'a':
|
break;
|
||||||
fakeport &= ~0x02;
|
case 'a':
|
||||||
break;
|
fakeport &= ~0x02;
|
||||||
case 'd':
|
break;
|
||||||
fakeport &= ~0x04;
|
case 'd':
|
||||||
break;
|
fakeport &= ~0x04;
|
||||||
case 's':
|
break;
|
||||||
fakeport &= ~0x08;
|
case 's':
|
||||||
break;
|
fakeport &= ~0x08;
|
||||||
case 'w':
|
break;
|
||||||
fakeport &= ~0x10;
|
case 'w':
|
||||||
break;
|
fakeport &= ~0x10;
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void mouse(int button, int state, int x, int y)
|
|
||||||
{
|
void mouse(int button, int state, int x, int y)
|
||||||
tbMouse(button, state, x, y);
|
{
|
||||||
}
|
tbMouse(button, state, x, y);
|
||||||
|
}
|
||||||
void motion(int x, int y)
|
|
||||||
{
|
void motion(int x, int y)
|
||||||
tbMotion(x, y);
|
{
|
||||||
}
|
tbMotion(x, y);
|
||||||
|
}
|
||||||
void reshape(int width, int height)
|
|
||||||
{
|
void reshape(int width, int height)
|
||||||
|
{
|
||||||
tbReshape(width, height);
|
|
||||||
|
tbReshape(width, height);
|
||||||
glViewport(0, 0, width, height);
|
|
||||||
|
glViewport(0, 0, width, height);
|
||||||
glMatrixMode(GL_PROJECTION);
|
|
||||||
glLoadIdentity();
|
glMatrixMode(GL_PROJECTION);
|
||||||
gluPerspective(60.0, (float)WindWidth/(float)WindWidth, 5., 1000.);
|
glLoadIdentity();
|
||||||
gluLookAt(NUM_ROWS*2., NUM_ROWS*2.+50., NUM_COLS*2.,
|
gluPerspective(60.0, (float)WindWidth/(float)WindWidth, 5., 1000.);
|
||||||
NUM_ROWS*2., NUM_ROWS*2., NUM_COLS*2.,
|
gluLookAt(NUM_ROWS*2., NUM_ROWS*2.+50., NUM_COLS*2.,
|
||||||
0.0, 0.0, 1.0);
|
NUM_ROWS*2., NUM_ROWS*2., NUM_COLS*2.,
|
||||||
glMatrixMode(GL_MODELVIEW);
|
0.0, 0.0, 1.0);
|
||||||
glLoadIdentity();
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glLoadIdentity();
|
||||||
WindWidth = width;
|
|
||||||
WindHeight = height;
|
WindWidth = width;
|
||||||
}
|
WindHeight = height;
|
||||||
|
}
|
||||||
/* change view angle */
|
|
||||||
static void special(int k, int x, int y) {
|
/* change view angle */
|
||||||
switch (k) {
|
static void special(int k, int x, int y) {
|
||||||
case GLUT_KEY_UP:
|
switch (k) {
|
||||||
view_rotx += 5.0;
|
case GLUT_KEY_UP:
|
||||||
break;
|
view_rotx += 5.0;
|
||||||
case GLUT_KEY_DOWN:
|
break;
|
||||||
view_rotx -= 5.0;
|
case GLUT_KEY_DOWN:
|
||||||
break;
|
view_rotx -= 5.0;
|
||||||
case GLUT_KEY_LEFT:
|
break;
|
||||||
view_rotz += 5.0;
|
case GLUT_KEY_LEFT:
|
||||||
break;
|
view_rotz += 5.0;
|
||||||
case GLUT_KEY_RIGHT:
|
break;
|
||||||
view_rotz -= 5.0;
|
case GLUT_KEY_RIGHT:
|
||||||
break;
|
view_rotz -= 5.0;
|
||||||
default:
|
break;
|
||||||
return;
|
default:
|
||||||
}
|
return;
|
||||||
glutPostRedisplay();
|
}
|
||||||
}
|
glutPostRedisplay();
|
||||||
/*
|
}
|
||||||
void timf(int value) {
|
/*
|
||||||
glutPostRedisplay();
|
void timf(int value) {
|
||||||
glutTimerFunc(1, timf, 0);
|
glutPostRedisplay();
|
||||||
}*/
|
glutTimerFunc(1, timf, 0);
|
||||||
|
}*/
|
||||||
void *display_loop(void * unused) {
|
|
||||||
unsigned char mode;;;
|
void *display_loop_run(void * unused) {
|
||||||
mode = setjmp(newmode_jmpbuf);
|
display_loop();
|
||||||
oldOldmode = oldMode;
|
}
|
||||||
waitForFire = 1;
|
|
||||||
scrolltext("</#Scrolltext3 Test");
|
int main(int argc, char **argv){
|
||||||
for(;;){
|
WindHeight = 700;
|
||||||
oldMode = mode;
|
WindWidth = 700;
|
||||||
switch(mode++) {
|
glutInit(&argc,argv);
|
||||||
case 1:
|
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
|
||||||
stonefly();
|
glutInitWindowSize(WindHeight, WindWidth);
|
||||||
break;
|
win = glutCreateWindow("16x16 Borg Simulator");
|
||||||
case 2:
|
|
||||||
breakpoint();
|
// callback
|
||||||
break;
|
//glutReshapeFunc(reshape);
|
||||||
case 3:
|
glutDisplayFunc(display);
|
||||||
schwarzesLoch();
|
glutIdleFunc(display);
|
||||||
break;
|
glutSetKeyRepeat(GLUT_KEY_REPEAT_OFF);
|
||||||
case 4:
|
glutKeyboardFunc(keyboard);
|
||||||
scrolltext("</#Scrolltext3 Test");
|
glutKeyboardUpFunc(keyboardup);
|
||||||
break;
|
glutSpecialFunc(special);
|
||||||
case 5:
|
glutMouseFunc(mouse);
|
||||||
spirale(20);
|
glutMotionFunc(motion);
|
||||||
break;
|
|
||||||
case 6:
|
// clearcolor & main loop
|
||||||
joern1();
|
glClearColor(0,0,0,1.0);
|
||||||
break;
|
gluPerspective(60.0, (float)WindWidth/(float)WindWidth, 5., 1000.);
|
||||||
case 7:
|
gluLookAt(NUM_COLS*2., NUM_COLS*2.+50., NUM_ROWS*2.,
|
||||||
snake();
|
NUM_COLS*2., NUM_COLS*2., NUM_ROWS*2.,
|
||||||
break;
|
0.0, 0.0, 1.0);
|
||||||
case 8:
|
|
||||||
schachbrett(20);
|
// init Call List for LED
|
||||||
break;
|
quad = gluNewQuadric();
|
||||||
case 9:
|
glNewList(0, GL_COMPILE);
|
||||||
feuer();
|
glColor4f(0.8, 0.0, 0.0, 1.);
|
||||||
break;
|
gluSphere(quad, 1.0, 12, 12);
|
||||||
case 10:
|
glEndList();
|
||||||
matrix();
|
glNewList(1, GL_COMPILE);
|
||||||
break;
|
glColor4f(0.5, 0.0, 0.0, 1.);
|
||||||
case 31:
|
gluSphere(quad, 1.4, 12, 12);
|
||||||
fadein();
|
glEndList();
|
||||||
break;
|
glNewList(2, GL_COMPILE);
|
||||||
case 32:
|
glColor4f(0.7, 0.0, 0.0, 1.);
|
||||||
test1();
|
gluSphere(quad, 1.55, 12, 12);
|
||||||
break;
|
glEndList();
|
||||||
case 43:
|
glNewList(3, GL_COMPILE);
|
||||||
menu();
|
glColor4f(1.00, 0.0, 0.0, 1.);
|
||||||
mode = oldOldmode;
|
gluSphere(quad, 1.7, 12, 12);
|
||||||
default:
|
glEndList();
|
||||||
break;
|
|
||||||
}
|
tbInit(GLUT_LEFT_BUTTON);
|
||||||
}
|
tbAnimate(GL_FALSE);
|
||||||
|
|
||||||
}
|
// start display_loop thread
|
||||||
|
#ifdef _WIN32
|
||||||
int main(int argc, char **argv){
|
_beginthread((void (*)(void*))display_loop_run, 0, NULL);
|
||||||
WindHeight = 700;
|
#else
|
||||||
WindWidth = 700;
|
pthread_create(&simthread, NULL, display_loop_run, NULL);
|
||||||
glutInit(&argc,argv);
|
#endif
|
||||||
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
|
//glutTimerFunc(40, timf, 0); // Set up timer for 40ms, about 25 fps
|
||||||
glutInitWindowSize(WindHeight, WindWidth);
|
glutMainLoop();
|
||||||
win = glutCreateWindow("16x16 Borg Simulator");
|
return 0;
|
||||||
|
}
|
||||||
// callback
|
|
||||||
//glutReshapeFunc(reshape);
|
|
||||||
glutDisplayFunc(display);
|
|
||||||
glutIdleFunc(display);
|
|
||||||
glutSetKeyRepeat(GLUT_KEY_REPEAT_OFF);
|
|
||||||
glutKeyboardFunc(keyboard);
|
|
||||||
glutKeyboardUpFunc(keyboardup);
|
|
||||||
glutSpecialFunc(special);
|
|
||||||
glutMouseFunc(mouse);
|
|
||||||
glutMotionFunc(motion);
|
|
||||||
|
|
||||||
// clearcolor & main loop
|
|
||||||
glClearColor(0,0,0,1.0);
|
|
||||||
gluPerspective(60.0, (float)WindWidth/(float)WindWidth, 5., 1000.);
|
|
||||||
gluLookAt(NUM_COLS*2., NUM_COLS*2.+50., NUM_ROWS*2.,
|
|
||||||
NUM_COLS*2., NUM_COLS*2., NUM_ROWS*2.,
|
|
||||||
0.0, 0.0, 1.0);
|
|
||||||
|
|
||||||
// init Call List for LED
|
|
||||||
quad = gluNewQuadric();
|
|
||||||
glNewList(0, GL_COMPILE);
|
|
||||||
glColor4f(0.8, 0.0, 0.0, 1.);
|
|
||||||
gluSphere(quad, 1.0, 12, 12);
|
|
||||||
glEndList();
|
|
||||||
glNewList(1, GL_COMPILE);
|
|
||||||
glColor4f(0.5, 0.0, 0.0, 1.);
|
|
||||||
gluSphere(quad, 1.4, 12, 12);
|
|
||||||
glEndList();
|
|
||||||
glNewList(2, GL_COMPILE);
|
|
||||||
glColor4f(0.7, 0.0, 0.0, 1.);
|
|
||||||
gluSphere(quad, 1.55, 12, 12);
|
|
||||||
glEndList();
|
|
||||||
glNewList(3, GL_COMPILE);
|
|
||||||
glColor4f(1.00, 0.0, 0.0, 1.);
|
|
||||||
gluSphere(quad, 1.7, 12, 12);
|
|
||||||
glEndList();
|
|
||||||
|
|
||||||
tbInit(GLUT_LEFT_BUTTON);
|
|
||||||
tbAnimate(GL_FALSE);
|
|
||||||
|
|
||||||
// start display_loop thread
|
|
||||||
#ifdef _WIN32
|
|
||||||
_beginthread((void (*)(void*))display_loop, 0, NULL);
|
|
||||||
#else
|
|
||||||
pthread_create(&simthread, NULL, display_loop, NULL);
|
|
||||||
#endif
|
|
||||||
//glutTimerFunc(40, timf, 0); // Set up timer for 40ms, about 25 fps
|
|
||||||
glutMainLoop();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue