我的graphics.h插件拒绝用代码:: blocks上的游戏的早期预测试代码显示图形 [英] My graphics.h plugin refuses to show graphics with my early pre-testing code for a game on code::blocks

查看:90
本文介绍了我的graphics.h插件拒绝用代码:: blocks上的游戏的早期预测试代码显示图形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法测试或修改代码的结构,这仍然是一个非常非常早期的构建...如果我不尝试包含任何图形,游戏在命令行上执行得很好。

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.

推荐答案

graphics.h 头文件用于DOS的Turbo C [++]图形库。如果你想使用它,你必须使用Turbo C [++]构建你的程序并在DOS下执行程序(启动到DOS系统或使用DOS模拟器,如DOSBox)。



要在窗口系统上运行时创建带图形输出的程序,您可以使用系统相关的低级框架(b)b
The graphics.h header file is for the Turbo C[++] graphics library for DOS. If you want to use that, you must build your program with Turbo C[++] and execute your program within DOS (boot into a DOS system or use a DOS emulator like DOSBox).

To create programs with graphical output when running on a windowed system you can


  1. 例如Microsoft Windows API,X Window或Wayland with Linux)
  2. 使用高级框架,如MFC或WTL for Windows或Qt,GTK +,wxWidgets用于多种操作系统



有关GUI框架的概述,请参阅小工具工具包列表 - 维基百科 [ ^ ]。


这篇关于我的graphics.h插件拒绝用代码:: blocks上的游戏的早期预测试代码显示图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