#include <iostream.h>
#include <fstream.h>
#include <windows.h>
#include <time.h>
#include <stdlib.h>
#include <conio.h>
#include <math.h>

#include "bits.h"
#include "blocks.h"
#include "game.h"
#include "draw.h"
#include "menu.h"
#include "test.h"

struct file
{
	char text[1000][150];
};


void textout(struct file, int);
struct file textin(char []);

main()
{

	screensize();
	box(0, 0, 79, 49, 12, 0, 2); 
	int key=0, line=0;
	struct file bit = textin("help.txt");
	for(;;)
	{
		

		textout(bit, line);
		do{key=getch();}while(key==0);
		switch(key)
		{
		case '+':
			line++;
			break;
		case '-':
			if(line>0)
				line--;
			else
				line=0;
			break;

			
		}
	}



return 0;
}

void textout(struct file help, int line)
{
	for(int y=0;y<48;y++)
	{
		for(int x=0;x<78;x++) 
		{
			if(help.text[y+line][x]=='~'||help.text[y+line][x]<30)
				put(0, x+1, y+1, 12);
			else
				put(help.text[y+line][x], x+1, y+1, 1);
		}
	}


}

struct file textin(char filename[])
{
	struct file help;
	bool eof=false;
	int count=0;
	char bit[100];

	ifstream filein (filename, ios::in);
	do
	{
		filein.getline(help.text[count], 150);
		count++;
	}while(help.text[count-1][0]!='~');

	filein.close();
	return help;
}
