示例#1
0
/*
 * 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
0
UggWrongWay::UggWrongWay(Node ArgCurNode, TypeEnumUW ArgType) : NPC(ArgCurNode)
{
	FramesPerJump = 5;
	FramesPerWait = 5;
	Type = ArgType;
	if (Type == UGG)
		InitGraphics("Ugg");
	else
		InitGraphics("Wrong-Way");
}
void InitChainReactionGraphics() {
	SetWindowTitle("Chain Reaction");
	InitGraphics();
	SetFont("Palatino");
	SetPointSize(10);
	SetStyle(Bold);
}
示例#4
0
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
0
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
0
文件: main.c 项目: huangjs/cl
/***************************************************************
 Main function
***************************************************************/			
int main()
{
	srand(time(NULL));
	NewGame();
    InitGraphics();
	return 0;
}
示例#7
0
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
0
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
0
int main()
{
	SetWindowSize(9, 5);
	InitGraphics();
	Welcome();
	GiveInstructions();
	return 0;
}
示例#10
0
void Engine::Init()
{
	m_SceneManager->Init();
	m_StartTime = timeGetTime();
	m_LastFrameTime = timeGetTime();

	InitGraphics();
}
示例#11
0
文件: graphics.cpp 项目: ej2xu/cs106b
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
0
		void Application::Init()
		{
			InitAppPreServices();
			InitPrimaryWindow();
			InitGraphics();
			InitInput();
			InitSound();
			InitExtraSubsystems();
			InitAppPostServices();
		}
示例#13
0
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
0
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
0
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();

}
int
main( int argc, char *argv[ ] )
{
	glutInit( &argc, argv );
	InitGraphics( );
	InitLists( );
	InitCL( );
	Reset( );
	InitGlui( );
	glutMainLoop( );
	return 0;
}
示例#17
0
文件: nge.c 项目: eledot/libnge2
void NGE_Init(int flags)
{
	if(initFlags==0){
#ifndef NGE_IPHONE
		if(flags&INIT_VIDEO)
			InitGraphics();
		if(flags&INIT_AUDIO)
			CoolAudioDefaultInit();
#endif
		initFlags = flags;
	}
}
示例#18
0
文件: 3telesa.cpp 项目: Barush/IMS
////////////////////////////////////////////////////////////////////////////
// popis experimentu ...
//
main()
{
  SetOutput("3telesa.dat");
  _Print("# Model obØhu dru§ice kolem soustavy dvou tØles v C++/SIMLIB \n");
  Init(0, 300);                   // inicializace experimentu
  InitGraphics();
  SetStep(1e-12,0.01);
  SetAccuracy(1e-14);             // je nutn  vysok  pýesnost
  Run();                          // simulace
  DoneGraphics();
  return 0;
}
示例#19
0
void Maze::draw()
{
	InitGraphics();	// this erases entire graphics window
	if (!configured) configureGraphics();
	for (int r = 0; r < cells.numRows(); r++) {
		for (int c = 0; c < cells.numCols(); c++) {
			pointT p = {r, c};
			drawWallsForCell(p);
		}
	}
	UpdateDisplay();
}
示例#20
0
//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
int main()
{
	g_manager = ::Effekseer::Manager::Create( 2000 );

#if __CULLING_TEST
	g_manager->CreateCullingWorld(200, 200, 200, 4);
#endif

#if _WIN32
	InitGraphics(g_window_width, g_window_height);
	InitSound();
#else
	InitGraphics( g_window_width, g_window_height);
	InitSound();
#endif

	Init();

	while(DoEvent())
	{
		Loop();

		g_manager->Update();

		Rendering();
	}

	g_manager->Destroy();

	for (size_t i = 0; i < g_effects.size(); i++)
	{
		ES_SAFE_RELEASE(g_effects[i]);
	}

	TermSound();

	TermGraphics();

	return 0;
}
示例#21
0
string loadGraphFile(Graph &graph, Map<coordT> &m) {
	ifstream in;
	promptUserForFile(in);
	InitGraphics();
	string image = drawBackGround(in);
	string token;
	in >> token;
	if (token == "NODES") readNodes(in, graph, m);
	else Error("File format error."); 
	readArcs(in, graph);
	in.close();
	return image;
}
示例#22
0
文件: Game.cpp 项目: maseek/gp2cw
 bool Game::Init( const string& title, const uint16Vec2& windowSize, const WindowStyleType windowStyle )
 {
     if( !InitWindow( title, windowSize, windowStyle ) )
         return false;
     if( !InitGraphics( windowSize ) )
         return false;
     // init game logic
     m_pGameLogic = ZN_NEW GameLogic();
     // start timer
     m_pTimer = ZN_NEW Timer();
     m_pTimer->Start();
     return true;
 }
