当前位置: 首页>>代码示例>>C++>>正文


C++ ShowCursor函数代码示例

本文整理汇总了C++中ShowCursor函数的典型用法代码示例。如果您正苦于以下问题:C++ ShowCursor函数的具体用法?C++ ShowCursor怎么用?C++ ShowCursor使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ShowCursor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: while

void z_ed3View::ShowTheCursor (void)
{
	while (ShowCursor (TRUE) < 0);
}
开发者ID:comarius,项目名称:getic3d,代码行数:4,代码来源:z_ed3View.cpp

示例2: while

void SingleOpenGLWindowImplT::Close()
{
#ifdef _WIN32
    // Release DirectInput.
    DirectInput.Release();

    // Rendering-Context zurückgeben.
    if (hRC)
    {
        // Vorher noch prüfen, ob es OpenGL-Fehler gab.
        while (true)
        {
            GLenum Error=glGetError();

            switch (Error)
            {
                case GL_NO_ERROR         : break;
                case GL_INVALID_ENUM     : MessageBox(NULL, "GL_INVALID_ENUM     ", NULL, MB_OK | MB_ICONERROR | MB_TOPMOST); break;
                case GL_INVALID_VALUE    : MessageBox(NULL, "GL_INVALID_VALUE    ", NULL, MB_OK | MB_ICONERROR | MB_TOPMOST); break;
                case GL_INVALID_OPERATION: MessageBox(NULL, "GL_INVALID_OPERATION", NULL, MB_OK | MB_ICONERROR | MB_TOPMOST); break;
                case GL_STACK_OVERFLOW   : MessageBox(NULL, "GL_STACK_OVERFLOW   ", NULL, MB_OK | MB_ICONERROR | MB_TOPMOST); break;
                case GL_STACK_UNDERFLOW  : MessageBox(NULL, "GL_STACK_UNDERFLOW  ", NULL, MB_OK | MB_ICONERROR | MB_TOPMOST); break;
                case GL_OUT_OF_MEMORY    : MessageBox(NULL, "GL_OUT_OF_MEMORY    ", NULL, MB_OK | MB_ICONERROR | MB_TOPMOST); break;
                default                  : MessageBox(NULL, "GL_UNKNOWN!!!       ", NULL, MB_OK | MB_ICONERROR | MB_TOPMOST); break;
            }

            if (Error==GL_NO_ERROR) break;
        }

        if (!wglMakeCurrent  (NULL, NULL)) MessageBox(NULL, "Unable to deactivate DC and RC.",      NULL, MB_OK | MB_ICONERROR);
        if (!wglDeleteContext(hRC)       ) MessageBox(NULL, "Unable to release rendering context.", NULL, MB_OK | MB_ICONERROR);

        hRC=NULL;
    }

    // Device-Context zurückgeben.
    if (hDC)
    {
        if (!ReleaseDC(hWindow, hDC)) MessageBox(NULL, "Unable to release device context.", NULL, MB_OK | MB_ICONERROR);
        hDC=NULL;
    }

    // Fenster schließen.
    if (hWindow)
    {
        if (!DestroyWindow(hWindow)) MessageBox(NULL, "Unable to destroy window.", NULL, MB_OK | MB_ICONERROR);
        hWindow=NULL;
    }

    // Fensterklasse abmelden. Dabei zurückgegebene Fehlercodes ignorieren.
    UnregisterClass("CafuMain", hInstance);

    // Standard-Display wiederherstellen.
    if (FullScreen)
    {
        ChangeDisplaySettings(NULL, 0);
        ShowCursor(true);
    }
#else
    // De-activate the invisible mouse cursor again (restore the previous visible cursor).
    XUndefineCursor(DisplayPtr, Win);

    // Turn on auto-repeat.
    // XAutoRepeatOn(DisplayPtr);

    // WARNING: Omitting the following line worked when this library was a static library.
    // When it became a shared library, the next call to glXMakeCurrent() caused a segmentation fault without this line.
    // That's strange. Probably it's just a driver bug on my machine, but I thought I'd better mention it...
    glXDestroyContext(DisplayPtr, RC);

    XCloseDisplay(DisplayPtr);
#endif

    // OpenGLWindow geschlossen.
    WindowIsOpen=false;
}
开发者ID:mark711,项目名称:Cafu,代码行数:76,代码来源:OpenGLWindow.cpp

示例3: Game_Init

