The basic operation of mode13 is to mimic the programming environment offered by DOS-based development systems,
where the program is in full control of the system, and need not be preoccupied with following an event-based model in order
to co-operate properly with other running processes.
To the extent that it is possible, then, mode13 applets run in a dedicated thread. This thread acts like the
'main' function in a C program or the main module in a QBASIC program. At any time, user code can perform drawing functions
on the framebuffer. The only problem with this model is that modern operating systems do not offer direct access to
framebuffer memory. As such, a program running under such a system must determine when it wishes to make the image it has
composited visible on the screen; it is not visible until the program proactively requests that the operating system display
it. With mode13, if a program simply draws to its framebuffer, and never indicates when to send a frame to the
display, a timer will periodically make the image visible. The interval between frames is configurable, but defaults to
250 milliseconds. That is, with no configuration, mode13 applications will update at 4 frames per second. This does have
legitimate applications; for a typical case, see the "mandelbrot" example program. Programs that wish to alter this rate,
though, can do so using the AutoUpdateInterval property.
Programs that wish to produce continuous, fluid images, though, must make one extra function call each time a frame is
completed: FlipPages(). mode13 operates in two modes. The default mode is essentially a double-
buffered system. All drawing operations draw to the "background" page, and when FlipPages is called, the image
is copied from the background page to the foreground page for display. The background page retains its image across the call.
For programs that always redraw the entire frame, there is a more efficient mode of operation. When EnablePaging
is set to true, FlipPages simply swaps the references to buffers. Effectively, this means that across the
FlipPages call, the active buffer effectively goes back one frame. This data is guaranteed to be
preserved, so it is possible for a program using EnablePaging = true to reuse some of the image data.
For instance, a persistent background or frame could be placed onto both pages at program startup. It would then remain on
both pages, provided it was not inadvertantly drawn over.
QBASIC provided a 256-entry colour palette to VGA programs. To be useful in a wider range of situations, though,
mode13 uses a 32-bit RGB framebuffer. In order to emulate QBASIC's palette, mode13 maintains two
copies of each of the active & visible pages. The main frame buffer is an RGB 32-bit bitmap, but an array of palette
indices is maintained as well, permitting programs that use palette effects to work as expected. When drawing functions are
invoked using a palette index for the colour, both planes are updated simultaneously; when drawing functions are given an
RGB colour, no attempt is made to map it back onto the palette. The palette indices plane is simply not updated, and if
palette effects are used, any non-palette drawing will be overwritten by the most recent palette index drawn for each pixel.
The basic layout of a mode13 program is as a subclass of Mode13ControlBase. This base class
provides all the core functionality of mode13: it implements all the drawing functions, and it performs the
platform calls required to put the framebuffer image onto the window. Mode13ControlBase is itself a .NET
System.Windows.Forms.Control. As such, it inherits all of the functionality of a Control. For
instance, keyboard input is available through the OnKeyDown/OnKeyPress/OnKeyUp virtual functions, which can be overridden by
the user code to process input. While OnMouseDown/OnMouseMove/OnMouseUp can also be overridden, to correctly support scaling,
user code should use OnMode13MouseDown/OnMode13MouseMove/OnMode13MouseUp. Also, other .NET controls, such as TextBox, CheckBox
and Button can be placed onto the user's control. They will not interfere with the mode13 framebuffer, but will
simply be drawn in front of it. Care must be taken, though, to ensure that GUI operations are performed on the GUI thread.
System.Windows.Forms requires this, and provides a function Invoke (documented by MSDN) which
permits user code to be executed on the GUI thread without requiring an event to fire.
mode13 controls can be placed into existing System.Windows.Forms GUIs. In the absence of an
existing user entrypoint, mode13 provides its own Main function. This function scans the AppDomain
for subclasses of Mode13ControlBase. If more than one is found, a menu is displayed listing the various
controls (this is how the default test suite operates). If exactly one is found, it is immediately invoked.
mode13 controls invoked in these ways are placed into a special container Form (the nested class
Mode13ControlBase/ContainerForm).
The entrypoint for mode13 applets is the function Mode13ControlBase::Run(), which user code should
override. The only propertis which must be set in the constructor are Size and UsingDirectDraw. In the
current implementation, the size of a mode13 applet is fixed for the duration of its runtime. The default size is
320x200 pixels, which coincides with QBASIC's SCREEN 13. By default, mode13 will use GDI+ to put
the framebuffer image on the screen. However, if the Managed DirectX assemblies are installed (mdxredist.msi),
using DirectDraw will result in significantly greater performance, especially when the control is scaled up. To attempt to load
the DirectDraw runtime (which is done dynamically), set the UsingDirectDraw property to true. If
loading fails, then the property's value will be false when it is immediately read back (no exception will be
thrown back to user code). The loading is done dynamically so that no static reference to the Managed DirectDraw assembly is
required. The Size property must be set before UsingDirectDraw is set to true, because initializing
DirectDraw results in the control being realized.
The array of graphics functions offered by mode13 is modelled after the cult DOS programming environment QBASIC.
Even functions such as DRAW and PLAY (music) are implemented. There are a few extra utility
functions as well. The functions are documented below.
| Function Name | Overloads | Description |
|---|---|---|
PagingEnabled { get; set; } |
bool property |
Enables/disables mode13's paging functionality. When disabled (default), the "active" buffer (the buffer on which drawing
functions operate) is copied (blitted) onto the visible buffer when FlipPages is called. When enabled, the
"active" buffer and the "visible" buffer are simply swapped. This is more efficient, but it means that the contents of the
"active" buffer essentially go back one frame when FlipPages is called. Paging will normally be used
by programs that completely redraw the image on every frame.
|
FlipPages |
FlipPages() |
Makes the current frame visible. See PagingEnabled for details on the modes in which this function operates.
|
AutoUpdateInterval { get; set; } |
int property |
By default, mode13 makes no assumption that user code will manage its frames manually. To ensure that the
image is kept relatively up-to-date (for such processes as the "mandelbrot" test program, which spend a relatively long
time computing a single frame), a timer automatically calls FlipPages(). The interval between calls is
specified by this property (AutoUpdateInterval). To disable the automated calls to FlipPages,
set this property to 0. The default value is 250, which translates to roughly 4 frames per second.
|
CLS |
CLS()
CLS(int colour)
CLS(Color colour)
|
Clears the active framebuffer, resetting all pixels to a given colour. If no argument is specified, the current background colour is used, otherwise the specified colour is used. |
|
COLOR
COLORBG
|
int COLOR()
int COLORBG()
Color COLORRGB()
Color COLORBGRGB()
|
These functions return the current setting for the colour. The BG functions return the current background
colour, and the RGB functions return the current colour as an RGB value rather than a palette index.
|
|
COLOR
COLORBG
|
COLOR(int index)
COLOR(int index, int background_index)
COLOR(Color colour)
COLOR(Color colour, Color background_colour)
COLORBG(int index)
COLORBG(Color colour)
|
These functions set the current foreground and/or background colours. The BG functions set only the
background, and leave the current foreground colour unchanged; the COLOR functions with only one argument
do not change the current background colour setting. When a palette index is specified, it is remembered and the drawing
functions update the palette indices plane as well as the RGB 32-bit bitmap that provides the actual framebuffer. When a
Color structure is specified, the RGB 32-bit pixel value is remembered, and drawing functions do not update
the palette indices plane. If the palette is modified, out-of-palette drawing will be overwritten by the older
palette-based colour index for each pixel.
|
PSET |
PSET(int x, int y)
PSET(int x, int y, int colour_index)
PSET(int x, int y, Color colour)
|
The simplest drawing primitive, PSET draws a single pixel at the specified location. If no colour is
specified, the current colour is used. See COLOR/COLORBG for a discussion of palette indices vs. RGB colour
values.
|
|
POINT
POINTRGB
|
int POINT(int x, int y)
Color POINTRGB(int x, int y)
|
The POINT functions return the colour of an existing pixel in the framebuffer. The POINTRGB
function returns the actual RGB Color at the specified coordinates. The POINT function returns the most
recent palette index drawn to the specified pixel, or -1 if the coordinates are out of range.
|
|
LINE
LINEB
LINEBF
|
LINE(int x2, int y2)
LINE(int x2, int y2, int colour_index)
LINE(int x2, int y2, Color colour)
LINE(int x1, int y1, int x2, int y2)
LINE(int x1, int y1, int x2, int y2, int colour_index)
LINE(int x1, int y1, int x2, int y2, Color colour)
LINEB(int x2, int y2)
LINEB(int x2, int y2, int colour_index)
LINEB(int x2, int y2, Color colour)
LINEB(int x1, int y1, int x2, int y2)
LINEB(int x1, int y1, int x2, int y2, int colour_index)
LINEB(int x1, int y1, int x2, int y2, Color colour)
LINEBF(int x2, int y2)
LINEBF(int x2, int y2, int colour_index)
LINEBF(int x2, int y2, Color colour)
LINEBF(int x1, int y1, int x2, int y2)
LINEBF(int x1, int y1, int x2, int y2, int colour_index)
LINEBF(int x1, int y1, int x2, int y2, Color colour)
AntiLINE(int x2, int y2)
AntiLINE(int x2, int y2, int colour_index)
AntiLINE(int x2, int y2, Color colour)
AntiLINE(int x1, int y1, int x2, int y2)
AntiLINE(int x1, int y1, int x2, int y2, int colour_index)
AntiLINE(int x1, int y1, int x2, int y2, Color colour)
|
This class of functions is involved in drawing the path from one coordinate to another. The LINE functions
draw a simple, direct line. The LINEB functions draw a hollow box connecting the coordinates. The
LINEBF functions draw a filled box connecting the coordinates. The AntiLINE functions draw an
anti-aliased line connecting the coordinates. If no colour is specified, these functions use the current colour value.
See COLOR/COLORBG for a discussion of palette indices vs. RGB colour values. If the starting coordinate is
not specified, the coordinate where the preceding drawing instruction left off is used. When an anti-aliased line is drawn
with AntiLINE using a palette index for the colour value, the palette indices plane is updated with a regular
(non-anti-aliased) line connecting the same coordinates.
|
|
CIRCLE
FillCIRCLE
|
CIRCLE(int x, int y, int r)
CIRCLE(int x, int y, int r, int colour_index)
CIRCLE(int x, int y, int r, Color colour)
CIRCLE(int x, int y, int r, int colour_index, double aspect)
CIRCLE(int x, int y, int r, Color colour, double aspect)
CIRCLE(int x, int y, int r, int colour_index, double start_arc,
double end_arc)
CIRCLE(int x, int y, int r, Color colour, double start_arc, double end_arc)
CIRCLE(int x, int y, int r, int colour_index, double start_arc, double end_arc,
double aspect)
CIRCLE(int x, int y, int r, Color colour, double start_arc, double end_arc,
double aspect)
FillCIRCLE(int x, int y, int r)
FillCIRCLE(int x, int y, int r, int colour_index)
FillCIRCLE(int x, int y, int r, Color colour)
FillCIRCLE(int x, int y, int r, int colour_index, double aspect)
FillCIRCLE(int x, int y, int r, Color colour, double aspect)
|
These functions draw circles, ellipses and elliptic arcs. If no colour is specified, these functions use the current colour value.
See COLOR/COLORBG for a discussion of palette indices vs. RGB colour values. If no aspect is specified, a circle is
drawn (pixels are assumed to be square, unlike QB which applies an aspect ratio of 5/6 by default). If an aspect is specified,
the circle is compressed to accommodate; that is, the r argument (radius) always specifies the larger radius of the ellipse's
axes. If start and end angles are provided, then only part of the ellipse is drawn (an arc). The part that is drawn connects the
start angle to the end angle in the counter-clockwise direction. (The angles are specified in radians.) The FillCIRCLE function
draws & fills a circle in a single step.
|
|
GET
PUT
|
int[] GET(int x1, int y1, int x2, int y2)
PUT(int x, int y, int[] get_buf)
PUT(int x, int y, int[] get_buf, PutMode mode)
PUT(int x, int y, int[] get_buf, int src_x, int src_y, int src_width,
int src_height, PutMode mode
|
The GET and PUT functions permit a region of the framebuffer to be copied and "pasted" many times. The
GET function captures a region of pixels and places it into an integer array, and the PUT function
then places that array at arbitrary locations. Unlike QBASIC's PUT function, mode13's PUT function
automatically clips to the edges of the framebuffer.mode13 also extends QBASIC's range of PUT modes. The allowable values are:
The Add and Subtract mode permit the result to wrap around. This may not produce the desired visual
effect, but will guarantee reversibility by simply applying the opposite mode in a subsequent PUT call. The bitwise
operations are applied to the RGB values of pixels. Programs that use these as a form of masking for placing sprites onto
backgrounds will still work as expected (provided palette index 0 is black and palette index 255 is white -- note that this is not
the default), but QBASIC programs that use these to achieve effects interacting with special palette configurations will not
operate as expected and will require more effort to port.The GET/PUT buffer format is very simple: The first two entries in the integer array specify the width & height
of the region passed to GET in pixels. The remaining entries consist of width x height RGB pixel values.
These pixel values can be converted to RGB using Color.FromArgb, and RGB Color structures can be
converted to compatible values using my_color.ToArgb().
|
|
PalettizedBitmapToGETBuffer
BitmapToGETBuffer
TranslateQBGETBuffer
ReadAndTranslateQBGETBuffer
|
PalettizedBitmapToGETBuffer(Bitmap bmp)
BitmapToGETBuffer(Bitmap bmp)
TranslateQBGETBuffer(byte[] get_buf)
ReadAndTranslateQBGETBuffer(Stream stream)
ReadAndTranslateQBGETBuffer(Stream stream, out int bytes_consumed)
|
These functions permit interoperation with System.Drawing.Bitmap objects and with QBASIC-style SCREEN 13
GET/PUT buffers.PalettizedBitmapToGETBuffer and BitmapToGETBuffer translate a System.Drawing.Bitmap to the
corresponding mode13 GET/PUT buffer. PalettizedBitmapToGETBuffer accepts only Bitmap objects
with indexed pixel formats, and converts the data according to the current mode13 palette (NOT the Bitmap
object's palette). BitmapToGEBuffer accepts Bitmap objects with any pixel format and ignores any palette
indices, assigning only RGB values. The alpha channel is preserved across this conversion.TranslateQBGETBuffer and ReadAndTranslateQBGETBuffer translate an old-fashioned QBASIC
SCREEN 13 GET/PUT buffer into the corresponding mode13 GET/PUT buffer. The RGB channels are
filled based on the current mode13 palette. (PutMode.PaletteIndicesInAlphaOnly can be used to PUT
the image based on a palette that has been updated after the conversion.)
|
DRAW |
SetDrawAspect(double y_scale_factor)
DRAW(string draw_string)
DRAW(int x, int y, string draw_string)
DRAW(int x, int y, string draw_string, bool antialias)
DRAW(string draw_string, bool antialias)
|
This function replicates the QBASIC DRAW function. The draw_string argument is a script in a simple
language that permits concise representations of sequences of line drawing operations. If the (x, y) arguments
are provided, the draw string will start at that location, otherwise the endpoint of the last drawing operation will be used.
If antialias is true, AntiLINE will be used to draw the segments, otherwise LINE will be used. For more information
on the language for the draw_string argument, refer to the QBASIC help file.
|
PAINT |
PAINT(int x, int y, int colour_index)
PAINT(int x, int y, Color colour)
PAINT(int x, int y, int colour_index, int border_index)
PAINT(int x, int y, Color colour, Color border)
|
These functions provide a flood-fill capability. If no border is specified, then all pixels of the same colour as the starting
pixel will be drawn over. If a border is specified, all pixels up to the specified border (regardless of their own colour) will
be drawn over. If palette indices are specified, then palette indices will be tested for the background or border condition; if
RGB Color structures are provided, then the RGB values in the framebuffer will be tested. The floodfill algorithm
used is a fairly efficient scanline detection algorithm.
|
|
LOCATE
PRINT
|
LOCATE(int y)
LOCATE(int y, int x)
SetPrintFlags(PrintFlags flags)
PRINT(int y, int x, string str)
PRINT(string str)
PRINT()
PRINTs(int y, int x, string str)
PRINTs(string str)
|
These functions replicate QBASIC's text output functions. LOCATE accepts 1-based indices onto a grid whose period is
the character box. The default text font used is the 8x8 VGA font provided by QBASIC's SCREEN 13. An 8x16 font
is also available through SetPrintFlags. By default, PRINT replicates QBASIC's behaviour of clearing
the text's background. This can be disabled through SetPrintFlags. The PRINT functions automatically
advance to the next line after printing their text; to remain on the same line (which QBASIC expresses with a semicolon at the
end of the PRINT statement), call the corresponding PRINTs function. Unlike QBASIC, if
LOCATE is passed an out-of-range argument, it will be used, and line wrapping will be applied as usual. A negative
value will cause the corresponding number of lines or characters to be drawn invisibly, above and/or to the left the frame
buffer. Positive out-of-range values will cause immediate line wrapping/upward scrolling.The value passed to SetPrintFlags is the bitwise OR of one or more of the following flag values:
|
|
LoadFont
LoadFontFromResource
MeasureString
DrawString
|
BitmapFont LoadFont(string filename)
BitmapFont LoadFont(Stream stream)
BitmapFont LoadFontFromResource(string resource_name)
BitmapFont LoadFontFromResource(Type type, string resource_name)
BitmapFont LoadFontFromResource(Assembly assembly, Type type, string resource_name)
Rectangle MeasureString(BitmapFont font, string str)
DrawString(BitmapFont font, string str)
DrawString(BitmapFont font, int x, int baseline_y, string str)
|
This set of functions provides a more sophisticated bitmap font function. User code can provide its own font files, either
through external files or embedded resources. The MeasureString function measures the rectangle which will be
covered by drawing the specified string, with respect to the initial coordinates provided to DrawString. As the
font format allows for arbitrary drawing offset & advancement values, this rectangle's top/left can have negative values.
Also, the drawing functions operate relative to the baseline of the font, not the top of the character box. If drawing relative
to the top of the character box is desired, then each line of text will need to be measured to ascertain its ascendance, and
this ascendance will then need to be subtracted from the intended Y coordinate. If no coordinate is passed to the
DrawString function, then the endpoint of the last graphics operation is used. DrawString never draws
an opaque text background; if this is desired, the background must be drawn prior to calling DrawString. This can be
done with LINEBF.
|
PALETTE |
Color PALETTE(int index)
Color EGAPALETTE(int index)
SuspendPalette()
PALETTE(int index, Color colour)
PALETTE(int index, int r, int g, int b)
PALETTE(Color[] colours, int first_source_index, int first_dest_index, int count)
ResumePalette()
ResumePalette(bool update)
CopyRegionFromPalettizedToFrameBuffer(int x, int y, int w, int h)
ResynchronizeAgainstPalette()
|
These functions permit manipulation of the palette emulation provided by mode13. The functions with a single integer
argument PALETTE and EGAPALETTE return the current RGB value for the specified palette entry and for the
standard 64-colour EGA palette, respectively. The three PALETTE functions with two or more arguments adjust the
current palette. On each adjustment, the RGB framebuffer is recomputed from the palette indices stored for each pixel. If a
sequence of palette changes will be made, or if no update is desired, the SuspendPalette and
ResumePalette functions should be called. While the palette is "suspended", changes to it will modify the palette
array, but will not be reflected in the image. When the palette is resumed, if the update argument is true, the
palette indices stored for each pixel will be used to recompute the RGB framebuffer image. This will overwrite and non-palette
changes made to the framebuffer. If update is not specified, the behaviour is as if true were passed.
The CopyRegionFromPalettizedToFrameBuffer function provides direct access to the recomputation function, and
permits its operation to be restricted to a limited area of the screen. The ResynchronizeAgainstPalette function
recomputes the palette indices from the RGB framebuffer. Only the pixels whose RGB value is one of the palette entries will be
updated.
|
PLAY |
PLAY(string play_string)
SyncPLAY(string play_string)
|
These functions replicate the functionality of QBASIC's PLAY function. For each note, the Win32 Beep
function is called to play the note from the PC speaker. It is an unfortunate fact that the Windows scheduler does not favour
threads which frequently suspend themselves, and Beep suspends the thread for the duration of the playback. As
such, when CPU usage is high (such as the user code in the Run method actively computing & drawing graphics),
the sound often slows down or pauses. This may change in the future, if PLAY is reimplemented to generate a waveform
sample for DirectSound playback.
|
RND |
double property |
The .NET Framework provides a more extended random number facility in the form of the System.Random class, but for
convenience, this property, whose usage is identical to that of QBASIC's RND function, is provided. Its return value is a
double-precision floating point value whose range, mathematically is: [0,1). This indicates that on rare occasions, its value can
actually be 0, but its value will never quite reach 1.
|
NOISE |
double NOISE(double x)
double NOISE(double x, double y)
double NOISE(double x, double y, double z)
SetNoiseDetail(int levels, double falloff)
|
Borrowed from the Java package "Processing", the NOISE function provides a persistent Perlin noise function in 1D,
2D or 3D. The SetNoiseDetail function allows the number of octaves and recursive falloff to be specified. For an
interactive demonstration of the difference between 3 levels and 8 levels of noise, see the "noise2" sample program.
|
CLAMP |
int CLAMP(int n, int low, int high)
double CLAMP(double n, double low, double high)
|
This convenience function forces a number into the specified range. If the number is less than low, then
low is returned. If the number is greater than high, then high is returned. If the number
is in range, then it is returned unchanged.
|
|
GRAY
RGB
HSL
|
Color GRAY(int intensity)
Color RGB(int r, int g, int b)
Color HSL(int hue, int saturation, int lightness)
|
These convenience functions return a Color value with the specified characteristics. The GRAY function returns a
grayscale Color structure whose red, green and blue members all have the same value. The RGB function returns a
Color structure whose red, green and blue members are set to the specified values (this is the same as
Color.FromArgb). The HSL function returns a Color structure whose red, green and blue members are
computed from the specified hue, saturation and lightness values. The hue is an angle in degrees ranging from 0 to 359, where
0 is pure red, 120 is pure green and 240 is pure blue. The saturation represents the "purity" of the colour; a saturation of 0 is
gray, while a saturation of 255 is a fully-saturated colour. The lightness represents the brightness of the colour; from 0 to 127
the lightness fades from black to the pure colour at the specified saturation level, and from 128 to 255, the lightness fades from
the colour to solid white. Any RGB colour can be represented as a combination of hue, saturation and lightness, and HSL provides
a more natural continuous representation of colours for the human eye.
|
ScaleSize |
int property |
This property scales the size of the mode13 control. Its value must not be less than 1, and use caution when setting it to very large values (typically it shouldn't need to be much more than 4 or 5). The framebuffer remains the same size, but is scaled to fill the new size of the form. The default value of 1, which corresponds to 100% (no scaling). The default ContainerForm attempts to add items to the window's "system menu" to adjust the scaling and scale mode. This property is public; it can be used from code outside of the control. |
ScaleMode |
InterpolationMode property |
This property changes the way the control is scaled, for values of ScaleSize greater than 1. The default is System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; any valid value of this enumeration can be used. The default ContainerForm attempts to add items to the window's "system menu" to adjust the scaling and scale mode. This property is public; it can be used from code outside of the control. |
|
OnMode13MouseDown
OnMode13MouseMove
OnMode13MouseUp
|
virtual functions to be overridden by user code: protected virtual void OnMode13MouseDown(MouseEventArgs e)
protected virtual void OnMode13MouseMove(MouseEventArgs e)
protected virtual void OnMode13MouseUp(MouseEventArgs e)
|
These functions are intended to be overridden by user code to process mouse input. Semantically, they are identical to the
OnMouseDown/OnMouseMove/OnMouseUp functions provided by System.Windows.Forms.Control, but their
mouse position X & Y coordinates are automatically scaled to accommodate changes in the mode13 control's
size.
|
UsingDirectDraw |
bool property |
This property may be assigned only from the constructor, and must be called after the ClientSize property is set,
as it may result in the control being realized. The default value is false; assigning true will
result in mode13 attempting to dynamically load the Managed DirectDraw assembly. If this succeeds, then
UsingDirectDraw will keep its new value of true; if it fails, the value will still be false.
If user code wishes to notify the user if DirectDraw initialization fails, the following code pattern can be used:
UsingDirectDraw = true;
|
|
LockFrame
UnlockFrame
|
LockFrame()
UnlockFrame()
|
These functions lock the active framebuffer for a sequence of drawing operations. While they may result in a very marginal
increase in speed, most programs will not need to use them. While the framebuffer is locked, repaint operations are unable to
proceed. A deadlock can arise if paging is disabled and FlipPages is called while the framebuffer is locked by the
user code thread.
|
mode13 depends on overriding
mode13 requires that its overrided implementations of the following functions be called for full functionality.
User code may still override them, but the user's override should place a call to base.whatever.
| Function/Property | Explanation |
|---|---|
OnParentChanged() |
This function is used to ensure that the container window, if it is a Mode13ControlBase/ContainerForm
instance, always has its Text property updated.
|
string Text { get; set; } |
This property's overridden implementation ensures that text value is applied to the the container window, if it is a
Mode13ControlBase/ContainerForm instance.
|
OnPaint() |
This function is used to repaint the window when it is unexpectedly exposed (for instance, when it is restored from a
minimized state). FlipPages() does not depend on this function, but a program which does not frequently call
FlipPages may have an interval of time during which the window remains unpainted, if the
OnPaint() function is overridden and the base implementation not called.
|
OnCreateControl() |
This function is where the active and visible frame buffers are created. The Size property must therefore be
set correctly before a property is accessed which will invoke this function. This function is guaranteed to be called
before the Run() method is called. If user code overrides this function and does not call the base
implementation, then mode13 will not work at all.
|
IsInputKey(Keys keyData) |
This function is overridden by Mode13ControlBase to allow "extended" keys, including escape, tab, page up/down and
the arrow keys to be received by the OnKeyDown event. This is to facilitate input for user programs. This function
can be overridden by user code if a different set of keys needs to be enabled. The full set forced on by mode13's
implementation is: Escape, F1 through F12, Tab, Backspace, Insert/Delete, Home/End, PageUp/PageDown, Up/Left/Down/Right.
|
|
OnMouseDown(MouseEventArgs e)
OnMouseMove(MouseEventArgs e)
OnMouseUp(MouseEventArgs e)
|
These functions are overridden by Mode13ControlBase to automatically translate the mouse event coordinates when the
mode13 control has a ScaleSize value greater than 1. User code can override these if it wishes, but
should be aware that the X & Y values provided in the parameter will not necessarily correspond with coordinates on the
mode13 framebuffer. User code should usually override OnMode13MouseDown/OnMode13MouseMove/OnMode13MouseUp
instead, as these functions have exactly the same semantics and provided automatic adjustments to the mouse position coordinates
based on the current scale value.
|
Run() |
This function is intended to be overridden by user code. It is the entrypoint into user code. In general, user code should only return from this function when it no longer needs to perform any updates. |