delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/24/19:56:52

From: "DeHackEd" <notgiven AT out DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <001901be47ef$796d13a0$b9d80ad0 AT default>
Subject: Re: Need help with paletes
Lines: 46
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.0810.800
X-MIMEOLE: Produced By Microsoft MimeOLE V5.00.0810.800
Message-ID: <jhPq2.239$hd7.52@tundra.ops.attcanada.net>
Date: Sun, 24 Jan 1999 19:53:33 -0500
NNTP-Posting-Host: 142.194.222.65
X-Trace: tundra.ops.attcanada.net 917225679 142.194.222.65 (Mon, 25 Jan 1999 00:54:39 GMT)
NNTP-Posting-Date: Mon, 25 Jan 1999 00:54:39 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Assuming you are working in 8 bit graphics modes, you should just have to do
this:

PALETTE pal;
BITMAP *bmp = load_bitmap("filename.here", pal);

bmp will contain your picture and pal will contain it's palette. Paint, the
Windows pain editor, saved for me a 136 byte file. A palette, unless compressed
(which I doubt) needs to be at least 768 bytes (RBG * 256 plus any header or
spacer).

Also for rotate_sprite, the angle is done using fixed notation.

Example (requires floating point math):

fixed degrees(float angle)
{
    return ftofix(angle/360.0*256.0); // float to fix conveter
}

// 25 degrees
rotate_sprite(screen, bmp, x, y, degrees(25));

Hope this helps.

----
"DeHackEd"

My Email address in the header is completely fake (spammers). Email me at this
address:
http://www.geocities.com/cgi-bin/homestead/mail.pl?dehacked

Steve Axsom <sssaxsom AT smithville DOT net> wrote in message
news:001901be47ef$796d13a0$b9d80ad0 AT default...
>    I'm making a game in allegro and I'm trying to load bitmaps. Is there an
>easier way of setting the palletes then setting RGB for each color at a
>time? With the windows default bitmap editor, I've notice you can save
>palate files (.pal). Also, rotate_sprite doesn't seem to work, even with
>memory bitmaps. if anybody could give me a *simple* code for it, I'd be very
>greatful =).
>
>                                                            -Shane
>
>


- Raw text -


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