Ejemplo n.º 1
0
// ################
// ## 6. LE MAIN ##
// ################
int main () {
    int n;
    BOOL b;

    init_graphics(600,600);

    write_text("Bonjour");
    write_text("Au revoir");
    write_text("ЮИХНТОГ юихнтог");

    n = 23;
    write_int(n);
    write_int(42);

    b = (2<3);
    write_bool(b);
    write_bool(2 == 3);

    POINT centre;
    centre = wait_clic();
    draw_fill_circle(centre, 20, rouge);

    wait_escape();
    exit (0);
}
Ejemplo n.º 2
0
int main (int argc, char** argv) {
    //Parse Arguments
    g_args = parse_args(argc, argv);

    printf("Parsing Netlist...\n");
    parse_netlist(g_args->netlist_file);
    printf("DONE\n");

    char buf[50] = "kplace graphics";
    init_graphics(buf);
    //start_interactive_graphics();

    if(g_args->clique) {
        //Quesiton 1.
        solve_clique();
    }

    if(g_args->bound2bound) {
        //Question 2.
        solve_clique();
        solve_bound2bound(1.);
    }

    //Quesiton 3.
    if(g_args->simpl) {
        solve_simpl();
    }

    start_interactive_graphics();
    printf("\nTool Finished - exiting...\n");
    return 0;
}
Ejemplo n.º 3
0
int main(int argc, char** argv)
{
	int i;

	init_graphics();

	char key;
	int x = (640-20)/2;
	int y = (480-20)/2;

	do
	{
		//draw a black rectangle to erase the old one
		draw_rect(x, y, 20, 20, Black);
		key = getkey();
		if(key == 'w') y-=10;
		else if(key == 's') y+=10;
		else if(key == 'a') x-=10;
		else if(key == 'd') x+=10;
		//draw a blue rectangle
		draw_rect(x, y, 20, 20, Blue);
		sleep_ms(20);
	} while(key != 'q');

	exit_graphics();

	return 0;

}
Ejemplo n.º 4
0
int main(int argc, char* argv[])
{
	/* Unused arguments */
	(void)argc;
	(void)argv;

	/* Initialize SDL */
	if (SDL_Init(SDL_INIT_VIDEO) != 0){
		SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
		                         "SDL_Init Failure",
		                         SDL_GetError(),
		                         NULL);
		return EXIT_FAILURE;
	}

	/* Initialize game state */
	init_game();
	/* Initialize graphics */
	if (init_graphics() != 0){
		return EXIT_FAILURE;
	}

	/* Start game logic thread */
	SDL_CreateThread(game_thread, "GameLogic", NULL);

	/* Main Loop */
	while (!quit){
		/* Handle events*/
		handle_event();
		/* Render graphics */
		update_graphics();
	}

	return EXIT_SUCCESS;
}
Ejemplo n.º 5
0
Archivo: MAIN.C Proyecto: ahelwer/UofC
/**
 * main
 * This function initializes all graphical variables as well as opens the input
 * file and calls a function which populates a 2D array accordingly. It then
 * calls run(), which takes care of the actual running of the Game of Life.
 * Finally, it restores the video mode to the original state and releases
 * keyboard control.
 **/
int main(int argc, char *argv[]) {
	//this array stores the current life state
    int model[COLUMNS][ROWS] = {0}; 
    key_init(); //takes control of keyboard input
    init_graphics(); //switches to XGA
    my_video_ds = __dpmi_allocate_ldt_descriptors(1);
    __dpmi_set_segment_base_address(my_video_ds,ADDR);
    ADDR = 0;	/* basis now zero from selector */
    __dpmi_set_segment_limit(my_video_ds,(width*height)|0xfff);
    //the following reads in a file if one was given and populates the grid
    if (argc==2) {
	FILE *fp = fopen(argv[1], "r");
	if (fp == 0) {
            printf("Error - invalid filename\n" );
	    return 0;
        }
        else {
	    populate(model, fp);
	}
    }
    run(model); //runs the program
    close_graphics(); //restores video mode to original state
    key_delete(); //releases control over the keyboard
    return 0;
}
Ejemplo n.º 6
0
int main ()
{
int i;
struct balle B[4];
struct traits T;

init_graphics (1020,700);
for (i=0 ; i<4 ; i++) B[i] = init_balle(i);
T = init_traits();

affiche_auto_off();
while(1)
	{
	// On affiche
	affiche_legende();
	
	affiche_traits(T);
	for (i=0 ; i<4 ; i++) affiche_balle(B[i]);

	affiche_all();

	// On efface
	efface_traits(T);
	for (i=0 ; i<4 ; i++) efface_balle(B[i]);

	// On modifie
	T = modifie_traits(T);
	for (i=0 ; i<4 ; i++) B[i] = deplace_balle(B[i],T);
	}

wait_escape();
exit(0);
}
Ejemplo n.º 7
0
// this function initializes and prepares Direct3D for use
void initD3D(HWND hWnd)
{
    d3d = Direct3DCreate9(D3D_SDK_VERSION);

    D3DPRESENT_PARAMETERS d3dpp;

    ZeroMemory(&d3dpp, sizeof(d3dpp));
    d3dpp.Windowed = TRUE;    
    d3dpp.hDeviceWindow = hWnd;
    d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
    d3dpp.BackBufferWidth = SCREEN_WIDTH;
    d3dpp.BackBufferHeight = SCREEN_HEIGHT;	
	d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
	d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
	d3dpp.EnableAutoDepthStencil = TRUE;

	setAA(d3dpp);

    // create a device class using this information and the info from the d3dpp stuct
    HRESULT r = d3d->CreateDevice(D3DADAPTER_DEFAULT,
                      D3DDEVTYPE_HAL,
                      hWnd,
                      D3DCREATE_SOFTWARE_VERTEXPROCESSING,
                      &d3dpp,
                      &d3ddev);

    init_graphics();    // call the function to initialize the triangle

    d3ddev->SetRenderState(D3DRS_LIGHTING, FALSE);
	//d3ddev->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, TRUE);
	d3ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
	d3ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);	
}
Ejemplo n.º 8
0
// this function initializes and prepares Direct3D for use
void initD3D(HWND hWnd)
{
    d3d = Direct3DCreate9(D3D_SDK_VERSION);

    D3DPRESENT_PARAMETERS d3dpp;

    ZeroMemory(&d3dpp, sizeof(d3dpp));
    d3dpp.Windowed = TRUE;
    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
    d3dpp.hDeviceWindow = hWnd;
    d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
    d3dpp.BackBufferWidth = SCREEN_WIDTH;
    d3dpp.BackBufferHeight = SCREEN_HEIGHT;
    d3dpp.EnableAutoDepthStencil = TRUE;    // automatically run the z-buffer for us
    d3dpp.AutoDepthStencilFormat = D3DFMT_D16;    // 16-bit pixel format for the z-buffer

    // create a device class using this information and the info from the d3dpp stuct
    d3d->CreateDevice(D3DADAPTER_DEFAULT,
                      D3DDEVTYPE_HAL,
                      hWnd,
                      D3DCREATE_SOFTWARE_VERTEXPROCESSING,
                      &d3dpp,
                      &d3ddev);

    init_graphics();    // call the function to initialize the triangle

    d3ddev->SetRenderState(D3DRS_LIGHTING, FALSE);    // turn off the 3D lighting
    d3ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);    // both sides of the triangles
    d3ddev->SetRenderState(D3DRS_ZENABLE, TRUE);    // turn on the z-buffer
}
Ejemplo n.º 9
0
int wt_init(char *pszWorldFile, int width, int height)
{
     FILE *fp;

     if ((fp = fopen(pszWorldFile, "r")) == NULL) {
   	  perror(pszWorldFile);
   	  exit(EXIT_FAILURE);
     }
     w = read_world_file(fp);
     fclose(fp);

     init_graphics();
     init_renderer(width, height);
     init_input_devices();

     /* setup view */
     view = new_view(fixdiv(FIXED_2PI, INT_TO_FIXED(4)));

     view->x = FIXED_ZERO;
     view->y = FIXED_ZERO;
     view->height = FIXED_ONE;
     view->angle = FIXED_ZERO;

     frames = 0;
     return EXIT_SUCCESS;
}
Ejemplo n.º 10
0
int main( int argc, char** argv )
{
  unsigned int my_seed = 1;

  t1 = create_terrain();

  if ( argc > 1 )
    my_seed = atoi( argv[1] );
  if ( DO_PRINTF )
    printf( "%s %d: seed: %u\n", argv[0], argc, my_seed );

  generate_true_cost_map( t1, my_seed );

  a1 = create_astar( t1 );

  init_graphics( &argc, argv, t1 );

#ifdef DO_GRAPHICS
  glutMainLoop();
#else
  for( ; ; )
    {
	#ifndef DO_GRAPHICS
		if ( path_done )
			return 0;
	#endif
    my_idlea();
    }
#endif
  return 0;
}
Ejemplo n.º 11
0
void vpr_place_and_route(INP t_vpr_setup vpr_setup, INP t_arch arch, INP t_options options) {
	/* Startup X graphics */
	set_graphics_state(vpr_setup.ShowGraphics, vpr_setup.GraphPause,
			vpr_setup.RouterOpts.route_type);
	if (vpr_setup.ShowGraphics) {
		init_graphics("VPR:  Versatile Place and Route for FPGAs", WHITE);
		alloc_draw_structs();
	}

	/* Do placement and routing */   //bug here need to debug - corrected
	place_and_route(vpr_setup.Operation, vpr_setup.PlacerOpts,
			&vpr_setup.FileNameOpts, vpr_setup.AnnealSched, vpr_setup.RouterOpts, vpr_setup.RoutingArch,
			vpr_setup.Segments, vpr_setup.Timing, arch.Chans, arch.models,
			arch.Directs, arch.num_directs, &arch);
	
	//added QT - for main.c hunk 3 qt
	if(options.Count[OT_INC_DUMP_NETS]) {
		inc_dump_nets(&vpr_setup.FileNameOpts);
	}
	
	fflush(stdout);

	/* Close down X Display */
	if (vpr_setup.ShowGraphics)
		close_graphics();
		free_draw_structs();
}
Ejemplo n.º 12
0
int main(int argc, char** argv) {
  init_graphics();
  clear_screen();

  int x, y;
  fill_circle(120, 120, 100, GREEN_COLOR);

  exit_graphics();
  return 0;
}
Ejemplo n.º 13
0
int main() {

  test_colors();
  test_dynamic_array();
  test_vectors();
  test_physics();

  int pixels[] = {0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff,
		  0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff,
		  0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff,
		  0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff,
		  0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff,
		  0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff};
  
  color pixels2[10000];
  for (int i = 0; i < 10000; i++) pixels2[i] = 0xE650E1FF;

  int window_width = 800;
  int window_height = 600;
  
  init_graphics();

  renderer_handle rend = create_window(window_width, window_height, "TEST", 0);
  texture_handle tex = load_texture_data(rend, pixels, 6, 6);
  texture_handle tex2 = load_texture_data(rend, pixels2, 100, 100);
  set_clear_color(rend, get_color(0,0,0,0xFF));

  while (SDL_GetTicks() < 10000) {
    clear(rend);
    double theta = (double) SDL_GetTicks() / 300;
    double r = 200 * cos(3*theta/5);

    int x1 = r*cos(theta) - 3 + window_width/2;
    int y1 = r*sin(theta) - 3 + window_height/2;
    int x2 = r*cos(theta + 2*PI/3) - 3 + window_width/2;
    int y2 = r*sin(theta + 2*PI/3) - 3 + window_height/2;
    int x3 = r*cos(theta - 2*PI/3) - 3 + window_width/2;
    int y3 = r*sin(theta - 2*PI/3) - 3 + window_height/2;

    double scale = .75 - .25 * cos(6*theta/5);
    int s = 100 * scale;

    draw(rend, tex2, (window_width - s) / 2, (window_height - s) / 2, -theta, s/2, s/2, 0, 0, scale);
    draw(rend, tex, x1, y1, 0, 0, 0, 0, 0, 1);
    draw(rend, tex, x2, y2, 0, 0, 0, 0, 0, 1);
    draw(rend, tex, x3, y3, 0, 0, 0, 0, 0, 1);
    show(rend);
    SDL_Delay(16);
  }

  destroy_window(rend);
  cleanup();
  
  return 0;
}
Ejemplo n.º 14
0
myApp::myApp(int nW, int nH, void* hInst, int nCmdShow) :
cglApp(nW, nH, hInst, nCmdShow)
, m_nPrevMouseX(-100)
, m_nPrevMouseY(-100)
{
    for (int i = 0; i < MAX_KEYS; i++)
    {
        m_keysPressed[i] = false;
    }

    init_graphics();
}
int main(int argc, char *argv[]) {

	/* parse commandline returns filename index in argv */
	/* create floorplan data structure					*/
	gfp=fpCreate(argv[commandlineParse(argc,argv)]);

	if (gPostScript	) gGUI 		= 1 ;	/* enable gui if post script required		*/
	if (!gGUI		) gVerbose	= 1 ;	/* enable verbose if if gui is not enabled	*/

	/* change random seed into current time */
	srandom(time(NULL));

	if (gGUI) {

		/*  calculating world and drawing dimentions							*/
		gWorldStep=MIN((880/((gfp->ny)*2)),(1000/((gfp->nx)+1))); /* grid step	*/
		gWorldX   =((gfp->nx)+1)*gWorldStep+240; /* world X dimension 			*/
		gWorldY   =(gfp->ny)*2*gWorldStep+180  ; /* world Y dimension 			*/	

		/* initialize display with WHITE 1000x1000 background */
		init_graphics((char*)"Simulated-Annealing Cell-Based Placement Tool", WHITE, NULL);
		init_world (0.,0.,gWorldX,gWorldY);

		/* Create new buttons */
		create_button ((char*)"Window"    , (char*)"---1"      , NULL     ); /* Separator				*/
		create_button ((char*)"---1"      , (char*)"Enable  PS", enablePS ); /* enable PS				*/
		create_button ((char*)"Enable  PS", (char*)"Disable PS", disablePS); /* disable PS				*/
		create_button ((char*)"Disable PS", (char*)"Run 1"     , run1     ); /* refresh every 1    temp	*/
		create_button ((char*)"Run 1"     , (char*)"Run 10"    , run10    ); /* refresh every 10   temp	*/
 		create_button ((char*)"Run 10"    , (char*)"Run 100"   , run100   ); /* refresh every 100  temp	*/
		create_button ((char*)"Run 100"   , (char*)"Run 1000"  , run1000  ); /* refresh every 1000 temp	*/
		create_button ((char*)"Run 1000"  , (char*)"Run All"   , runAll   ); /* refresh at end only		*/
	}

	/* invoke simulated-annealing placement with designated parameters */
	fpAnneal(gfp
			,(gMoveTemp*(gfp->cellsN)^(4/3))
			,gInitTemp*(gfp->bbox)
			,gCoolRate
			,gFreezeTemp/(gfp->bbox/gfp->netsN)
	);

	/* finished! wait still until 'Exit" is pressed */
	if (gGUI)
		while(1) waitLoop();

	/* free database */
	fpDelete(gfp);


	return 1;
}
Ejemplo n.º 16
0
int main() {
	int i;
	int x = 150;
	int y = 150;
	init_graphics();
	do {
		const char *text = "Enter 'q' to exit loop";
		draw_text(50,50,text,0x07E0);
		sleep_ms(500);
		draw_line(x,y,x+10,y+10,0xF81F);
		sleep_ms(500);
		draw_line(x+10,y+10,x+10,y+20,0xFFE0);
		sleep_ms(500);
		draw_line(x+10,y+20,x,y+30,0x79E0);
		sleep_ms(500);
		draw_line(x,y+30,x-10,y+20,0x001F);
		sleep_ms(500);
		draw_line(x-10,y+20,x-10,y+10,0xFBE0);
		sleep_ms(500);
		draw_line(x-10,y+10,x,y,0xBDF7);
		sleep_ms(700);
		clear_screen();
	} while (getkey() != 'q');
	const char *text2 = "*insert witty remark here*";
	draw_text(250,83,text2,0xF81F);
	for (i = 250; i < 458; i++) {
		draw_pixel(i, 100, 0xF800);
		draw_pixel(i, 101, 0xF800);
		draw_pixel(i, 102, 0xF800);
		draw_pixel(i, 103, 0xFBE0);
		draw_pixel(i, 104, 0xFBE0);
		draw_pixel(i, 105, 0xFBE0);
		draw_pixel(i, 106, 0xFFE0);
		draw_pixel(i, 107, 0xFFE0);
		draw_pixel(i, 108, 0xFFE0);
		draw_pixel(i, 109, 0x07E0);
		draw_pixel(i, 110, 0x07E0);
		draw_pixel(i, 111, 0x07E0);
		draw_pixel(i, 112, 0x07FF);
		draw_pixel(i, 113, 0x07FF);
		draw_pixel(i, 114, 0x07FF);
		draw_pixel(i, 115, 0x001F);
		draw_pixel(i, 116, 0x001F);
		draw_pixel(i, 117, 0x001F);
		draw_pixel(i, 118, 0x780F);
		draw_pixel(i, 119, 0x780F);
		draw_pixel(i, 120, 0x780F);
	}
	sleep_ms(600);
	exit_graphics();
	return 0;
}
Ejemplo n.º 17
0
int main(int argc, char **argv)
{
    init_args(argc, argv);
    load_params();
    init_graphics();

    /* not used */
    load_database();
    draw();
    set_texture_coord();
    save_database();
    return 0;
}
Ejemplo n.º 18
0
int main(int argc, char** argv) {
    Waveform game = Waveform();

    init_graphics(argc, argv);

    game.start();
    while(game.running()){
        game.update();
        game.render();
        game.pause();
    }
    return 0;
}
Ejemplo n.º 19
0
int main()
   {
   init_graphics();           //initialize graphics system

   circle cir(40, 12, 5, cBLUE, X_FILL);      //create circle
   rect rec(12, 7, 10, 15, cRED, SOLID_FILL); //create rectangle
   tria tri(60, 7,  11, cGREEN, MEDIUM_FILL); //create triangle

   cir.draw();                //draw all shapes
   rec.draw();
   tri.draw();
   set_cursor_pos(1, 25);     //lower left corner
   return 0;
   }
