Skip to content

term.Framebuffer().Clear() does not clear newlines #2

@aaangeletakis

Description

@aaangeletakis

What's happening?

Here's the code (most of it's from Maze.cpp but I was trying to play around with Terminate and learn it)

#include <iostream>
#include <fstream>
#include <cstdlib>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <Terminate/terminate.hpp>
#include <Terminate/sdl/context.hpp>

const Term::Color BGCOLOR( 255,200,0 );
const Term::Color FONTCOLOR(0,0,0);


int
main( int argc, char* argv[] )
    {
    SDL_Init( SDL_INIT_VIDEO );
    atexit( SDL_Quit );
    atexit( IMG_Quit );

    Term::SDL::Context term( 200, 100 );
    term.Tilemap( "tileset.png" );
    SDL_Surface* screen = SDL_SetVideoMode(
        term.Framebuffer().Width()  * term.TileWidth(),
        term.Framebuffer().Height() * term.TileHeight(),
        32, SDL_SWSURFACE );
    term.RenderTarget( screen );
    term.Framebuffer().ClearChar( Term::Char('\0', 0, BGCOLOR, FONTCOLOR));
    term.Framebuffer().Clear();


    Term::TTY tty(term.Framebuffer());
    tty.Set( Term::TTY::VScroll );
    tty.Set( Term::TTY::Wrap );
    tty.PriColor( BGCOLOR );
    tty.SecColor( FONTCOLOR );

    bool running = true;
    srand (time(NULL));
    while(running)
        {
        SDL_Event event;
        while( SDL_PollEvent(&event) ) switch(event.type)
            {
            case SDL_QUIT:
            case SDL_KEYDOWN:
                running = false; break;
            }

        tty.Put("me@mehost ~/Downloads/Terminate-master/build/demo $" + std::to_string(rand()) + "\n");
        term.Print();
        SDL_Flip(screen);
        SDL_Delay(500);
        term.Framebuffer().Clear(); 
        }
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions