#ifdef GET_STRAT_DEF #define opengoalattack 0 #define behindbackattack 1 #define fakeattack 2 #define fake2attack 3 #define ricochetattack 4 #define trapballattack 5 #define playdeadattack 6 #define noattackchosen 7 #define goaldefense 0 #define staygoaldefense 1 #define chargedefense 2 #define arizona 0 #define defiant 1 #define executor 2 #define hannibal 3 #define madmax 4 #define taz 5 #define xnor 6 typedef struct { int openingoffense,openingdefense; int startingattackstrategy,startingdefensivestrategy; int FLIPBOARD; int robotcolor; int opponent; int score; int oppscore; int RFCHECK; } Strategy_Settings; #endif #ifdef THREADS_H #include #include #include #include #include #include #include #include #include #ifdef USE_LML_HEADER #include #include #include #include #include "LML33_ioctl.h" #endif #include "jcontrol.h" #include "teststrategy.h" #define BUTTON_HIGHLIGHT_WIDTH 3 #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 600 //336 #define IMG_WIDTH 720 //256 #define IMG_HEIGHT 480 //256 #define IMG_BPP 3 #define UNCLICKED 0 #define CLICKED (~0) #define NUM_DEFINED_COLORS 9 #define MIN(a,b) (((a)>(b))?(b):(a)) #define MAX(a,b) (((a)>(b))?(a):(b)) #define CONFIGFILE "config.dat" #define BOUNDSFILE "bounds.dat" //Object stuff typedef enum {MYBUTTON, MYSLIDER, MYTRIANGLE, MYYELLOWTHING, MYEDITBOX, MYRADIO} ObjType; typedef struct { int objtype, objnum; int x, y, xsize, ysize; XImage *img; XImage *clckd; unsigned char *image; unsigned char *clicked_image; char *label; int clicked_status; // is the object displaying the clicked image? unsigned background; int group; int data1a, data1b, data2a, data2b; int data3a, data3b; } MyObject; typedef struct { int x, y, size; int oldx, oldy, oldsize; } Hexagon; typedef struct { unsigned char rmin, rmax, gmin, gmax, bmin, bmax; } ColorBoundSet; typedef struct { ColorBoundSet colors[NUM_DEFINED_COLORS]; int Left_Ignore, Top_Ignore, Right_Ignore, Bottom_Ignore; int Yellow_Red, Yellow_Green, Yellow_Blue; } Bounds; Bounds bounds; Strategy_Settings ssettings; MyObject objarray[200]; int numobjs; int *ElementMap; // buttons that start the robot's strategy, end the robot's strategy, stop the robot's // motors, and quit the program; it's best to end and stop before quitting MyObject *btnStart, *btnEnd, *btnQuit, *btnStopMotors, *btnRFCheck; // select whether Prometheus is on offense or defense MyObject *radioOffenseBlue, *radioOffenseYellow, *radioDefenseBlue, *radioDefenseYellow; // select what attack method Prometheus will use MyObject *radioOpenGoalAttack, *radioBehindBackAttack, *radioFakeAttack, *radioFake2Attack, *radioRicochetAttack, *radioTrapBallAttack, *radioPlayDeadAttack; // select which defensive method Prometheus will take MyObject *radioGoalDefense, *radioStayGoalDefense, *radioChargeDefense; // select which robot is P's current opponent MyObject *radioArizona, *radioDefiant, *radioExecutor, *radioHannibal, *radioMadmax, *radioTaz, *radioXNor; // increment P's score and the Opponent's score MyObject *btnPScoreUp, *btnOpScoreUp, *btnPScoreDn, *btnOpScoreDn; //Function Prototypes void MakeWindow(Display**, Window*, GC*, Drawable*, int **ElementMap); MyObject* createButton(Display*, Drawable, GC, char*, int x, int y, int xs, int ys, int group, unsigned fg, unsigned bg); MyObject* createTriangle(Display*, Drawable, GC, int x, int y, int xs, int ys, int group); MyObject* createRadio(Display*, Drawable, GC, char*, int x, int y, int xs, int ys, int group, int clicked, unsigned fg, unsigned bg); MyObject* findobjectat(int x, int y); void hiliteobject(MyObject *myobj, Display *dpy, Drawable p, GC gc); void drawString(Display *dpy, Drawable p, GC gc,int x, int y, char *str, int fg, int bg); void clickButton(MyObject *button, int clicked); void clickRadio(MyObject *radio, int clicked); void startJThread(void); void endJThread(void); #endif