当前位置: 动力学知识库 > 问答 > 编程问答 >

arrays - simple graphical output in visual c++

问题描述:

I just started using visual c++ have an idea for an easy game and would like to know wether there is a simple way to display a 2d array on screen as a graphical output

I already tried many librarys but there were somehow too complicated. But however I am not interested in having an character box

thanks.

网友答案:

There really is no simple solution.

There are some libraries out there which can make your life easier. The drawback is that you have to learn how these different libraries work. If you want to make a simple game in C++ that's what you have to do.

Some libraries would be:

SDL

Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. It is used by video playback software, emulators, and popular games including Valve's award winning catalog and many Humble Bundle games.

SFML

SFML provides a simple interface to the various components of your PC, to ease the development of games and multimedia applications. It is composed of five modules: system, window, graphics, audio and network.

网友答案:

For simple, out-of-the-box text console output:

#include <iostream>

int main()
{
    const unsigned int ARR_LENX = 5;
    const unsigned int ARR_LENY = 5;
    char array[ARR_LENX][ARR_LENY];
    Initialize(array);

    for (int y = 0; y < ARR_LENY; ++y)
    {
        for (int x = 0; x < ARR_LENX; ++x)
            std::cout << array[y][x];
        std::cout << std::endl;
    }
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: