Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5729 → Rev 5730

/programs/cmm/lib/font.h
0,0 → 1,95
#ifndef INCLUDE_FONT_H
#define INCLUDE_FONT_H
 
#ifndef INCLUDE_MATH_H
#include "../lib/math.h"
#endif
 
#ifndef INCLUDE_IO_H
#include "../lib/io.h"
#endif
 
:struct FONT
{
byte width,height,offsetLine;
word block;
dword data;
dword size_file;
byte load(...);
byte symbol(word x,y;byte s;dword c);
dword text(word x,y;dword text,c);
dword textarea(word x,y;dword text,c);
};
FONT font = 0;
:dword FONT::text(word x,y;dword text1,c)
{
dword len=0;
WHILE(DSBYTE[text1])
{
len += symbol(x+len,y,DSBYTE[text1],c);
text1++;
}
return len;
}
:dword FONT::textarea(word x,y;dword text1,c)
{
dword len=0;
WHILE(DSBYTE[text1])
{
IF(DSBYTE[text1]=='\r'){ y+=height; len=0;}
ELSE len += symbol(x+len,y,DSBYTE[text1],c);
text1++;
}
return len;
}
:byte FONT::symbol(signed x,y;byte s;dword c)
{
dword xi,yi;
dword tmp,_;
dword iii;
byte rw=0;
IF(offsetLine)y+=offsetLine;
IF(s==32)return width/4;
yi = 0;
iii = 0;
tmp = 4*block*s;
tmp +=data;
while(yi<height)
{
xi = 0;
WHILE(xi<width)
{
IF(!(iii%32))
{
tmp += 4;
_ = DSDWORD[tmp];
}
ELSE _ >>= 1;
IF(_&1)
{
IF(xi>rw)rw=xi;
PutPixel(x+xi,y+yi,c);
}
xi++;
iii++;
}
yi++;
}
return rw;
}
:byte FONT::load(dword path)
{
dword tmp;
IF(data)free(data);
tmp = io.read(path);
data = tmp;
size_file = io.FILES_SIZE;
tmp +=size_file;
tmp--;
height = DSBYTE[tmp];
tmp--;
width = DSBYTE[tmp];
block = math.ceil(height*width/32);
}
 
#endif
/programs/cmm/lib/io.h
279,6 → 279,7
byte copy(...);
byte move(...);
dword set(...);
dword readKPACK(dword path1);
dword convert_size();
__DIR dir;
__PATH path;
285,7 → 286,16
__FILE file;
____BDVK BDVK;
}io;
 
:dword IO::readKPACK(dword path1)
{
dword sizes;
EAX = 68;
EBX = 27;
ECX = path.path(path1);
EDX = sizes;
$int 0x40;
return EAX;
}
:byte __ConvertSize_size_prefix[8];
:dword IO::convert_size()
{
/programs/cmm/lib/math.h
15,7 → 15,32
float sqrt(float x);
float tan(float x);
float abs(float x);
float floor(float x);
signed round(float x);
signed ceil(float x);
}math;
:signed MATH::round(float x)
{
x+=0.6;
return x;
}
:signed MATH::ceil(float x)
{
dword z;
float tmp;
z = x;
tmp = z;
IF(tmp<x)z++;
return z;
}
:float MATH::floor(float x)
{
signed long z;
z = x;
IF(z==x)return x;
IF(z<0) return z-1;
return z;
}
:float MATH::abs(float x)
{
IF(x<0)return -x;