Ejemplo n.º 1
0
void mainwindow::set_ambient()
{
  QColor color = QColorDialog::getColor(_current_material.ambient, this);
  std::cout << color.greenF() << std::endl;
  _current_material.ambient = color;
  update_interface();
}
Ejemplo n.º 2
0
void 
mainwindow::addfile()
{
 QStringList qfilelist = QFileDialog::getOpenFileNames(this, tr("Open Volume"), ".", tr("Surface Files (*.igs *.cfg)"));
 std::list<std::string> filelist;
 std::transform(qfilelist.begin(), qfilelist.end(), std::back_inserter(filelist), []( QString const& qstr ) { return qstr.toStdString(); } );
 _glwindow->add(filelist); 

 _object_list->addItems(qfilelist);

 update_interface();
}
Ejemplo n.º 3
0
Archivo: draw.cpp Proyecto: janba/DSC
void Painter::update(DSC::DeformableSimplicialComplex& dsc)
{
    interface->clear_data();
    wire_frame->clear_data();
    edges->clear_data();
    domain->clear_data();
    low_quality->clear_data();
    unmoved->clear_data();
    switch (display_type) {
        case INTERFACE:
            update_interface(dsc);
            break;
        case WIRE_FRAME:
            update_wire_frame(dsc);
            break;
        case BOUNDARY:
            update_interface(dsc);
            update_domain(dsc);
            break;
        case EDGES:
            update_wire_frame(dsc);
            update_edges(dsc);
            break;
        case LOW_QUALITY:
            update_interface(dsc);
            update_low_quality(dsc);
            break;
        case UNMOVED:
            update_interface(dsc);
            update_unmoved(dsc);
            break;
            
        default:
            break;
    }
    
}
Ejemplo n.º 4
0
void ColorOptions::loadColorSchema_Dark()
{
	mainwindow->maincurve->backgroundcolor.setRed(64);
	mainwindow->maincurve->backgroundcolor.setGreen(64);
	mainwindow->maincurve->backgroundcolor.setBlue(64);

	mainwindow->maincurve->small_ruler_color.setRed(255);
	mainwindow->maincurve->small_ruler_color.setGreen(255);
	mainwindow->maincurve->small_ruler_color.setBlue(255);

	mainwindow->maincurve->big_ruler_color.setRed(128);
	mainwindow->maincurve->big_ruler_color.setGreen(128);
	mainwindow->maincurve->big_ruler_color.setBlue(128);

	mainwindow->maincurve->mouse_rect_color.setRed(255);
	mainwindow->maincurve->mouse_rect_color.setGreen(255);
	mainwindow->maincurve->mouse_rect_color.setBlue(255);

	mainwindow->maincurve->text_color.setRed(255);
	mainwindow->maincurve->text_color.setGreen(255);
	mainwindow->maincurve->text_color.setBlue(255);

	mainwindow->maincurve->baseline_color.setRed(128);
	mainwindow->maincurve->baseline_color.setGreen(128);
	mainwindow->maincurve->baseline_color.setBlue(128);

	mainwindow->maincurve->annot_marker_color.setRed(255);
	mainwindow->maincurve->annot_marker_color.setGreen(255);
	mainwindow->maincurve->annot_marker_color.setBlue(255);

	mainwindow->maincurve->signal_color = 12;

	mainwindow->maincurve->floating_ruler_color = 10;

	mainwindow->maincurve->blackwhite_printing = 1;

	mainwindow->show_annot_markers = 1;

	mainwindow->show_baselines = 1;

	mainwindow->maincurve->crosshair_1.color = 7;

	mainwindow->maincurve->crosshair_2.color = 10;

	mainwindow->clip_to_pane = 0;

	update_interface();
}
Ejemplo n.º 5
0
void
mainwindow::deletefiles()
{
  std::list<std::string> filelist;

  auto items = _object_list->selectedItems();

  for (auto item : items) {
    filelist.push_back(item->text().toStdString());
  }

  _glwindow->remove(filelist);

  qDeleteAll(_object_list->selectedItems());

  update_interface();
}
Ejemplo n.º 6
0
/**
 * load_game:
 * @filename:  File name of the saved game
 *
 * Try to load the game state saved in the given file name
 * and update the game state appropriately.
 */
