Exemplo n.º 1
0
void clearscreen(){
    int x,y;
    for (x=0; x<750; x++){
        for (y=0; y<450; y++){
            location = (x+vinfo.xoffset) * (vinfo.bits_per_pixel/8) +
                           (y+vinfo.yoffset) * finfo.line_length;
            *(fbp + location) = 255;        // blue
            *(fbp + location + 1) = 248;      // green
            *(fbp + location + 2) = 224;      // red
            *(fbp + location + 3) = 0;      // transparency
        }
        for (y=450; y<500; y++){
            location = (x+vinfo.xoffset) * (vinfo.bits_per_pixel/8) +
                           (y+vinfo.yoffset) * finfo.line_length;
            *(fbp + location) = 255;        // blue
            *(fbp + location + 1) = 144;      // green
            *(fbp + location + 2) = 30;      // red
            *(fbp + location + 3) = 0;      // transparency
        }
    }
    draw_object(14,38,ship,380,10);
    if (isRight)
        draw_object(14, size_y, plane_right, 10, coor_y);
    else 
        draw_object(14, size_y, plane_left, 10, coor_y);
}
Exemplo n.º 2
0
void draw_objects(HWND hWnd)
{
	PAINTSTRUCT ps;
	HDC hdc;

	WORD t;
	int a=-1;

	SCROLLINFO si;
    ZeroMemory(&si, sizeof(si));
    si.cbSize = sizeof(si);
	si.fMask = SIF_POS;
    GetScrollInfo(ghWndDesign, SB_HORZ, &si);
    SX=-si.nPos;
    GetScrollInfo(ghWndDesign, SB_VERT, &si);
    SY=-si.nPos;

	hdc = BeginPaint (hWnd, &ps);

	for (t=0;t<GLOBAL.objects;t++)
	{
		draw_object(hdc,t);
//		draw_connections(hdc,t);
		draw_captions(hdc,t);
		if (objects[t]==actobject) a=t;
	}
//	for (t=0;t<GLOBAL.objects;t++)	draw_captions(hdc,t);
	if (a!=-1) { draw_object(hdc,a); draw_connections(hdc,a); draw_captions(hdc,a); }
	for (t=0;t<GLOBAL.objects;t++)	draw_connections(hdc,t);

	EndPaint( hWnd, &ps );

}
Exemplo n.º 3
0
void arkanoid::Game::init_game_settings(){

	nodelay(stdscr, TRUE);
	getmaxyx(stdscr, actual_max_row, actual_max_col);
	stop = false;
	dr_counter = 0;
	is_ball_moving = false;
	ticks = 0;
	if(level_nr < 50)
		level_nr++;
		
	bar_speed = 4;
	if(rand() % 2 == 0)
		col_mod = -1;
	else
		col_mod = 1;

	row_mod = -1;
	draw_border();
	load_level();
	draw_object(bar);
	draw_object(ball1);
	draw_health();
	draw_level_nr();

}
Exemplo n.º 4
0
/*! free popup event */
void event_freepu(void) {
	int i;

	switch(buf[4]) {
	case PUL_ALERT :
		if(_app) 
			menu_tnormal(adr_menu, T_FICHIER, 0);
		else {
			win[WINDACC].w_bar[T_FICHIER + 3].ob_state |= SELECTED;
			draw_object(T_FICHIER + 3, WINDACC);
		}
		big_alert(2, ALERT, "", TRUE);

		if(_app)
			menu_tnormal(adr_menu, T_FICHIER, 1);
		else {
			win[WINDACC].w_bar[T_FICHIER + 3].ob_state &= ~SELECTED;
			draw_object(T_FICHIER + 3, WINDACC);
		}
		break;
	
	case PUL_WMENU :
		if(_app)
			menu_tnormal(adr_menu, T_FENETRES, 0);
		else {
			win[WINDACC].w_bar[T_FENETRES + 3].ob_state |= SELECTED;
			draw_object(T_FENETRES + 3, WINDACC);
		}
		if(win[WINDMENU].w_hg <= ZERO) {
			win[WINDMENU].w_pal =(Palette *)malloc(work_display.n_color * sizeof(Palette));
			for(i = 0 ; i < work_display.n_color ; i++) {
				win[WINDMENU].w_pal[i][0] = work_display.palette[i][0];
				win[WINDMENU].w_pal[i][1] = work_display.palette[i][1];
				win[WINDMENU].w_pal[i][2] = work_display.palette[i][2];
			}
			open_window(WINDMENU, WTYP_PICT, WATR_CURRB,
				bureau.xd +(bureau.wd / 5), bureau.yd +(bureau.hd / 5), 320, 150,
				100, 100, 200, 200, 16, 16,
				WFARROW, THIN_CROSS,
				winicn, ZERO, close_wmenu, get_string(TIT_MENU), "",
				(long) bureau.wd,(long) bureau.hd,
				TRUE, FALSE, W_MENU,
				10, BLACK);
		}
		else {
			buf[3] = win[WINDMENU].w_hg;
			(*win[WINDMENU].w_top)();
		}
		if(_app)
			menu_tnormal(adr_menu, T_FENETRES, 1);
		else {
			win[WINDACC].w_bar[T_FENETRES + 3].ob_state &= ~SELECTED;
			draw_object(T_FENETRES + 3, WINDACC);
		}
		break;
	}	/* end switch case */
}	/* event_freepu */
Exemplo n.º 5
0
void draw_game(Game *g, BITMAP *scr) {
    draw_object(&(g->player), scr, g->player.x, g->player.y);
    for(Object *o = g->asteroids; o; o = o->next)
        draw_object(o, scr, g->player.x, g->player.y);
    for(Object *o = g->shot; o; o = o->next)
        draw_object(o, scr, g->player.x, g->player.y);
    for(Object *o = g->particles; o; o = o->next)
        draw_object(o, scr, g->player.x, g->player.y);
}
Exemplo n.º 6
0
Arquivo: main.c Projeto: kusma/cb-bart
void draw_dilldallscene(object* room, object *sphere, object *sphere_copy, float time, float flash, float flash2){
	glPushAttrib(GL_ALL_ATTRIB_BITS);

	glClearColor(1,1,1,0);
	glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
	glMatrixMode(GL_TEXTURE);
	glLoadIdentity();
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(90, ASPECT, 1.f, 500);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	glFogi(GL_FOG_MODE, GL_LINEAR);
	glFogfv(GL_FOG_COLOR,black_color);
	glFogf(GL_FOG_START, 100.f);
	glFogf(GL_FOG_END, 250.f);
	glEnable(GL_FOG);

	gluLookAt(
		sin(time)*90,-50,cos(time)*90,
		0,-30,0,

		0,1,0
		);

	set_light(0, (float)sin(time*5)*50,0,(float)cos(time*5)*50,TRUE);

	glEnable(GL_LIGHTING);
	glEnable(GL_DEPTH_TEST);

	glPushMatrix();
	glTranslatef(100,0,-100);
	draw_object(room);
	glPopMatrix();

	glPushMatrix();
	glTranslatef(0,-30+ sin(time*flash)*flash*20+flash2,0);
	glScalef(0.7f,0.7f,0.7f);
	glRotatef(time*55,1,0,1);
	glRotatef(time*55,1,0,0);
	glRotatef(time*55.2f,0,1,0);

	glRotatef(time*55,0,0,1);
	glRotatef(time*75,1,0,0);
	glRotatef(time*55.2f,0,1,0);

	blob_distort(sphere, sphere_copy, vector_make((float)sin(time),time,-time), vector_make(
		(float)(1+sin(time))*0.1f,
		(float)(1+sin(time))*0.1f,
		(float)(1+sin(time))*0.1f
		),vector_make(0.3f,0.3f,0.3f) );
	draw_object(sphere_copy);
	glPopMatrix();

	glPopAttrib();
}
Exemplo n.º 7
0
/*! Free form */
void formulaire(void) {
	OBJECT *adr;
	int quit = FALSE;
	char *adr_bakrsc = 0L;			/* ptr form state */
	MFDB img;

	img.fd_addr = NULL;
	if(_app)
		menu_tnormal(adr_menu, T_FICHIER, 0); 	/* Inverser titre */
	else {
		win[WINDACC].w_bar[T_FICHIER + 3].ob_state |= SELECTED;
		draw_object(T_FICHIER + 3, WINDACC);
	}
	wind_update(BEG_MCTRL);								/* Bloquer menu */
	adr = ir_trindex[FORMULAIRE];
	if(work_display.n_color >= 16) {
		adr->ob_spec.obspec.interiorcol = 8;
		adr->ob_spec.obspec.fillpattern = 7;
		adr[TXT1].ob_spec.tedinfo->te_color = 8;
		adr[TXT1].ob_spec.tedinfo->te_color |= 7 << 4;
		adr[TXT1].ob_spec.tedinfo->te_color |=(1 << 8);
		adr[TXT2].ob_spec.tedinfo->te_color = 8;
		adr[TXT2].ob_spec.tedinfo->te_color |= 7 << 4;
		adr[TXT2].ob_spec.tedinfo->te_color |=(1 << 8);
	}
	bak_rsc(adr, &adr_bakrsc);
	formm_draw(adr, TXT1, TRUE, &img);
	do {
		if(dialog(DLG_FORM, adr, FALSE, FALSE, BLANK, &img, TRUE)) {
			switch(object) {
			case P_CONFIRME :
				quit = TRUE;
				break;
			case P_ANNULE :
				quit = TRUE;
				res_rsc(adr, &adr_bakrsc);
				break;
			}
		}
	} while(NOT quit);
	formm_undraw(adr, &img);
	if(adr_bakrsc)							/* Si état formulaire sauvegardé */
		free(adr_bakrsc);
	wind_update(END_MCTRL);								/* Débloquer menu */
	if(_app)
		menu_tnormal(adr_menu, T_FICHIER, 1); 	/* Inverser titre */
	else {
		win[WINDACC].w_bar[T_FICHIER + 3].ob_state &= ~SELECTED;
		draw_object(T_FICHIER + 3, WINDACC);
	}
}	/* end of formulaire() */
Exemplo n.º 8
0
void arkanoid::Game::update_bar_position(){

	float xdiff;
	Drawable *bar = &drawed[drawed.size() - 2];
	Drawable *ball = &drawed[drawed.size() - 1];
	if(g_input == KEY_LEFT){
		if(bar->d_start_col > bar_speed){
			erase_object(*bar);
			bar->d_start_col -= bar_speed;
			bar->d_end_col -= bar_speed;
			draw_object(*bar);
			if(!is_ball_moving){
				erase_object(*ball);
				ball->d_start_col -= bar_speed;
				ball->d_end_col -= bar_speed;
				draw_object(*ball);
			}
		} else {
			if(bar->d_start_col > 1){
				erase_object(*bar);
				bar->d_start_col --;
				bar->d_end_col --;
				draw_object(*bar);
				if(!is_ball_moving){
					erase_object(*ball);
					ball->d_start_col --;
					ball->d_end_col --;
					draw_object(*ball);
				}
			}
		}
	} else if(g_input == KEY_RIGHT){
		
		if(bar->d_end_col < default_max_col - bar_speed - 2){
			erase_object(*bar);
			bar->d_start_col += bar_speed;
			bar->d_end_col += bar_speed;
			draw_object(*bar);
			if(!is_ball_moving){
				erase_object(*ball);
				ball->d_start_col += bar_speed;
				ball->d_end_col += bar_speed;
				draw_object(*ball);
			}
		} else {
			if(bar->d_end_col < default_max_col - 2){
				erase_object(*bar);
				bar->d_start_col ++;
				bar->d_end_col ++;
				draw_object(*bar);
				if(!is_ball_moving){
					erase_object(*ball);
					ball->d_start_col ++;
					ball->d_end_col ++;
					draw_object(*ball);
				}
			}
		}
	}
}
Exemplo n.º 9
0
void Instructions()
{
	cls();
	draw_object ("instructions.txt", 0x0A);

	while(true)
	{
		int input1;
		cin >> input1;

		//if the player presses 1...
		//bring to difficulty screen
		if(input1 == yes)
		{
			Beep (1350,150);
			gameLoop();
			break;
		}
		//if the player presses 2...
		if(input1 == no)
		{
			Beep (1350,150);
			cout << "Thank you for playing! ! !" << endl;
			g_quitGame = true;
			break;
		}
	}
}
void Smoke::draw_objects(Worker &worker)
{
    auto &data = frame_data_[frame_data_index_];
    auto cmd = data.worker_cmds[worker.index_];

    VkCommandBufferInheritanceInfo inherit_info = {};
    inherit_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO;
    inherit_info.renderPass = render_pass_;
    inherit_info.framebuffer = worker.fb_;

    VkCommandBufferBeginInfo begin_info = {};
    begin_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
    begin_info.flags = VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT;
    begin_info.pInheritanceInfo = &inherit_info;

    vk::BeginCommandBuffer(cmd, &begin_info);

    vk::CmdSetViewport(cmd, 0, 1, &viewport_);
    vk::CmdSetScissor(cmd, 0, 1, &scissor_);

    vk::CmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_);

    meshes_->cmd_bind_buffers(cmd);

    for (int i = worker.object_begin_; i < worker.object_end_; i++) {
        auto &obj = sim_.objects()[i];

        draw_object(obj, data, cmd);
    }

    vk::EndCommandBuffer(cmd);
}
Exemplo n.º 11
0
/***********************************
  FUNCTION: my_display
  ARGS: none
  RETURN: none
  DOES: main drawing function
************************************/
void my_display(void) {
  /* clear the buffer */
  /* NEW: now we have to clear depth as well */
  glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) ;

  glMatrixMode(GL_MODELVIEW) ;
  
  
  glLoadIdentity();
  gluLookAt(0.0, 5.0, 25.0,  // x,y,z coord of the camera 
	    0.0, 0.0, 0.0,  // x,y,z coord of the origin
	    0.0, 1.0, 0.0); // the direction of up (default is y-axis)
      
	
	

  glRotatef(theta_y,0,1,0);
  glRotatef(theta_x,1,0,0);
  
    
  draw_object(crt_shape);
  
 
  
  /* buffer is ready */
  glutSwapBuffers();
  
     
	
  return ;
}
Exemplo n.º 12
0
// TODO Either fix lighting or just give up
void draw_object_with_lighting(object_t* o, uint32_t x, uint32_t y)
{
    if(is_lit(o))
    {
        draw_object(o, x, y);
    }
}
Exemplo n.º 13
0
int drawPlane(int coor_y, bool isRight) {
    int size_x = 14, size_y=24;
    if (isRight) {
        draw_object(size_x, size_y, plane_right, 10, coor_y);
        usleep(1000);
        removePlane(size_x, size_y, 10, coor_y);
        coor_y+=1;
        
    } else {
        draw_object(size_x, size_y, plane_left,10,coor_y);
        usleep(1000);
        removePlane(size_x, size_y, 10, coor_y);
        coor_y-=1;
    }
    return coor_y;
}
Exemplo n.º 14
0
//function to display gameover screen
void gameover()
{
	cls();
	//show gameover screen
	draw_object ("dead.txt", 0x0C);
	colour(0x0A);
	highscore(score);

	cout << endl << "Enter 1 to replay" << endl;
	cout << "Enter 2 to return to Main Menu" << endl;

	int inputGO = 0;
	cin.clear();
	cin >> inputGO;
	//reset the game
	if (inputGO == 1)
	{
		Beep (2000,200);
		init();
		mainLoop();

	}
	if (inputGO == 2)
	{
		Beep (1350,150);
		init();
		gameLoop();
	}
}
Exemplo n.º 15
0
/* Puts robot in (0,0)
 *
 *
 * LOGS the movement
 */
