/FallingSandpaper/jni/app.c
C | 127 lines | 59 code | 20 blank | 48 comment | 0 complexity | 7bd9ff935aef14c6bc7be5ba0ae500e6 MD5 | raw file
1/* 2 * app.c 3 * ------------------------- 4 * Contains definitions for all of the global 5 * variables used in the JNI part of the code. 6 */ 7 8//Include the global macros 9#include "macros.h" 10//Include the server functions 11#include "server.h" 12 13// The simple framework expects the application code to define these functions. 14void appInit(); 15void appDeinit(); 16void appRender(); 17 18/* Value is non-zero when application is alive, and 0 when it is closing. 19 * Defined by the application framework. 20 */ 21int gAppAlive; 22 23//Current element selected 24int celement; 25//Current point during processing 26int cpoint; 27//Play state 28int play; 29//Size variable 30int size; 31 32//Array for bitmap drawing 33unsigned char colors[TPixels*3]; // 3 bytes per pixel 34 35//Coordinates 36float x[TPoints]; 37float y[TPoints]; 38//Old coordinates (for collision resolving) 39short int oldx[TPoints]; 40short int oldy[TPoints]; 41//Velocities 42short int xvel[TPoints]; 43short int yvel[TPoints]; 44 45//Element type 46char element[TPoints]; 47//Frozen state 48char frozen[TPoints]; 49//Spawn type 50char spawn[TPoints]; 51 52//RGB properties 53unsigned char red[TElements]; 54unsigned char green[TElements]; 55unsigned char blue[TElements]; 56//Fall velocity property 57int fallvel[TElements]; 58//Density property 59int density[TElements]; 60//Solid property 61int solid[TElements]; 62//Growing property 63int growing[TElements]; 64//Condensing property 65int condensing[TElements]; 66//Fire-like burning property 67int fireburn[TElements]; 68//Explosiveness property 69int exploness[TElements]; 70 71//Custom element collision data 72int colliseelement1[TCollision]; 73 74//Collision matrix 75int collision[TElements][TElements]; 76 77//Index set state 78char set[TPoints]; 79//Index available state 80short int avail[TPoints]; 81 82//Location in avail array 83int loq; 84//Zoom value 85int screensize; 86 87//Gravity values 88float gravx; 89float gravy; 90 91//Accelerometer control state 92int accelcon; 93//Flipped state 94int flipped; 95 96//The extent of the screen (what area to draw in) 97int maxx; 98int maxy; 99 100// A map of all the coordinates on the screen 101int allcoords[WIDTH][HEIGHT]; 102 103//Mouse positions 104int xm; 105int ym; 106//Old mouse positions 107int lmx; 108int lmy; 109//Finger down state 110int fd; 111 112//Buffer building variables 113char username[8]; 114char password[8]; 115char userlength; 116char passlength; 117char buffer[3 + 1 + (2 * TPoints * 4) + 200]; 118int bufferlength; 119 120//Error variable 121char* error; 122 123//Socket variables 124int sockfd; //The file descriptor for the socket 125int n; //Used in sending and recieving data 126struct sockaddr_in serv_addr; //The server address struct 127struct hostent *server; //Pointer to a hostent struct that is used to set up serv_addr