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


C++ InitGraphics函数代码示例

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


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

示例1: main

/*
 * Function: main
 * -----------------
 * Serves as entry point of program. Takes in all user inputs to determine specific boggle configuration.
 * Then, it gives the user a chance to find words in the boggleBoard. Then, the computer takes over
 * to find any remaining words. Finally, gives user option to play another round.
 *
 *@return 0 if program completed successfully.
 */
int main()
{
	Randomize(); //initializes random constructor
	SetWindowSize(8, 5);
	InitGraphics();
	Welcome();
	GiveInstructions();
	Lexicon wordList("lexicon.dat"); //generates list of all possible words
	while (true) {
		Lexicon usedWords; //generates a list that stores all words found by the player and computer
		InitGraphics();
		SoundFeature();
		int boardDimension = BoggleBoardSize();
		DrawBoard(boardDimension, boardDimension);
		Grid<char> boggleBoard(boardDimension, boardDimension);
		if (!UserBoardConfiguration()) {
			InitializeRandomBoard(boggleBoard); //if user chooses not to specify board configuration, a random one is generated
		} else {
			string diceConfig = GetDiceConfiguration(boardDimension);
			SetDiceConfiguration(boggleBoard, diceConfig);
		}
		DrawBoggleBoard(boggleBoard);
		Grid<bool> usedDice(boggleBoard.numRows(), boggleBoard.numCols());
		CreateMarker(usedDice);
		InputGuesses(boggleBoard, wordList, usedWords, usedDice); //player's turn
		FindRemainingWords(boggleBoard, wordList, usedWords, usedDice); //computer's turn
		PlayNamedSound("thats pathetic.wav"); //assumes the player will always lose to the computer
		if (!GameContinue()) break;
	}
	return 0;
}
开发者ID:ruiping82,项目名称:Stanford,代码行数:40,代码来源:boggle.cpp

示例2: NPC

UggWrongWay::UggWrongWay(Node ArgCurNode, TypeEnumUW ArgType) : NPC(ArgCurNode)
{
	FramesPerJump = 5;
	FramesPerWait = 5;
	Type = ArgType;
	if (Type == UGG)
		InitGraphics("Ugg");
	else
		InitGraphics("Wrong-Way");
}
开发者ID:ThielHater,项目名称:myQBert,代码行数:10,代码来源:UggWrongWay.cpp

示例3: InitChainReactionGraphics

void InitChainReactionGraphics() {
	SetWindowTitle("Chain Reaction");
	InitGraphics();
	SetFont("Palatino");
	SetPointSize(10);
	SetStyle(Bold);
}
开发者ID:rahulbhaya,项目名称:lab2,代码行数:7,代码来源:chain-reaction-graphics.cpp

示例4: ZeroMemory

bool FRenderD3D11::Initialize(HWND hWindow)
{
	// create a struct to hold information about the swap chain
	DXGI_SWAP_CHAIN_DESC scd;

	// clear out the struct for use
	ZeroMemory(&scd, sizeof(DXGI_SWAP_CHAIN_DESC));

	// fill the swap chain description struct
	scd.BufferCount = 1;                                    // one back buffer
	scd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;     // use 32-bit color
	scd.BufferDesc.Width = FTL::WINDOW_DEFAULT_ROW_SIZE;                    // set the back buffer width
	scd.BufferDesc.Height = FTL::WINDOW_DEFAULT_COL_SIZE;                  // set the back buffer height
	scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;      // how swap chain is to be used
	scd.OutputWindow = hWindow;                                // the window to be used
	scd.SampleDesc.Count = 4;                               // how many multisamples
	scd.Windowed = TRUE;                                    // windowed/full-screen mode
	scd.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;     // allow full-screen switching

	// create a device, device context and swap chain using the information in the scd struct
	D3D11CreateDeviceAndSwapChain(NULL,
		D3D_DRIVER_TYPE_HARDWARE,
		NULL,
		NULL,
		NULL,
		NULL,
		D3D11_SDK_VERSION,
		&scd,
		&m_pSwapchain,
		&m_pDevice,
		NULL,
		&m_pDeviceContext);

	// get the address of the back buffer
	ID3D11Texture2D *pBackBuffer;
	m_pSwapchain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer);

	// use the back buffer address to create the render target
	m_pDevice->CreateRenderTargetView(pBackBuffer, NULL, &m_pBackbuffer);
	pBackBuffer->Release();

	// set the render target as the back buffer
	m_pDeviceContext->OMSetRenderTargets(1, &m_pBackbuffer, NULL);

	// Set the viewport
	D3D11_VIEWPORT viewport;
	ZeroMemory(&viewport, sizeof(D3D11_VIEWPORT));

	viewport.TopLeftX = 0;
	viewport.TopLeftY = 0;
	viewport.Width = FTL::WINDOW_DEFAULT_ROW_SIZE;
	viewport.Height = FTL::WINDOW_DEFAULT_COL_SIZE;

	m_pDeviceContext->RSSetViewports(1, &viewport);

	InitPipeline();
	InitGraphics();

	return true;
}
开发者ID:JeongHwanYim,项目名称:FEngine,代码行数:60,代码来源:FRenderD3D11.cpp