示例#23
0
文件: System.cpp 项目: Namoor/GSP914
void System::Run(IScene* p_pScene)
{
	m_pScene = p_pScene;

	InitWindow();
	InitGraphics();


	m_pScene->Init(m_pDevice, m_pDeviceContext, m_pBackBuffer, m_pDepthStencilView);


	MSG msg;

	m_pTimer = new Timer();

	//GameLoop
	while (true)
	{
		if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
		{
			//Message bearbeiten
			TranslateMessage(&msg);
			DispatchMessage(&msg);

			if (msg.message == WM_QUIT)
				break;
		}



		float _Color[4];
		_Color[0] = 0.3f;//(rand() % 256) / 255.0f;
		_Color[1] = 0.3f;//(rand() % 256) / 255.0f;
		_Color[2] = 0.3f;//(rand() % 256) / 255.0f;
		_Color[3] = 1;

		m_pDeviceContext->ClearRenderTargetView(m_pBackBuffer, _Color);
		m_pDeviceContext->ClearDepthStencilView(m_pDepthStencilView, D3D11_CLEAR_FLAG::D3D11_CLEAR_DEPTH, 1.0f, 0);


		m_pScene->Update(m_pTimer->GetDeltaTime());

		m_pScene->Render();

		m_pSwapChain->Present(0, 0);


	}

	m_pScene->Shutdown();
}
// Primary initialization function. Sets everything up and takes care of the program
char *Start(int run_vegastrike) {
	InitGraphics();

	DATA.name = NewString("");
	DATA.author = NewString("");
	DATA.description = NewString("");
	DATA.briefing = NewString("");
	DATA.path = NewString("");
	DATA.numplayers = NewString("");

	ShowMain(1);
	gtk_main();
	return DATA.path;
}
///----------------------------------------------------------------------------
///Initializes this GraphicsApp instance
///----------------------------------------------------------------------------
bool GraphicsApp::InitInstance(HANDLE hInstance, LPCTSTR lpCmdLine, int iCmdShow)
{
	if(!CreateDisplay())
	{
		ShutDown();
		return false;
	}

	//initilizes the graphics device
	InitGraphics();

	//Initializes the data
	InitData();

	return true;
}
示例#26
0
int main()
{
    InitGraphics(800,600);                      // inicjalizuj okno graficzne
    settextstyle(DEFAULT_FONT, HORIZ_DIR, 2);   // styl tekstu dla calej gry
    if(SaveEmpty() == 1)
        MakePlaceholderSave();

    // DEKLARACJA ZMIENNYCH:
    int X = getmaxx(); // maxymalna szerokosc okna graficznego
    int Y = getmaxy(); // maksymalna wysokosc okna graficznego

    char mainMenu[4][40] = { {"Korwin kontra Lewacy z Marsa"},
                             {"Nowa Gra"},
                             {"Kontynuuj"},
                             {"Wyjdz"} };   // tablica z elementami menu glownego
    int chosen;         // zmienna przechowujaca wybrana opcje
    bool gameOn = 1;    // status programu; doyslnie 1 - dziala, 0 - zakonczony
    int diff_level;     // poziom trudnosci gry


    do
    {
        cleardevice();
        chosen = Menu(mainMenu, 3, X/2, Y/2);

        switch(chosen)
        {
        case 1:
            ChooseDifficulty(&diff_level,X/2,Y/2);
            new_game(diff_level, X, Y, 0);
            break;
        case 2:
            if(SaveEmpty() == 1)
            {
                DisplayNoGameSaved(X/2, Y/2);
            }
            else new_game(diff_level, X, Y, 1);
            break;
        case 3:
            gameOn = 0;
            break;
        }

    }while(gameOn == 1);

}
示例#27
0
文件: exttest.c 项目: jamjr/Helios-NG
int main()
{
   Stream *graph;
   word   x, y;
   
   if (!InitGraphics(NULL, NULL))
      exit(1);
   
   graph = OpenGraph(NULL, 10, 10, 200, 200, WS_OVERLAPPEDWINDOW, SW_SHOWNA);
   if (graph == (Stream *) NULL)
      exit(1);
   
   SetMapMode(graph, M_LOMETRIC);
   GetLogicalExt(graph, &x, &y);
   CloseGraph(graph);
   printf("Logical extents are %x %x \r\n", (int)x, (int)y);
   exit(0);
}        
void InitPuzzleGraphics() {
	SetCoordinateSystem("screen");
	SetWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT + CONTROL_STRIP_HEIGHT);
	InitGraphics();
	DefineColor("CONTROL_STRIP", 0.90, 0.90, 0.90);
	DefineColor("STANDARD_BACKGROUND", 0.80, 0.80, 0.80);
	DefineColor("STANDARD_HIGHLIGHT", 1.00, 1.00, 1.00);
	DefineColor("STANDARD_INNERSHADE", 0.72, 0.72, 0.72);
	DefineColor("STANDARD_OUTERSHADE", 0.43, 0.43, 0.43);
	DefineColor("ACTIVATED_BACKGROUND", 0.00, 0.00, 1.00);
	DefineColor("ACTIVATED_BORDER", 0.00, 0.00, 0.90);
	DefineColor("ACTIVATED_INNERSHADE", 0.00, 0.00, 0.80);
	DefineColor("ACTIVATED_TEXT", 1.00, 1.00, 1.00);
	SetPenColor("CONTROL_STRIP");
	FillBox(0, WINDOW_HEIGHT, WINDOW_WIDTH, CONTROL_STRIP_HEIGHT);
	SetPenColor("Black");
	SetWindowTitle("Triangle Puzzle Solver");
}
示例#29
0
int main()
{
	

	
	InitGraphics();



	giftable.packet_count	= GIF_PACKET_MAX;
	giftable.packet			= &packets[0];



	

	InitSprites();

	

	

	while(1)
	{
		GsGifPacketsClear(&giftable);		// clear the area that we are going to put the sprites/triangles/....

		

		MoveSprites();
		DrawSprites(&giftable);				//add stuff to the packet area
	
		


		GsDrawSync(0);
		GsVSync(0);
		GsClearDrawEnv1(&draw_env);			// clear the draw environment before we draw stuff on it
		GsGifPacketsExecute(&giftable, 1);	// set to '1' becuse we want to wait for drawing to finish. if we dont wait we will write on packets that is currently writing to the gif
		
	}


	return 0;
}
示例#30
0
文件: proj7.cpp 项目: guwu/cs553
int
main( int argc, char *argv[ ] )
{
	// turn on the glut package:
	// (do this before checking argc and argv since it might
	// pull some command line arguments out)

	glutInit( &argc, argv );


	// setup all the graphics stuff:

	InitGraphics( );


	// create the display structures that will not change:

	InitLists( );


	// init all the global variables used by Display( ):
	// this will also post a redisplay
	// it is important to call this before InitGlui( )
	// so that the variables that glui will control are correct
	// when each glui widget is created

	Reset( );


	// setup all the user interface stuff:

	InitGlui( );


	// draw the scene once and wait for some interaction:
	// (this will never return)

	glutMainLoop( );


	// this is here to make the compiler happy:

	return 0;
}