问题描述
我无法测试或修改代码的结构,这仍然是一个非常非常早期的构建...如果我不尝试包含任何图形,游戏在命令行上执行得很好。
I couldn't test or modify the structure of the code yet, and this is still a very, very early build... if I don't attempt to include any graphics, the game executes just fine on a command line.
#include <iostream>
#include <string>
#include <graphics.h>
int main()
{
int gd = DETECT;
int gm;
initgraph(&gd, &gm, "C:\\TC\\BGI");
arc(200, 200, 0, 130, 50);
arc(150, 150, 0, 360, 10);
arc(250, 150, 0, 360, 10);
arc(200, 200, 0, 360, 5);
getch();
closegraph;
int erick[2][6] = {{1,3,5},{2,4,6}};
// 1,3,5
// 2,4,6
int juliett[3][6] = {{1,3,5},{2,4,6}};
// 1,3,5
// 2,4,6
int elliot[4][6] = {{1,3,5},{2,4,6}};
// 1,3,5
// 2,4,6
int paul[5][6] = {{1,3,5},{2,4,6}};
// 1,3,5
// 2,4,6
int friedrich[6][6] = {{1,3,5},{2,4,6}};
// 1,3,5
// 2,4,6
int name1;
string age1;
char initial1;
cout << "naming game: type and guess the secret name to advance, if failure you see the credits!" << endl;
cin >> age1 >> initial1 >> name1;
cout << "type the secret name" << name1 << "starts with " << age1 << "the letter e" << name1 << endl;
int name2;
string age2;
char initial2;
cout << "stage 2" << endl;
cin >> age2 >> initial2 >> name2;
cout << "type the secret name" << name2 << "starts with " << age2 << "the letter j" << name2 << endl;
int name3;
string age3;
char initial3;
cout << "stage 3" << endl;
cin >> age3 >> initial3 >> name3;
cout << "type the secret name" << name3 << "starts with " << age3 << "the letter e" << name3 << endl;
int name4;
string age4;
char initial4;
cout << "stage 4" << endl;
cin >> age4 >> initial4 >> name4;
cout << "type the secret name" << name4 << "starts with " << age4 << "the letter p" << name4 << endl;
int name5;
string age5;
char initial5;
cout << "stage 5" << endl;
cin >> age5 >> initial5 >> name5;
cout << "type the secret name" << name5 << "starts with " << age5 << "the letter f" << name5 << endl;
}
换句话说,小窗口是空白的(灰色),如果我没有任何反应尝试使用图形。
我尝试过:
我试图取消图形编码,它开始作为命令行界面工作。还尝试在这里和那里修改编码,但它主要通过CLI工作,而不是GUI。
In other words, the small window is blank (grey), and nothing happens if I attempt to use graphics.
What I have tried:
I tried to take the graphics coding away and it started working as a command line interface. Also attempted to modify the coding here and there, but it is mostly working at this point through CLI, just not GUI.
推荐答案
- 例如Microsoft Windows API,X Window或Wayland with Linux)
- 使用高级框架,如MFC或WTL for Windows或Qt,GTK +,wxWidgets用于多种操作系统
有关GUI框架的概述,请参阅 []。
这篇关于我的graphics.h插件拒绝用代码:: blocks上的游戏的早期预测试代码显示图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!