예제 #1
0
파일: area.cpp 프로젝트: angjminer/godot
Area::Area() :
		CollisionObject(PhysicsServer::get_singleton()->area_create(), true) {

	space_override = SPACE_OVERRIDE_DISABLED;
	set_gravity(9.8);
	locked = false;
	set_gravity_vector(Vector3(0, -1, 0));
	gravity_is_point = false;
	gravity_distance_scale = 0;
	linear_damp = 0.1;
	angular_damp = 1;
	priority = 0;
	monitoring = false;
	collision_mask = 1;
	collision_layer = 1;
	set_ray_pickable(false);
	set_monitoring(true);
	set_monitorable(true);

	audio_bus_override = false;
	audio_bus = "Master";

	use_reverb_bus = false;
	reverb_bus = "Master";
	reverb_amount = 0.0;
	reverb_uniformity = 0.0;
}
예제 #2
0
파일: area_2d.cpp 프로젝트: 3miu/godot
Area2D::Area2D() : CollisionObject2D(Physics2DServer::get_singleton()->area_create(),true) {

	space_override=SPACE_OVERRIDE_DISABLED;
	set_gravity(98);;
	set_gravity_vector(Vector2(0,1));
	gravity_is_point=false;
	density=0.1;
	locked=false;
	priority=0;
	monitoring=false;
	set_enable_monitoring(true);

}
예제 #3
0
//initialize is called by each constructor 
void ascii_man::initialize(float _gravity)
{
	set_temp_mv(NULL);
	set_gravity(_gravity);
	set_render(""," 0 "," 8="," /\\","");
	set_pt(20,2);
	set_xt(1.2,1.5);
	set_mv(0,0);
	set_mass(3);
	set_frict((float)0.55);
	dir = 1;
	set_damage(10);
	set_health(50);
}
예제 #4
0
	void Clear() {
		collisionloss = 0.8f;
		tophit = false;
		lefthit = false;
		righthit = false;
		ground = 0;
		bounced = 0;
		bouncelimit = 2;
		active = false;
		ydir = 1.0f;
		friction = 0.8f;
		vel[0] = 0.0f;
		vel[1] = 0.0f;
		vel[2] = 0.0f;
		mass = 10;

		ftop = 0;
		fbottom = 0;
		fleft = 0;
		fright = 0;

		accel[0] = 0.0f;
		accel[1] = 0.0f;
		accel[2] = 0.0f;

		force[0] = 0.0f;
		force[1] = 0.0f;
		force[2] = 0.0f;

		gravity[0] = 0.0f;
		gravity[1] = 0.0f;
		gravity[2] = 0.0f;

		impulse[0] = 0.0f;
		impulse[1] = 0.0f;
		impulse[2] = 0.0f;

		momentum[0] = 0;
		momentum[1] = 0;
		momentum[2] = 0;

		set_pos(0, 0, 0);
		set_gravity(0, -9.8, 0);

	}