Ejemplo n.º 20
0
myApp::myApp(int nW, int nH, void* hInst, int nCmdShow) :
cglApp(nW, nH, hInst, nCmdShow)
, m_nPrevMouseX(-100)
, m_nPrevMouseY(-100)
, globalCoordSystem(worldCenter, 0xffffff)
, plane(D3DXVECTOR3(0.0f, 0.0f, 0.0f), { 0.0f, 1.0f, 0.0f }, 0, 110.0f, 0.0045f)
{
    for (int i = 0; i < MAX_KEYS; i++)
    {
        m_keysPressed[i] = false;
    }

    init_graphics();
}
Ejemplo n.º 21
0
int main(int argc, char *argv[])
{
    int width=0;
    int height=0;
    pixel_format pf=PF_ERROR;
    char *filename=NULL;
    u8 *image_data=NULL;
    FILE *image_file=NULL;
    int i=0, c=0, image_bytes=0;
    SDL_Event e;
    int quit=0;
    
    if(parse_args(argc, argv, &width, &height, &pf, &filename))
    {
        display_help();
        goto end;
    }
    image_bytes=width*height*get_pixel_format_bits(pf)/8;
    image_data=(u8 *)malloc(image_bytes);
    image_file=fopen(filename, "rb");
    if(!image_file)
    {
        printf("File %s does not exist\n", filename);
        goto end;
    }
    for(i=0;(c=fgetc(image_file))!=EOF&&i<image_bytes;i++)
        image_data[i]=(u8)c;
    fclose(image_file);

    init_graphics(width, height);
    blit_image(width, height, pf, image_data);

    while(!quit)
    {
        SDL_Delay(1.0/15.0f);
        while(SDL_PollEvent(&e))
        {
            if(e.type==SDL_QUIT)
                quit=1;
        }
    }
    destroy_graphics(width, height);
end:
    if(image_data)
        free(image_data);
    if(filename)
        free(filename);
    return 0;
}
Ejemplo n.º 22
0
	// Affiche tous les objets et vérifie que la fonction init_graphics 
	// a été appelée précédemment et affiche un message d'erreur sinon.	
