看过《WINDOWS游戏编程大师技巧》的进下,帮忙看看问题

wafx5545592 2010-05-03 05:39:13
我装载一张图片,运行都通的过,但是就是没有画面,我想了一下可能是因为图片是376,222的,于是我更改程序为376,222的,但是依旧没有图像,这是怎么回事啊

int Game_Init(void *parms)
{
// this function is where you do all the initialization
// for your game
DDraw_Init(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP);
Load_Bitmap_File(&bitmap16bit,"beginmenu.bmp");

Create_Bitmap(&startmenu,0,0,376,222,16);
Load_Image_Bitmap(&startmenu,&bitmap16bit,0,0,BITMAP_EXTRACT_MODE_ABS);



Unload_Bitmap_File(&bitmap16bit);

// start up DirectDraw (replace the parms as you desire)



return(1);

} // end Game_Init

///////////////////////////////////////////////////////////

int Game_Shutdown(void *parms)
{

return(1);
} // end Game_Shutdown

///////////////////////////////////////////////////////////



//////////////////////////////////////////////////////////

int Game_Main(void *parms)
{
// this is the workhorse of your game it will be called
// continuously in real-time this is like main() in C
// all the calls for you game go here!

Start_Clock();
DDraw_Fill_Surface(lpddsback, 0);
DDraw_Lock_Back_Surface();
Draw_Bitmap16(&startmenu, back_buffer, back_lpitch, 0);
DDraw_Unlock_Back_Surface();
DDraw_Flip();
// check of user is trying to exit
if (KEY_DOWN(VK_ESCAPE))
PostMessage(main_window_handle, WM_DESTROY,0,0);

// sync to 30ish fps
Wait_Clock(30);

// return success
return(1);

} // end Game_Main

//////////////////////////////////////////////////////////


...全文
91 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
hankcs 2010-05-03
  • 打赏
  • 举报
回复
在你的代码里面
Load_Bitmap_File(&bitmap16bit,"beginmenu.bmp");
色深是16,所以要找个16位的图片
hankcs 2010-05-03
  • 打赏
  • 举报
回复
检查你的图片色深
// load in the generator bob image
Load_Bitmap_File(&bitmap8bit, "GENS4.BMP");

注意这个函数是8位色深

64,637

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