void move_robot_origin()
{
	draw_info(ENERGY,ENERGY_STAT, 0, 0, DIRECTION);
	draw_log("--Ir al origen      ");

	draw_robot(0, 0, DIRECTION);

	origin();

	BOARD[X][Y] = EMPTY;
	if( is_station_below )
	{
		BOARD[X][Y] = STATION;
		draw_object(X, Y, 's');
		is_station_below=0;
	}
	X=0;
	Y=0;
	if( DIRECTION == UP)
	{
		BOARD[X][Y] = UROBOT;
	}
	else if( DIRECTION == DOWN)
	{
		BOARD[X][Y] = DROBOT;
	}
	else if( DIRECTION == RIGHT)
	{
		BOARD[X][Y] = RROBOT;
	}
	else if( DIRECTION == LEFT)
	{
		BOARD[X][Y] = LROBOT;
	}
}
Exemplo n.º 16
0
/*! Display info about BIG */
void aff_infos(void) {
	OBJECT *adr;
	int quit = FALSE, index, tit, menuf = FALSE;
	MFDB img;

	if(buf[0] == BEV_WMENU) {
		index = buf[5];
		tit = buf[3];
		menuf = TRUE;
	}
	if(_app)
		menu_tnormal(adr_menu, T_BUREAU, 0); /* Inverser titre */
	wind_update(BEG_MCTRL);							/* Bloquer menu */
	adr = ir_trindex[INFOS];
	if(work_display.n_color >= 16) {
		adr->ob_spec.obspec.interiorcol = 8;
		adr->ob_spec.obspec.fillpattern = 7;
	}
	formm_draw(adr, BLANK, FALSE, &img);
	do {
		dialog(DLG_FORM, adr, FALSE, FALSE, BLANK, &img, FALSE);
		if(object == INF_SORTIE)
			quit = TRUE;
	} while(NOT quit);
	formm_undraw(adr, &img);
	wind_update(END_MCTRL);							/* Débloquer menu */
	if(_app)
		menu_tnormal(adr_menu, T_BUREAU, 1); /* Inverser titre */
	if(menuf) {
		win[index].w_bar[tit].ob_state &= ~SELECTED;
		draw_object(tit, index);
	}
}	/* endof aff_infos() */ 
Exemplo n.º 17
0
void drawstimuli(Map m, Sensor s) {
  TCOD_list_t stims = sensor_consume_stimuli(s);
  unsigned char *tiles;
  mapVec pos, size, oldPt, delta;
  unsigned char visflags;
  if(TCOD_list_size(stims) > 0) {
    TCOD_console_print_left(NULL, 0, 10, TCOD_BKGND_NONE, "                            ");
  }
  for(int i = 0; i < TCOD_list_size(stims); i++) {
    //this is a very naive approach that completely ignores the possibility of overdraw and 'forgets' object positions
    Stimulus st = TCOD_list_get(stims, i);
    stimtype type = stimulus_type(st);
    TCOD_console_print_left(NULL, i*2, 10, TCOD_BKGND_NONE, "s%i", type);
    switch(type) {
      case StimTileLitChange:
      case StimTileVisChange:
        //redraw all tiles
        tiles = stimulus_tile_sight_change_get_new_tiles(st);
        pos = stimulus_tile_sight_change_get_position(st);
        size = stimulus_tile_sight_change_get_size(st);
        drawtiles(m, tiles, s, pos, size);
        break;
      case StimObjLitChange:
      case StimObjVisChange:
        //redraw object
        draw_object(st);
        break;
      case StimObjMoved:
        visflags = stimulus_obj_sight_change_get_new_flags(st);
        pos = stimulus_obj_sight_change_get_position(st);
        delta = stimulus_obj_moved_get_dir(st);
        oldPt = mapvec_subtract(pos, delta);
        TCOD_console_print_left(NULL, oldPt.x*2, oldPt.y, TCOD_BKGND_NONE, "x");
        draw_object(st);
        TCOD_console_print_left(NULL, 0, 15, TCOD_BKGND_NONE, "got move");
        break;
      case StimGeneric:
      default:
        TCOD_console_print_left(NULL, i*9, 16, TCOD_BKGND_NONE, "generic %d", i);
        break;
    }
    stimulus_free(st);
  }
  TCOD_list_delete(stims);
}
Exemplo n.º 18
0
Arquivo: hw2.c Projeto: MaikuMori/gfx
void hw2_draw(void)
{
    //If something failed there's no point even attempting to render anything.
    if(!init_done)
        return;

    //Clear depth buffer.
    glClear(GL_DEPTH_BUFFER_BIT);

    //Render the object.
    draw_object();
}
Exemplo n.º 19
0
//function to render items
void renderpickup (item &bonus)
{
	if (check == 0)
	{
		if (bonus.ID == 1 && elapsedTime >= 16  && checker[0] == 0)
		{
			draw_object ("item1.txt", 0x0A, bonus.loc.X,  bonus.loc.Y);
		}
		else if (bonus.ID == 2 && elapsedTime >= 24 && checker[1] == 0)  
		{
			draw_object ("item2.txt", 0x0D, bonus.loc.X,  bonus.loc.Y);
		}
		else if (bonus.ID == 3 && elapsedTime >= 33 && checker[2] == 0)
		{
			draw_object ("item3.txt", 0x0C, bonus.loc.X,  bonus.loc.Y);
		}
	}

	else
	{
		if (bonus.ID == 1 && elapsedTime >= 47  && checker[0] == 0)
		{
			draw_object ("item1.txt", 0x0A, bonus.loc.X,  bonus.loc.Y);
		}
		else if (bonus.ID == 2 && elapsedTime >= 55 && checker[1] == 0)  
		{
			draw_object ("item2.txt", 0x0D, bonus.loc.X,  bonus.loc.Y);
		}
		else if (bonus.ID == 3 && elapsedTime >= 64 && checker[2] == 0)
		{
			draw_object ("item3.txt", 0x0C, bonus.loc.X,  bonus.loc.Y);
		}
	}

}
Exemplo n.º 20
0
gboolean
draw_cb (GtkWidget * w, cairo_t * cr, gpointer data)
{
  int i, j;

  for (j = 0; j < GAME_HEIGHT; j++) {
    for (i = 0; i < GAME_WIDTH; i++) {
      draw_object (i, j, arena[i][j], cr);
    }
  }

  draw_bubble (cr);

  return TRUE;
}
Exemplo n.º 21
0
void* threadHandler(void *threadArgs) {
    while (isExploded()==0) { // harusnya ini kondisi tertembak
        coor_y = drawPlane(coor_y,isRight);
        if(coor_y > (750-size_y*5)-10 && isRight) {
            isRight = false;
        }
        else if(coor_y < 10 && !isRight) {
            isRight = true;
        }
    }
	coor_y = drawPlane(coor_y,isRight);
	usleep(1);
    draw_object(13,14,explosion,coor_x,coor_y);
    usleep(100000);
    return NULL;
}
Exemplo n.º 22
0
static void draw(void) {
  static int first_call = TRUE;
  static GLint display_list = 0;
	
  if (first_call) {
    first_call = FALSE;
    display_list = glGenLists(1);
    glNewList(display_list, GL_COMPILE_AND_EXECUTE);
    draw_frame();
    draw_object();
    glEndList();
  }
  else {
    glCallList(display_list);
  }
}
Exemplo n.º 23
0
void Scene::draw_octree(Octree &oct,bool testcollision,std::list<Object*> &drawn) {
    if(oct.objects.size()!=0) {

        std::list<Object*>::iterator it;
        for(it=oct.objects.begin();it!=oct.objects.end();it++) {
            Object *o=*it;
            if(!o->has_been_drawn && o->enable_draw()) {

                o->update_matrices(&perspective,&camera);

                draw_object(o);

                drawn.push_back(o);
                o->has_been_drawn=true;

            }
        }

    } else {

        if(testcollision) {
            Octree_Collisions col = oct.frustum_collision(frustum);
            if(col==FULL_IN) {
                for(int i=0;i<8;i++) {
                    if(oct.nodes[i]!=NULL) {
                        draw_octree(*oct.nodes[i],false,drawn);
                    }
                }
            } else if(col==IN) {
                for(int i=0;i<8;i++) {
                    if(oct.nodes[i]!=NULL) {
                        draw_octree(*oct.nodes[i],true,drawn);
                    }
                }
            } 
        } else {
            for(int i=0;i<8;i++) {
                if(oct.nodes[i]!=NULL) {
                    draw_octree(*oct.nodes[i],false,drawn);
                }
            }
        }

    }
}
Exemplo n.º 24
0
void Hologram::draw_objects(Worker &worker)
{
    auto &data = frame_data_[frame_data_index_];
    auto cmd = data.worker_cmds[worker.index_];

    VkCommandBufferInheritanceInfo inherit_info = {};
    inherit_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO;
    inherit_info.renderPass = render_pass_;
    inherit_info.framebuffer = worker.fb_;

    VkCommandBufferBeginInfo begin_info = {};
    begin_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
    begin_info.flags = VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT;
    begin_info.pInheritanceInfo = &inherit_info;

    vk::BeginCommandBuffer(cmd, &begin_info);

    vk::CmdSetViewport(cmd, 0, 1, &viewport_);
    vk::CmdSetScissor(cmd, 0, 1, &scissor_);

    vk::CmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_);

    meshes_->cmd_bind_buffers(cmd);

    for (int i = worker.object_begin_; i < worker.object_end_; i++) {
        auto &obj = sim_.objects()[i];

        draw_object(obj, data, cmd);
    }

    vk::EndCommandBuffer(cmd);

    if (!use_push_constants_) {
        // This flush is not technically required, but it helps API tracing tools track changes in
        // mapped memory blocks like this one.
        VkMappedMemoryRange range = {};
        range.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE;
        range.pNext = nullptr;
        range.memory = frame_data_mem_;
        range.offset = (data.base - frame_data_[0].base) + sim_.objects()[worker.object_begin_].frame_data_offset;
        range.size = aligned_object_data_size * (worker.object_end_ - worker.object_begin_);

        vk::FlushMappedMemoryRanges(dev_, 1, &range);
    }
}
Exemplo n.º 25
0
bool arkanoid::Game::load_level(){

	unsigned br_count = 0;
	for(int k = 1; k < alevel->brick_nr; k++){
		for(int i = 1; i < arkanoid::Level::map_num_rows; i+= arkanoid::Brick::height){
			for(int j = 1; j < arkanoid::Level::map_num_cols; j+= arkanoid::Brick::width){
				if(alevel->M[i][j] == k){
					if(k == 1)
						bricks.push_back(WinningBrick(i,j));
					else
						bricks.push_back(NormalBrick(i,j));
					draw_object(bricks[br_count]);
					br_count++;
				}
			}
		}
	}
}
Exemplo n.º 26
0
void monster::draw(WINDOW *w, int plx, int ply, bool inv)
{
 int x = SEEX + posx - plx;
 int y = SEEY + posy - ply;
 nc_color color = type->color;
 
 // see if it's possible to draw a graphical sprite
 if(type->sprite) {
  if(draw_object(w, x, y, type->sprite)) return;
 }
 
 if (friendly != 0 && !inv)
  mvwputch_hi(w, y, x, color, type->sym);
 else if (inv)
  mvwputch_inv(w, y, x, color, type->sym);
 else {
  color = color_with_effects();
  mvwputch(w, y, x, color, type->sym);
 }
}
Exemplo n.º 27
0
/* draw the the AR objects */
static int draw( ObjectData_T *object, int objectnum )
{
    int     i;
    double  gl_para[16];

    glClearDepth( 1.0 );
    glClear(GL_DEPTH_BUFFER_BIT);
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LEQUAL);
    glEnable(GL_LIGHTING);

    /* calculate the viewing parameters - gl_para */
    for( i = 0; i < objectnum; i++ ) {
        if( object[i].visible == 0 ) continue;
        argConvGlpara(object[i].trans, gl_para);
        draw_object( object[i].id, gl_para, object[i].collide );
    }

    glDisable( GL_LIGHTING );
    glDisable( GL_DEPTH_TEST );

    return(0);
}
Exemplo n.º 28
0
static void draw ( void ) {
  glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

  glPushMatrix();

    glTranslatef( 0.0, 0.0, -10.0 );
    glScalef( Scale*WindH/WindW, Scale, Scale );
    glTranslatef(2.5*WindW/WindH*sin(step*1.11),2.5*cos(step*1.25*1.11),0);
    glRotatef(step*100,1,0,0);
    glRotatef(step*95,0,1,0);
    glRotatef(step*90,0,0,1);

  seno=(sin(step)+1.0/3.0)*(4.0/5.0)*Magnitude;

  draw_object();

  glPopMatrix();

  glFlush();

  glutSwapBuffers();

}
Exemplo n.º 29
0
unsigned arkanoid::Game::update_scene(){

	if(is_scrsize_changed()){
		delete_border();
		for(unsigned i = 0; i < drawed.size(); i++){
			erase_object(drawed[i]);
		}

		getmaxyx(stdscr, actual_max_row, actual_max_col);
		
		draw_border();

		for(unsigned i = 0; i < drawed.size(); i++){
			draw_object(drawed[i]);
		}
		draw_health();
		draw_level_nr();
	}

	update_bar_position();

	return update_ball_position();
}
Exemplo n.º 30
0
/*TODO add on*/
void my_display() {

  // clear all pixels, reset depth 
  glClear(GL_COLOR_BUFFER_BIT |GL_DEPTH_BUFFER_BIT );
  
   // init to identity 

   glLoadIdentity() ;

   gluLookAt(x_camera, y_camera, z_camera,  // x,y,z coord of the camera 
	    0.0, 0.0, 0.0,  // x,y,z LookAt
	    0.0, 1.0, 0.0); // the direction of Up (default is y-axis)

   draw_axes();


   draw_object(crt_shape);

  // this buffer is ready

  glutSwapBuffers();

}