vs 是 2019,easyx 是官网最新版 20200902 的
我有几张图可以显示,但另外几张却不能显示,调了一天还是不知道问题在哪里。
现在下了功夫纯手打了一份精简代码,过程有好有坏。我边打边运行,首先背景顺利的显示了,接着飞机也能显示出来,有点兴奋。但到了飞机遮罩那里就显示不出了,然后我又加上敌机的代码,也没有显示,我真的摸不着头脑,这东西真的好奇怪。
#include <stdio.h>
#include <windows.h>
#include <conio.h>
#include <graphics.h>
#pragma comment(lib,"Winmm.lib")
#define Width 500
#define High 700
IMAGE img_bg; //背景
IMAGE img_plane1; //飞机
IMAGE img_plane2; //飞机遮罩
IMAGE img_enermy1, img_enermy2; //敌机和敌机遮罩
float plane_x=Width*0.4, plane_y=High*0.7;
float enermy_x = Width * 0.2, enermy_Y = High * 0.3;
int main()
{
initgraph(Width, High);
loadimage(&img_bg,_T("D:\\123\\Pictures\\飞机空战素材\\background.jpg")); //显示背景
putimage(0, 0, &img_bg);
loadimage(&img_plane2, _T("D:\\123\\Pictures\\飞机空战素材\\plane2.jpg")); //显示飞机遮罩
putimage(plane_x, plane_y, &img_plane2, NOTSRCERASE);
loadimage(&img_plane1, _T("D:\\123\\Pictures\\飞机空战素材\\plane.jpg")); //显示飞机
putimage(plane_x, plane_y, &img_plane1, SRCINVERT);
loadimage(&img_enermy1, _T("D:\\123\\Pictures\\飞机空战素材\\enermy.jpg")); //显示敌机
putimage(enermy_x, enermy_Y, &img_enermy1);
_getch(); //暂停界面
}