示例#1
0
/* Draws the console buffer to the screen if the console is "visible" */
void CON_DrawConsole(ConsoleInformation *console) {
    SDL_Rect DestRect;
    SDL_Rect SrcRect;

    if(!console)
        return;

    /* only draw if console is visible: here this means, that the console is not CON_CLOSED */
    if(console->Visible == CON_CLOSED)
        return;

    /* Update the scrolling offset */
    CON_UpdateOffset(console);

    /* Update the command line since it has a blinking cursor */
    DrawCommandLine();

    /* before drawing, make sure the alpha channel of the console surface is set
     * properly.  (sigh) I wish we didn't have to do this every frame... */
    //TR2 if(console->OutputScreen->flags & SDL_GL_OPENGLBLIT)
    //	CON_AlphaGL(console->ConsoleSurface, console->ConsoleAlpha);

    SrcRect.x = 0;
    SrcRect.y = console->ConsoleSurface->h - console->RaiseOffset;
    SrcRect.w = console->ConsoleSurface->w;
    SrcRect.h = console->RaiseOffset;

    /* Setup the rect the console is being blitted into based on the output screen */
    DestRect.x = console->DispX;
    DestRect.y = console->DispY;
    DestRect.w = console->ConsoleSurface->w;
    DestRect.h = console->ConsoleSurface->h;

    //SDL_BlitSurface(console->ConsoleSurface, &SrcRect, console->OutputScreen, &DestRect);
    SDL_BlitSurface(console->ConsoleSurface, &SrcRect, console->OutputScreen, &DestRect);

    //TR2 if(console->OutputScreen->flags & SDL_OPENGLBLIT)
    //	SDL_UpdateRects(console->OutputScreen, 1, &DestRect);
}
示例#2
0
/* Draws the console buffer to the screen if the console is "visible" */
void CON_DrawConsole(ConsoleInformation * console)
{
    SDL_Rect DestRect;
    SDL_Rect SrcRect;

    if (!console)
        return;

    /* only draw if console is visible: here this means, that the console is not CON_CLOSED */
    if (console->Visible == CON_CLOSED)
        return;

    /* Update the scrolling offset */
    CON_UpdateOffset(console);

    /* Update the command line since it has a blinking cursor */
    DrawCommandLine();

    SrcRect.x = 0;
    SrcRect.y = console->ConsoleSurface->h - console->RaiseOffset;
    SrcRect.w = console->ConsoleSurface->w;
    SrcRect.h = console->RaiseOffset;

    /* Setup the rect the console is being blitted into based on the output screen */
    DestRect.x = console->DispX;
    DestRect.y = console->DispY;
    DestRect.w = console->ConsoleSurface->w;
    DestRect.h = console->RaiseOffset;

    SDL_FillRect(console->OutputScreen, &DestRect,
                 SDL_MapRGBA(console->ConsoleSurface->format,
                             255, 255, 255, console->ConsoleAlpha));
    SDL_BlitSurface(console->ConsoleSurface, &SrcRect,
                    console->OutputScreen, &DestRect);

}