Source: src/ex_scroll.cc


Annotated List
Files
Globals
Hierarchy
Index
#include 

#include 
#include 
#include 

#include "ex_drs.h"

using namespace std;

#define BASE 388
#define XBASE 174

class SCROLL
{
	private:
		string	scroll;
		BITMAP	*mixer;
		BITMAP	*submixer;
		FONT	*myfont;

		int char_pointer;
		int char_counter;
		int scrx, scry;
		int a;
		char xbuf[3];
		
	public:
		SCROLL();
		~SCROLL();
		
		void load(string name);
		void draw(BITMAP *bmp);
		void set_position(int x1, int y1);
		void set_font(FONT *fnt);
		
};
	
void SCROLL::load(string name)
{
	char buf[1024];
	PACKFILE *fp;

	scroll = "       ";

	fp = pack_fopen(name.c_str(),"rb");
	while(pack_fgets(buf, 1023, fp)) {
		scroll += buf;
		scroll += " ";
	}
	pack_fclose(fp);
	
	scroll += "\\";
}

SCROLL::SCROLL()
{
	char_counter = 8;
	char_pointer = 0;

	scrx = 640;
	scry = 200;

	submixer = create_bitmap(700, 40);
	mixer = create_bitmap(700, 40);
	

	clear_to_color(mixer, makecol16(255, 0, 255));
	clear_to_color(submixer, makecol16(255, 0, 255));

	bzero(xbuf,3);

	myfont = font;
	a = 0;
}

SCROLL::~SCROLL()
{
	destroy_bitmap(mixer);
	destroy_bitmap(submixer);
}

void SCROLL::set_position(int x1, int y1)
{
	scrx = x1;
	scry = y1;
}

void SCROLL::draw(BITMAP *bmp)
{
	char_counter--;

	if(!char_counter) {
		char_pointer++;
		if(scroll[char_pointer] == '\\') { char_pointer = 0; }
		xbuf[0] = scroll[char_pointer];
		char_counter = text_length(myfont, xbuf) / 2 + 1; 
		textprintf(mixer, myfont, scrx + 1, 0, 65535, "%c", scroll[char_pointer]);
	}
	
	a++;
	if(a>17) { a = 0; }
	
	blit(mixer, submixer, 2, 0, 0, 0, scrx - 2 + 50, 40);
	blit(submixer, mixer, 0, 0, 0, 0, scrx + 50, 40);
	blit(mixer, mixer, 100, 0, 100, 1, 5, 40);
	blit(mixer, mixer, 496, 2, 496, 0, 10, 40);
	blit(mixer, mixer, 520, 0, 520, 2, 10, 40);
	blit(mixer, mixer, 540, 2, 540, 0, 10, 40);
	blit(mixer, mixer, 566, 0, 566, 2, 10, 40);
	if(a%2) {
		blit(mixer, mixer, BASE, 0, BASE, 3, 1, 40);
		blit(mixer, mixer, BASE - 2, 0, BASE - 2, 3, 1, 40);
		blit(mixer, mixer, BASE - 4, 0, BASE - 4, 3, 1, 40);
		blit(mixer, mixer, BASE - 6, 0, BASE - 6, 3, 1, 40);
		blit(mixer, mixer, BASE - 8, 0, BASE - 8, 3, 1, 40);
		blit(mixer, mixer, BASE - 10, 0, BASE - 10, 3, 1, 40);
		blit(mixer, mixer, BASE - 12, 0, BASE - 12, 3, 1, 40);
		blit(mixer, mixer, BASE - 14, 0, BASE - 14, 3, 1, 40);

		blit(mixer, mixer, XBASE, 3, XBASE, 0, 1, 40);
		blit(mixer, mixer, XBASE - 2, 3, XBASE - 2, 0, 1, 40);
		blit(mixer, mixer, XBASE - 4, 3, XBASE - 4, 0, 1, 40);
		blit(mixer, mixer, XBASE - 6, 3, XBASE - 6, 0, 1, 40);
		blit(mixer, mixer, XBASE - 8, 3, XBASE - 8, 0, 1, 40);
		blit(mixer, mixer, XBASE - 10, 3, XBASE - 10, 0, 1, 40);
		blit(mixer, mixer, XBASE - 12, 3, XBASE - 12, 0, 1, 40);
		blit(mixer, mixer, XBASE - 14, 3, XBASE - 14, 0, 1, 40);

//		blit(mixer, mixer, 180, 12, 180, 0, 1, 30);
	}
	blit(mixer, mixer, 0, 0, 0, a/3, 30, 40);
	masked_blit(mixer, bmp, 0, 0, 0, 442, scrx, 40);
	DRS_add_rectangle(0, 442, scrx, 40);
}

void SCROLL::set_font(FONT *fnt)
{
	myfont = fnt;
}


Generated by: georgik on armada on Sat Jul 24 07:07:15 2004, using kdoc 2.0a54.