{ "auto_complete": { "selected_items": [ [ "Writ", "WriteLine" ], [ "NU", "NUM_BODIES" ], [ "SDL_Draw", "SDL_SetRenderDrawColor" ], [ "y_", "y_ecp" ], [ "chea", "cheat_active" ], [ "SDL_SC", "SDL_SCANCODE_S" ], [ "SDL_Lock", "SDL_LockTexture" ], [ "clock", "clock_t" ], [ "textu", "textures" ], [ "text", "texture_ih" ], [ "textur", "texture_ih" ], [ "MAP", "MAPY" ] ] }, "buffers": [ { "file": "simulations/boids.c", "settings": { "buffer_size": 4811, "encoding": "UTF-8", "line_ending": "Unix" } }, { "file": "simulations/universe.c", "settings": { "buffer_size": 2502, "encoding": "UTF-8", "line_ending": "Unix" } }, { "file": "/home/pupkich/projects/chordgen.py", "settings": { "buffer_size": 1732, "encoding": "UTF-8", "line_ending": "Unix" } }, { "contents": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,//0\n\t\t1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,//1\n\t\t1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,//2\n\t\t1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,//3\n\t\t1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,//4\n\t\t1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,//5\n\t\t1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,//6\n\t\t1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,//7\n\t\t1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,//8\n\t\t1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,//9\n\t\t1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,//10\n\t\t1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,//11\n\t\t1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,//12\n\t\t1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,//13\n\t\t1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,//14\n\t\t1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,\n\nvoid drawSky(void *tpixels, SDL_Surface *surface, struct player P)\n{\n\tUint32 *edited = (Uint32 *)malloc(WIDTH*HEIGHT/2*sizeof(Uint32));\n\tfor(int y = 1; y < HEIGHT/2; y++)\n\t\tfor(int x = 0; x < WIDTH; x++)\n\t\t{\n\t\t\tint xo = (int)(-P.th*WIDTH/(FOV*DEG)) - x;\n\t\t\tif(xo < 0) {xo += WIDTH;}\n\t\t\txo %= WIDTH; \n\t\t\tint index = (y*WIDTH + xo)*3;\n\t\t\tchar red = sky[index];\n\t\t\tchar green = sky[index +1];\n\t\t\tchar blue = sky[index +2];\n\t\t\tedited[y*WIDTH + x] = SDL_MapRGB(surface->format, red, green, blue);\n\t\t}\n\tmemcpy(tpixels, edited, sizeof(WIDTH*HEIGHT/2*sizeof(Uint32)));\n\tfree(edited);\n}\n\nUint32 mixSDLColors(Uint32 back, Uint32 front, SDL_PixelFormat *fmt, int alpha)\n{\n\tif(alpha == 0)\n\t\treturn front;\n\n\tUint32 ch1, ch2, sum = 0;\n\n\tch1 = back & fmt->Rmask;\n\tch2 = front & fmt->Rmask;\n\tsum |= (ch1 + ch2) >> 1 & fmt->Rmask;\n\n\tch1 = back & fmt->Gmask;\n\tch2 = front & fmt->Gmask;\n\tsum |= (ch1 + ch2) >> 1 & fmt->Gmask;\n\n\tch1 = back & fmt->Bmask;\n\tch2 = front & fmt->Bmask;\n\tsum |= (ch1 + ch2) >> 1 & fmt->Bmask;\n\n\tsum |= front & !(fmt->Rmask + fmt->Gmask + fmt->Bmask);\n\treturn sum;\n}", "settings": { "buffer_size": 1681, "line_ending": "Unix" } }, { "file": "/home/pupkich/Документы/physgraph.c", "settings": { "buffer_size": 642, "encoding": "UTF-8", "line_ending": "Unix" } }, { "contents": "#include \n\n#ifdef _WIN32 // грубый способ определения; на деле разница не в ОС, а в компиляторe\n\t#include \n\t#include \n\t#include \n#else\n\t#include \n\t#include \n\t#include \n#endif\n\n#define HEIGHT 480\n#define WIDTH 640\n#define CELL 16\n#define DELAY 10\n\nstruct cell {int x, y, birth_num, death_num} \n\t\t\tcells[HEIGHT * WIDTH / CELL];\n\nvoid render(SDL_Renderer *renderer, SDL_Rect *cellrects) {\n\tSDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); // фон\n\tSDL_RenderClear(renderer);\n\tSDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);\n\n\tfor(int i = 0; i