int Game_Init(void *parms)
{
// this function is where you do all the initialization
// for your game

    int index; // looping var

// start up DirectDraw (replace the parms as you desire)
    DDraw_Init2(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_BPP, WINDOWED_APP,1);

// initialize directinput
    DInput_Init();

// acquire the keyboard
    DInput_Init_Keyboard();

// add calls to acquire other directinput devices here...

// initialize directsound and directmusic
    DSound_Init();
    DMusic_Init();

// hide the mouse
    if (!WINDOWED_APP)
        ShowCursor(FALSE);

// seed random number generator
    srand(Start_Clock());

    Open_Error_File("ERROR.TXT");

// initialize math engine
    Build_Sin_Cos_Tables();

// initialize the camera with 90 FOV, normalized coordinates
    Init_CAM4DV1(&cam,      // the camera object
                 CAM_MODEL_EULER, // the euler model
                 &cam_pos,  // initial camera position
                 &cam_dir,  // initial camera angles
                 &cam_target,      // no target
                 10.0,        // near and far clipping planes
                 12000.0,
                 120.0,      // field of view in degrees
                 WINDOW_WIDTH,   // size of final screen viewport
                 WINDOW_HEIGHT);

// set a scaling vector
    VECTOR4D_INITXYZ(&vscale,20.00,20.00,20.00);

// load all the objects in
    for (int index_obj=0; index_obj < NUM_OBJECTS; index_obj++)
    {
        Load_OBJECT4DV2_COB2(&obj_array[index_obj], object_filenames[index_obj],
                             &vscale, &vpos, &vrot, VERTEX_FLAGS_SWAP_YZ  |
                             VERTEX_FLAGS_TRANSFORM_LOCAL
                             /* VERTEX_FLAGS_TRANSFORM_LOCAL_WORLD*/,0 );

    } // end for index_obj

// set current object
    curr_object = 0;
    obj_work = &obj_array[curr_object];

// load in the scenery object that we will place all over the place
    Load_OBJECT4DV2_COB2(&obj_scene, "fire_cube01.cob",
                         &vscale, &vpos, &vrot, VERTEX_FLAGS_SWAP_YZ  |
                         VERTEX_FLAGS_TRANSFORM_LOCAL
                         /* VERTEX_FLAGS_TRANSFORM_LOCAL_WORLD*/, 0);

// position the scenery objects randomly
    for (index = 0; index < NUM_SCENE_OBJECTS; index++)
    {
        // randomly position object
        scene_objects[index].x = RAND_RANGE(-UNIVERSE_RADIUS, UNIVERSE_RADIUS);
        scene_objects[index].y = RAND_RANGE(-200, 200);
        scene_objects[index].z = RAND_RANGE(-UNIVERSE_RADIUS, UNIVERSE_RADIUS);
    } // end for

// set up lights
    Reset_Lights_LIGHTV2(lights2, MAX_LIGHTS);

// create some working colors
    white.rgba = _RGBA32BIT(255,255,255,0);
    gray.rgba  = _RGBA32BIT(100,100,100,0);
    black.rgba = _RGBA32BIT(0,0,0,0);
    red.rgba   = _RGBA32BIT(255,0,0,0);
    green.rgba = _RGBA32BIT(0,255,0,0);
    blue.rgba  = _RGBA32BIT(0,0,255,0);
    orange.rgba = _RGBA32BIT(255,128,0,0);
    yellow.rgba  = _RGBA32BIT(255,255,0,0);


// ambient light
    Init_Light_LIGHTV2(lights2,               // array of lights to work with
                       AMBIENT_LIGHT_INDEX,
                       LIGHTV2_STATE_ON,      // turn the light on
                       LIGHTV2_ATTR_AMBIENT,  // ambient light type
                       gray, black, black,    // color for ambient term only
                       NULL, NULL,            // no need for pos or dir
                       0,0,0,                 // no need for attenuation
//.........这里部分代码省略.........
开发者ID:renatorabelo,项目名称:tricks-of-the-3d-game-programming-gurus,代码行数:101,代码来源:demoII12_5.cpp

示例4: CDisplay

HRESULT BKMainFrame::initDirectDraw()
{
	if ( display ) { delete display; display = NULL; }
	display = new CDisplay();

	if ( isFullScreenMode() ) {
		CDC* dc = CWnd::GetDesktopWindow()->GetDC();
		int bpp = dc->GetDeviceCaps( BITSPIXEL );
		CWnd::GetDesktopWindow()->ReleaseDC( dc );
		if ( display->CreateFullScreenDisplay( this, 512, 256, bpp ) != S_OK ) {
			AfxMessageBox( "Failed initializing DirectDraw." );
			return -1;
		}
		ModifyStyle( WS_OVERLAPPEDWINDOW, 0 );
		SetMenu( NULL );

		fullWindowWidth  = display->getSurfaceDesc()->dwWidth;
		fullWindowHeight = display->getSurfaceDesc()->dwHeight;
	} else {
		if ( display->CreateWindowedDisplay( this, bk_width, bk_height ) != S_OK ) {
			AfxMessageBox( "Failed initializing DirectDraw." );
			return -1;
		}
		ModifyStyle( 0, WS_OVERLAPPEDWINDOW );
		SetMenu( CMenu::FromHandle( ::LoadMenu( NULL, MAKEINTRESOURCE( IDR_MAINFRAME ) ) ) );
	}
	::SystemParametersInfo( SPI_GETWORKAREA, 0, &screenRect, 0 );
	updateBounds();
	ShowCursor( !fullScreenMode );

	bytePerPixel = display->getSurfaceDesc()->ddpfPixelFormat.dwRGBBitCount >> 3;
	if ( bytePerPixel > 1 ) {
		DWORD rMask = display->getSurfaceDesc()->ddpfPixelFormat.dwRBitMask;
		DWORD gMask = display->getSurfaceDesc()->ddpfPixelFormat.dwGBitMask;
		DWORD bMask = display->getSurfaceDesc()->ddpfPixelFormat.dwBBitMask;
		DWORD mask;
		rBits = 0;
		gBits = 0;
		bBits = 0;
		rZero = 0;
		gZero = 0;
		bZero = 0;
		mask = rMask;
		while ( (mask & 0x1) == 0 ) {
			mask = mask >> 1;
			rZero++;
		}
		while ( mask & 0x1 ) {
			mask = mask >> 1;
			rBits++;
		}
		mask = gMask;
		while ( (mask & 0x1) == 0 ) {
			mask = mask >> 1;
			gZero++;
		}
		while ( mask & 0x1 ) {
			mask = mask >> 1;
			gBits++;
		}
		mask = bMask;
		while ( (mask & 0x1) == 0 ) {
			mask = mask >> 1;
			bZero++;
		}
		while ( mask & 0x1 ) {
			mask = mask >> 1;
			bBits++;
		}
		rBits = 8 - rBits;
		gBits = 8 - gBits;
		bBits = 8 - bBits;
	}
开发者ID:aurusov,项目名称:bk_emul,代码行数:73,代码来源:bkemulmainfrm.cpp

示例5: window_init

static int window_init( WININFO *info )
{
	unsigned int	PixelFormat;
    DWORD			dwExStyle, dwStyle;
    DEVMODE			dmScreenSettings;
    RECT			rec;

    WNDCLASS		wc;

    ZeroMemory( &wc, sizeof(WNDCLASS) );
    wc.style         = CS_OWNDC|CS_HREDRAW|CS_VREDRAW;
    wc.lpfnWndProc   = WndProc;
    wc.hInstance     = info->hInstance;
    wc.lpszClassName = info->wndclass;
	
    if( !RegisterClass(&wc) )
        return( 0 );

    if( info->full )
    {
        dmScreenSettings.dmSize       = sizeof(DEVMODE);
        dmScreenSettings.dmFields     = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
        dmScreenSettings.dmBitsPerPel = 24;
        dmScreenSettings.dmPelsWidth  = XRES;
        dmScreenSettings.dmPelsHeight = YRES;
        if( ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL)
            return( 0 );
        dwExStyle = WS_EX_APPWINDOW;
        dwStyle   = WS_VISIBLE | WS_POPUP;// | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
		ShowCursor( 0 );
    }
    else
    {
        dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
        dwStyle   = WS_VISIBLE | WS_CAPTION | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_SYSMENU;
    }

    rec.left   = 0;
    rec.top    = 0;
    rec.right  = XRES;
    rec.bottom = YRES;
    AdjustWindowRect( &rec, dwStyle, 0 );

    info->hWnd = CreateWindowEx( dwExStyle, wc.lpszClassName, "avada kedabra!", dwStyle,
                               (GetSystemMetrics(SM_CXSCREEN)-rec.right+rec.left)>>1,
                               (GetSystemMetrics(SM_CYSCREEN)-rec.bottom+rec.top)>>1,
                               rec.right-rec.left, rec.bottom-rec.top, 0, 0, info->hInstance, 0 );
    if( !info->hWnd )
        return( 0 );
	hWnd = info->hWnd;

    if( !(info->hDC=GetDC(info->hWnd)) )
        return( 0 );

    if( !(PixelFormat=ChoosePixelFormat(info->hDC,&pfd)) )
        return( 0 );

    if( !SetPixelFormat(info->hDC,PixelFormat,&pfd) )
        return( 0 );

    if( !(info->hRC=wglCreateContext(info->hDC)) )
        return( 0 );

    if( !wglMakeCurrent(info->hDC,info->hRC) )
        return( 0 );
    
    return( 1 );
}
开发者ID:chock-mostlyharmless,项目名称:mostlyharmless,代码行数:68,代码来源:main_deb.cpp

示例6: deleteAll

//=============================================================================
// Destructor
//=============================================================================
Game::~Game()
{
    deleteAll();                // free all reserved memory
    ShowCursor(true);           // show cursor
}
开发者ID:Mutjas,项目名称:Projects,代码行数:8,代码来源:game.cpp

示例7: winWindowProc


//.........这里部分代码省略.........
      if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
	break;

      /* Has the mouse pointer crossed screens? */
      if (s_pScreen != miPointerCurrentScreen ())
	miPointerSetNewScreen (s_pScreenInfo->dwScreen,
			       GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset,
			       GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset);

      /* Are we tracking yet? */
      if (!s_fTracking)
	{
	  TRACKMOUSEEVENT		tme;
	  
	  /* Setup data structure */
	  ZeroMemory (&tme, sizeof (tme));
	  tme.cbSize = sizeof (tme);
	  tme.dwFlags = TME_LEAVE;
	  tme.hwndTrack = hwnd;

	  /* Call the tracking function */
	  if (!(*g_fpTrackMouseEvent) (&tme))
	    ErrorF ("winWindowProc - _TrackMouseEvent failed\n");

	  /* Flag that we are tracking now */
	  s_fTracking = TRUE;
	}

      /* Hide or show the Windows mouse cursor */
      if (g_fSoftwareCursor && g_fCursor && (s_pScreenPriv->fActive || s_pScreenInfo->fLessPointer))
	{
	  /* Hide Windows cursor */
	  g_fCursor = FALSE;
	  ShowCursor (FALSE);
	}
      else if (g_fSoftwareCursor && !g_fCursor && !s_pScreenPriv->fActive
	       && !s_pScreenInfo->fLessPointer)
	{
	  /* Show Windows cursor */
	  g_fCursor = TRUE;
	  ShowCursor (TRUE);
	}
      
      /* Deliver absolute cursor position to X Server */
      miPointerAbsoluteCursor (GET_X_LPARAM(lParam)-s_pScreenInfo->dwXOffset,
			       GET_Y_LPARAM(lParam)-s_pScreenInfo->dwYOffset,
			       g_c32LastInputEventTime = GetTickCount ());
      return 0;

    case WM_NCMOUSEMOVE:
      /*
       * We break instead of returning 0 since we need to call
       * DefWindowProc to get the mouse cursor changes
       * and min/max/close button highlighting in Windows XP.
       * The Platform SDK says that you should return 0 if you
       * process this message, but it fails to mention that you
       * will give up any default functionality if you do return 0.
       */
      
      /* We can't do anything without privates */
      if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
	break;
      
      /* Non-client mouse movement, show Windows cursor */
      if (g_fSoftwareCursor && !g_fCursor)
	{
开发者ID:narenas,项目名称:nx-libs,代码行数:67,代码来源:winwndproc.c

示例8: sizeof

/** 创建windows窗口 */
bool GLWindow::Create(const char * window_title,const char * class_name, HINSTANCE h_instance, LPVOID lpParam)
{
	int nX=0;
	int nY=0;
	PIXELFORMATDESCRIPTOR pfd =											/**< 设置像素描述结构 */
	{
		sizeof(PIXELFORMATDESCRIPTOR),									/**< 像素描述结构的大小 */ 
		1,																/**< 版本号 */
		PFD_DRAW_TO_WINDOW	|											/**< 缓存区的输出显示在一个窗口中 */
		PFD_SUPPORT_OPENGL	|											/**< 缓存区支持OpenGL绘图 */
		PFD_STEREO			|											/**< 颜色缓存区是立体缓存 */
		PFD_DOUBLEBUFFER,												/**< 颜色缓存区是双缓存 */
		PFD_TYPE_RGBA,													/**< 使用RGBA颜色格式 */
		m_BitsPerPixel,													/**< 颜色缓存区中颜色值所占的位深 */
		0, 0, 0, 0, 0, 0,												/**< 使用默认的颜色设置 */
		0,																/**< 无Alpha缓存 */
		0,																/**< 颜色缓存区中alpha成分的移位计数 */
		0,																/**< 无累计缓存区 */
		0, 0, 0, 0,														/**< 累计缓存区无移位 */
		32,																/**< 32位深度缓存 */
		0,																/**< 无蒙版缓存 */
		0,																/**< 无辅助缓存区 */
		PFD_MAIN_PLANE,													/**< 必须为PFD_MAIN_PLANE,设置为主绘图层 */
		0,																/**< 表示OpenGL实现所支持的上层或下层平面的数量 */
		0, 0, 0															/**< 过时,已不再使用 */
	};

	DWORD windowStyle = WS_TILEDWINDOW  ;							/**< 定义我们窗口类型,使用常规设定 */
	DWORD windowExtendedStyle = WS_EX_APPWINDOW;						

	if (m_IsFullScreen == true)											/**< 如果为全屏模式,尝试转化为全屏模式 */
	{
		if (ChangeScreenSetting() == false)
		{																/**< 全屏模式转换失败,弹出对话框提示,并尝试窗口模式 */
			MessageBox(HWND_DESKTOP, "模式转换失败.\n在窗口模式下运行.", "Error", MB_OK | MB_ICONEXCLAMATION);
			m_IsFullScreen = false;										/**< 设置为窗口模式 */
		}
		else															/**< 如果为窗口模式 */
		{
			ShowCursor(false);											/**< 隐藏鼠标 */
			windowStyle = WS_POPUP;										/**< 设置窗口模式为顶层窗口 */
			windowExtendedStyle |= WS_EX_TOPMOST;						
		}																
	}

	/// 调整我们窗口的大小,使其客户区的大小为我们设置的大小
	RECT windowRect = {GetPosX(), GetPosY(), GetPosX() + GetWidth(), GetPosY() + GetHeight()};
	if (m_IsFullScreen == false)										/**< 在窗口模式下使用 */
	{	
		windowExtendedStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;	/**< 使窗口具有3D外观 */
		int wid = GetSystemMetrics(SM_CXSCREEN);		/**< 获取当前屏幕宽 */
		int hei = GetSystemMetrics(SM_CYSCREEN);		/**< 获取当前屏幕高 */
		nX = (wid - GetWidth()) / 2;                    /**< 计算窗口居中用 */
		nY = (hei - GetHeight()) / 2;			
		/// 调整我们窗口的大小,使其客户区的大小为我们设置的大小
		AdjustWindowRectEx(&windowRect, windowStyle, 0, windowExtendedStyle);
		/// 判断窗口的左上角是否隐藏在桌面外
		if (windowRect.left < 0)										/**< 如果窗口X坐标为负,移动坐标到0处,并调整窗口的位置 */
		{
			windowRect.right -= windowRect.left;						
			windowRect.left = 0;										
		}
		if (windowRect.top < 0)											/**< 如果窗口Y坐标为负,移动坐标到0处,并调整窗口的位置 */
		{
			windowRect.bottom -= windowRect.top;						
			windowRect.top = 0;											
		}
	}

	/// 创建窗口
	m_hWnd = CreateWindowEx(windowExtendedStyle,						/**< 窗口的扩展风格 */
							class_name,									/**< 窗口的类名 */
							window_title,								/**< 窗口标题 */
							windowStyle,								/**< 窗口的风格 */
							nX,nY,                                      /**< 窗口的左上角位置 */
							windowRect.right - windowRect.left,			/**< 窗口的宽度 */
							windowRect.bottom - windowRect.top,			/**< 窗口的高度 */
                            HWND_DESKTOP,								/**< 窗口的父窗口为桌面 */
							0,											/**< 无菜单 */
							h_instance,									/**< 传入窗口的实例句柄 */
							lpParam);									/**< 传入程序类参数 */

	while (m_hWnd != 0)													/**< 窗口是否创建成功 */
	{
		m_hDC = GetDC(m_hWnd);											/**< 返回窗口的设备描述表 */
		if (m_hDC == 0)													/**< 如果为空 */
		{																/**< 失败 */
			break;														
		}

		GLuint PixelFormat = ChoosePixelFormat(m_hDC, &pfd);			/**< 查找一个兼容的像素格式 */
		if (PixelFormat == 0)											/**< 如果没找到 */
		{																/**< 失败 */
			break;														
		}
		if (SetPixelFormat(m_hDC, PixelFormat, &pfd) == false)			/**< 设置像素格式 */
		{																/**< 失败 */
			break;														
		}
//.........这里部分代码省略.........
开发者ID:OpenGLFrame,项目名称:5_Blending,代码行数:101,代码来源:GLWindow.cpp

示例9: InitWindow

void InitWindow(HINSTANCE hInstance)
{
	// TODO: make it search all available configs and ask what to load from or something
	if(!cfg.LoadFromFile("default.cfg")) LogToFile("debug.log", "Failed to load config");

	window_rect.left = 0;
	window_rect.right = cfg.scr_width;
	window_rect.top = 0;
	window_rect.bottom = cfg.scr_height;

	window_class.hInstance = hInstance;
	window_class.style = CS_VREDRAW | CS_HREDRAW | CS_OWNDC;
	window_class.lpfnWndProc = WndProc;
	window_class.cbClsExtra = 0;
	window_class.cbWndExtra = 0;
	window_class.hbrBackground = NULL;
	window_class.hIcon = LoadIcon(NULL, IDI_WINLOGO);
	window_class.hCursor = LoadCursor(NULL, IDC_ARROW);
	window_class.lpszMenuName = NULL;
	window_class.lpszClassName = "OpenOrionClass";

	fullscreenflag = cfg.fullscreen;

	if(!RegisterClass(&window_class))
	{
		MessageBox(NULL, "Failed to register window class", "RegisterClass() Error", MB_OK | MB_ICONEXCLAMATION);
		LogToFile("debug.log", "Failed to register window class");
		PostQuitMessage(-1);
	}

	if(cfg.fullscreen)
	{
		memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));    // Очистка для хранения установок
		dmScreenSettings.dmSize = sizeof(dmScreenSettings);      // Размер структуры Devmode
		dmScreenSettings.dmPelsWidth = cfg.scr_width;        // Ширина экрана
		dmScreenSettings.dmPelsHeight = cfg.scr_height;        // Высота экрана
		dmScreenSettings.dmBitsPerPel = cfg.scr_bpp;        // Глубина цвета
		dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; // Режим Пикселя

		DWORD disp;

		disp = ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);

		switch(disp)
		{
		case DISP_CHANGE_SUCCESSFUL:
			{
				fullscreenflag = true;
				ShowCursor(true);
				break;
			}
		case DISP_CHANGE_BADDUALVIEW:
			{
				fullscreenflag = false;
				ShowCursor(true);
				LogToFile("Failed to set fullscreen mode: error (DISP_CHANGE_BADDUALVIEW)");
				MessageBox(NULL, "Failed to set fullscreen mode", "DISP_CHANGE_BADDUALVIEW", MB_OK | MB_ICONEXCLAMATION);
				break;
			}
		case DISP_CHANGE_BADFLAGS:
			{
				fullscreenflag = false;
				ShowCursor(true);
				LogToFile("Failed to set fullscreen mode: error (DISP_CHANGE_BADFLAGS)");
				MessageBox(NULL, "Failed to set fullscreen mode", "DISP_CHANGE_BADFLAGS", MB_OK | MB_ICONEXCLAMATION);
				break;
			}
		case DISP_CHANGE_BADMODE:
			{
				fullscreenflag = false;
				ShowCursor(true);
				LogToFile("Failed to set fullscreen mode: error (DISP_CHANGE_BADMODE)");
				MessageBox(NULL, "Failed to set fullscreen mode", "DISP_CHANGE_BADMODE", MB_OK | MB_ICONEXCLAMATION);
				break;
			}
		case DISP_CHANGE_BADPARAM:
			{
				fullscreenflag = false;
				ShowCursor(true);
				LogToFile("Failed to set fullscreen mode: error (DISP_CHANGE_BADPARAM)");
				MessageBox(NULL, "Failed to set fullscreen mode", "DISP_CHANGE_BADPARAM", MB_OK | MB_ICONEXCLAMATION);
				break;
			}
		case DISP_CHANGE_FAILED:
			{
				fullscreenflag = false;
				ShowCursor(true);
				LogToFile("Failed to set fullscreen mode: error (DISP_CHANGE_FAILED)");
				MessageBox(NULL, "Failed to set fullscreen mode", "DISP_CHANGE_FAILED", MB_OK | MB_ICONEXCLAMATION);
				break;
			}
		case DISP_CHANGE_NOTUPDATED:
			{
				fullscreenflag = false;
				ShowCursor(true);
				LogToFile("Failed to set fullscreen mode: error (DISP_CHANGE_NOTUPDATED)");
				MessageBox(NULL, "Failed to set fullscreen mode", "DISP_CHANGE_NOTUPDATED", MB_OK | MB_ICONEXCLAMATION);
				break;
			}
		case DISP_CHANGE_RESTART:
//.........这里部分代码省略.........
开发者ID:lightsgoout,项目名称:interview,代码行数:101,代码来源:openorion.cpp

示例10: Game_Init

int Game_Init(void *parms)
{
// this function is where you do all the initialization 
// for your game

int index; // looping var

// start up DirectDraw (replace the parms as you desire)
DDraw_Init(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_BPP, WINDOWED_APP);

// initialize directinput
DInput_Init();

// acquire the keyboard 
DInput_Init_Keyboard();

// add calls to acquire other directinput devices here...

// initialize directsound and directmusic
DSound_Init();
DMusic_Init();

// hide the mouse
if (!WINDOWED_APP)
    ShowCursor(FALSE);

// seed random number generator
srand(Start_Clock()); 

Open_Error_File("ERROR.TXT");

// initialize math engine
Build_Sin_Cos_Tables();

// initialize the camera with 90 FOV, normalized coordinates
Init_CAM4DV1(&cam,            // the camera object
             CAM_MODEL_EULER, // the euler model
             &cam_pos,        // initial camera position
             &cam_dir,        // initial camera angles
             &cam_target,     // no target
             40.0,            // near and far clipping planes
             12000.0,
             90.0,            // field of view in degrees
             WINDOW_WIDTH,    // size of final screen viewport
             WINDOW_HEIGHT);

VECTOR4D terrain_pos = {0,0,0,0};

Generate_Terrain_OBJECT4DV2(&obj_terrain,            // pointer to object
                            TERRAIN_WIDTH,           // width in world coords on x-axis
                            TERRAIN_HEIGHT,          // height (length) in world coords on z-axis
                            TERRAIN_SCALE,           // vertical scale of terrain
                            "checkerheight01.bmp",  // filename of height bitmap encoded in 256 colors
                            "checker256256.bmp",   // filename of texture map
                             RGB16Bit(255,255,255),  // color of terrain if no texture        
                             &terrain_pos,           // initial position
                             NULL,                   // initial rotations
                             POLY4DV2_ATTR_RGB16  
                             | POLY4DV2_ATTR_SHADE_MODE_FLAT 
                             // | POLY4DV2_ATTR_SHADE_MODE_GOURAUD
                             | POLY4DV2_ATTR_SHADE_MODE_TEXTURE);

// the shading attributes we would like


// set up lights
Reset_Lights_LIGHTV2(lights2, MAX_LIGHTS);

// create some working colors
white.rgba = _RGBA32BIT(255,255,255,0);
gray.rgba  = _RGBA32BIT(100,100,100,0);
black.rgba = _RGBA32BIT(0,0,0,0);
red.rgba   = _RGBA32BIT(255,0,0,0);
green.rgba = _RGBA32BIT(0,255,0,0);
blue.rgba  = _RGBA32BIT(0,0,255,0);

// ambient light
Init_Light_LIGHTV2(lights2,
                   AMBIENT_LIGHT_INDEX,   
                   LIGHTV2_STATE_ON,      // turn the light on
                   LIGHTV2_ATTR_AMBIENT,  // ambient light type
                   gray, black, black,    // color for ambient term only
                   NULL, NULL,            // no need for pos or dir
                   0,0,0,                 // no need for attenuation
                   0,0,0);                // spotlight info NA

VECTOR4D dlight_dir = {-1,1,-1,1};

// directional light
Init_Light_LIGHTV2(lights2,
                   INFINITE_LIGHT_INDEX,  
                   LIGHTV2_STATE_ON,      // turn the light on
                   LIGHTV2_ATTR_INFINITE, // infinite light type
                   black, gray, black,    // color for diffuse term only
                   NULL, &dlight_dir,     // need direction only
                   0,0,0,                 // no need for attenuation
                   0,0,0);                // spotlight info NA


VECTOR4D plight_pos = {0,200,0,1};
//.........这里部分代码省略.........
开发者ID:giantchen2012,项目名称:tricks-of-the-3d-game-programming-gurus,代码行数:101,代码来源:demoII12_6.cpp

示例11: BWAPIExceptionFilter

// The primary exception filter
LONG WINAPI BWAPIExceptionFilter(EXCEPTION_POINTERS *ep)
{
  DDrawDestroy();
  ShowCursor(TRUE);

  SYSTEMTIME st;
  char szFilename[MAX_PATH];

  // Create the file
  GetSystemTime(&st);
  sprintf_s(szFilename, MAX_PATH, "%sbwapi-data\\logs\\Exceptions\\%u_%02u_%02u.txt", szInstallPath, st.wYear, st.wMonth, st.wDay);

  FILE *hFile = fopen( szFilename, "a+");
  if ( hFile )
  {
    fprintf(hFile, "\n//////////////////////////////////////////////////\n");

    // Print the time
    time_t _t = time(NULL);
    fprintf(hFile, "TIME: %s\n", ctime(&_t));

    // Print version data
    WORD w1,w2,w3,w4;
    GetCurrentProductVersion(w1, w2, w3, w4);
    fprintf(hFile, "VERSION: %hu.%hu.%hu.%hu\n", w1, w2, w3, w4);

    // BWAPI/Broodwar specific
    fprintf(hFile, "BWAPI:\n");
    fprintf(hFile, "  REVISION: %u\n", BWAPI::BroodwarImpl.getRevision());
    fprintf(hFile, "  BUILD: %s\n", BWAPI::BroodwarImpl.isDebug() ? "DEBUG" : "RELEASE");
    fprintf(hFile, "  ERROR: %s\n", BWAPI::BroodwarImpl.getLastError().c_str());
    fprintf(hFile, "  LOCATION: %s %s\n", BWAPI::BroodwarImpl.isMultiplayer() ? (BWAPI::BroodwarImpl.isBattleNet() ? "Battle.net" : "Multiplayer") : "Single Player", BWAPI::BroodwarImpl.isReplay() ? "Replay" : "");
    
    if ( BWAPI::BroodwarImpl.isInGame() )
    {
      fprintf(hFile, "MAP: %s\n     %s\n", BWAPI::BroodwarImpl.mapName().c_str(), BWAPI::BroodwarImpl.mapFileName().c_str());
      NULLCHECK(BWAPI::BroodwarImpl.self());
      NULLCHECK(BWAPI::BroodwarImpl.enemy());
      NULLCHECK(BWAPI::BroodwarImpl.neutral());
      if ( BWAPI::BroodwarImpl.hAIModule && !BWAPI::BroodwarImpl.client )
        fprintf(hFile, "\"Broodwar\" pointer was not initialized for AI module.\n");
      if ( BWAPI::BroodwarImpl.hTournamentModule && !BWAPI::BroodwarImpl.tournamentAI )
        fprintf(hFile, "\"Broodwar\" pointer was not initialized for Tournament module.\n");
    }

    // Print the exception info
    DWORD dwExceptionCode = ep->ExceptionRecord->ExceptionCode;
    fprintf(hFile, "\nEXCEPTION: 0x%p    %s\n", dwExceptionCode, GetExceptionName(dwExceptionCode));

    // Store exception address
    PVOID pExceptionAddr = ep->ExceptionRecord->ExceptionAddress;

    // Print offending module info
    fprintf(hFile, "FAULT:     0x%p    %s\n", pExceptionAddr, getModuleNameFrom(pExceptionAddr).c_str());

    // Print register information
    fprintf(hFile, "REGISTERS:\n");
    DWORD dwCntxtFlags = ep->ContextRecord->ContextFlags;
    if ( dwCntxtFlags & CONTEXT_INTEGER )
      fprintf(hFile, "  EDI: %08X\n"
                     "  ESI: %08X\n"
                     "  EBX: %08X\n"
                     "  EDX: %08X\n"
                     "  ECX: %08X\n"
                     "  EAX: %08X\n",
                     ep->ContextRecord->Edi,
                     ep->ContextRecord->Esi,
                     ep->ContextRecord->Ebx,
                     ep->ContextRecord->Edx,
                     ep->ContextRecord->Ecx,
                     ep->ContextRecord->Eax);
    if ( dwCntxtFlags & CONTEXT_CONTROL )
      fprintf(hFile, "  EBP: %08X\n"
                     "  EIP: %08X\n"
                     "  ESP: %08X\n",
                     ep->ContextRecord->Ebp,
                     ep->ContextRecord->Eip,
                     ep->ContextRecord->Esp);

    // Get the stack frame
    STACKFRAME sf = { 0 };
    sf.AddrPC.Mode      = AddrModeFlat;
    sf.AddrPC.Offset    = ep->ContextRecord->Eip;
    sf.AddrFrame.Mode   = AddrModeFlat;
    sf.AddrFrame.Offset = ep->ContextRecord->Ebp;
    sf.AddrStack.Mode   = AddrModeFlat;
    sf.AddrStack.Offset = ep->ContextRecord->Esp;

    // Create a context record copy
    CONTEXT c = *ep->ContextRecord;

    // Do the stack trace
    fprintf(hFile, "STACK:\n");

    // Get frequently used handles
    HANDLE hProcess = GetCurrentProcess();
    HANDLE hThread  = GetCurrentThread();

    // Initialize symbols and stuff
//.........这里部分代码省略.........
开发者ID:simingl,项目名称:IM_Debug_Terran_GA_Micro,代码行数:101,代码来源:ExceptionFilter.cpp

示例12: ShowCursor

	void PointerManager::setPointerVisible(bool _value)
	{
		ShowCursor(_value);
	}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:4,代码来源:PointerManager.cpp

示例13: GetModuleHandle

void SystemClass::InitializeWindows(int &_ScreenWidth, int &_ScreenHeight)
{
	WNDCLASSEX WindowClass;
	DEVMODE ScreenSettings;
	int PosX, PosY;

	ApplicationHandle = this;
	m_Instance = GetModuleHandle(NULL);
	m_ApplicationName = L"Project Potato";

	WindowClass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
	WindowClass.lpfnWndProc = WndProc;
	WindowClass.cbClsExtra = 0;
	WindowClass.cbWndExtra = 0;
	WindowClass.hInstance = m_Instance;
	WindowClass.hIcon = LoadIcon(NULL, IDI_WINLOGO);
	WindowClass.hIconSm = WindowClass.hIcon;
	WindowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
	WindowClass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
	WindowClass.lpszMenuName = NULL;
	WindowClass.lpszClassName = m_ApplicationName;
	WindowClass.cbSize = sizeof(WNDCLASSEX);

	RegisterClassEx(&WindowClass);

	_ScreenWidth = GetSystemMetrics(SM_CXSCREEN);
	_ScreenHeight = GetSystemMetrics(SM_CYSCREEN);

	if(FULL_SCREEN)
	{
		memset(&ScreenSettings, 0, sizeof(ScreenSettings));
		ScreenSettings.dmSize = sizeof(ScreenSettings);
		ScreenSettings.dmPelsWidth = (unsigned long)_ScreenWidth;
		ScreenSettings.dmPelsHeight = (unsigned long)_ScreenHeight;
		ScreenSettings.dmBitsPerPel = 32;
		ScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;

		ChangeDisplaySettings(&ScreenSettings, CDS_FULLSCREEN);

		PosX = PosY = 0;
	}

	else
	{
		_ScreenWidth = 800;
		_ScreenHeight = 600;

		PosX = (GetSystemMetrics(SM_CXSCREEN) - _ScreenWidth) / 2;
		PosY = (GetSystemMetrics(SM_CYSCREEN) - _ScreenHeight) / 2;
	}


	m_WindowHandle = CreateWindowEx(WS_EX_APPWINDOW, m_ApplicationName, m_ApplicationName, WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_POPUP, PosX, PosY, _ScreenWidth, _ScreenHeight,
		NULL,NULL, m_Instance, NULL);

	ShowWindow(m_WindowHandle, SW_SHOW);
	SetForegroundWindow(m_WindowHandle);
	SetFocus(m_WindowHandle);

	ShowCursor(false);
}
开发者ID:derilect,项目名称:Project-Potato,代码行数:61,代码来源:SystemClass.cpp

示例14: ShowCursor

void ImageLoader::error(String txt)
{
	ShowCursor (1);  // show cursor
    MessageBox(0, txt.c_String(), "Error", MB_OK|MB_ICONERROR);
    PostQuitMessage(0);
}
开发者ID:pinchyCZN,项目名称:deepness,代码行数:6,代码来源:ImageLoader.cpp

示例15: Game_Init

int Game_Init(void *parms,  int num_parms)
{
// this function is where you do all the initialization 
// for your game

int index;         // looping var
char filename[80]; // used to build up files names

// start up DirectDraw (replace the parms as you desire)
DDraw_Init(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_BPP, WINDOWED_APP);

// joystick creation section ////////////////////////////////

/// start up DirectInput
DInput_Init();

// initialize the joystick
DInput_Init_Joystick(-24,24,-24,24);

///////////////////////////////////////////////////////////

// load the background
Load_Bitmap_File(&bitmap16bit, "MUSH_24.BMP");

// load in the four frames of the mushroom
for (index=0; index<4; index++)
    {
    // create mushroom bitmaps
    Create_Bitmap(&mushrooms[index],0,0,32,32,16);
    Load_Image_Bitmap16(&mushrooms[index],&bitmap16bit,index,0,BITMAP_EXTRACT_MODE_CELL);  
    } // end for index

// now create the bug blaster bob
Create_BOB(&blaster,0,0,32,32,3,
           BOB_ATTR_VISIBLE | BOB_ATTR_MULTI_ANIM | BOB_ATTR_ANIM_ONE_SHOT,
           DDSCAPS_SYSTEMMEMORY,0,16);

// load in the four frames of the mushroom
for (index=0; index < 3; index++)
     Load_Frame_BOB16(&blaster,&bitmap16bit,index,index,1,BITMAP_EXTRACT_MODE_CELL);  

// unload the bitmap file
Unload_Bitmap_File(&bitmap16bit);

// set the animation sequences for bug blaster
Load_Animation_BOB(&blaster,0,5,blaster_anim);

// set up stating state of bug blaster
Set_Pos_BOB(&blaster,320, 400);
Set_Anim_Speed_BOB(&blaster,3);

// create mushroom playfield bitmap
Create_Bitmap(&playfield,0,0,SCREEN_WIDTH,SCREEN_HEIGHT, 16);
playfield.attr |= BITMAP_ATTR_LOADED;

// fill in the background
Load_Bitmap_File(&bitmap16bit, "GRASS_24.BMP");

// load the grass bitmap image
Load_Image_Bitmap16(&playfield,&bitmap16bit,0,0,BITMAP_EXTRACT_MODE_ABS);
Unload_Bitmap_File(&bitmap16bit);

// seed random number generator
srand(Start_Clock());

// create the random mushroom patch
for (index=0; index<50; index++)
    {
    // select a mushroom
    int mush = rand()%4;

    // set mushroom to random position
    mushrooms[mush].x = rand()%(SCREEN_WIDTH-32);
    mushrooms[mush].y = rand()%(SCREEN_HEIGHT-128);

    // now draw the mushroom into playfield
    Draw_Bitmap16(&mushrooms[mush], playfield.buffer, playfield.width*2,1);

    } // end for

// hide the mouse
if (!WINDOWED_APP)
    ShowCursor(FALSE);

// return success
return(1);

} // end Game_Init
开发者ID:calyx,项目名称:windows-game-source-code,代码行数:88,代码来源:demo9_3a_16b.cpp


注:本文中的ShowCursor函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。