|
|
Learn how to open a window and display a picture with PTK.
#include "ptk.h"
KWindow *ourWindow = NULL ;
KGraphic *ourPicture = NULL ;
//according to your operating sytem the entry point is slightly different
#ifdef WIN32
int WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPreInst, LPSTR lpszCmdLine, int nCmdShow )
#else
int main( void )
#endif
{
ourWindow = KPTK::createKWindow( K_OPENGL);
if( ourWindow == NULL ) return 0 ;
ourWindow->createGameWindow( 640,480,-1,true,"test window" );
ourPicture = KPTK::createKGraphic( ) ;
ourPicture->loadPicture( KMiscTools::makeFilePath( "image.jpg" ) , true, true ) ;
do
{
ourWindow->setDefaultWorldView( ) ;
ourPicture->blitAlphaRect(0,0,640,480,0,0 ) ;
ourWindow->flipBackBuffer( ) ;
}while( ourWindow->isQuit() == false )
delete ourWindow ;
delete ourPicture;
return 0 ;
}
|