本文整理汇总了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;
}
示例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");
}
示例3: InitChainReactionGraphics
void InitChainReactionGraphics() {
SetWindowTitle("Chain Reaction");
InitGraphics();
SetFont("Palatino");
SetPointSize(10);
SetStyle(Bold);
}
示例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;
}
示例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;
}
示例6: main
/***************************************************************
Main function
***************************************************************/
int main()
{
srand(time(NULL));
NewGame();
InitGraphics();
return 0;
}
示例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;
}
}
示例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;
}
示例9: main
int main()
{
SetWindowSize(9, 5);
InitGraphics();
Welcome();
GiveInstructions();
return 0;
}
示例10: timeGetTime
void Engine::Init()
{
m_SceneManager->Init();
m_StartTime = timeGetTime();
m_LastFrameTime = timeGetTime();
InitGraphics();
}
示例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;
}
示例12: InitAppPreServices
void Application::Init()
{
InitAppPreServices();
InitPrimaryWindow();
InitGraphics();
InitInput();
InitSound();
InitExtraSubsystems();
InitAppPostServices();
}
示例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);
}
示例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);
}
示例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();
}