Point set

From Bennu Wiki
Revision as of 23:59, 20 July 2012 by Kloppix (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Definition

INT point_set ( <INT fileID> , <INT graphID> , <INT controlpointID> , <INT x>, <INT y>)

Allows you to set a control point of a particular graphic.

Any graph can contain up to 1000 control points (from 0 to 999). Control point 0 is the center of the graphic. This function allows you to set the location of any control point belonging to any graph. The coordinates are relative to the upper left corner of the graphic.

To obtain the coordinates of a control point, use point_get().

The previous name set_point() is deprecated.

Parameters

INT fileID - FileID of the file containing the graphic.
INT graphID - GraphID of the graphic of which to set a control point.
INT controlpointID - Number of the control point.
INT x - The new X-coordinate of the control point.
INT y - The new Y-coordinate of the control point.

Returns

INT : Successrate

-1 - One of the following: specified graph is invalid, specified control point is invalid.
1 - The control point was set successfully.

Example

import "mod_map"
import "mod_say"
import "mod_wm"
import "mod_key"
import "mod_grproc"

Process Main()
Private
    int map;
    int cx,cy;
Begin

    // Create a red graph
    map = new_map(100,100,8);
    map_clear(0,map,rgb(255,0,0));

    // Set the center to a random point
    point_set(0,map,0,rand(-10,110),rand(-10,110));

    // Get the center
    point_get(0,map,0,&cx,&cy);

    // Show the center
    say("Center-X: " + cx);
    say("Center-Y: " + cy);

    // Assign the map to the graph variable
    graph = map;

    // Set the location of this process to the center of the screen
    x = 160;
    y = 100;

    Repeat
        frame;
    Until(exit_status||key(_ESC))

End

Used in example: new_map(), map_clear(), point_set(), point_get(), say(), pointer, graph

Notice that setting the center influences the position of the graph:

Point get.png
The center influences the position of the graph


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()