Sack Library Documentation
ContentsIndexReferenceHome
Example
   
// get a render display, just a default window of some size
// extended features are available for more precision.
Render render = OpenDisplay(0);
   

 

A few methods of using this surface are available. One, you may register for events, and be called as required.

RedrawCallback MyDraw = DrawHandler;
MouseCallback MyMouse;
KeyProc MyKey;
CloseCallback MyClose;
   
// called when the surface is initially shown, or when its surface changes.
// otherwise, the image drawn by the application is static, and does
// not get an update event.
SetRedrawHandler( render, MyDraw, 0 );
   
// This will get an event every time a mouse event happens.
// If no Key handler is specified, key strokes will also be mouse events.
SetMouseHandler( render, MyMouse, 0 );
   
// If the window was closed, get an event.
SetCloseHandler( render, MyClose, 0 );
   
// specify a handler to get keyboard events...
SetKeyboardHandler( render, MyKey, 0 );
   

 

Or, if you don't really care about any events...

// load an image
Image image = LoadImageFile( "sample.jpg" );
// get the image target of render
Image display = GetDisplayImage( render );
// copy the loaded image to the display image
BlotImage( display, image );
// and update the display
UpdateDisplay( render );

 

   
void CPROC DrawHandler( PTRSZVAL psvUserData, PRENDERER render )
{
    Image display = GetDisplayImage( render );
    // the display image may change, because of an external resize
   
    // update the image to display as desired...
   
    // when done, the draw handler should call UpdateDisplay or...
    UpdateDisplayPortion( render, 0, 0, 100, 100 );
}

 

Oh! And most importantly! Have to call this to put the window on the screen.

UpdateDisplay( render );

 

Or maybe can pretend it was hidden

RestoreDisplay( render );
Created with a commercial version of Doc-O-Matic. In order to make this message disappear you need to register this software. If you have problems registering this software please contact us at support@toolsfactory.com.
Copyright (c) 2000+. All rights reserved.