⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fig15_03.c

📁 C程序设计经典教程第5版程序示例,比较适合初级c语言的学生
💻 C
字号:
/* Fig. 15.3: fig15_03.c
   Displaying a bitmap on the screen. */
#include <allegro.h>

int main( void )
{
    BITMAP *bmp; /* pointer to the bitmap */
    
    allegro_init(); /* initialize Allegro */
    install_keyboard(); /* allow Allegro to recieve keyboard input */
    set_color_depth( 16 ); /* set the color depth to 16-bit */
    set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0 ); /* set graphics mode */
    bmp = load_bitmap( "picture.bmp", NULL ); /* load the bitmap file */
    blit( bmp, screen, 0, 0, 0, 0, bmp->w, bmp->h ); /* draw the bitmap */
    readkey(); /* wait for a keypress */
    destroy_bitmap( bmp ); /* free the memory allocated to bmp */
    return 0;
} /* end function main */
END_OF_MAIN() /* Allegro-specific macro */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -