Coordinate system: 640*480 pixels (0,0)->: x |||||| (0,439) v1,#include "DarkGDK.h "function header 2, void DarkGDK () main function 3, geometric function dbDot(int x, int). Int y 1, int x2, Int y2) draw a straight line dbCircle(int x, int y, Int radius) Draw a circle db Wait for dbWait(int delay) delay time 1000= 1s dbWaitKey () Wait for user input 5. Output dbText(int x, int y, char*string) to display the string at (x, y) position, and output a line DBC at the leftmost end of dbprint (). 6. Enter dbinput (); Returns the string 6. 1, and the number and string are converted into atoi (string); Convert a string into an integer atof (string); Convert a string into a floating point number such as: atoi (dbinput); DbStr (integer or floating point); Convert an integer or floating-point type into a string, such as dbtext (20,40, dbStr(int));); 7. The title bar of the system function dbSetWindowTitle (string) window is set with dbScreenWidth (); Returns the default window width pixel value dbscreenheight (); Returns the default height pixel value dbtimer () of the window; Returns the system time in milliseconds as an integer, dbcreed (); Returns the system screen color depth dbSetDisplayMode (width, height and color depth); Set the size and color depth of the display window to dbset display mode (150, 100, dbscreendepth ()); DbFileExist ("file name")//Whether the file has dbBitmapMirrored (number); Whether the numbered file is mirrored returns1/0 dbbitmapflipped ($ NUMBER); Whether the numbering file is turned over or not, 1/0 8 is returned, and the random number dbRND(int top) returns the random value dbRandomize(int seed) of the integer 0~top to initialize the random number. The following code sets the random number seed: {intseed = dbtimer (); DbRandomize (seed); //Use dbRND(int MAX) to return the value} 9 from 0 to MAX. Mathematical library dbCOS(angle) cosine dbSIN(angle) sine dbTAN(angle) tangent dbACOS(int) anti-cosine dbASIN(int) arc tangent dbSQRT(value) square root dbABS(value) absolute value 10, color dbclear (int red, int green, int blue); //function clears the window and fills it with the color dbCLS (); When there are no parameters, the screen is cleared in black by default, and when there are parameters, the screen is cleared in parameter color (DWORD type). dbRGB(int red,int green,int blue); //The function returns a 32-bit value that can store colors, usually DWORD, where DWORD is a 32-bit unsigned type DB ink (DWORD foreground, background); //Set the foreground and background colors. The foreground color acts on words and shapes, and the background color only acts on words. dbPoint(int x,int y); Returns the color value (DWORD) of the (x, y) point. DbRGBR(DWORD color); Returns the red channel value dbrgbg (dword color); Returns the green channel value dbrgbb (dword color); Returns the blue channel value 1 1, and the image dbLoadBitmap ("file name"); Loading images; The image cannot be resized, otherwise only a part will be displayed. As the background by default. The file name can be relative or absolute. Absolute path: c: \ \...\ ... Up to 32 pictures can be loaded into the memory, numbered 0~3 1, and bitmap 0 is the currently displayed picture. Load the graph to the location numbered k: dbLoadBitmap ("..."), k ",k); DbCopyBitmap (number k, number n); Put the picture numbered k in the position numbered n dbBitmapWidth (bitmap number); Returns the bitmap file width dbBitmapHeight (bitmap number); Returns the bitmap file dbBitmapDepth (bitmap number); Returns the bitmap file color depth dbDeleteBitmap (bitmap number); Delete the numbered bitmap file from memory. DbFlipBitmap (bitmap number); Vertically flip the bitmap dbMirrorBitmap (bitmap number); Generate a horizontal mirror dbFadeBitmap (fade value); Fade 0~ 100, and the maximum 0 dbblur map (fuzzy value); Fuzzy 1~9, maximum 9 dbLoadImage (file name, image number); Loads the image, but does not display it. The image number is 1~65536. Pay attention to dbPasteImage (image number, x, y, transparency) which is different from dbLoadBitma. Display the image, (x, y) indicates the upper left corner, and the transparency is 0/1; When the transparency is 1, the key color pixels in the image are regarded as transparent, and the default key color is black (0,0,0), that is, green screen technology, which should be saved in bmp format. dbSetImageColorKey(int red,int green,int blue); Change the key color. DbDeleteImage (image number); Delete pictures from memory. 12, animated dbsyncon (); From now on, the program will actively control the screen refresh. dbSyncOff(); DbSyncRate (time) causes automatic screen refresh to restart; Refresh frequency dbsync (); Forced to refresh the screen once loopgdk (); Dbupkey () used to control the number of loop executions per second; Detecting whether the dbDownKey () key is pressed; dbLeftKey(); dbRightKey(); dbControlKey(); ctrl dbshift key(); dbReturnKey(); Enter the key dbescapekey (); del key dbSpaceKey(); DbSprite (set the wizard number, int x, int y, image number); Set the wizard and display it. The default main color of elves is black. Because sprite is an object, there is no need to clear the screen or anything. Because the object is moving, the general operation is as follows: set the key color:: dbetimagecolorkey (0,255,0); Set green as the healthy color of the loaded image::: dbloadimage ("space.bmp ",1); Show wizard:: dbsprite (1, 0,1); If you use paste, you can only display sprite and other pictures and texts by refreshing * * * and saving the sprite:: dbsprite (1, 100, 1) of your mobile phone; There is no need to clear the screen dbSpriteX (guide number); Returns the x coordinate dbSpriteY (sprite number) of the sprite; Returns the y coordinate of the wizard dbSpriteWidth returns the width of the wizard (wizard number); Returns the high dbSpriteAngle return angle dbSpriteOffsetX (the number of wizards) of the wizard; Returns the insertion point offset dbSpriteOffsetY (wizard number) of the wizard; Returns the offset dbRotateSprite (wizard number, angle) of the wizard insertion point. Rotate around the upper left corner of Sprite (unit degree 0~359) dbOffsetSprite (sprite number, x offset, y offset); Change the insertion point and move it from the default upper left corner. DbHideSprite (wizard number); Hide the wizard dbShowSprite (wizard number); Redisplay the wizard dbhidealsprites (); Hide all sprites dbhowallsprites (); Show all the wizards dbSpriteVisible (wizard number); Returns whether to display (1) dbSizeSprite (sprite number, new value of x, new value of y); Change the size of dbStretchSprite (number of wizards, x zoom percentage, y zoom percentage); Change the size dbpritescalex (); Returns the x-axis scaling ratio dbspatescale (); Returns the y-axis scaling ratio dbSetSpritePriority (wizard number, priority); Set a higher wizard priority value, and the default value is 0 dbSpriteExist (wizard number); Whether the wizard was successfully created with dbSetSpriteImage (wizard number, image number); Re-associate the image number dbSpriteImage with the wizard number; Returns the image number dbFlipSprite flip wizard dbMirrorSprite associated with it; Mirror wizard dbSpriteFlipped (wizard number); Determines whether to flip the dbSpriteMirrored (wizard number); Jud whether to mirror that dbSetSprite (sprite numb, background restoration, transparency) dbSetSpriteAlpha (sprite number, transparency); Set the transparency to 0~255, where 0 is invisible dbSpriteAlpha(sprite number);); Returns the transparency dbDeleteSprite (wizard number); Delete wizard dbPasteSprite (wizard number, int x, int y); Paste a copy of the wizard, and the copy will do the same operation as the original dbCloneSprite (wizard number, target number); Cloning the original is a brand-new way. DbCreateAnimatedSprite (set the number of sprites, file names, how many pairs in a row and how many pairs in a column, and set the number of loaded pictures); Load animation dbPlaySprite (sprite number, start frame, end frame, delay); Play dbSpriteCollison (WizardNo .. 1, Wizard 2); Detect whether there is a collision and return 1. If the parameter of Elf 2 is 0, detect the collision between Elf 1 and any dbLoadSound ("file name", sound number); Load the sound dbPlaySound (sound number); Play sound (background play) dbPlaySound (sound number, starting position); Play (start byte) dbLoopSound from a certain position; Cycle the sound dbStopSound (sound number); Pause the sound playback dbSoundPlaying (sound number); Returns whether dbSoundLooping is playing; Returns whether dbDeleteSound (sound number) is looping; Delete the sound dbSoundExist from the memory; Returns whether the sound has a dbSoundPause (sound number); Pause dbResumeSound (tone number); Resume playing dbCloneSound (source number, destination number); Clone dbSetSoundVolume (tone number, size); Adjust the volume from 0 to 100 dbsoundvolume to return the current volume dbSoundSpeed; Returns the speed of sound dbSetSoundSpeed; Set the sound speed dbSetSoundPan (pan); Pan:- 10000 ~ 10000 left and right channel dbLoadMusic ("file name", file number); Load the music file with the number 1~32 dbPlayMusic (music number); Play music dbLoopMusic (music number); Cyclic music dbStopMusic (music number); Pause dbMusicPlaying (music number); Returns whether dbMusicLooping is playing; Returns whether dbDeleteMusic (music number) is looping; Delete the music file dbMusicExist (music number); Returns whether there is a dbPauseMusic (music number); Pause dbRemuseMusic (music number); Restore music dbSetMusicVolume (music number); Set the volume dbMusicVolume to return the music volume dbSetMusicSpeed to set the speed dbMusicSpeed; Returns the music speed dbLoadCDMusic (track number, music number); Set the loaded CD (load from CDRom, make sure the CD is available). dbGetNumberOfCDTracks () returns the number of tracks. dbSetTextSize(int) sets the font size dbFontSize () returns the font size dbSetTextFont ("string ") sets the font size dbTextFont (). Returns the font string dbsettexttobold () bold dbsettexttooitalic () italic dbsettexttonnormal () ordinary dbtextstyle (); Return font 0 normal 1 inclined 2 bold 3 inclined bold dbSetTextOpaque () Text background opaque dbSetTextTransparent () Set text background to re-transparent dbtextwidth (); Returns the text width dbtextheight (); Returns the text height dbSetCursor(int x, int y) and sets the text cursor position dbmousex (); Returns the mouse x coordinate dbmousey (); Returns the mouse y coordinate dbmouseclick (); Returns whether it was clicked, and the return value is which key dbhidemouse () of the mouse was pressed; The mouse hides dbshowmouse (); Redisplay the mouse dbpositionmouse (int x,. int y); Locate the mouse dbchangemouse (int); The passed-in value 1 is changed to hourglass, and 0 is restored to mouse dbmousemovex (); Returns the mouse movement distance dbmousemovey (); Returns the distance moved by the mouse.
Seek adoption