Nekronomik Temat założony przez niniejszego użytkownika |
» 2013-07-04 19:23:09 #include <allegro5/allegro.h> #include <allegro5/allegro_image.h> #include <zlib.h> #include<string> #include<iostream> #include<fstream> #include <allegro5/allegro_memfile.h> using namespace std; ALLEGRO_BITMAP * OB1 = 0; ALLEGRO_BITMAP * OB2 = 0; void obrazek() { al_draw_bitmap( OB2, 10, 10, 0 ); } int main() { ALLEGRO_DISPLAY * display = NULL; al_init(); al_set_new_display_flags( ALLEGRO_WINDOWED ); display = al_create_display( 640, 480 ); al_init_image_addon(); al_install_keyboard(); ALLEGRO_KEYBOARD_STATE Key; al_get_time(); OB1 = al_load_bitmap( "p.png" ); fstream plik1; char od[ 100000 ]; char bm[ 3 ]; plik1.open( "v.txt", ios::in ); for( int xx = 0; xx < 100000; xx++ ) { plik1 >> od[ xx ]; if( od[ xx ] == 'q' ) { break; } } plik1.close(); int pp = 0; int cc = 0; int img = 0; int ccc = 0; string str[ 10000 ]; cout << endl; for( int xx = 0; xx < 1000000; xx++ ) { if( od[ xx ] != ',' ) { bm[ cc ] = od[ xx ]; cc++; } else { cc = 0; str[ img ] = bm; ccc = ccc + 1000; cout << str[ img ] << " " << img << " " << endl; img++; } if( od[ xx ] == 'q' ) { str[ img ] = "q"; break; } } int ws = 0; unsigned char dane[ 10000 ]; for( int x = 0; x < 10000; x++ ) { cout << ws << endl; if( str[ x ] == "q" ) break; if( str[ x ] == "0x00" ) dane[ x ] = 0x00; if( str[ x ] == "0x01" ) dane[ x ] = 0x01; if( str[ x ] == "0x02" ) dane[ x ] = 0x02; if( str[ x ] == "0x03" ) dane[ x ] = 0x03; if( str[ x ] == "0x04" ) dane[ x ] = 0x04; if( str[ x ] == "0x05" ) dane[ x ] = 0x05; if( str[ x ] == "0x06" ) dane[ x ] = 0x06; if( str[ x ] == "0x07" ) dane[ x ] = 0x07; if( str[ x ] == "0x08" ) dane[ x ] = 0x08; if( str[ x ] == "0x09" ) dane[ x ] = 0x09; if( str[ x ] == "0x10" ) dane[ x ] = 0x10; if( str[ x ] == "0x11" ) dane[ x ] = 0x11; if( str[ x ] == "0x12" ) dane[ x ] = 0x12; if( str[ x ] == "0x13" ) dane[ x ] = 0x13; if( str[ x ] == "0x14" ) dane[ x ] = 0x14; if( str[ x ] == "0x15" ) dane[ x ] = 0x15; if( str[ x ] == "0x16" ) dane[ x ] = 0x16; if( str[ x ] == "0x17" ) dane[ x ] = 0x17; if( str[ x ] == "0x18" ) dane[ x ] = 0x18; if( str[ x ] == "0x19" ) dane[ x ] = 0x19; if( str[ x ] == "0x20" ) dane[ x ] = 0x20; if( str[ x ] == "0x21" ) dane[ x ] = 0x21; if( str[ x ] == "0x22" ) dane[ x ] = 0x22; if( str[ x ] == "0x23" ) dane[ x ] = 0x23; if( str[ x ] == "0x24" ) dane[ x ] = 0x24; if( str[ x ] == "0x25" ) dane[ x ] = 0x25; if( str[ x ] == "0x26" ) dane[ x ] = 0x26; if( str[ x ] == "0x27" ) dane[ x ] = 0x27; if( str[ x ] == "0x28" ) dane[ x ] = 0x28; if( str[ x ] == "0x29" ) dane[ x ] = 0x29; if( str[ x ] == "0x30" ) dane[ x ] = 0x30; if( str[ x ] == "0x31" ) dane[ x ] = 0x31; if( str[ x ] == "0x32" ) dane[ x ] = 0x32; if( str[ x ] == "0x33" ) dane[ x ] = 0x33; if( str[ x ] == "0x34" ) dane[ x ] = 0x34; if( str[ x ] == "0x35" ) dane[ x ] = 0x35; if( str[ x ] == "0x36" ) dane[ x ] = 0x36; if( str[ x ] == "0x37" ) dane[ x ] = 0x37; if( str[ x ] == "0x38" ) dane[ x ] = 0x38; if( str[ x ] == "0x39" ) dane[ x ] = 0x39; if( str[ x ] == "0x40" ) dane[ x ] = 0x40; if( str[ x ] == "0x41" ) dane[ x ] = 0x41; if( str[ x ] == "0x42" ) dane[ x ] = 0x42; if( str[ x ] == "0x43" ) dane[ x ] = 0x43; if( str[ x ] == "0x44" ) dane[ x ] = 0x44; if( str[ x ] == "0x45" ) dane[ x ] = 0x45; if( str[ x ] == "0x46" ) dane[ x ] = 0x46; if( str[ x ] == "0x47" ) dane[ x ] = 0x47; if( str[ x ] == "0x48" ) dane[ x ] = 0x48; if( str[ x ] == "0x49" ) dane[ x ] = 0x49; if( str[ x ] == "0x50" ) dane[ x ] = 0x50; if( str[ x ] == "0x51" ) dane[ x ] = 0x51; if( str[ x ] == "0x52" ) dane[ x ] = 0x52; if( str[ x ] == "0x53" ) dane[ x ] = 0x53; if( str[ x ] == "0x54" ) dane[ x ] = 0x54; if( str[ x ] == "0x55" ) dane[ x ] = 0x55; if( str[ x ] == "0x56" ) dane[ x ] = 0x56; if( str[ x ] == "0x57" ) dane[ x ] = 0x57; if( str[ x ] == "0x58" ) dane[ x ] = 0x58; if( str[ x ] == "0x59" ) dane[ x ] = 0x59; if( str[ x ] == "0x60" ) dane[ x ] = 0x60; if( str[ x ] == "0x61" ) dane[ x ] = 0x61; if( str[ x ] == "0x62" ) dane[ x ] = 0x62; if( str[ x ] == "0x63" ) dane[ x ] = 0x63; if( str[ x ] == "0x64" ) dane[ x ] = 0x64; if( str[ x ] == "0x65" ) dane[ x ] = 0x65; if( str[ x ] == "0x66" ) dane[ x ] = 0x66; if( str[ x ] == "0x67" ) dane[ x ] = 0x67; if( str[ x ] == "0x68" ) dane[ x ] = 0x68; if( str[ x ] == "0x69" ) dane[ x ] = 0x69; if( str[ x ] == "0x70" ) dane[ x ] = 0x70; if( str[ x ] == "0x71" ) dane[ x ] = 0x71; if( str[ x ] == "0x72" ) dane[ x ] = 0x72; if( str[ x ] == "0x73" ) dane[ x ] = 0x73; if( str[ x ] == "0x74" ) dane[ x ] = 0x74; if( str[ x ] == "0x75" ) dane[ x ] = 0x75; if( str[ x ] == "0x76" ) dane[ x ] = 0x76; if( str[ x ] == "0x77" ) dane[ x ] = 0x77; if( str[ x ] == "0x78" ) dane[ x ] = 0x78; if( str[ x ] == "0x79" ) dane[ x ] = 0x79; if( str[ x ] == "0x80" ) dane[ x ] = 0x80; if( str[ x ] == "0x81" ) dane[ x ] = 0x81; if( str[ x ] == "0x82" ) dane[ x ] = 0x82; if( str[ x ] == "0x83" ) dane[ x ] = 0x83; if( str[ x ] == "0x84" ) dane[ x ] = 0x84; if( str[ x ] == "0x85" ) dane[ x ] = 0x85; if( str[ x ] == "0x86" ) dane[ x ] = 0x86; if( str[ x ] == "0x87" ) dane[ x ] = 0x87; if( str[ x ] == "0x88" ) dane[ x ] = 0x88; if( str[ x ] == "0x89" ) dane[ x ] = 0x89; if( str[ x ] == "0x90" ) dane[ x ] = 0x90; if( str[ x ] == "0x91" ) dane[ x ] = 0x91; if( str[ x ] == "0x92" ) dane[ x ] = 0x92; if( str[ x ] == "0x93" ) dane[ x ] = 0x93; if( str[ x ] == "0x94" ) dane[ x ] = 0x94; if( str[ x ] == "0x95" ) dane[ x ] = 0x95; if( str[ x ] == "0x96" ) dane[ x ] = 0x96; if( str[ x ] == "0x97" ) dane[ x ] = 0x97; if( str[ x ] == "0x98" ) dane[ x ] = 0x98; if( str[ x ] == "0x99" ) dane[ x ] = 0x99; if( str[ x ] == "0xA0" ) dane[ x ] = 0xA0; if( str[ x ] == "0xA1" ) dane[ x ] = 0xA1; if( str[ x ] == "0xA2" ) dane[ x ] = 0xA2; if( str[ x ] == "0xA3" ) dane[ x ] = 0x13; if( str[ x ] == "0xA4" ) dane[ x ] = 0xA4; if( str[ x ] == "0xA5" ) dane[ x ] = 0xA5; if( str[ x ] == "0xA6" ) dane[ x ] = 0xA6; if( str[ x ] == "0xA7" ) dane[ x ] = 0xA7; if( str[ x ] == "0xA8" ) dane[ x ] = 0xA8; if( str[ x ] == "0xA9" ) dane[ x ] = 0xA9; if( str[ x ] == "0xB0" ) dane[ x ] = 0xB0; if( str[ x ] == "0xB1" ) dane[ x ] = 0xB1; if( str[ x ] == "0xB2" ) dane[ x ] = 0xB2; if( str[ x ] == "0xB3" ) dane[ x ] = 0xB3; if( str[ x ] == "0xB4" ) dane[ x ] = 0xB4; if( str[ x ] == "0xB5" ) dane[ x ] = 0xB5; if( str[ x ] == "0xB6" ) dane[ x ] = 0xB6; if( str[ x ] == "0xB7" ) dane[ x ] = 0xB7; if( str[ x ] == "0xB8" ) dane[ x ] = 0xB8; if( str[ x ] == "0xB9" ) dane[ x ] = 0xB9; if( str[ x ] == "0xC0" ) dane[ x ] = 0xC0; if( str[ x ] == "0xC1" ) dane[ x ] = 0xC1; if( str[ x ] == "0xC2" ) dane[ x ] = 0xC2; if( str[ x ] == "0xC3" ) dane[ x ] = 0xC3; if( str[ x ] == "0xC4" ) dane[ x ] = 0xC4; if( str[ x ] == "0xC5" ) dane[ x ] = 0xC5; if( str[ x ] == "0xC6" ) dane[ x ] = 0xC6; if( str[ x ] == "0xC7" ) dane[ x ] = 0xC7; if( str[ x ] == "0xC8" ) dane[ x ] = 0xC8; if( str[ x ] == "0xC9" ) dane[ x ] = 0xC9; if( str[ x ] == "0xD0" ) dane[ x ] = 0xD0; if( str[ x ] == "0xD1" ) dane[ x ] = 0xD1; if( str[ x ] == "0xD2" ) dane[ x ] = 0xD2; if( str[ x ] == "0xD3" ) dane[ x ] = 0xD3; if( str[ x ] == "0xD4" ) dane[ x ] = 0xD4; if( str[ x ] == "0xD5" ) dane[ x ] = 0xD5; if( str[ x ] == "0xD6" ) dane[ x ] = 0xD6; if( str[ x ] == "0xD7" ) dane[ x ] = 0xD7; if( str[ x ] == "0xD8" ) dane[ x ] = 0xD8; if( str[ x ] == "0xD9" ) dane[ x ] = 0xD9; if( str[ x ] == "0xE0" ) dane[ x ] = 0xE0; if( str[ x ] == "0xE1" ) dane[ x ] = 0xE1; if( str[ x ] == "0xE2" ) dane[ x ] = 0xE2; if( str[ x ] == "0xE3" ) dane[ x ] = 0xE3; if( str[ x ] == "0xE4" ) dane[ x ] = 0xE4; if( str[ x ] == "0xE5" ) dane[ x ] = 0xE5; if( str[ x ] == "0xE6" ) dane[ x ] = 0xE6; if( str[ x ] == "0xE7" ) dane[ x ] = 0xE7; if( str[ x ] == "0xE8" ) dane[ x ] = 0xE8; if( str[ x ] == "0xE9" ) dane[ x ] = 0xE9; if( str[ x ] == "0xF0" ) dane[ x ] = 0xF0; if( str[ x ] == "0xF1" ) dane[ x ] = 0xF1; if( str[ x ] == "0xF2" ) dane[ x ] = 0xF2; if( str[ x ] == "0xF3" ) dane[ x ] = 0xF3; if( str[ x ] == "0xF4" ) dane[ x ] = 0xF4; if( str[ x ] == "0xF5" ) dane[ x ] = 0xF5; if( str[ x ] == "0xF6" ) dane[ x ] = 0xF6; if( str[ x ] == "0xF7" ) dane[ x ] = 0xF7; if( str[ x ] == "0xF8" ) dane[ x ] = 0xF8; if( str[ x ] == "0xF9" ) dane[ x ] = 0xF9; if( str[ x ] == "0x0A" ) dane[ x ] = 0x0A; if( str[ x ] == "0x1A" ) dane[ x ] = 0x1A; if( str[ x ] == "0x2A" ) dane[ x ] = 0x2A; if( str[ x ] == "0x3A" ) dane[ x ] = 0x3A; if( str[ x ] == "0x4A" ) dane[ x ] = 0x4A; if( str[ x ] == "0x5A" ) dane[ x ] = 0x5A; if( str[ x ] == "0x6A" ) dane[ x ] = 0x6A; if( str[ x ] == "0x7A" ) dane[ x ] = 0x7A; if( str[ x ] == "0x8A" ) dane[ x ] = 0x8A; if( str[ x ] == "0x9A" ) dane[ x ] = 0x9A; if( str[ x ] == "0x0B" ) dane[ x ] = 0x0B; if( str[ x ] == "0x1B" ) dane[ x ] = 0x1B; if( str[ x ] == "0x2B" ) dane[ x ] = 0x2B; if( str[ x ] == "0x3B" ) dane[ x ] = 0x3B; if( str[ x ] == "0x4B" ) dane[ x ] = 0x4B; if( str[ x ] == "0x5B" ) dane[ x ] = 0x5B; if( str[ x ] == "0x6B" ) dane[ x ] = 0x6B; if( str[ x ] == "0x7B" ) dane[ x ] = 0x7B; if( str[ x ] == "0x8B" ) dane[ x ] = 0x8B; if( str[ x ] == "0x9B" ) dane[ x ] = 0x9B; if( str[ x ] == "0x0C" ) dane[ x ] = 0x0C; if( str[ x ] == "0x1C" ) dane[ x ] = 0x1C; if( str[ x ] == "0x2C" ) dane[ x ] = 0x2C; if( str[ x ] == "0x3C" ) dane[ x ] = 0x3C; if( str[ x ] == "0x4C" ) dane[ x ] = 0x4C; if( str[ x ] == "0x5C" ) dane[ x ] = 0x5C; if( str[ x ] == "0x6C" ) dane[ x ] = 0x6C; if( str[ x ] == "0x7C" ) dane[ x ] = 0x7C; if( str[ x ] == "0x8C" ) dane[ x ] = 0x8C; if( str[ x ] == "0x9C" ) dane[ x ] = 0x9C; if( str[ x ] == "0x0D" ) dane[ x ] = 0x0D; if( str[ x ] == "0x1D" ) dane[ x ] = 0x1D; if( str[ x ] == "0x2D" ) dane[ x ] = 0x2D; if( str[ x ] == "0x3D" ) dane[ x ] = 0x3D; if( str[ x ] == "0x4D" ) dane[ x ] = 0x4D; if( str[ x ] == "0x5D" ) dane[ x ] = 0x5D; if( str[ x ] == "0x6D" ) dane[ x ] = 0x6D; if( str[ x ] == "0x7D" ) dane[ x ] = 0x7D; if( str[ x ] == "0x8D" ) dane[ x ] = 0x8D; if( str[ x ] == "0x9D" ) dane[ x ] = 0x9D; if( str[ x ] == "0x0E" ) dane[ x ] = 0x0E; if( str[ x ] == "0x1E" ) dane[ x ] = 0x1E; if( str[ x ] == "0x2E" ) dane[ x ] = 0x2E; if( str[ x ] == "0x3E" ) dane[ x ] = 0x3E; if( str[ x ] == "0x4E" ) dane[ x ] = 0x4E; if( str[ x ] == "0x5E" ) dane[ x ] = 0x5E; if( str[ x ] == "0x6E" ) dane[ x ] = 0x6E; if( str[ x ] == "0x7E" ) dane[ x ] = 0x7E; if( str[ x ] == "0x8E" ) dane[ x ] = 0x8E; if( str[ x ] == "0x9E" ) dane[ x ] = 0x9E; if( str[ x ] == "0x0F" ) dane[ x ] = 0x0F; if( str[ x ] == "0x1F" ) dane[ x ] = 0x1F; if( str[ x ] == "0x2F" ) dane[ x ] = 0x2F; if( str[ x ] == "0x3F" ) dane[ x ] = 0x3F; if( str[ x ] == "0x4F" ) dane[ x ] = 0x4F; if( str[ x ] == "0x5F" ) dane[ x ] = 0x5F; if( str[ x ] == "0x6F" ) dane[ x ] = 0x6F; if( str[ x ] == "0x7F" ) dane[ x ] = 0x7F; if( str[ x ] == "0x8F" ) dane[ x ] = 0x8F; if( str[ x ] == "0x9F" ) dane[ x ] = 0x9F; if( str[ x ] == "0xAA" ) dane[ x ] = 0xAA; if( str[ x ] == "0xAB" ) dane[ x ] = 0xAB; if( str[ x ] == "0xAC" ) dane[ x ] = 0xAC; if( str[ x ] == "0xAD" ) dane[ x ] = 0xAD; if( str[ x ] == "0xAE" ) dane[ x ] = 0xAE; if( str[ x ] == "0xBF" ) dane[ x ] = 0xBF; if( str[ x ] == "0xBA" ) dane[ x ] = 0xBA; if( str[ x ] == "0xBB" ) dane[ x ] = 0xBB; if( str[ x ] == "0xBC" ) dane[ x ] = 0xBC; if( str[ x ] == "0xBD" ) dane[ x ] = 0xBD; if( str[ x ] == "0xBE" ) dane[ x ] = 0xBE; if( str[ x ] == "0xBF" ) dane[ x ] = 0xBF; if( str[ x ] == "0xCA" ) dane[ x ] = 0xCA; if( str[ x ] == "0xCB" ) dane[ x ] = 0xCB; if( str[ x ] == "0xCC" ) dane[ x ] = 0xCC; if( str[ x ] == "0xCD" ) dane[ x ] = 0xCD; if( str[ x ] == "0xCE" ) dane[ x ] = 0xCE; if( str[ x ] == "0xCF" ) dane[ x ] = 0xCF; if( str[ x ] == "0xDA" ) dane[ x ] = 0xDA; if( str[ x ] == "0xDB" ) dane[ x ] = 0xDB; if( str[ x ] == "0xDC" ) dane[ x ] = 0xDC; if( str[ x ] == "0xDD" ) dane[ x ] = 0xDD; if( str[ x ] == "0xDE" ) dane[ x ] = 0xDE; if( str[ x ] == "0xDF" ) dane[ x ] = 0xDF; if( str[ x ] == "0xEA" ) dane[ x ] = 0xEA; if( str[ x ] == "0xEB" ) dane[ x ] = 0xEB; if( str[ x ] == "0xEC" ) dane[ x ] = 0xEC; if( str[ x ] == "0xED" ) dane[ x ] = 0xED; if( str[ x ] == "0xEE" ) dane[ x ] = 0xEE; if( str[ x ] == "0xEF" ) dane[ x ] = 0xEF; if( str[ x ] == "0xFA" ) dane[ x ] = 0xFA; if( str[ x ] == "0xFB" ) dane[ x ] = 0xFB; if( str[ x ] == "0xFC" ) dane[ x ] = 0xFC; if( str[ x ] == "0xFD" ) dane[ x ] = 0xFD; if( str[ x ] == "0xFE" ) dane[ x ] = 0xFE; if( str[ x ] == "0xFF" ) dane[ x ] = 0xFF; } ALLEGRO_FILE * file = al_open_memfile( dane, sizeof( dane ), "rw" ); OB2 = al_load_bitmap_f( file, ".png" ); double time1 = 0; bool xw = false; bool wcisniety = false; double czas_fps = 0; int fps = 0; for(;; ) { al_get_keyboard_state( & Key ); if( al_get_time() > time1 + 0.01 ) { al_clear_to_color( al_map_rgb( 255, 255, 255 ) ); time1 = al_get_time(); al_draw_bitmap( OB2, 10, 10, 0 ); al_flip_display(); } if( al_key_down( & Key, ALLEGRO_KEY_Q ) && wcisniety == false ) { al_set_new_display_flags( ALLEGRO_FULLSCREEN ); al_resize_display( display, 1280, 1024 ); wcisniety = true; } if( al_key_down( & Key, ALLEGRO_KEY_Q ) == false ) wcisniety = false; if( al_get_time() > czas_fps ) { czas_fps = czas_fps + 1; cout << fps << endl; fps = 0; } fps++; if( al_key_down( & Key, ALLEGRO_KEY_ESCAPE ) ) break; } al_flip_display(); al_destroy_bitmap( OB1 ); al_destroy_display( display ); return 0; } Teraz do pliku v.txt trzeba dodać kod z hex np; 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x1C, 0x08, 0x06, 0x00, 0x00, 0x00, 0x72, 0x0D, 0xDF, 0x94, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xAE, 0xCE, 0x1C, 0xE9, 0x00, 0x00, 0x00, 0x04, 0x67, 0x41, 0x4D, 0x41, 0x00, 0x00, 0xB1, 0x8F, 0x0B, 0xFC, 0x61, 0x05, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0E, 0xC4, 0x00, 0x00, 0x0E, 0xC4, 0x01, 0x95, 0x2B, 0x0E, 0x1B, 0x00, 0x00, 0x00, 0x39, 0x49, 0x44, 0x41, 0x54, 0x48, 0x4B, 0xED, 0xCD, 0x31, 0x11, 0x00, 0x20, 0x10, 0xC4, 0xC0, 0x03, 0x29, 0xE8, 0xC1, 0x2C, 0x0A, 0xF9, 0x06, 0x09, 0x99, 0x2F, 0x98, 0x6C, 0x93, 0x32, 0x63, 0x9D, 0x7D, 0xD3, 0x68, 0xBE, 0xB6, 0x71, 0x88, 0x73, 0x88, 0x73, 0x88, 0x73, 0x88, 0x73, 0x88, 0x73, 0x88, 0x73, 0x88, 0x73, 0x88, 0xFB, 0x7D, 0x98, 0x14, 0x8C, 0x65, 0x02, 0x56, 0x4A, 0xFC, 0x41, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE, 0x42, 0x60, 0x82 i na końcu dodać ",q" wtedy obrazek jest wczytywany. |