void affiche_all()
	{
	SDL_Event event;
	if (SDL_PollEvent(&event)) if (event.type == SDL_QUIT) exit(0);
	if (__init_graphics_is_already_called == 25) SDL_Flip(SDL_screen);
		else {
		     init_graphics(380,80);
		     write_text("init_graphics() n'a pas été appelée.");
		     write_text("");
		     write_text("           Cliquer pour terminer.");
		     fprintf(stderr,"init_graphics() n'a pas été appelée.\n");
		     fprintf(stderr,"Cliquer pour terminer.\n");
		     wait_clic();
		     exit(1);
		     }
	}
Ejemplo n.º 23
0
int main() {
	Fraction a;
	Fraction b;
	Fraction c;
	int op;
	char opchar;

	init_graphics(); // Initialize graphics in msoftcon.h

	a.SetAll(1); // 1 indicates that it's the 1st Fraction
	b.SetAll(2); // 2 indicates that it's the 2nd Fraction

	cout << "Enter an operation to perform { + - / * } ";
	cin >> opchar;

	switch (opchar) {
	case '+':
		op = FRAC_ADD;
		break;
	case '-':
		op = FRAC_SUB;
		break;
	case '*':
		op = FRAC_MUL;
		break;
	case '/':
		op = FRAC_DIV;
		break;
	default: // If operator is illegal shut program down
		cout << "Invalid operator." << endl;
		return(0);
	}
	if((a.den == 0) || (b.den == 0)) // Fraction undefined if so
		cout << "\n\nFraction is undefined.";
	else { // Else Function can be worked with
		c = Fraction_Do_Op(op, a, b);
		cout << "\n\n";
		c.Reduce(); // Reduce to simplify Fraction
		cout << "Fraction value: " << c.num << "/" << c.den << endl;
		cout << "Decimal value: " << FracDecVal(c) << endl;
		c.DisplayMixed();
	}
	cout << "Press any key to continue" << endl;
	cout.flush();
	getch();
	return(0);
}
Ejemplo n.º 24
0
int main()
{
init_graphics(500,500);

// Debut du code
POINT p;
p=wait_clic();

int i;
for (i=0;i<=10;i++){
	p.x=p.x+10;p.y=p.y+20;
	dessine_etoile(p);
}
// Fin du code

wait_escape();
exit(0);
}
Ejemplo n.º 25
0
int main()
{
  init_graphics(); // initialize graphics system

  circle c1; // create circles
  circle c2; 
  circle c3;

  c1.set(15, 7, 5, cBLUE, X_FILL); // set circle attributes
  c2.set(41, 12, 7, cRED, O_FILL);
  c3.set(65, 18, 4, cGREEN, MEDIUM_FILL);

  c1.draw(); // draw circles
  c2.draw();
  c3.draw();
  set_cursor_pos(1, 25); // lower left corner
  return 0;
}
Ejemplo n.º 26
0
void
sc_engine_init(void)
{
    Uint32 sdl_flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO;
    if (SDL_Init(sdl_flags) < 0)
        sc_critical_error(SC_ESDL, __FILE__, __LINE__, "%s", SDL_GetError());

    sc_init_default_rnd();

    init_graphics();

    /* show detected features on stderr */
    sc_engine_dump_info();

    /* assert crutial features */
    if (!GLEE_EXT_texture_array)
        sc_critical_error(SC_EGRAPHIC, NULL, 0,
            "Required device feature 'EXT_texture_array' missing");
}
Ejemplo n.º 27
0
void begin_graphics (void)
{
   t_bound_box initial_coords = t_bound_box(0,0,100,100);

   init_graphics("Analytical Placer - Final View", WHITE);
   set_visible_world(initial_coords);

   std::ostringstream str_buf;
   str_buf << cells.size() << " cells placed with " << nets.size() << " nets";
   std::string disp_str = str_buf.str();
   update_message(disp_str);

   if(!created_button) {
     create_button ("Window", "Toggle Lines", act_on_toggle_nets_button); // name is UTF-8
     created_button = true;
   }
   event_loop(NULL, NULL, NULL, drawscreen);   
   //t_bound_box old_coords = get_visible_world(); //save the current view for later
}
Ejemplo n.º 28
0
void step_graphis (double overlap_ratio, int vpin_cnt)
{
   t_bound_box initial_coords = t_bound_box(0,0,100,100);

   init_graphics("Analytical Placer - verbose mode", WHITE);
   set_visible_world(initial_coords);

   std::ostringstream str_buf;
   str_buf  << "Added " << vpin_cnt << " virtual pins; overlap ratio = " << overlap_ratio;
   std::string disp_str = str_buf.str();
   update_message(disp_str);

   if(!created_button) {
     create_button ("Window", "Toggle Lines", act_on_toggle_nets_button); // name is UTF-8
     created_button = true;
   }
   drawscreen();
   event_loop(NULL, NULL, NULL, drawscreen);   
}
Ejemplo n.º 29
0
int
main(int argc, char *argv[])
{
    int next_tick, loops;
    float interpolation;
    init_graphics("Graphics Demo");
    init_events();
    init_entities();


    next_tick = SDL_GetTicks();

    while( gameIsRunning ){
        loops = 0;
        /*
        if( SDL_GetTicks() == next_tick ){
            printf("Im here\n");
            SDL_Delay(10);
            continue;
        }
        */

        while( SDL_GetTicks() > next_tick && loops++ < MAX_FRAME_SKIP ){
            handle_events();
            update_game();

            next_tick += 1000 / GAME_SPEED_HZ;
        }

    
        interpolation = float(SDL_GetTicks() + (1000 / GAME_SPEED_HZ) - next_tick) / float(1000 / GAME_SPEED_HZ);
        render( interpolation );

        //putpixel( screen, 100, 100, SDL_MapRGB( screen->format, 0xFF, 0xFF, 0xFF ) );


        //SDL_Flip(screen);
    }

    //SDL_FreeSurface( screen );
    clean_up();
}
Ejemplo n.º 30
0
// this function initializes and prepares Direct3D for use
void DirectXHelper::initD3D(HWND hWnd, HINSTANCE hInstance)
{
    d3d = Direct3DCreate9(D3D_SDK_VERSION); // create the Direct3D interface

    D3DPRESENT_PARAMETERS d3dpp; // create a struct to hold various device information

    ZeroMemory(&d3dpp, sizeof(d3dpp));    // clear out the struct for use
	d3dpp.Windowed = !FULLSCREEN;    // program fullscreen, not windowed
	d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;    // discard old frames
    d3dpp.hDeviceWindow = hWnd;    // set the window to be used by Direct3D
//#if FULLSCREEN
	d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;    // set the back buffer format to 32-bit
    d3dpp.BackBufferWidth = SCREEN_WIDTH;    // set the width of the buffer
    d3dpp.BackBufferHeight = SCREEN_HEIGHT;    // set the height of the buffer
//#endif

    // create a device class using this information and the info from the d3dpp stuct
    d3d->CreateDevice(D3DADAPTER_DEFAULT,
                      D3DDEVTYPE_HAL,
                      hWnd,
                      D3DCREATE_SOFTWARE_VERTEXPROCESSING,
                      &d3dpp,
                      &d3ddev);

	v_buffer = NULL;
	
	//uncomment this to see the movement at work
	init_graphics();

	d3ddev->SetRenderState(D3DRS_LIGHTING, FALSE);    // turn off the 3D lighting
	d3ddev->SetRenderState(D3DRS_ZENABLE, TRUE);
	d3ddev->SetRenderState(D3DRS_AMBIENT, D3DCOLOR_XRGB(150, 150, 150));
	d3ddev->SetRenderState(D3DRS_NORMALIZENORMALS, TRUE);
	
	
	camera = new Camera(d3ddev);
	input = new Input(d3ddev, camera);
	input->initDInput(hInstance, hWnd);

	
}