#include #include #include #include "shadow.h" static int mouse_img_data[] = { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,4,5,1,1,1,0,0,0,0,0,0,0,0,0, 0,1,3,4,5,6,6,1,1,1,0,0,0,0,0,0, 0,0,1,3,4,5,6,6,6,6,1,1,1,0,0,0, 0,0,1,2,3,4,5,6,6,6,6,6,6,1,1,1, 0,0,1,2,2,3,4,5,6,6,6,1,1,0,0,0, 0,0,0,1,2,2,3,4,5,6,1,0,0,0,0,0, 0,0,0,1,2,2,2,3,4,5,6,1,0,0,0,0, 0,0,0,1,2,2,2,2,3,4,5,6,1,0,0,0, 0,0,0,0,1,2,2,1,2,3,4,5,6,1,0,0, 0,0,0,0,1,2,1,0,1,2,3,4,5,6,1,0, 0,0,0,0,1,2,1,0,0,1,2,3,4,5,6,1, 0,0,0,0,0,1,0,0,0,0,1,2,3,4,1,0, 0,0,0,0,0,1,0,0,0,0,0,1,2,1,0,0, 0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0 }; #define MOUSE_WIDTH 16 #define MOUSE_HEIGHT 16 static void init_allegro_stuff(void); static BITMAP* create_mouse_img(void); static void draw_bg(BITMAP* bmp); int main(int argc, char** argv) { int i = 0; lscene_t* l; BITMAP* r; BITMAP* f; BITMAP* m; BITMAP* mouse_img; BITMAP* buffer; init_allegro_stuff(); l = create_lscene(); draw_bg(add_layer(l, 0)); r = add_layer(l, 1); clear_to_color(r, MASK_COLOR_32); draw_window_frame(r, 120, 110, 20 * 8 + 4, 10 * 8 + 4); text_mode(makecol32(191, 191, 191)); draw_lotsa_text(r, 122, 112, 20, 10, makecol32(0, 0, 0), 0); f = add_layer(l, 2); clear_to_color(f, MASK_COLOR_32); draw_window_frame_2(f, 9, 29, 25 * 8 + 9, 13 * 8 + 9); text_mode(-1); draw_lotsa_text(f, 13, 33, 25, 13, makecol32(0, 255, 0), 1); m = add_layer(l, 3); mouse_img = create_mouse_img(); buffer = create_bitmap(SCREEN_WIDTH, SCREEN_HEIGHT); while (!keypressed()) { clear_to_color(m, MASK_COLOR_32); blit(mouse_img, m, 0, 0, mouse_x, mouse_y, MOUSE_WIDTH, MOUSE_HEIGHT); blit(r, buffer, 122, 112, 0, 0, 20 * 8, 1); blit(r, r, 122, 113, 122, 112, 20 * 8, 10 * 8 - 1); blit(buffer, r, 0, 0, 122, 112 + 10 * 8 - 1, 20 * 8, 1); if (i == 1) { blit(f, buffer, 13, 33, 0, 0, 25 * 8 + 1, 1); blit(f, f, 13, 34, 13, 33, 25 * 8 + 1, 13 * 8); blit(buffer, f, 0, 0, 13, 33 + 13 * 8, 25 * 8 + 1, 1); i = 0; } else {i = 1;} /*if (++i == 8) { text_mode(makecol32(191, 191, 191)); draw_text(r, 122, 92 + 9 * 8, 20); text_mode(MASK_COLOR_32); draw_text(f, 12, 32 + 12 * 8, 25); i = 0; }*/ render_lscene(buffer, l); acquire_screen(); vsync(); blit(buffer, screen, 0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); release_screen(); } destroy_lscene(l); destroy_bitmap(buffer); destroy_bitmap(mouse_img); return EXIT_SUCCESS; } END_OF_MAIN(); /* Prepare everything Allegro */ static void init_allegro_stuff(void) { allegro_init(); install_keyboard(); install_mouse(); install_timer(); set_color_depth(SCREEN_DEPTH); set_gfx_mode(SCREEN_MODE, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); } static BITMAP* create_mouse_img(void) { BITMAP* m = create_bitmap_ex(INTERNAL_DEPTH, MOUSE_WIDTH, MOUSE_HEIGHT); int x, y; int* mp = mouse_img_data; for (y = 0; y < MOUSE_HEIGHT; y++) for (x = 0; x < MOUSE_WIDTH; x++, mp++) switch (*mp) { case 0: putpixel(m, x, y, MASK_COLOR_32); break; case 1: putpixel(m, x, y, 0x000000); break; case 2: putpixel(m, x, y, 0x4f4f6f); break; case 3: putpixel(m, x, y, 0x6f6f8f); break; case 4: putpixel(m, x, y, 0x8f8faf); break; case 5: putpixel(m, x, y, 0xafafcf); break; case 6: putpixel(m, x, y, 0xcfcfef); break; } return m; } static void draw_bg(BITMAP* bmp) { int y, x; for (y = 0; y < SCREEN_HEIGHT; y++) for (x = 0; x < SCREEN_WIDTH; x++) { int r = 191 - (cos(sin((x + y) * M_PI / 40) - (y + x + 150) * sin(y * M_PI / 20) * M_PI / 180) + 1.0) * 31; int g = 191 - (sin((5 * (sin((x + y) * M_PI / 20) * M_PI / 50) + 10 * cos(y * M_PI / 40)) * (y - x) * M_PI / 360) + 1.0) * 31; int b = 191 - (cos(((sin((y + x) * M_PI / 10))) - M_PI * cos(sin(x * M_PI / 50) - y * M_PI / 20)) * sin(y * M_PI / 160) + 1.0) * 31; putpixel(bmp, x, y, makecol32(r, g, b)); } }