delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/25/20:48:08

From: mert0407 AT sable DOT ox DOT ac DOT uk (George Foot)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro question regarding .exe size
Date: 25 May 1997 23:33:21 GMT
Organization: Oxford University, England
Lines: 79
Message-ID: <5mai81$pne@news.ox.ac.uk>
References: <3388b9c1 DOT 30672726 AT news DOT cis DOT yale DOT edu>
NNTP-Posting-Host: sable.ox.ac.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

jon (quacci AT vera DOT com) wrote:

: I don't really mind the exe size too much, because I assume it (like
: DJGPP's protected mode stuff) doesn't grow proportionally larger with
: code size. But I am curious as to what it is in there. My program
: presently uses no sound or sprite functions... in fact, it really only
: uses BITMAP/screen blitting, keyboard, and _only_ video mode 13h
: stuff. Mouse has been tried too; not a significant factor. Anyway,
: maybe Allegro comes prepared for a lot more than this program uses?

Well, the linker doesn't link in the code from object files within
libraries which are *completely* unused; but if you use any part of an
object file the whole thing is linked in. So, if you initialise a
component but do not use it, you'll still get the whole thing linked in.

I don't recall whether the Allegro library builds itself with the -s
option; if not, this would reduce the size of its code.

: Anyway, this isn't really discouraging, but I would like to read some
: comments on this observation in this thread. Because I can't really
: decide which lib to focus on- they are both great, and while Allegro
: offers more "stuff", jlib offers more portability. Both appear to be
: equally robust and speedy, and both have excellent documentation.

When I moved to DJGPP, I initially did my own graphics, in a limited sort
of way, by using the dos memory functions to put a 320x200 buffer onto the
screen memory. Then I started playing with GRX in 640x480, which wasn't
too bad. I looked at JLib and Allegro next, and chose Allegro because it
seemed more accessible (and more highly recommended, even a year ago ;) ).

: Actually, I hope it is always hard to choose our libs. We're all very,
: _very_ lucky for the fantastic efforts of Shawn Hargreaves  with
: Allegro and Jon Griffiths with Jlib. Thanks, guys! (round of
: applause!)

Standing ovation, more like :)

: Oh, and on a more general front- what do any of you suggest as the
: best way to move a mouse over an arbitrary-sized buffer (BITMAP) in
: RAM? Yes, there is a reason I'd like to! Anyway, all mouse functions
: are, naturally, oriented toward screen movement... but is there a way
: to access mouse x and y's out beyond screenwidth and screenheight? I
: can think of work-arounds, but for all I know, you can have x and y's
: beyond 65000- which would be plenty! 

You can adjust the mouse range, but this fails on some mouse drivers. If
the library you are using supports reading mouse mickeys, you can do this
and simulate the mouse movement yourself (the mickeys will tell you how
far the mouse has moved since the last call). Allegro doesn't have this
yet, I'm not sure about JLib. You can get around this by doing something
like this (pseudo-Allegro code):

On initialisation: position_mouse(screen_width/2,screen_heigth/2);

Then make a function:

void get_mouse_difference(int *x,int *y)
{
 *x=mouse_x-screen_width/2;
 *y=mouse_y-screen_height/2;
 position_mouse(screen_width/2,screen_height/2);
}

Each call to get_mouse_difference will get the change since last time it
was called. The above code isn't tested; I can't do that here. The
position_mouse function may be called something else, as well.
screen_width and screen_height should be set to the width and height of
the screen (i.e. the mouse's range) although this isn't too important.

Using this, you can get the amount the mouse has moved by each cycle, and
add it onto the mouse's last position (on your bitmap). Then you might
need to clip it to keep it inside the bitmap, and draw the sprite
yourself.

-- 
George Foot <mert0407 AT sable DOT ox DOT ac DOT uk>
Merton College, Oxford

What's the wizard's password for? (dunnet)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019