All pastes #135801 Raw Edit

linafroot

public cpp v1 · immutable
#135801 ·published 2006-08-17 05:37 UTC
rendered paste body
#include <stdlib.h>#include <windows.h>#include <stdio.h>#include <time.h>HANDLE hRead;HANDLE hWrite;char cFPS[9]="FPS: 22";int main(){	hWrite = GetStdHandle(STD_OUTPUT_HANDLE);	hRead = GetStdHandle(STD_INPUT_HANDLE);	// Set our console properties-	SetConsoleTitle("ASCII Raster v.01");	SMALL_RECT windowSize = { 0, 0, 19, 19 };	SetConsoleWindowInfo(hWrite, TRUE, &windowSize);	COORD buffSize = {20,20 };	SetConsoleScreenBufferSize(hWrite, buffSize);	// Set up the character buffer and positions-    CHAR_INFO consoleBuffer[10*11];    COORD charBufSize = {10,11};    COORD characterPos = {0,0};    SMALL_RECT writeArea = {0,0,10,11};    //Render Loop-	for(;;)	{			//TODO: start clock here-		//Populate our back buffer-		for (int y=0; y<10; ++y) 		{			for (int x=0; x<10; ++x) 			{				consoleBuffer[x+10*y].Char.AsciiChar = rand()%256;				consoleBuffer[x+10*y].Attributes = rand()%256;			}		}		//Populate fps portion of back buffer (read in cFPS[])-		for( int i=0; i<10;  ++i)		{			consoleBuffer[i+100].Attributes = FOREGROUND_BLUE |FOREGROUND_INTENSITY |BACKGROUND_RED |BACKGROUND_GREEN |BACKGROUND_INTENSITY;			consoleBuffer[i+100].Char.AsciiChar = cFPS[i];		}		//Write buffer to output-		WriteConsoleOutput(hWrite, consoleBuffer, charBufSize, characterPos, &writeArea);	}	return 0;}