// include lib:
#include <acknex.h>
#include <default.c>
#include <strio.c>
STRING* document_str = "notes2.txt"; // the name of the document file
STRING* strText = "";
STRING* strFile = "";
// document description text:
TEXT* doc_desc_txt = {
strings = 0;
layer = 2;
font = "Arial#18i";
flags = SHOW | LIGHT | WWRAP;
}
//STRING* strText = "";
//STRING* strFile = "";
STRING* strNumber = "";
/**
* reads a Note from a File. Modifies doc_desc_txt as it appends strings to it.
*/
var read_notes(STRING* file)
{
var fhandle = file_open_read(file);
if (fhandle)
{
var num = 0;
var eof = 0;
do
{
eof = file_str_readto(fhandle, strFile, "#", 10000);
if (eof != -1)
{
error(strFile);
if (str_len(strFile) > 0)
{
txt_addstring(doc_desc_txt, strFile);
num++;
}
}
} while (eof != -1);
return num;
}
return 0;
}
void cycle_notes(var from, var to)
{
var waitTime = 0;
var curr = from;
while(1)
{
txt_setinvisible(doc_desc_txt, -1);
txt_setvisible(doc_desc_txt, curr);
waitTime += time_step;
if (waitTime > 10)
{
waitTime = 0;
curr = cycle(curr+1, from, to+1);
}
wait(1);
}
}
// main function:
void main(){
fps_max = 60;
level_load(NULL);
var msgs = read_notes("notes2.txt");
cycle_notes(0, msgs-1);
while(!key_esc){
DEBUG_VAR(1, 0);
DEBUG_VAR(msgs, 20);
doc_desc_txt.pos_x = 15;
doc_desc_txt.pos_y = 15;
doc_desc_txt.size_x = 200;
doc_desc_txt.size_y = 400;
wait(1);
}
// exit:
sys_exit("");
}