Libraries

Search this archive.

From: Nicolas Raitman (new_world@radar.com.ar)
Date: Mon 25 Sep 2000 - 17:29:20 IDT


Hi. I have the following program with 3 files, please look at it. There is
no mistake, at least no error is shown to me, but the printf statement that
I will highlight does not print anything. Please try to guide me on where
the error could be, perhaps I am using bad the library that I created or the
structure. Thanks

/* libgraficos.h */

#ifndef LIBGRAFICOS_H_
#define LIBGRAFICOS_H_

struct screen {
 GraphicsContext *physicalscreen;
 GraphicsContext *virtualscreen;
 };


void inicializar (struct screen *my_screen);

#undef LIBGRAFICOS_H_
#endif LIBGRAFICOS_H_



/* libgraficos.c */

#include <stdio.h>
#include <stdlib.h>
#include <vgagl.h>
#include <vga.h>
#include <string.h>
#include "libgraficos.h"

float xmax, ymax, midx, midy;


void inicializar(struct screen *my_screen)

{

unsigned char *gl_font8x8;

vga_disabledriverreport();
vga_init();
vga_setmode(12);
gl_setcontextvga(12);

my_screen->physicalscreen = gl_allocatecontext();
gl_getcontext(my_screen->physicalscreen);
gl_setcontextvgavirtual(12);
my_screen->virtualscreen = gl_allocatecontext();
gl_getcontext(my_screen->virtualscreen);
gl_setcontext(my_screen->virtualscreen);
gl_setfont(8,8,gl_font8x8);
gl_setwritemode(FONT_COMPRESSED + WRITEMODE_MASKED);

xmax = vga_getxdim();
ymax = vga_getydim();
midx = xmax / 2;
midy = ymax / 2;
gl_clearscreen(0);
}

/* libtest.c the file used to test the libraries */

#include <stdio.h>
#include <stdlib.h>
#include <vgakeyboard.h>
#include <math.h>
#include <vgagl.h>
#include <vga.h>
#include <string.h>
#include <unistd.h>
#include "libgraficos.h"


void inicializar (struct screen *my_screen);

#define TEXT 0

float midx, midy, xmax, ymax;

struct screen *my_screen;

int main (void)
{

my_screen = (struct screen *) malloc (sizeof(struct screen));

inicializar(my_screen);

/* this gl_printf does not print testing... could it be because I
initialized the graphics system on another file? Is is ok the gl_copyscreen
statement?  */
gl_printf(200, 200, "Testing...");
gl_copyscreen(my_screen->physicalscreen);
getchar();

gl_clearscreen(0);
vga_setmode(TEXT);

exit(EXIT_SUCCESS);

}






------------------------------------------------------------------
Unsubscribe:  To:   listbot@svgalib.org
              Body: unsubscribe linux-svgalib


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:23 IST