示例5: main

int main(int argc, char** argv)
{
  // GLUT Window Initialization:
  glutInit (&argc, argv);
  glutInitWindowSize (g_Width, g_Height);
  glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
  glutCreateWindow ("CS248 GLUT example");

  // Initialize OpenGL graphics state
  InitGraphics();

  // Register callbacks:
  glutDisplayFunc (display);
  glutReshapeFunc (reshape);
  glutKeyboardFunc (Keyboard);
  glutMouseFunc (MouseButton);
  glutMotionFunc (MouseMotion);
  glutIdleFunc (AnimateScene);

  // Create our popup menu
  BuildPopupMenu ();
  glutAttachMenu (GLUT_RIGHT_BUTTON);

  // Get the initial time, for use by animation
  gettimeofday (&last_idle_time, NULL);

  // Turn the flow of control over to GLUT
  glutMainLoop ();
  return 0;
}
开发者ID:harshabandaru,项目名称:Graphics,代码行数:30,代码来源:sol5.cpp

示例6: main

/***************************************************************
 Main function
***************************************************************/			
int main()
{
	srand(time(NULL));
	NewGame();
    InitGraphics();
	return 0;
}
开发者ID:huangjs,项目名称:cl,代码行数:10,代码来源:main.c

示例7: ClaimSprite

Structure::Structure(int Type, int Material)  {
  if(!graphicsinitialized)  InitGraphics();
  material = Material;
  struct_type = Type;
  finished = 0;
  if(material == MATERIAL_WOOD)  {
    fresist = 40;
    ffeul = struct_qty[struct_type];
    }
  else  {
    fresist = 32767;
    ffeul = 0;
    }
  if(Type == STRUCT_BRIDGE || Type == STRUCT_RAMP) height = 1;
  else height = 10;
  location[0] = NULL;
  location[1] = NULL;
  inside = new Thing*[2];
  inside[0] = NULL;
  inside[1] = NULL;
  type = THING_STRUCT;
  ClaimSprite(image.Number());
  image.SetPanel(mainp);
  discovered = 0;
  int ctr;
  for(ctr=0; ctr<MATERIAL_MAX; ctr++)  {
    contains[ctr] = 0;
    }
  }
开发者ID:steaphangreene,项目名称:dg2,代码行数:29,代码来源:struct.cpp

示例8: main

int main(int argc, char* argv[])
{
	printf("--- MIDISYS ENGINE: bilotrip foundation MIDISYS ENGINE 0.1 - dosing, please wait\n");
	
	// init graphics

	InitGraphics(argc, argv);

	// load shaders

	eye_shaderProg = LoadShader("eye");
	fsquad_shaderProg = LoadShader("fsquad");
	redcircle_shaderProg = LoadShader("redcircle");

	// load textures

	grayeye_tex = LoadTexture("grayeye.png");

	room_tex[0] = LoadTexture("room1.png");
	room_tex[1] = LoadTexture("room2.png");
	room_tex[2] = LoadTexture("room3.png");

	// init MIDI sync and audio

	LoadMIDIEventList("music.mid");
	ParseMIDITimeline("mapping.txt");
	InitAudio("music.mp3");

	// start mainloop

	StartMainLoop();
	return 0;
}
开发者ID:pahamoka,项目名称:midisystem,代码行数:33,代码来源:eyeblur.c

示例9: main

int main()
{
	SetWindowSize(9, 5);
	InitGraphics();
	Welcome();
	GiveInstructions();
	return 0;
}
开发者ID:nejyeah,项目名称:cplusplus,代码行数:8,代码来源:boggle.cpp

示例10: timeGetTime

void Engine::Init()
{
	m_SceneManager->Init();
	m_StartTime = timeGetTime();
	m_LastFrameTime = timeGetTime();

	InitGraphics();
}
开发者ID:trezor555,项目名称:Editor,代码行数:8,代码来源:Engine.cpp

示例11: main

