Pal map getid

From Bennu Wiki
Revision as of 07:32, 17 March 2012 by 82.74.128.190 (talk) (Created page with 'Category:functions Category:palettes Category:mod_map == Syntax == '''INT''' pal_map_getid ( <'''INT''' fileID> , <'''INT''' graphID> ) == Description == This func…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Syntax

INT pal_map_getid ( <INT fileID> , <INT graphID> )

Description

This function returns the identification code of the palette of a specific graphic.

Parameters

INT fileID - The handle of the file.
INT graphID - The handle of the graph.


Returns

INT : Error/status.

0 - Error: could not open file; corrupt or truncated file; file doesn't contain palette information.
id - The identifier of the palette.

Example

/* original bennupack example FROM: \2 Medium\fenix test\palettes\rbear8-5.prg (from bomberlink) */

/* this program demonstrates the use of the functions: pal_load(), pal_map_get_id()              */
/* pal_map_assign(), pal_set() and pal_refresh().                                                */

/* In this example pal_get() is not used but the table is filled with data by forehand.          */


IMPORT "mod_debug";
IMPORT "mod_say";
IMPORT "mod_map";
IMPORT "mod_key";
IMPORT "mod_video";
IMPORT "mod_text";

GLOBAL

   int pal_normal; // identifier of the palette
   
   int fpg_id;     // identifier of the fpg file
   
   // the arrays with data (pre-filled)   
   byte orange_palette_data[21] =
                                80,0,0,
                               110,0,0,
                               140,0,0,
                               170,0,0,
                               190,0,0,
                               220,0,0,
                               250,0,0;
   byte green_palette_data[21] =
                               0, 80,0,
                               0,110,0,
                               0,140,0,
                               0,170,0,
                               0,190,0,
                               0,220,0,
                               0,250,0;
                               
   int count;

PROCESS main();   
   
BEGIN

    set_fps(10,0);
    set_mode(320,200,16);



    // load the fpg
    fpg_id=fpg_load("rbear8.fpg");

    write_int(0,10,10,0,&fps);
    write(0,10,20,0,"F1/F2 - change palette");

    x=160;
    y=120;

    pal_normal=pal_map_getid(fpg_id,1); // file,graph   
    say("pal_normal: "+pal_normal);

    WHILE (NOT key(_ESC))
    
        FROM graph=1 TO 13;
        
            FRAME;
            
            IF (key(_F1))
                pal_set(pal_normal,7,7,&green_palette_data);    // colors 7 - 13
                pal_refresh(pal_normal);
            END
            
            IF (key(_F2))
                pal_set(pal_normal,7,7,&orange_palette_data);  // colors 7 - 13
                pal_refresh(pal_normal);
            END
            
            IF (key(_ESC)) 
               BREAK; 
            END
        END
    END

END

Used in example: , Pal_set(), Pal_map_assign(), Pal_refresh(), Say(), Set_fps(), Set_mode(), Write(), Write_int()

See also

Pal_set(), Pal_get()


Mod_map
Globals None
Imported:
FullscreenGraphmodeM7ScalemodeScaleresolutionScaleresolutionaspectratioScaleresolutionorientation
Constants BCLEARCHARSETCP850CHARSETISO8859GANIMATIONSPEEDGANIMATIONSTEPGANIMATIONSTEPSGCENTERXGCENTERYGDEPTHGFRAMESGHEIGHTGPITCHGWIDEGWIDTHGXCENTERGYCENTERNFBFIXEDWIDTHNFBVARIABLEWIDTH
Imported:
BABLENDBALPHABHMIRRORBNOCOLORKEYBSBLENDBTRANSLUCENTBVMIRRORDOUBLEBUFFERHWSURFACEM1024X768M1280X1024M320X200M320X240M320X400M360X240M376X282M400X300M512X384M640X400M640X480M800X600MODE16BITSMODE16BPPMODE2XSCALEMODE8BITSMODE8BPPMODEDOUBLEBUFFERMODEFRAMELESSMODEFULLSCREENMODEHARDWAREMODEMODALMODEWAITVSYNCMODEWINDOW
Functions Bdfload()Centerset()Colorfind()Colorsget()Colorsset()Fade()Fadeoff()Fadeon()Fntload()Fntnew()Fntsave()Fntunload()Fpgadd()Fpgdel()Fpgexists()Fpgload()Fpgnew()Fpgsave()Fpgunload()Getpixel()Glyphget()Glyphset()Graphicinfo()Graphicset()Mapblockcopy()Mapbuffer()Mapclear()Mapclone()Mapdel()Mapexists()Mapgetpixel()Mapinfo()Mapinfoget()Mapinfoset()Mapload()Mapname()Mapnew()Mapput()Mapputpixel()Mapsave()Mapsetname()Mapunload()Mapxput()Mapxputnp()Palclone()Paldel()Palget()Palload()Palmapassign()Palmapgetid()Palmapremove()Palnew()Palrefresh()Palsave()Palset()Palunload()Paletteconvert()Paletteroll()Pcxload()Pngload()Pngsave()Pointget()Pointset()Putpixel()Rgb()Rgbget()Rgba()Rgbaget()