/* * test.c * * Created on: 15 oct. 2011 * Author: laurent */ #include #include "net_http.h" #include "str_string.h" #include "str_array.h" #include "config.h" #include "gl3_items2d.h" #include "logs.h" #include "keyboard.h" #include "object.h" #define GL3_PROTOTYPES 1 #include "GL3/gl3.h" void fontGLPrint(float x, float y, const char *fmt, ... ){} int loadGLTexture(const char *file){return 0;} GLAPI void APIENTRY glBindTexture (GLenum target, GLuint texture) {}; GLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer) {} GLAPI void APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) {} void logsAddPrintf(logs *l, const char *func, const char *file, const int line, const char *fmt, ...) {} void setVideoSize(int width, int height, int fullscreen) {} void fontUse() {} void fontUnUse() {} void keyQuit(SDL_keysym *keysym) {} void keyToggleFullScreen(SDL_keysym *keysym) {} void keyMenu(SDL_keysym *keysym) {} void KeyScreenCapture(SDL_keysym *keysym) {} void keyDownPlayerForward(SDL_keysym *keysym) {} void keyUpPlayerForward(SDL_keysym *keysym) {} void keyDownPlayerBackward(SDL_keysym *keysym) {} void keyUpPlayerBackward(SDL_keysym *keysym) {} void keyDownPlayerLeft(SDL_keysym *keysym) {} void keyUpPlayerLeft(SDL_keysym *keysym) {} void keyDownPlayerRight(SDL_keysym *keysym) {} void keyUpPlayerRight(SDL_keysym *keysym) {} void keyPlayerJump(SDL_keysym *keysym) {} void keyReloadMapFrag(SDL_keysym *keysym) {} void keyInitGame(SDL_keysym *keysym) {} void keyDownShowLog(SDL_keysym *keysym) {} void keyUpShowLog(SDL_keysym *keysym) {} void keyInfoInt(SDL_keysym *keysym) {} void objectInit(object *o){} void objectSetNbVertice(object *o, unsigned int nb){} void objectSetNbMapCoord(object *o, unsigned int nb){} void objectSetNbPolygon(object *o, unsigned int nb){} void objectAddMapCoord(object *o, vertexMapCoord *vmc){} void objectAddVertice(object *o, vertex *v){} void objectAddPolygon(object *o, vertexPolygon *vp){} #include "math_v3d.h" #include "obj_s3d.h" void testSphere() { s3d s; v3d v, pos, dir; v3dInit(&v, 1, 1, 0); v3dInit(&pos, -5, -5, 0); v3dInit(&dir, 1, 0.5, 0); v3dNormalize(&dir); s3dCreate(&s,&v,5); printf("in : %d\n", (int) s3dTestRayIntersionWithMaxDist(&s, &pos, &dir,100.0f) ); v3d r; //s3dCalRayIntersion(&r, &s, &pos, &dir); v3dPrint(&r); } int main() { testSphere(); return 0; strArray *a = strArrayNew(); a->lengthMax = 10; str *s1 = strNew(); str *s2 = strNew(); strSet(s1, "toto"); strSet(s2, "a372315265"); for(int i=0; i<1000; i++) { strArrayAddValueStr(a,s1); strArrayAddValueChar(a,"hihihi"); } strUnSetKeyStr(a, s2); strUnSetKeyChar(a, "a531352976"); strArrayPrint(a); _strArrayItem *s3; strArrayIteratorInitchar(a,"a1115917669"); while( (s3 = strArrayIteratorGet(a)) ) { printf("%p, k = %s, c = %s\n", s3, s3->key->c_str, s3->value->c_str); strArrayIteratorPrev(a); } strFree(s2); strFree(s1); strArrayFree(a); str *s = strNewPrintf("\r\n Bonjour dans la famille. \r\n"); //str *s = strNewPrintf("\r\n \r\n"); strTrim(s); printf("trim '%s'\n", s->c_str); strFree(s); config = configNew(); configLoad(config); configPrint(config); configSave(config); configFree(config); net_dl *dl = httpNew(); printf("1 %i\n",(int) httpSetUrl(dl,"http://lapinator.net/images/ostan/1161005373720.jpg")); //printf("1 %i\n",(int) httpSetUrl(dl,"http://c7.lp.fr/")); printf("2 %i\n",(int) httpDlFile(dl,"OStan.jpg")); httpFree(dl); items2dStack *os = items2dStackNew(); items2d *opt; for(int i=0; i<10; i++) { opt = items2dSelectBoxNew("toto", NULL, 0, 0); items2dStackAdd(os,opt); } items2dStackFreeWithItems2dFree(os); testSphere(); //items2dFree(opt); return 0; }