예제 #5
0
파일: area.cpp 프로젝트: 03050903/godot
Area::Area() : CollisionObject(PhysicsServer::get_singleton()->area_create(),true) {

	space_override=SPACE_OVERRIDE_DISABLED;
	set_gravity(9.8);;
	locked=false;
	set_gravity_vector(Vector3(0,-1,0));
	gravity_is_point=false;
	gravity_distance_scale=0;
	linear_damp=0.1;
	angular_damp=1;
	priority=0;
	monitoring=false;
	collision_mask=1;
	layer_mask=1;
	set_ray_pickable(false);
	set_enable_monitoring(true);
	set_monitorable(true);

}
예제 #6
0
TestGravityWindow::TestGravityWindow (Gdk::Gravity gravity, const std::string &helpImageName) :
  TestWindow ("TestGravityWindow", helpImageName)
{
  set_gravity (gravity);
  //move (100, 100);
/*
GRAVITY_NORTH_WEST 	
GRAVITY_NORTH 	
GRAVITY_NORTH_EAST 	
GRAVITY_WEST 	
GRAVITY_CENTER 	
GRAVITY_EAST 	
GRAVITY_SOUTH_WEST 	
GRAVITY_SOUTH 	
GRAVITY_SOUTH_EAST 	
GRAVITY_STATIC 
*/
  
  show ();
}
예제 #7
0
파일: main.c 프로젝트: PamC/VSPlugin
static void handleSensorEvent(bps_event_t *event) {
	if (SENSOR_AZIMUTH_PITCH_ROLL_READING == bps_event_get_code(event)) {
		float azimuth, pitch, roll;
		float result_x = 0.0f, result_y = -1.0f;

		sensor_event_get_apr(event, &azimuth, &pitch, &roll);

		float radians = abs(roll) * M_PI / 180 ;//+ adjustment_angle;
		float horizontal = sin(radians) * 0.5f;
		float vertical = cos(radians) * 0.5f;

		if (pitch < 0) {
			vertical = -vertical;
		}
		if (roll >= 0) {
			horizontal = -horizontal;
		}

		//Account for axis change due to different starting orientations
		if (orientation_angle == 0) {
			result_x = horizontal;
			result_y = vertical;
		} else if (orientation_angle == 90) {
			result_x = -vertical;
			result_y = horizontal;
		} else if (orientation_angle == 180) {
			result_x = -horizontal;
			result_y = -vertical;
		} else if (orientation_angle == 270) {
			result_x = vertical;
			result_y = -horizontal;
		}

		set_gravity(result_x, result_y);
	}
}
예제 #8
0
jobManWindow::jobManWindow() :
		refreshWorker(services) {
	isMaximized = false;
	positionValid = false;
	waitCursorCounter = 0;

	refreshWorker.sig_done.connect(sigc::mem_fun(*this, &jobManWindow::on_refresh_complete));
	startWorker.sig_done.connect(sigc::mem_fun(*this, &jobManWindow::on_start_complete));
	stopWorker.sig_done.connect(sigc::mem_fun(*this, &jobManWindow::on_stop_complete));

	// We need this to precisely return window to it's previous possition
	set_gravity(Gdk::GRAVITY_STATIC);

	// Prepare menu etc.
	//Create actions for menus and toolbars:
	refActionGroup = Gtk::ActionGroup::create();

	refActionGroup->add(Gtk::Action::create("FileMenu", "_File"));
	refActionGroup->add(Gtk::Action::create("FileExit", Gtk::Stock::QUIT, "E_xit", "Exit the application"),
			sigc::mem_fun(*this, &jobManWindow::on_menu_file_exit));

	refActionGroup->add(Gtk::Action::create("HelpMenu", "_Help"));
	refActionGroup->add(Gtk::Action::create("HelpAbout", Gtk::Stock::ABOUT, "_About", "About JobMan"),
			sigc::mem_fun(*this, &jobManWindow::on_menu_help_about));

	refUIManager = Gtk::UIManager::create();
	refUIManager->insert_action_group(refActionGroup);

	add_accel_group(refUIManager->get_accel_group());

	Glib::ustring ui_info = "<ui>"
			"  <menubar name='MenuBar'>"
			"    <menu action='FileMenu'>"
			"      <separator/>"
			"      <menuitem action='FileExit'/>"
			"    </menu>"
			"    <menu action='HelpMenu'>"
			"      <menuitem action='HelpAbout'/>"
			"    </menu>"
			"  </menubar>"
			"</ui>";

	try {
		refUIManager->add_ui_from_string(ui_info);
	} catch (const Glib::Error& ex) {
		std::cerr << "building menus failed: " << ex.what();
	}

	Gtk::Widget* pMenubar = refUIManager->get_widget("/MenuBar");
	if (pMenubar) {
		vMainBox.pack_start(*pMenubar, Gtk::PACK_SHRINK);
	}
	vMainBox.pack_start(paned, Gtk::PACK_EXPAND_WIDGET);

	add(vMainBox);

	paned.set_hexpand(true);
	paned.set_vexpand(true);

	scrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
	scrolledWindow.add(treeView);

	treeModel = Gtk::ListStore::create(modelColumns);

	treeView.set_model(treeModel);
	//treeView.signal_selection_received().connect(sigc::mem_fun(*this, &mmWindow::on_job_selected));
	treeView.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &jobManWindow::on_job_selected_handler));

	// Show columns in the vew
	treeView.append_column("Name", modelColumns.jobName);
	treeView.get_column(0)->set_expand(true);
	treeView.append_column("Running", modelColumns.someInstanceRunning);
	treeView.append_column("Manual\n(Disabled)", modelColumns.setToManual);
	treeView.append_column("Description", modelColumns.description);
	treeView.get_column(3)->set_expand(true);

	paned.pack1(scrolledWindow, Gtk::FILL);

	scrolledWindowLabel.add(detailsLabel);

	hBoxRightButtons.pack_start(buttonStart, true, true, 2);
	hBoxRightButtons.pack_start(buttonRestart, true, true, 2);
	hBoxRightButtons.pack_start(buttonStop, true, true, 2);

	hBoxRightLower.pack_start(buttonSetManual, true, true, 2);

	hBoxRightLower.pack_start(buttonReefresh, true, true, 2);

	vBoxRightOuter.pack_start(scrolledWindowLabel, true, true, 2); // add(detailsLabel);
	vBoxRightOuter.pack_start(hBoxRightButtons, false, true, 2);
	vBoxRightOuter.pack_start(hBoxRightLower, false, true, 2);

	buttonStart.set_label("Start");
	buttonRestart.set_label("Restart");
	buttonStop.set_label("Stop");
	buttonSetManual.set_label("Enable (remove manual)");
	buttonReefresh.set_label("Refresh list");

	// Initially buttons are disabled, and label is empty:
	initRightPanel();

	buttonReefresh.signal_clicked().connect(sigc::mem_fun(*this, &jobManWindow::on_refresh_clicked));
	buttonStart.signal_clicked().connect(sigc::mem_fun(*this, &jobManWindow::on_start_clicked));
	buttonRestart.signal_clicked().connect(sigc::mem_fun(*this, &jobManWindow::on_restart_clicked));
	buttonStop.signal_clicked().connect(sigc::mem_fun(*this, &jobManWindow::on_stop_clicked));
	buttonSetManual.signal_clicked().connect(sigc::mem_fun(*this, &jobManWindow::on_set_manual_clicked));

	//detailsLabel.set_markup("&lt;empty&gt;");
	detailsLabel.set_line_wrap(true);
	detailsLabel.set_use_markup(true);
	detailsLabel.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START);

	paned.pack2(vBoxRightOuter, Gtk::FILL);

	services.loadUpstartJobs();

	show_all_children();

}
예제 #9
0
파일: main.c 프로젝트: PamC/VSPlugin
int main(int argc, char **argv) {
	shutdown = false;

	//Create a screen context that will be used to create an EGL surface to to receive libscreen events
	screen_create_context(&screen_cxt, 0);

	//Initialize BPS library
	bps_initialize();

	//Determine initial orientation angle
	orientation_direction_t direction;
	orientation_get(&direction, &orientation_angle);

	//Use utility code to initialize EGL for rendering with GL ES 1.1
	if (EXIT_SUCCESS != bbutil_init_egl(screen_cxt, GL_ES_1)) {
		fprintf(stderr, "bbutil_init_egl failed\n");
		bbutil_terminate();
		screen_destroy_context(screen_cxt);
		return 0;
	}

	//Initialize application logic
	if (EXIT_SUCCESS != init_blocks()) {
		fprintf(stderr, "initialize failed\n");
		bbutil_terminate();
		screen_destroy_context(screen_cxt);
		return 0;
	}

	//Signal BPS library that navigator and screen events will be requested
	if (BPS_SUCCESS != screen_request_events(screen_cxt)) {
		fprintf(stderr, "screen_request_events failed\n");
		bbutil_terminate();
		screen_destroy_context(screen_cxt);
		return 0;
	}

	if (BPS_SUCCESS != navigator_request_events(0)) {
		fprintf(stderr, "navigator_request_events failed\n");
		bbutil_terminate();
		screen_destroy_context(screen_cxt);
		return 0;
	}

	//Signal BPS library that navigator orientation is not to be locked
	if (BPS_SUCCESS != navigator_rotation_lock(false)) {
		fprintf(stderr, "navigator_rotation_lock failed\n");
		bbutil_terminate();
		screen_destroy_context(screen_cxt);
		return 0;
	}

	//Setup Sensors
	if (sensor_is_supported(SENSOR_TYPE_AZIMUTH_PITCH_ROLL)) {
		//Microseconds between sensor reads. This is the rate at which the
		//sensor data will be updated from hardware. The hardware update
		//rate is set below using sensor_set_rate.
		static const int SENSOR_RATE = 25000;

		//Initialize the sensor by setting the rates at which the
		//sensor values will be updated from hardware
		sensor_set_rate(SENSOR_TYPE_AZIMUTH_PITCH_ROLL, SENSOR_RATE);

		sensor_set_skip_duplicates(SENSOR_TYPE_AZIMUTH_PITCH_ROLL, true);
		sensor_request_events(SENSOR_TYPE_AZIMUTH_PITCH_ROLL);
	} else {
		set_gravity(0.0f, -1.0f);
	}

	//Start with one cube on the screen
	add_cube(200, 100);

	int i = 0;

	while (!shutdown) {


		i = check(1);

		// Handle user input and sensors
		handle_events();

		//Update cube positions
		update();

		// Draw Scene
		render();
	}

	//Stop requesting events from libscreen
	screen_stop_events(screen_cxt);

	//Shut down BPS library for this process
	bps_shutdown();

	//Free app data
	free(boxes);

	//Use utility code to terminate EGL setup
	bbutil_terminate();

	//Destroy libscreen context
	screen_destroy_context(screen_cxt);
	return 0;
}