delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/29/09:22:52

From: "Chris A. Triebel" <cat AT sun4 DOT iol DOT unh DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: button/bitmap for allegro
Date: Tue, 29 Oct 1996 06:30:04 -0500
Organization: University of New Hampshire - Durham, NH
Lines: 69
Message-ID: <Pine.SUN.3.91.961029062603.19214B-100000@sun4.iol.unh.edu>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 961028212047 DOT 13154A-100000 AT sun4 DOT iol DOT unh DOT edu>
NNTP-Posting-Host: sun4.iol.unh.edu
Mime-Version: 1.0
In-Reply-To: <Pine.SUN.3.91.961028212047.13154A-100000@sun4.iol.unh.edu>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Stupid me.  Just realized that I sent out the wrong function.  Sorry.
Anyway here is both of them.  This way you can get a look at two
different systems easily.  You may ask why I wrote d_bitmap_proc over.
It is because the image that bitmap produced was being blown away inside 
the dialog by one that was behind/surrounding it.

cat
-----------------------------------------------------------------------
#include <allegro.h>

int A_bitmap_proc(int msg,DIALOG *d, int c)
{
	BITMAP *b=(BITMAP*)d->dp;

	switch(msg)
	{
		case MSG_WANTFOCUS:
		{
			return D_WANTFOCUS;
		}
		case MSG_GOTFOCUS:
		{
			return D_REDRAW;
		}
		case MSG_DRAW:
		{
			show_mouse(0);
			blit(b,screen,0,0, d->x, d->y, d->w, d->h);
			show_mouse(screen);
		break;
		}
	}
return D_O_K;
}


int A_tile_proc(int msg,DIALOG *d, int c)
{
	int err;
	BITMAP *b=(BITMAP*)d->dp;
	switch(msg)
	{
		case MSG_DRAW:
		{
			show_mouse(0);
			// blit the bitmap stored in dp to screen
			blit(b,screen,0,0,d->x,d->y,d->w,d->h);
			if (d->flags&D_SELECTED)
				rect(screen,d->x,d->y,(d->x)+(d->w)-1,(d->y)+(d->h)-1,SELECT_COLOR);
			show_mouse(screen);
		return D_O_K;
		}
		case MSG_CLICK:
		{
			if(d->flags&D_SELECTED)
				d->flags-=D_SELECTED;
			else
				d->flags|=D_SELECTED;
			select(d);
			A_tile_proc(MSG_DRAW,d,c);
		return D_O_K;
		}
		case MSG_WANTFOCUS:
			return D_WANTFOCUS;
	}
return D_O_K;
}


- Raw text -


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