Показать сообщение отдельно
Старый 03.06.2011, 08:41   #6
RegIon
Элита
 
Аватар для RegIon
 
Регистрация: 16.01.2010
Адрес: Новосибирск
Сообщений: 2,158
Написано 502 полезных сообщений
(для 1,012 пользователей)
Ответ: Где ошибка,хелп...

//#include "libgame.h"

#define    NULL    (void*)0

extern void **ftab;

#define COLOR_ROP_TRANSP    0xcc    // transparency
#define COLOR_ROP_NOP        0xf0    // nop - just paint

typedef unsigned char        uint8_t;
typedef unsigned short        uint16_t;
typedef unsigned long        uint32_t;
typedef unsigned long long    uint64_t;
int chars[]={
0,0,0,0,0,0,0,0,//пробел
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0, 
0,0,0,1,1,0,0,0,//!
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,1,1,0,0,0,
0,0,0,1,1,0,0,0, 
0,1,1,0,1,1,0,0,//"
0,1,1,0,1,1,0,0,
0,1,0,0,1,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0 
};
typedef struct gfx_rect {
    uint16_t    x, y;
    uint16_t    width, height;
} gfx_rect_t;

typedef struct key_data {
    uint32_t    key1;
    uint32_t    key2;
} key_data_t;

void  altprint(int chars[],int size,int x,int y,char string[],int len);
void (*dprintf)(char *fmt, ...);

//int (*gfx_init)();
int (*gfx_init)(void *buffer, int buffsize);
int (*gfx_set_framebuffer)(int width, int height);
int (*gfx_set_display_screen)(gfx_rect_t *rect);//int with, int height);
int (*gfx_set_cammmode)(int mode);
int (*gfx_set_fgcolor)(uint32_t *color);
uint32_t (*gfx_get_fgcolor)();
int (*gfx_set_colorrop)(uint32_t rop);
int (*gfx_fillrect)(gfx_rect_t *rect);
int (*gfx_enable_feature)(uint32_t feature);
int (*gfx_flush)();
int (*gfx_paint)();

uint32_t (*get_time)();    // returns system ticks equivalent
void (*get_keys)(key_data_t *keys);//uint64_t *keys);

#define    FUNC(n)        *(ftab + (n >> 2))

#define    MAKE_RGB(r, g, b) (r & 0xff) | ((g & 0xff) << 8) | ((b & 0xff) << 16);
//int i,n,p;
int main()
{
    //int i;
    gfx_rect_t rect;
    //uint32_t color;
    uint16_t fbuff[320*240];
    key_data_t keys, no_keys;

    // setup function pointers
    dprintf               = FUNC(0x04);
    gfx_init              = FUNC(0x38);
    gfx_set_framebuffer   = FUNC(0x90);
    gfx_set_display_screen= FUNC(0x54);
    gfx_set_cammmode      = FUNC(0x8c);
    gfx_set_colorrop      = FUNC(0x3c);
    gfx_set_fgcolor       = FUNC(0x44);
    gfx_get_fgcolor       = FUNC(0x48);
    gfx_fillrect          = FUNC(0xc4);
    gfx_enable_feature    = FUNC(0x7c);
    gfx_flush             = FUNC(0xc);
    gfx_paint             = FUNC(0x10);
    get_time              = FUNC(0x124);
    get_keys              = FUNC(0x100);

//    dprintf("Hello World!\n");
    gfx_init(fbuff, sizeof(fbuff));

    rect.x = 0;
    rect.y = 0;
    rect.width = 320;
    rect.height = 240;

    gfx_set_framebuffer(320,240);
    gfx_set_display_screen(&rect);//320, 240);


    altprint(chars,2,20,20,'!!!!!!!!"!!!!!!!',3);
    gfx_set_colorrop(COLOR_ROP_NOP);
    gfx_flush();
    gfx_paint();
    
    get_keys(&no_keys);
//    no_keys.key2 &= ~0x5ff0;
    while (1) {
     
        get_keys(&keys);
//        keys.key2 &= ~0x5ff0;
        if (keys.key2!=no_keys.key2) break;
    }

    return 0;
}
void altprint(int chars[],int size,int x,int y,char string[],int len){


int i,n,p,z,cod;
gfx_rect_t point;
uint32_t c;
for(z=0;string[z];z++){
cod=string[z];
//}
//for(p=1;p<len+1;p++){
    for(i=0;i<8;i++){
    for(n=0;n<8;n++){
    point.x = z*20+i*size;
    point.y = 20+n*size;
    point.width = size;
    point.height = size;

   c = MAKE_RGB(255,255,255);  
    gfx_set_fgcolor(&c);
    gfx_set_colorrop(COLOR_ROP_NOP);
    if(chars[(cod-32)*64+n*8+i]==1 )gfx_fillrect(&point);
 }
 }
 }
}
чет не может напринтить на экране "(кавычку),правильно ведь делаю?
__________________
Сайт: http://iexpo.ml

Последний раз редактировалось RegIon, 03.06.2011 в 09:54.
(Offline)
 
Ответить с цитированием