int WINAPI WinMain( HINSTANCE instance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { MSG msg; int done=0; WININFO *info = &wininfo; info->hInstance = GetModuleHandle( 0 ); //if( MessageBox( 0, "fullscreen?", info->wndclass, MB_YESNO|MB_ICONQUESTION)==IDYES ) info->full++; if( !window_init(info) ) { window_end( info ); MessageBox( 0, "window_init()!","error",MB_OK|MB_ICONEXCLAMATION ); return( 0 ); } intro_init(); #ifdef USEDSOUND mzk_init( myMuzik+22 ); memcpy( myMuzik, wavHeader, 44 ); if( !sndPlaySound( (const char*)&myMuzik, SND_ASYNC|SND_MEMORY ) ) { window_end( info ); MessageBox( 0, "mzk???", "error", MB_OK|MB_ICONEXCLAMATION ); return( 0 ); } #endif long to=timeGetTime(); while( !done ) { long t = timeGetTime() - to; while( PeekMessage(&msg,0,0,0,PM_REMOVE) ) { if( msg.message==WM_QUIT ) done=1; TranslateMessage( &msg ); DispatchMessage( &msg ); } intro_do( t ); if( t>(MZK_DURATION*1000) ) { done = 1; } SwapBuffers( info->hDC ); } sndPlaySound( 0, 0 ); window_end( info ); return( 0 ); }
static void window_end_window_void(void** state){ OS_t * new_OS = OS_new("Jupiter"); window_t* pwindow = OS_window_new(new_OS, "Callisto", "i am test"); window_start(new_OS, pwindow); window_end(new_OS, pwindow); assert_int_equal(OS_get_amountOFworking_window(new_OS), 0); window_free(pwindow); OS_free(new_OS); }
static void OS_dec_amountOFworkingWindow__amountOFworking_window__returns_inc_amountOFworking_window(void **state){ OS_t * new_OS = OS_new("Jupiter"); window_t * pwindow = OS_window_new(new_OS, "TESTwindow", "test"); window_start(new_OS, pwindow); window_end(new_OS, pwindow); assert_int_equal(OS_get_amountOFworking_window(new_OS), 0); window_free(pwindow); OS_free(new_OS); }
static void window_getStatus_window_status(void** state){ OS_t * new_OS = OS_new("Jupiter"); window_t* pwindow = OS_window_new(new_OS, "Callisto", "i am test"); window_start(new_OS, pwindow); assert_int_equal(window_getStatus(pwindow), working); window_end(new_OS, pwindow); assert_int_equal(window_getStatus(pwindow), non_working); window_free(pwindow); OS_free(new_OS); }
void main(int argc, char *argv[]){ if (strcmp(argv[1],"tests")==0) { module_runTests(); } else if (strcmp(argv[1], "modules") == 0){ OS_t* Linux = OS_new("Linux");//1.0 OS_t* Windows = OS_new("Windows");//2.0 OS_window_new(Linux, "Internet","HELLO");//1.2 puts("listOfWindows(Linux)"); OS_print_listOfWindows(Linux); OS_deleteWindow(Linux, 2); puts("listOfWindows(Linux) after deleting window(2)"); OS_print_listOfWindows(Linux); OS_window_new(Windows, "Camomiles","LOVE");//2.2 OS_window_new(Windows, "Roses","SAD");//2.3 puts("listOfWindows(Windows)"); OS_print_listOfWindows(Windows); window_start(Windows, 2); window_start(Windows, 3); puts("listOFworking_windows(Windows)"); OS_print_listOFworking_windows(Windows); window_end(Windows,2); puts("listOFworking_windows(Windows)"); OS_print_listOFworking_windows(Windows); window_send_letter(Windows, 2, 3); window_send_letter(Windows, 2, 3); window_send_letter(Windows, 3, 2); puts("listOFrecivedLetters(Roses)"); window_print_listOfrecievedLetters(Windows,3); puts("listOFrecived_windows(Camomailes)"); window_print_listOfrecievedLetters(Windows,2); window_free(Windows,2); window_free(Windows,3); OS_free(Linux); OS_free(Windows); getchar(); } }
int WINAPI WinMain( HINSTANCE instance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { MSG msg; int done=0; WININFO *info = &wininfo; info->hInstance = GetModuleHandle( 0 ); //if( MessageBox( 0, "fullscreen?", info->wndclass, MB_YESNO|MB_ICONQUESTION)==IDYES ) info->full++; if (!window_init(info)) { window_end(info); MessageBox(0, "window_init()!", "error", MB_OK|MB_ICONEXCLAMATION); return 0; } if (initGL(info)) { return 0; } //intro_init(); // Initialize COM HRESULT hr = CoInitialize(NULL); if (FAILED(hr)) exit(-1); // Example editor usage char errorText[MAX_ERROR_LENGTH+1]; char filename[SM_MAX_FILENAME_LENGTH+1]; sprintf_s(filename, SM_MAX_FILENAME_LENGTH, "shaders/%s", usedShader[usedIndex]); if (editor.loadText(filename, errorText)) { MessageBox(info->hWnd, errorText, "Editor init", MB_OK); return -1; } long to=timeGetTime(); while( !done ) { long t = timeGetTime() - to; while( PeekMessage(&msg,0,0,0,PM_REMOVE) ) { if( msg.message==WM_QUIT ) done=1; TranslateMessage( &msg ); DispatchMessage( &msg ); } glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); intro_do(t); editor.render(t); SwapBuffers( info->hDC ); } window_end( info ); // Un-initialize COM CoUninitialize(); return( 0 ); }
int WINAPI WinMain( HINSTANCE instance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) //void entrypoint(void) { MSG msg; int done=0; WININFO *info = &wininfo; window_init(info); long st = GetTickCount(); CLogger* myLogger; myLogger = new CLogger(); GraphicsClass* m_Graphics; m_Graphics = new GraphicsClass(); m_Graphics->Initialize(XRES,YRES,info->hWnd); // BASS BASS_Init(-1,44100,0,0,NULL); //char filename[400]="C:\\My_Projects\\frmwrk\\Debug\\lemonade-merry_xmas_nectas.xm"; char filename[400]="C:\\My_Projects\\frmwrk\\Debug\\bass_system-questa_sera.xm"; //char * filename= "dark_rat-xmas.xm"; DWORD chan; float time; //chan=BASS_MusicLoad(FALSE,"dark_rat-xmas.xm",0,0,BASS_SAMPLE_LOOP|BASS_MUSIC_RAMPS|BASS_MUSIC_PRESCAN,0); if (!(chan=BASS_MusicLoad(FALSE,filename,0,0,BASS_MUSIC_RAMPS|BASS_MUSIC_PRESCAN,0))) { int k=5; } float dummy; int a; for (a=0;BASS_ChannelGetAttribute(chan,BASS_ATTRIB_MUSIC_VOL_CHAN+a,&dummy);a++); QWORD pos; pos=BASS_ChannelGetLength(chan,BASS_POS_BYTE); BASS_ChannelPlay(chan,FALSE); // programm loop long to=0; while( !done ) { pos=BASS_ChannelGetPosition(chan,BASS_POS_BYTE); time=BASS_ChannelBytes2Seconds(chan,pos); myLogger->LogThis("pos"); myLogger->LogThisFloat((float)pos); myLogger->LogThis("time"); myLogger->LogThisFloat((float)time); if (time!=0) { int k=6; } long t = GetTickCount(); if( !to ) to=t; t-=to; while( PeekMessage(&msg,0,0,0,PM_REMOVE) ) { if( msg.message==WM_QUIT ) done=1; TranslateMessage( &msg ); DispatchMessage( &msg ); } DrawTime( info, .001f*t ); m_Graphics->Frame(); m_Graphics->Render(); } window_end(info); ExitProcess( 0 ); }
int WINAPI WinMain( HINSTANCE instance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { MSG msg; int done=0; WININFO *info = &wininfo; info->hInstance = GetModuleHandle( 0 ); //if( MessageBox( 0, "fullscreen?", info->wndclass, MB_YESNO|MB_ICONQUESTION)==IDYES ) info->full++; if (!window_init(info)) { window_end( info ); MessageBox( 0, "window_init()!","error",MB_OK|MB_ICONEXCLAMATION ); return( 0 ); } #ifdef USEDGRAPHICS intro_init(); #endif // open audio device if (waveOutOpen(&hWaveOut, WAVE_MAPPER, &wfx, 0, 0, CALLBACK_NULL) != MMSYSERR_NOERROR) { MessageBox(0, "unable to open WAVE_MAPPER device", "error", MB_OK|MB_ICONEXCLAMATION); return 0; } // create music block mzk_init(); // prepare and play music block header[0].lpData = (char *)myMuzikBlock[0]; header[1].lpData = (char *)myMuzikBlock[1]; header[0].dwBufferLength = AUDIO_BUFFER_SIZE * MZK_NUMCHANNELS * 2; header[1].dwBufferLength = AUDIO_BUFFER_SIZE * MZK_NUMCHANNELS * 2; waveOutPrepareHeader(hWaveOut, &(header[0]), sizeof(WAVEHDR)); waveOutWrite(hWaveOut, &(header[0]), sizeof(WAVEHDR)); waveOutPrepareHeader(hWaveOut, &(header[1]), sizeof(WAVEHDR)); waveOutWrite(hWaveOut, &(header[1]), sizeof(WAVEHDR)); timer.wType = TIME_SAMPLES; while (!done) { waveOutGetPosition(hWaveOut, &timer, sizeof(timer)); DWORD t = timer.u.sample; while (PeekMessage(&msg,0,0,0,PM_REMOVE)) { if (msg.message==WM_QUIT) done=1; TranslateMessage(&msg); DispatchMessage(&msg); } #ifdef USEDGRAPHICS intro_do(t); #endif #if 0 if( t > (MZK_DURATION*1000) ) { done = 1; } #endif SwapBuffers(info->hDC); // Try to unprepare header if (waveOutUnprepareHeader(hWaveOut, &(header[nextPlayBlock]), sizeof(WAVEHDR)) != WAVERR_STILLPLAYING) { #ifdef USEDSOUND mzk_prepare_block(myMuzikBlock[nextPlayBlock]); #endif waveOutPrepareHeader(hWaveOut, &(header[nextPlayBlock]), sizeof(WAVEHDR)); waveOutWrite(hWaveOut, &(header[nextPlayBlock]), sizeof(WAVEHDR)); nextPlayBlock = 1 - nextPlayBlock; } } // Close the wave output (for savety?) waveOutClose(hWaveOut); window_end( info ); return( 0 ); }
//void entrypoint( void ) int main( void ) { XEvent event; int done=0; WININFO *info = &wininfo; if( !smalloc_init() ) { #ifdef ERRORMSG printf( "window_init()!" ); #endif return( 1 ); } /* if( MessageBox( 0, "fullscreen?", info->wndclass, MB_YESNO|MB_ICONQUESTION)==IDYES ) info->full++; */ if( !window_init(info) ) { window_end( info ); #ifdef ERRORMSG printf( "window_init()!" ); #endif return( 2 ); } FONT_Init( (long)info->hDisplay ); if( !intro_init( XRES, YRES, 0, (int)info->hWnd ) ) { window_end( info ); #ifdef ERRORMSG printf( msg_error ); #endif return( 3 ); } while( !done ) { done = intro_do(); while( XPending(info->hDisplay) ) { XNextEvent( info->hDisplay, &event ); switch( event.type ) { case KeyPress: switch( XKeycodeToKeysym( info->hDisplay, event.xkey.keycode, 0 ) ) { case XK_Escape: done = 1; break; } break; case DestroyNotify: done = 1; break; } } glXSwapBuffers( info->hDisplay, info->hWnd ); } intro_end(); window_end( info ); smalloc_end(); return( 0 ); }
/************************************************* * OpenGL initialization *************************************************/ static int initGL(WININFO *winInfo) { char errorString[MAX_ERROR_LENGTH + 1]; // Create openGL functions for (int i=0; i<NUM_GL_NAMES; i++) glFP[i] = (GenFP)wglGetProcAddress(glnames[i]); // NEHE MULTISAMPLE bool arbMultisampleSupported = false; int arbMultisampleFormat = 0; // Get Our Pixel Format PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB"); HDC hDC = winInfo->hDC; int pixelFormat; int valid; UINT numFormats; float fAttributes[] = { 0,0 }; // These Attributes Are The Bits We Want To Test For In Our Sample // Everything Is Pretty Standard, The Only One We Want To // Really Focus On Is The SAMPLE BUFFERS ARB And WGL SAMPLES // These Two Are Going To Do The Main Testing For Whether Or Not // We Support Multisampling On This Hardware int iAttributes[] = { WGL_DRAW_TO_WINDOW_ARB,GL_TRUE, WGL_SUPPORT_OPENGL_ARB,GL_TRUE, WGL_ACCELERATION_ARB,WGL_FULL_ACCELERATION_ARB, WGL_COLOR_BITS_ARB,24, WGL_ALPHA_BITS_ARB,8, WGL_DEPTH_BITS_ARB,0, WGL_STENCIL_BITS_ARB,0, WGL_DOUBLE_BUFFER_ARB,GL_TRUE, WGL_SAMPLE_BUFFERS_ARB,GL_TRUE, WGL_SAMPLES_ARB, 4, // Check For 4x Multisampling 0,0 }; // First We Check To See If We Can Get A Pixel Format For 4 Samples valid = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats); // if We Returned True, And Our Format Count Is Greater Than 1 if (valid && numFormats >= 1) { arbMultisampleSupported = true; arbMultisampleFormat = pixelFormat; } else { // Our Pixel Format With 4 Samples Failed, Test For 2 Samples iAttributes[19] = 2; valid = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats); if (valid && numFormats >= 1) { arbMultisampleSupported = true; arbMultisampleFormat = pixelFormat; } } if (arbMultisampleSupported) { //SetPixelFormat(winInfo->hDC, arbMultisampleFormat, &pfd); //wglMakeCurrent(winInfo->hDC, winInfo->hRC); //DestroyWindow(winInfo->hWnd); window_end(winInfo); // Remove all messages... MSG msg; while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)); window_init(winInfo, true, arbMultisampleFormat); } glEnable(GL_MULTISAMPLE_ARB); // Create and initialize the shader manager if (shaderManager.init(errorString)) { MessageBox(winInfo->hWnd, errorString, "Shader Manager Load", MB_OK); return -1; } // Create and initialize everything needed for texture Management if (textureManager.init(errorString)) { MessageBox(winInfo->hWnd, errorString, "Texture Manager Load", MB_OK); return -1; } // Create the text editor if (editor.init(&shaderManager, &textureManager, errorString)) { MessageBox(winInfo->hWnd, errorString, "Editor init", MB_OK); return -1; } blob = 0.; // Create the fluid simulation stuff //fluid_simulation_.Init(false); return 0; }