void load_game(gchar *filename)
{
    if (read_state_from_file(filename))
    {
        gskat.state = PLAYING;

        update_interface();
        calc_card_positions();
        draw_area();

        play_stich();

        /* activate the quicksave, bugreport and gamesave menu items */
        gtk_widget_set_sensitive(get_widget("mi_quicksave"), TRUE);
        gtk_widget_set_sensitive(get_widget("mi_bugreport"), TRUE);
        gtk_widget_set_sensitive(get_widget("mi_gamesave"), TRUE);
    }
}
Ejemplo n.º 7
0
void ColorOptions::loadColorSchemaButtonClicked()
{
	char path[MAX_PATH_LENGTH],
			 scratchpad[2048],
			 *result;

	struct xml_handle *xml_hdl;


	strcpy(path, QFileDialog::getOpenFileName(0, "Load colorschema", QString::fromLocal8Bit(mainwindow->recent_colordir), "Montage files (*.color *.COLOR)").toLocal8Bit().data());

	if(!strcmp(path, ""))
	{
		return;
	}

	get_directory_from_path(mainwindow->recent_colordir, path, MAX_PATH_LENGTH);

	xml_hdl = xml_get_handle(path);
	if(xml_hdl==NULL)
	{
		sprintf(scratchpad, "Can not open colorschema:\n%s", path);
		QMessageBox messagewindow(QMessageBox::Critical, "Error", QString::fromLocal8Bit(scratchpad));
		messagewindow.exec();
		return;
	}

	if(strcmp(xml_hdl->elementname, PROGRAM_NAME "_colorschema"))
	{
		QMessageBox messagewindow(QMessageBox::Critical, "Error", "There seems to be an error in this colorschema.");
		messagewindow.exec();
		xml_close(xml_hdl);
		return;
	}

	mainwindow->get_rgbcolor_settings(xml_hdl, "backgroundcolor", 0, &mainwindow->maincurve->backgroundcolor);

	mainwindow->get_rgbcolor_settings(xml_hdl, "small_ruler_color", 0, &mainwindow->maincurve->small_ruler_color);

	mainwindow->get_rgbcolor_settings(xml_hdl, "big_ruler_color", 0, &mainwindow->maincurve->big_ruler_color);

	mainwindow->get_rgbcolor_settings(xml_hdl, "mouse_rect_color", 0, &mainwindow->maincurve->mouse_rect_color);

	mainwindow->get_rgbcolor_settings(xml_hdl, "text_color", 0, &mainwindow->maincurve->text_color);

	mainwindow->get_rgbcolor_settings(xml_hdl, "baseline_color", 0, &mainwindow->maincurve->baseline_color);

	mainwindow->get_rgbcolor_settings(xml_hdl, "annot_marker_color", 0, &mainwindow->maincurve->annot_marker_color);

	if(xml_goto_nth_element_inside(xml_hdl, "signal_color", 0))
	{
		xml_close(xml_hdl);
		return;
	}
	result = xml_get_content_of_element(xml_hdl);
	if(result==NULL)
	{
		xml_close(xml_hdl);
		return;
	}
	mainwindow->maincurve->signal_color = atoi(result);
	free(result);

	xml_go_up(xml_hdl);

	if(xml_goto_nth_element_inside(xml_hdl, "floating_ruler_color", 0))
	{
		xml_close(xml_hdl);
		return;
	}
	result = xml_get_content_of_element(xml_hdl);
	if(result==NULL)
	{
		xml_close(xml_hdl);
		return;
	}
	mainwindow->maincurve->floating_ruler_color = atoi(result);
	free(result);

	xml_go_up(xml_hdl);

	if(xml_goto_nth_element_inside(xml_hdl, "blackwhite_printing", 0))
	{
		xml_close(xml_hdl);
		return;
	}
	result = xml_get_content_of_element(xml_hdl);
	if(result==NULL)
	{
		xml_close(xml_hdl);
		return;
	}
	mainwindow->maincurve->blackwhite_printing = atoi(result);
	free(result);

	xml_go_up(xml_hdl);

	if(xml_goto_nth_element_inside(xml_hdl, "show_annot_markers", 0))
	{
		xml_close(xml_hdl);
		return;
	}
	result = xml_get_content_of_element(xml_hdl);
	if(result==NULL)
	{
		xml_close(xml_hdl);
		return;
	}
	mainwindow->show_annot_markers = atoi(result);
	free(result);

	xml_go_up(xml_hdl);

	if(xml_goto_nth_element_inside(xml_hdl, "show_baselines", 0))
	{
		xml_close(xml_hdl);
		return;
	}
	result = xml_get_content_of_element(xml_hdl);
	if(result==NULL)
	{
		xml_close(xml_hdl);
		return;
	}
	mainwindow->show_baselines = atoi(result);
	free(result);

	xml_go_up(xml_hdl);

	if(xml_goto_nth_element_inside(xml_hdl, "clip_to_pane", 0))
	{
		xml_close(xml_hdl);
		return;
	}
	result = xml_get_content_of_element(xml_hdl);
	if(result==NULL)
	{
		xml_close(xml_hdl);
		return;
	}
	mainwindow->clip_to_pane = atoi(result);
	free(result);

	xml_go_up(xml_hdl);

	if(xml_goto_nth_element_inside(xml_hdl, "crosshair_1_color", 0))
	{
		xml_close(xml_hdl);
		return;
	}
	result = xml_get_content_of_element(xml_hdl);
	if(result==NULL)
	{
		xml_close(xml_hdl);
		return;
	}
	mainwindow->maincurve->crosshair_1.color = atoi(result);
	free(result);

	xml_go_up(xml_hdl);

	if(xml_goto_nth_element_inside(xml_hdl, "crosshair_2_color", 0))
	{
		xml_close(xml_hdl);
		return;
	}
	result = xml_get_content_of_element(xml_hdl);
	if(result==NULL)
	{
		xml_close(xml_hdl);
		return;
	}
	mainwindow->maincurve->crosshair_2.color = atoi(result);
	free(result);

	xml_close(xml_hdl);

	update_interface();
}
Ejemplo n.º 8
0
std::pair<bool, int16>
update_world()
{
        short theElapsedTime = 0;
        bool canUpdate = true;
        int theUpdateResult = kUpdateNormalCompletion;

#ifndef DISABLE_NETWORKING
	if (game_is_networked)
		NetProcessMessagesInGame();
#endif
        
        while(canUpdate)
        {
                // If we have flags in the GameQueue, or can put a tick's-worth there, we're ok.
                // Note that GameQueue should be stocked evenly (i.e. every player has the same # of flags)
                if(GameQueue->countActionFlags(0) == 0)
                {
                        canUpdate = overlay_queue_with_queue_into_queue(GetRealActionQueues(), GetLuaActionQueues(), GameQueue);
                }

		if(!sPredictionWanted)
		{
			// See if the speed-limiter (net time or heartbeat count) will let us advance a tick
#if !defined(DISABLE_NETWORKING)
			int theMostRecentAllowedTick = game_is_networked ? NetGetNetTime() : get_heartbeat_count();
#else
			int theMostRecentAllowedTick = get_heartbeat_count();
#endif

			if(dynamic_world->tick_count >= theMostRecentAllowedTick)
			{
				canUpdate = false;
			}
		}
                
                // If we can't update, we can't update.  We're done for now.
                if(!canUpdate)
                {
                        break;
                }

		// Transition from predictive -> real update mode, if necessary.
		exit_predictive_mode();

		// Capture the flags for each player for use in prediction
		for(short i = 0; i < dynamic_world->player_count; i++)
			sMostRecentFlagsForPlayer[i] = GameQueue->peekActionFlags(i, 0);

		theUpdateResult = update_world_elements_one_tick();

                theElapsedTime++;

                
                L_Call_PostIdle();
                if(theUpdateResult != kUpdateNormalCompletion || Movie::instance()->IsRecording())
                {
                        canUpdate = false;
                }
	}

        // This and the following voodoo comes, effectively, from Bungie's code.
        if(theUpdateResult == kUpdateChangeLevel)
        {
                theElapsedTime = 0;
        }

	/* Game is over. */
	if(theUpdateResult == kUpdateGameOver) 
	{
		game_timed_out();
		theElapsedTime = 0;
	} 
	else if (theElapsedTime)
	{
		update_interface(theElapsedTime);
		update_fades();
	}

	check_recording_replaying();

	// ZZZ: Prediction!
	bool didPredict = false;
	
	if(theUpdateResult == kUpdateNormalCompletion && sPredictionWanted)
	{
		NetUpdateUnconfirmedActionFlags();

		// We use "2" to make sure there's always room for our one set of elements.
		// (thePredictiveQueues should always hold only 0 or 1 element for each player.)
		ActionQueues	thePredictiveQueues(dynamic_world->player_count, 2, true);

		// Observe, since we don't use a speed-limiter in predictive mode, that there cannot be flags
		// stranded in the GameQueue.  Unfortunately this approach will mispredict if a script is
		// controlling the local player.  We could be smarter about it if that eventually becomes an issue.
		for ( ; sPredictedTicks < NetGetUnconfirmedActionFlagsCount(); sPredictedTicks++)
		{
			// Real -> predictive transition, if necessary
			enter_predictive_mode();

			// Enqueue stuff into thePredictiveQueues
			for(short thePlayerIndex = 0; thePlayerIndex < dynamic_world->player_count; thePlayerIndex++)
			{
				uint32 theFlags = (thePlayerIndex == local_player_index) ? NetGetUnconfirmedActionFlag(sPredictedTicks) : sMostRecentFlagsForPlayer[thePlayerIndex];
				thePredictiveQueues.enqueueActionFlags(thePlayerIndex, &theFlags, 1);
			}
			
			// update_players() will dequeue the elements we just put in there
			update_players(&thePredictiveQueues, true);

			didPredict = true;
			
		} // loop while local player has flags we haven't used for prediction

	} // if we should predict

	// we return separately 1. "whether to redraw" and 2. "how many game-ticks elapsed"
        return std::pair<bool, int16>(didPredict || theElapsedTime != 0, theElapsedTime);
}
Ejemplo n.º 9
0
void handle_keyword(int tag)
{

	bool cheated= true;

	switch (tag)
	{
		case _tag_health:
			if (local_player->suit_energy<PLAYER_MAXIMUM_SUIT_ENERGY)
			{
				local_player->suit_energy= PLAYER_MAXIMUM_SUIT_ENERGY;
			}
			else
			{
				if (local_player->suit_energy<2*PLAYER_MAXIMUM_SUIT_ENERGY)
				{
					local_player->suit_energy= 2*PLAYER_MAXIMUM_SUIT_ENERGY;
				}
				else
				{
					local_player->suit_energy= MAX(local_player->suit_energy, 3*PLAYER_MAXIMUM_SUIT_ENERGY);
				}
			}
			mark_shield_display_as_dirty();
			break;
		case _tag_oxygen:
			local_player->suit_oxygen= MAX(local_player->suit_oxygen,PLAYER_MAXIMUM_SUIT_OXYGEN);
			mark_oxygen_display_as_dirty();
			break;
		case _tag_map:
			dynamic_world->game_information.game_options^= (_overhead_map_shows_items|_overhead_map_shows_monsters|_overhead_map_shows_projectiles);
			break;
		case _tag_invincible:
			process_player_powerup(local_player_index, _i_invincibility_powerup);
			break;
		case _tag_invisible:
			process_player_powerup(local_player_index, _i_invisibility_powerup);
			break;
		case _tag_infravision:
			process_player_powerup(local_player_index, _i_infravision_powerup);
			break;
		case _tag_extravision:
			process_player_powerup(local_player_index, _i_extravision_powerup);
			break;
		case _tag_jump:
			accelerate_monster(local_player->monster_index, WORLD_ONE/10, 0, 0);
			break;
		// LP: changed these cheats and added new ones:
		case _tag_pistol:
			AddOneItemToPlayer(_i_magnum,2);
			AddItemsToPlayer(_i_magnum_magazine,10);
			break;
		case _tag_rifle:
			AddItemsToPlayer(_i_assault_rifle,10);
			AddItemsToPlayer(_i_assault_rifle_magazine,10);
			AddItemsToPlayer(_i_assault_grenade_magazine,10);
			break;
		case _tag_missile:
			AddItemsToPlayer(_i_missile_launcher,1);
			AddItemsToPlayer(_i_missile_launcher_magazine,10);
			break;
		case _tag_toaster:
			AddItemsToPlayer(_i_flamethrower,1);
			AddItemsToPlayer(_i_flamethrower_canister,10);
			break;
		case _tag_fusion:
			AddItemsToPlayer(_i_plasma_pistol,1);
			AddItemsToPlayer(_i_plasma_magazine,10);
			break;
		case _tag_pzbxay:
			AddItemsToPlayer(_i_alien_shotgun,1);
			break;
		case _tag_shotgun:
			AddOneItemToPlayer(_i_shotgun,2);
			AddItemsToPlayer(_i_shotgun_magazine,10);
			break;
		case _tag_smg:
			AddOneItemToPlayer(_i_smg,2);
			AddItemsToPlayer(_i_smg_ammo,10);
			break;
		case _tag_save:
			save_game();
			break;
		// LP guess as to what might be good: ammo-only version of "aslag"
		case _tag_ammo:
			{
				short items[]= { _i_assault_rifle, _i_magnum, _i_missile_launcher, _i_flamethrower,
					_i_plasma_pistol, _i_alien_shotgun, _i_shotgun,
					_i_assault_rifle_magazine, _i_assault_grenade_magazine, 
					_i_magnum_magazine, _i_missile_launcher_magazine, _i_flamethrower_canister,
					_i_plasma_magazine, _i_shotgun_magazine, _i_shotgun, _i_smg, _i_smg_ammo};
				
				for(unsigned index= 0; index<sizeof(items)/sizeof(short); ++index)
				{
					switch(get_item_kind(items[index]))
					{	
						case _ammunition:
							AddItemsToPlayer(items[index],10);
							break;
					} 
				}
			}
			break;
		case _tag_aslag:
			{
				// LP change: added the SMG and its ammo
				short items[]= { _i_assault_rifle, _i_magnum, _i_missile_launcher, _i_flamethrower,
					_i_plasma_pistol, _i_alien_shotgun, _i_shotgun,
					_i_assault_rifle_magazine, _i_assault_grenade_magazine, 
					_i_magnum_magazine, _i_missile_launcher_magazine, _i_flamethrower_canister,
					_i_plasma_magazine, _i_shotgun_magazine, _i_shotgun, _i_smg, _i_smg_ammo};
				
				for(unsigned index= 0; index<sizeof(items)/sizeof(short); ++index)
				{
					switch(get_item_kind(items[index]))
					{
						case _weapon:
							if(items[index]==_i_shotgun || items[index]==_i_magnum)
							{
								AddOneItemToPlayer(items[index],2);
							} else {	
								AddItemsToPlayer(items[index],1);
							}
							break;
							
						case _ammunition:
							AddItemsToPlayer(items[index],10);
							break;
							
						case _powerup:
						case _weapon_powerup:
							break;
							
						default:
							break;
					} 
					process_new_item_for_reloading(local_player_index, items[index]);
				}
			}
			local_player->suit_energy = MAX(local_player->suit_energy, 3*PLAYER_MAXIMUM_SUIT_ENERGY);
			update_interface(NONE);
			break;
			
		default:
			cheated= false;
			break;
	}

//	/ can't use computer terminals or save in the final version if we've cheated 
//	if (cheated) SET_PLAYER_HAS_CHEATED(local_player);
#if 0
	if (cheated)
	{
		long final_ticks;
		
		SetSoundVol(7);
		play_local_sound(20110);
		Delay(45, &final_ticks);
		play_local_sound(20110);
		Delay(45, &final_ticks);
		play_local_sound(20110);
	}
#endif
	
	return;

}
Ejemplo n.º 10
0
mainwindow::mainwindow(int argc, char** argv, unsigned width, unsigned height)
  : _width ( width ),
    _height ( height )
{
  /////////////////////////////////////
  // surface rendering modes
  /////////////////////////////////////
  _rendering_modes.insert(std::make_pair(gpucast::gl::bezierobject::raycasting, "Ray Casting"));
  _rendering_modes.insert(std::make_pair(gpucast::gl::bezierobject::tesselation, "Tesselation"));
  _rendering_modes.insert(std::make_pair(gpucast::gl::bezierobject::shadow, "ShadowMode"));
  _rendering_modes.insert(std::make_pair(gpucast::gl::bezierobject::shadow_lowres, "ShadowMode LowQuality"));
  
  /////////////////////////////////////
  // fill modes
  /////////////////////////////////////
  _fill_modes.insert(std::make_pair(gpucast::gl::bezierobject::solid, "Solid"));
  _fill_modes.insert(std::make_pair(gpucast::gl::bezierobject::wireframe, "Wireframe"));
  _fill_modes.insert(std::make_pair(gpucast::gl::bezierobject::points, "Points"));

  /////////////////////////////////////
  // anti-aliasing modes
  /////////////////////////////////////
  _antialiasing_modes.insert(std::make_pair(gpucast::gl::bezierobject::disabled, "No Anti-Aliasing"));
  _antialiasing_modes.insert(std::make_pair(gpucast::gl::bezierobject::prefiltered_edge_estimation, "Prefiltered Edge Estimation"));
  _antialiasing_modes.insert(std::make_pair(gpucast::gl::bezierobject::multisampling2x2, "Multisampling(2x2)"));
  _antialiasing_modes.insert(std::make_pair(gpucast::gl::bezierobject::multisampling3x3, "Multisampling(3x3)"));
  _antialiasing_modes.insert(std::make_pair(gpucast::gl::bezierobject::multisampling4x4, "Multisampling(4x4)"));
  _antialiasing_modes.insert(std::make_pair(gpucast::gl::bezierobject::multisampling8x8, "Multisampling(8x8)"));
  _antialiasing_modes.insert(std::make_pair(gpucast::gl::bezierobject::csaa4, "CSAA4"));
  _antialiasing_modes.insert(std::make_pair(gpucast::gl::bezierobject::csaa8, "CSAA8"));
  _antialiasing_modes.insert(std::make_pair(gpucast::gl::bezierobject::csaa16, "CSAA16"));

  /////////////////////////////////////
  // trimming modes
  /////////////////////////////////////
  _trimming_modes.insert(std::make_pair(gpucast::beziersurfaceobject::no_trimming, "No Trimming"));
  _trimming_modes.insert(std::make_pair(gpucast::beziersurfaceobject::curve_binary_partition, "Double Binary (SF2009)"));
  _trimming_modes.insert(std::make_pair(gpucast::beziersurfaceobject::contour_binary_partition, "Curve Sets BSP (Undocumented)"));
  _trimming_modes.insert(std::make_pair(gpucast::beziersurfaceobject::contour_kd_partition, "Kd-optimized Curve Sets (SF2017)"));
  //_trimming_modes.insert(std::make_pair(gpucast::beziersurfaceobject::contour_list, "Contour loop-list"));

  /////////////////////////////////////
  // preclassification modes
  /////////////////////////////////////
  _preclassification_modes.insert(std::make_pair(0, "No Preclassification"));
  _preclassification_modes.insert(std::make_pair(4, "Preclassification 4x4"));
  _preclassification_modes.insert(std::make_pair(8, "Preclassification 8x8"));
  _preclassification_modes.insert(std::make_pair(16, "Preclassification 16x16"));
  _preclassification_modes.insert(std::make_pair(32, "Preclassification 32x32"));
  _preclassification_modes.insert(std::make_pair(64, "Preclassification 64x64"));
  _preclassification_modes.insert(std::make_pair(128, "Preclassification 128x128"));

  /////////////////////////////////////
  // create GUI
  /////////////////////////////////////
  _create_widgets(argc, argv);
  _create_menus();
  _create_statusbar();
  _create_actions();

  setUnifiedTitleAndToolBarOnMac(true);

  update_interface();
}