int main () {
	Point v1, v2, v3, currentPoint;
	InitGraphics();
	createTriangle(v1, v2, v3);
	currentPoint = randPoint(v1, v2, v3);
	iterate(v1, v2, v3, currentPoint);
	return 0;
}
开发者ID:ej2xu,项目名称:cs106b,代码行数:8,代码来源:graphics.cpp

示例12: InitAppPreServices

		void Application::Init()
		{
			InitAppPreServices();
			InitPrimaryWindow();
			InitGraphics();
			InitInput();
			InitSound();
			InitExtraSubsystems();
			InitAppPostServices();
		}
开发者ID:Jerorfigan,项目名称:BlackJack,代码行数:10,代码来源:Application.cpp

示例13: main

int main()
{
	InitGraphics();
	SetWindowTitle("CS106 Pathfinder");
    cout << "This masterful piece of work is a graph extravaganza!" << endl
        << "The main attractions include a lovely visual presentation of the graph" << endl
        << "along with an implementation of Dijkstra's shortest path algorithm and" << endl
        << "the computation of a minimal spanning tree.  Enjoy!" << endl;
    return (0);
}
开发者ID:nejyeah,项目名称:cplusplus,代码行数:10,代码来源:pathfinder.cpp

示例14: main

int main() {
	InitGraphics();
	SetWindowTitle("CS106 Pathfinder");
    cout << "This masterful piece of work is a graph extravaganza!" << endl
        << "The main attractions include a lovely visual presentation of the graph" << endl
        << "along with an implementation of Dijkstra's shortest path algorithm and" << endl
        << "the computation of a minimal spanning tree.  Enjoy!" << endl;
	Graph graph;
	Map<coordT> nodeCor;
	string loc1, loc2, image;
	image = loadGraphFile(graph, nodeCor);
	drawMap(graph, nodeCor);
	while (true) {
		int choice = promptForChoice();
		switch (choice) {
			case 1:
				graph.clear();
				nodeCor.clear();
				image = loadGraphFile(graph, nodeCor);
				drawMap(graph, nodeCor);
				break;
			case 2:
				cout << endl;
				loc1 = getLocName("Click on starting location...  ", nodeCor);
				loc2 = getLocName("Click on ending location...  ", nodeCor);
				displayMinPath(graph, nodeCor, loc1, loc2);
				break;
			case 3:
				InitGraphics();
				DrawNamedPicture(image);
				drawVertices(nodeCor);
				displayMST(graph, nodeCor);
				break;
			case 4:
				displayDomSet(graph, nodeCor);
				break;
			case 5: exit(0);
		}
	} 

    return (0);
}
开发者ID:ej2xu,项目名称:cs106b,代码行数:42,代码来源:pathfinder.cpp

示例15: InitD3D

void InitD3D( HWND hWnd, SFLOAT width, SFLOAT height ){

	//initializing swap chain
	DXGI_SWAP_CHAIN_DESC swapChainDesc;

	ZeroMemory( &swapChainDesc, sizeof( DXGI_SWAP_CHAIN_DESC ) );

	swapChainDesc.BufferCount = 1; // number of back buffers
	swapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; //unsigned normalized values
	swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; // draw graphics into back buffer
	swapChainDesc.OutputWindow = hWnd; // window to output to
	swapChainDesc.SampleDesc.Count = 4; // anti-aliasing that is done on the images
	swapChainDesc.Windowed = TRUE;

	D3D_FEATURE_LEVEL featureLevels[] = 
	{
		//D3D_FEATURE_LEVEL_11_0
        D3D_FEATURE_LEVEL_10_1,
        //D3D_FEATURE_LEVEL_10_0,
	};

	HRESULT hr = D3D11CreateDeviceAndSwapChain(
		NULL,
		D3D_DRIVER_TYPE_HARDWARE,
		NULL,
		0, //flags for singlethreading/multithreading etc. stuff
		featureLevels,
		1,
		D3D11_SDK_VERSION,
		&swapChainDesc,
		&gSwapChain,
		&gDevice,
		NULL,
		&gDeviceContext
	);

	//setting the render target to the back buffer
	//get address of back buffer into renderTargetLocation
	ID3D11Texture2D *renderTargetAddress;
	gSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), (LPVOID*)&renderTargetAddress );

	//using the back buffer address to create the render target
	gDevice->CreateRenderTargetView( renderTargetAddress, NULL, &gRenderTargetView );
	renderTargetAddress->Release();

	//set render target as the back buffer
	gDeviceContext->OMSetRenderTargets( 1, &gRenderTargetView, NULL );

	InitViewport( width, height );
	//InitRasterizer();
	InitGraphics( width, height );
	InitPipeline();

}
开发者ID:dianxiang,项目名称:graphics,代码行数:54,代码来源:main.cpp


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