Beispiel #1
0
Console::Console(const std::string& font, Renderer& r)
{
    const auto screen = GetSdlSurface(r);

    mSdlConsole = CON_Init(font.c_str(), screen, LINE_COUNT,
                             { 0, 0,
                               static_cast<Uint16>(screen->w),
                               static_cast<Uint16>(screen->h * .75f) });
    if (!mSdlConsole) {
        throw "Unable to create console.";
    }

    CON_Alpha(mSdlConsole, ALPHA_LEVEL);
    CON_Topmost(mSdlConsole);

    CON_SetPrompt(mSdlConsole, "> ");
    CON_SetHideKey(mSdlConsole, SDLK_BACKQUOTE);

    CON_SetExecuteFunction(mSdlConsole, ConsoleCmdHandler);
    CON_SetTabCompletion(mSdlConsole, ConsoleTabHandler);

    r.RegisterPostRenderHook([&](void*){ CON_DrawConsole(mSdlConsole); });

    gConsoleMap[mSdlConsole] = this;
}
Beispiel #2
0
/* ==========================================================================
 * DRAWING
 * ==========================================================================
 */
void con_draw(void)
{
#ifdef CONSOLE
    CON_DrawConsole(Console);
    CON_UpdateConsole(Console);
#else
#if 0
    char buffer[CON_LINE_LEN+1];
    int i,j;
    for (i = con_line, j=0; j < 20; i = (i+1) % CON_NUM_LINES, j++)
    {
        memcpy(buffer, con_display[i], CON_LINE_LEN);
        buffer[CON_LINE_LEN] = 0;
        GrString(1, j * 10, buffer, 1);
    }
#endif
#endif
}
void
RC_ConsoleDraw(ConsoleInformation *console)
{
    CON_DrawConsole(console);
}