示例#1
0
int main(void)
{
    // print user instructions
    cout << " Hit the F1 key to Toggle between Fullscreen and windowed mode" << endl;
    cout << " Hit ESC to quit" << endl;

    if( SDL_Init( SDL_INIT_VIDEO ) < 0 )                      // try to initialize SDL video module
    {
        cerr << "Failed initializing SDL Video : " << SDL_GetError() << endl;      // report error if it fails
        return 1;                                             // we use this instead of Quit because SDL isn't yet initialized
    }

    // Set up the format for the pixels of the OpenGL drawing surface
    SetupPixelFormat();
    // Create our window, we pass caption for the window, the width, height and video flags required
    CreateMyWindow("www.GameTutorials.com - TextureMapping", SCREEN_WIDTH, SCREEN_HEIGHT, VideoFlags);

    // Initializes our OpenGL drawing surface
    
    Init();

    // Run our message loop
    MainLoop();

    // quit main returning success
    return 0;
}
示例#2
0
int PASCAL WinMain(HINSTANCE hInstance,
						 HINSTANCE hPrevInstance,
						 LPSTR lpCmdLine,
						 int nCmdShow)
{
	m_hInstance = hInstance;
#ifdef USE_WINDOW
	InitInstance(hInstance, hPrevInstance);
	CreateMyWindow();
#endif

	// Invoke the "Upgrade" function of the DLL.
	int nResult = (int)Upgrade(m_hWndMain, NULL, 2, 123456L);

	char result_buffer[80];
	sprintf(result_buffer, "Result (%d)", nResult);

	char buffer[80];
	sprintf(buffer, "Upgrade returned %s", result_buffer);
	MessageBox(m_hWndMain, buffer, "Upgrade", MB_OK);

#ifdef USE_WINDOW
	if (m_hWndMain != NULL)
	{
		DestroyWindow(m_hWndMain);
	}
#endif

	return 0;
}
示例#3
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hprev, PSTR cmdline, int ishow)
{	
	// Create the main window and offset the height by the menu pixel height
	HWND hWnd = CreateMyWindow("www.GameTutorials.com - Rpg (Part 6)", 
			    			   kScreenWidth, kScreenHeight + kMenuOffset, 0, hInstance);

	// If we never got a valid window handle, quit the program
	if(hWnd == NULL) return TRUE;

	// Initialize our important things after the window is created
	Init(hWnd);													

	// Run our message loop and after it's done, return the result
	return (int)MainLoop();						
}
示例#4
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hprev, PSTR cmdline, int ishow)
{
	HWND hWnd;
 
	int screenWidth = GetSystemMetrics(SM_CXSCREEN);
	int screenHeight = GetSystemMetrics(SM_CYSCREEN);

	hWnd = CreateMyWindow("Савельев", screenWidth, screenHeight, 1, true, hInstance);
 
	// Выходим при ошибке
	if(hWnd == NULL) return TRUE;
 
	// Инициализируем OpenGL
	Init(hWnd);
 
	// Запускаем игровой цикл
	return MainLoop();
}
示例#5
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hprev, PSTR cmdline, int ishow)
{	
	// Create the main window and offset the height by the menu pixel height
	HWND hWnd = CreateMyWindow("www.GameTutorials.com - MapEditor(1)", 
			    			   SCREEN_WIDTH, SCREEN_HEIGHT + MENU_OFFSET, 0, hInstance);

	// If we never got a valid window handle, quit the program
	if(hWnd == NULL) return TRUE;

	// Create our tool bar window offset by the scroll bar pixel width and to compensate
	// for the small title bar we offset the height with the menu offset
	g_hWndTool = CreateToolWindow(hWnd, "", TILE_WIDTH + SCROLL_BAR_OFFSET, HEIGHT + MENU_OFFSET, 
								  WS_POPUP| WS_SYSMENU | WS_CAPTION , hInstance);

	// Initialize our important things after the window is created
	Init(hWnd);													

	// Run our message loop and after it's done, return the result
	return (int)MainLoop();						
}
示例#6
0
文件: Init.cpp 项目: 88er/tutorials
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hprev, PSTR cmdline, int ishow)
{	
	HWND hWnd;

	// Check if we want full screen or not
	if(MessageBox(NULL, "Click Yes to go to full screen (Recommended)", "Options", MB_YESNO | MB_ICONQUESTION) == IDNO)
		g_bFullScreen = false;
	
	// Create our window with our function we create that passes in the:
	// name, width, height, any flags for the window, if we want fullscreen of not, and the hInstance.
	hWnd = CreateMyWindow("www.GameTutorials.com - 3DS Animation", SCREEN_WIDTH, SCREEN_HEIGHT, 0, g_bFullScreen, hInstance);

	// If we never got a valid window handle, quit the program
	if(hWnd == NULL) return true;

	// INIT OpenGL
	Init(hWnd);													

	// Run our message loop and after it's done, return the result
	return (int)MainLoop();						
}
void DoFileStuff(HWND hwnd)
{
  HANDLE hFile = CreateFile(
    TEXT("\\Windows\\tmail.exe"),
    GENERIC_READ,
    FILE_SHARE_READ,
    NULL,
    OPEN_EXISTING,
    FILE_ATTRIBUTE_NORMAL,
    NULL);
  DWORD dw1 = GetLastError();
  DWORD atts = GetFileAttributes(TEXT("\\Windows\\tmail.exe"));
  DWORD dw2 = GetLastError();
  CreateMyWindow(hwnd);
  TCHAR buffer[255];
  StringCbPrintf(buffer, sizeof(buffer), TEXT("Open File Error: %d\r\nAttributes: %d\r\nAttributes Error: %d"), dw1, atts, dw2);
  if(g_dlg)
  {
    g_dlg->Append(buffer);
  }
  CloseHandle(hFile);
}
示例#8
0
文件: Main.cpp 项目: ETRu/Laura
//-------------------------------------------------------------------------------------------------
int main(int argc, char **argv) {
    
    igraph_set_error_handler(igraph_error_handler_printignore);
        igraph_i_set_attribute_table(&igraph_cattribute_table);
    
    
    
    drawingcontrol=1;
	runningcontrol=0;
    cleared=1;
    graphisloaded=0;
	newgraph=1;
    usesteady=0;
    ispii=0;
    haveout=0;
    isrelaxed=0;
    havecstop=0;
    isdissipating=0;
    
    
    
    //RANDOM NUMBER GENERATOR INITIALISE
    init_genrand(0); //srand(3);
    
    
    //preloaded graph:
    {
        latticedim=2;
        latticeside=5;
        istoro=1;
        islattice=1;
        isclustered=0;
        israndomER1=0;
        generatelattice(2,5,1,0,0,0,0);
        //inizializations
        igraph_matrix_init(&state, 0, 0);
        igraph_matrix_init(&density, 0, 0);
        igraph_matrix_init(&densityold,0,0);
        igraph_matrix_init(&statenew, 0, 0);
        igraph_matrix_init(&flux, 0, 0);
        igraph_matrix_init(&loss, 0, 0);
        beginner=(nodesnumber/2);
        InitialStateTAS(beginner,0,totrun);
        igraph_vector_init(&gain,nodesnumber);
        graphisloaded=1;
        newgraph=1;
        haveloadedstate=0;
        
        
        drnodes=1;
        drlinks=1;
        drfluxes=0;
    }
    
    
    
    
    havepath=0;
    sprintf(path,"No path");
  
	
    logDebug("\n DEFAULT ADJ MATRIX:\n");
    print_matrix_ur(&admatrix,stdout);
    printf("\n");
	printf("\n");
    rewrite=1;
    
    CreateMyWindow();
    
    
  //Fl::add_timeout(1.0,mainidle_cb);
  Fl::add_idle(mainidle_cb, 0);
  Fl::run();
    
    
    histdist.Clear();
    
    igraph_destroy(&graph);
    igraph_destroy(&sgraph);
    igraph_matrix_destroy(&admatrix);
    igraph_matrix_destroy(&layout);
    igraph_matrix_destroy(&density);
    igraph_matrix_destroy(&densityold);
    igraph_matrix_destroy(&state);
    igraph_matrix_destroy(&loadedstate);
    igraph_matrix_destroy(&statenew);
    igraph_matrix_destroy(&flux);
    igraph_vector_destroy(&gain);
    igraph_matrix_destroy(&loss);
    igraph_vector_destroy(&statstate);
    igraph_matrix_destroy(&estates);
    
    closeout();
    
  return 0;
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
{
  LRESULT lResult = TRUE;

  switch(msg)
  {
    case WM_CREATE:
      lResult = OnCreate(hwnd, (CREATESTRUCT*)lp);
      break;

    case WM_COMMAND:
      switch (wp)
      {
        case IDOK:
          DestroyWindow(hwnd);
          break;
        case ID_NEWWINDOW:
          CreateMyWindow(hwnd);
          break;
        case ID_SETTEXT:
          SetDialogText(TEXT("AaBbYyZz"));
          break;
        case ID_GO:
          StartCounter();
          break;
        case ID_CLOSEWINDOW:
          DestroyMyWindow();
          break;
        case ID_BEEP:
          MakeTheBeep();
          break;
        case ID_HIDE:
          g_dlg->Hide();
          break;
        case ID_SHOW:
          g_dlg->Show();
          break;
        case ID_DOFILESTUFF:
          DoFileStuff(hwnd);
          break;
        case ID_LIGHT:
          DoLight();
          break;
        default:
          goto DoDefault;
      }
      break;

    case WM_PAINT:
    {
      HDC hdc;
      PAINTSTRUCT ps;
      RECT rect;
      hdc = BeginPaint(hwnd, &ps);
      GetClientRect(hwnd, &rect);

      DrawText(hdc, g_szMessage, -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
      EndPaint (hwnd, &ps);
    }
    break;

    case WM_DESTROY:
      PostQuitMessage(0);
      break;

    DoDefault:
    default:
      lResult = DefWindowProc(hwnd, msg, wp, lp);
      break;
  }
  return(lResult);
}