Library Creation Error

Search this archive.

From: Nicolas Raitman (new_world@radar.com.ar)
Date: Fri 01 Sep 2000 - 23:59:39 IDT


Hi to all... I have created the following files in order to make a library
but there is a mistake and i cannot find it. I guess that it might me the
arguments that im passing to the inicializar function but please help me.

Perhpahs the problem is that im trying to make a function to initialize the
graphics, but when i pass the arguments of the GraphicsContext perhaps the
variables initialize in some other part and when i return to the main
program their values have been lost.

/* 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;


extern void inicializar(GraphicsContext *physicalscreen, GraphicsContext
*virtualscreen)
{
extern unsigned char *gl_font8x8;

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

physicalscreen = gl_allocatecontext();
gl_getcontext(physicalscreen);
gl_setcontextvgavirtual(12);
virtualscreen = gl_allocatecontext();
gl_getcontext(virtualscreen);
gl_setcontext(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);
return;

}



/* libgraficos.h */

#ifndef LIBGRAFICOS_H_
#define LIBGRAFICOS_H_

void inicializar (GraphicsContext *, GraphicsContext *);

#undef LIBGRAFICOS_H_
#endif LIBGRAFICOS_H_

/* libtest.c the program testing the library */

#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"


extern void inicializar (GraphicsContext *, GraphicsContext *);

#define TEXT 0

float midx, midy, xmax, ymax;

GraphicsContext *physical_screen;
GraphicsContext *virtual_screen;



int main (void)

{

inicializar(physical_screen, virtual_screen);


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

gl_printf(xmax, ymax, "Prueba");
getchar();

gl_clearscreen(0);
vga_setmode(TEXT);

exit(EXIT_SUCCESS);

}


Please Help!!!!!! THANKS
Nicolas


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