📄 cwlib.inc
字号:
;Set a pixel to specified colour. Cheats by useing BitmapFillRectangle for now.
;
;On Entry:
;
;EAX - Flags, bit significant if set.
; 0 - FillValue is RGB.
;EBX - Fill value.
;ECX - X co-ord.
;EDX - Y co-ord.
;EBP - Bitmap.
;
;On Exit:
;
;nothing.
;
;All registers preserved.
;
;-------------------------------------------------------------------------
extdef BitmapSetPixel:near
;-------------------------------------------------------------------------
;Name: BitmapFillRectangle
;-------------------------------------------------------------------------
;
;Fill a rectangle of a bitmap.
;
;On Entry:
;
;flags - Flags.
;fillvalue - Fill value.
;xcoord - X co-ord.
;ycoord - Y co-ord.
;wide - width.
;depth - depth.
;bitmap - bitmap.
;
;On Exit:
;
;nothing.
;
;All registers preserved.
;
;-------------------------------------------------------------------------
extdef BitmapFillRectangle:near
;-------------------------------------------------------------------------
;Name: BitmapDrawLine
;-------------------------------------------------------------------------
;
;Draw a line in specified colour between specified points.
;
;On Entry:
;
;C style stack parameters as follows,
;
;flags - flags, bit significant if set.
;colour - fill colour.
;x1 - start X co-ord.
;y1 - start Y co-ord.
;x2 - end x co-ord.
;y2 - end y co-ord.
;bitmap - bitmap to draw on.
;
;On Exit:
;
;nothing.
;
;All registers preserved.
;
;Notes:
;
;If type 1 is selected it is the callers responsibility to ensure that the
;buffer pointed to by EBX is big enough.
;
;-------------------------------------------------------------------------
extdef BitmapDrawLine:near
;-------------------------------------------------------------------------
;Name: BitmapBlitBitmap
;-------------------------------------------------------------------------
;
;Blit a bitmap into another bitmap.
;
;On Entry:
;
;C style stack parameters as follows:
;
;Flags - Flags, bit significant if set, may be combined.
; 0-Reserved.
; 1-OR the bitmap, "Chroma" contains transparent colour.
; 2-Scaled blit, DWide & DDepth contain destination sizes.
;SBitmap -Pointer to source bitmap.
;DBitmap -Pointer to destination bitmap.
;XCoord -X co-ord in destination to blit to.
;YCoord -Y co-ord in destination to blit to.
;XOff -X offset within source to blit from.
;YOff -Y offset within source to blit from.
;Wide -Width to blit, -1 for entire source width.
;Depth -Depth to blit, -1 for entire destination width.
;DWide -Destination width of blit when scaleing.
;DDepth -Destination depth of blit when scaleing.
;Chroma -Transparent colour when OR'ing.
;
;On Exit:
;
;ALL registers preserved.
;
;-------------------------------------------------------------------------
extdef BitmapBlitBitmap:near
;-------------------------------------------------------------------------
;Name: BitmapXFlip
;------------------------------------------------------------------------------
;
;Flip a bitmap from left to right, eg, around Y axis, but affecting it in the X
;
;On Entry:
;
;ESI - bitmap
;
;On Exit:
;
;nothing.
;
;All registers preserved.
;
;-------------------------------------------------------------------------
extdef BitmapXFlip:near
;-------------------------------------------------------------------------
;Name: BitmapYFlip
;------------------------------------------------------------------------------
;
;Flip a bitmap from top to bottom, eg, around X axis, but affecting it in the Y
;
;On Entry:
;
;ESI - bitmap
;
;On Exit:
;
;nothing.
;
;All registers preserved.
;
;-------------------------------------------------------------------------
extdef BitmapYFlip:near
;-------------------------------------------------------------------------
;Name: ButtonWindow
;-------------------------------------------------------------------------
;
;Make a piece of window look like a button.
;
;On Entry:
;
;EAX - Type.
;ECX - X coord
;EBX - Y coord
;EDX - width.
;EDI - depth.
;ESI - Pointer to window structure.
;
;On Exit:
;
;nothing.
;
;ALL registers preserved.
;
;-------------------------------------------------------------------------
extdef ButtonWindow:near
;-------------------------------------------------------------------------
;Name: DrawDialog
;-------------------------------------------------------------------------
;
;Draw a dialog entry.
;
;On Entry:
;
;ECX - Button number, -1 to do all.
;ESI - Dialog.
;EDI - Window.
;
;On Exit:
;
;nothing.
;
;ALL registers preserved.
;
;-------------------------------------------------------------------------
extdef DrawDialog:near
;-------------------------------------------------------------------------
;Name: DialogGetButtonD
;-------------------------------------------------------------------------
;
;Get depth of a dialog entry.
;
;On Entry:
;
;ECX - Entry number.
;ESI - Pointer to dialog structure.
;
;On Exit:
;
;EAX - Depth.
;
;ALL other registers preserved.
;
;-------------------------------------------------------------------------
extdef DialogGetButtonD:near
;-------------------------------------------------------------------------
;Name: DialogGetButtonW
;-------------------------------------------------------------------------
;
;Get width of a dialog entry.
;
;On Entry:
;
;ECX - Entry number.
;ESI - Pointer to dialog structure.
;
;On Exit:
;
;EAX - Width.
;
;ALL other registers preserved.
;
;-------------------------------------------------------------------------
extdef DialogGetButtonW:near
;-------------------------------------------------------------------------
;Name: DialogGetButtonX
;-------------------------------------------------------------------------
;
;Get X coord of a dialog entry.
;
;On Entry:
;
;ECX - Entry number.
;ESI - Pointer to dialog structure.
;
;On Exit:
;
;EAX - X coord.
;
;ALL other registers preserved.
;
;-------------------------------------------------------------------------
extdef DialogGetButtonX:near
;-------------------------------------------------------------------------
;Name: DialogGetButtonY
;-------------------------------------------------------------------------
;
;Get Y coord of a dialog entry.
;
;On Entry:
;
;ECX - Entry number.
;ESI - Pointer to dialog structure.
;
;On Exit:
;
;EAX - Y coord.
;
;ALL other registers preserved,
;
;-------------------------------------------------------------------------
extdef DialogGetButtonY:near
;-------------------------------------------------------------------------
;Name: DialogGetDepth
;-------------------------------------------------------------------------
;
;Get main depth of a dialog.
;
;On Entry:
;
;ESI - Pointer to dialog structure.
;
;On Exit:
;
;EAX - Depth.
;
;ALL other registers preserved.
;
;-------------------------------------------------------------------------
extdef DialogGetDepth:near
;-------------------------------------------------------------------------
;Name: DialogGetState
;-------------------------------------------------------------------------
;
;Get state field of a dialog entry.
;
;On Entry:
;
;ECX - Entry number.
;ESI - Pointer to dialog structure.
;
;On Exit:
;
;EAX - State.
;
;ALL other registers preserved.
;
;-------------------------------------------------------------------------
extdef DialogGetState:near
;-------------------------------------------------------------------------
;Name: DialogGetWidth
;-------------------------------------------------------------------------
;
;Get main width of a dialog.
;
;On Entry:
;
;ESI - Pointer to dialog structure.
;
;On Exit:
;
;EAX - Width.
;
;ALL other registers preserved.
;
;-------------------------------------------------------------------------
extdef DialogGetWidth:near
;-------------------------------------------------------------------------
;Name: DialogSetState
;-------------------------------------------------------------------------
;
;Set state field of a dialog entry.
;
;On Entry:
;
;EAX - State to set.
;ECX - Entry number.
;ESI - Pointer to dialog structure.
;
;On Exit:
;
;nothing.
;
;ALL registers preserved.
;
;-------------------------------------------------------------------------
extdef DialogSetState:near
;-------------------------------------------------------------------------
;Name: DialogWhich
;-------------------------------------------------------------------------
;
;Work out which section of a dialog the specified co-ords relate to.
;
;On Entry:
;
;ECX - X coord.
;EDX - Y coord.
;ESI - Dialog.
;
;On Exit:
;
;EAX - Entry number, -1 for none.
;ECX - Relative X coord.
;EDX - Relative Y coord.
;
;ALL other registers preserved.
;
;-------------------------------------------------------------------------
extdef DialogWhich:near
;-------------------------------------------------------------------------
;Name: LoadFont
;-------------------------------------------------------------------------
;
;Load font file into a slot.
;
;On Entry:
;
;EDX - file name.
;ECX - slot number.
;
;On Exit:
;
;EAX - status.
; 0 - no error.
; 1 - file not found or I/O error.
; 2 - not enough memory.
;
;ALL other registers preserved.
;
;-------------------------------------------------------------------------
extdef LoadFont:near
;------------------------------------------------------------------------------
;Name: StringLenPixels
;------------------------------------------------------------------------------
;
;Work out the pixel length of a string.
;
;On Entry:
;
;ESI - String to scan.
;EDI - Font to use.
;
;On Exit:
;
;EAX - Length in pixels.
;
;ALL other registers preserved.
;
;------------------------------------------------------------------------------
extdef StringLenPixels:near
;-------------------------------------------------------------------------
;Name: DlgMessageOKCANCEL
;-------------------------------------------------------------------------
;
;Display a box with specified message and OK/CANCEL buttons.
;
;On Entry:
;
;ESI - Message to display.
;
;On Exit:
;
;EAX - status.
; 0 - Cancel.
; !=0 - OK.
;
;All other registers preserved.
;
;-------------------------------------------------------------------------
extdef DlgMessageOKCANCEL:near
;-------------------------------------------------------------------------
;Name: dlgFileSelector
;-------------------------------------------------------------------------
;
;Display a file selector and get a list of file names from the user.
;
;On Entry:
;
;C style stack parameters as follows,
;
;flags - Flags, bit significant if set.
; 0 - Allow multiple selections with SHIFT & CTRL.
; 1 - Allow typed name.
;titleptr - Title pointer, normal ASCII zero terminated string.
;pathptr - Path pointer, normal ASCII zero terminated string.
;maskptr - Masks pointer, list of normal ASCII zero terminated strings, -1
; to terminate list.
;nameptr - Default name pointer, normal ASCII zero terminated string.
;filestart - Start position of file list.
;maskstart - Start position of mask list.
;masknum - Mask number to use by default.
;drivestart - Start position of drive list.
;
;On Exit:
;
;EAX - Exit code.
; 0 - no problems.
; 1 - CANCEL'd.
; 2 - no files selected.
; 3 - ran out of memory.
;
;EBX - File list start position.
;ECX - Mask list start position.
;EDX - Mask number.
;ESI - Drive list start position.
;EDI - List of file names.
;
;ALL other registers preserved.
;
;Notes:
;
;Expects SYSTEM font to have been loaded.
;
;-------------------------------------------------------------------------
extdef dlgFileSelector:near
;------------------------------------------------------------------------------
;Name: LoadImageFile
;------------------------------------------------------------------------------
;
;Load an image file.
;
;On Entry:
;
;EDX - pointer to name of file to load.
;
;On Exit:
;
;EAX - Status,
; 0 - No error.
; 1 - File access error.
; 2 - Not enough memory.
; 3 - Bad file format.
;ESI - Bitmap pointer.
;
;------------------------------------------------------------------------------
extdef L
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -