예제 #1
0
	virtual Binding GetTextureBinding(texture_id_t id)
	{
		std::map<CStrIntern, std::pair<GLenum, int> >::iterator it = m_Samplers.find(CStrIntern(id));
		if (it == m_Samplers.end())
			return Binding();
		else
			return Binding((int)it->second.first, it->second.second);
	}
예제 #2
0
	virtual Binding GetUniformBinding(CStrIntern id)
	{
		std::map<CStrIntern, std::pair<int, GLenum> >::iterator it = m_Uniforms.find(id);
		if (it == m_Uniforms.end())
			return Binding();
		else
			return Binding(it->second.first, (int)it->second.second);
	}
예제 #3
0
	virtual Binding GetTextureBinding(texture_id_t id)
	{
		int index = GetUniformFragmentIndex(CStrIntern(id));
		if (index == -1)
			return Binding();
		else
			return Binding((int)GL_TEXTURE_2D, index);
	}
bool QtBoostIntegrationBindingObject::bind(QObject *sender, const char *signal,
                         QObject *receiver, QtBoostAbstractConnectionAdapter *adapter,
#ifdef QTBOOSTINTEGRATION_CHECK_SIGNATURE
                         int nrArguments, int argumentList[],
#endif
                         Qt::ConnectionType connType)
{
    if (!sender || !signal || !adapter)
        return false;

    int signalIndex = sender->metaObject()->indexOfSignal(&signal[1]);
    if (signalIndex < 0) {
        qWarning("qtlambda::connect(): no match for signal '%s'", signal);
        return false;
    }

    Q_ASSERT_X(!receiver || receiver->thread() == thread(),
               "qtlambda::connect", "The receiving QObject must be on the thread connect() is called in");

#ifdef QTBOOSTINTEGRATION_CHECK_SIGNATURE
    QByteArray signalSignature = sender->metaObject()->normalizedSignature(signal);
    QByteArray adapterSignature = buildAdapterSignature(nrArguments, argumentList);

    if (!QMetaObject::checkConnectArgs(signalSignature, adapterSignature))
        return false;
#endif

    // locate a free slot
    int slotIndex = m_freeList.isEmpty() ? m_bindings.size() : m_freeList.takeLast();

    // wire up the connection from the binding object to the sender
    bool connected = QMetaObject::connect(sender, signalIndex, this, slotIndex + bindingOffset(), connType);
    if (!connected)
        return false;

    // store the binding
    if (slotIndex == m_bindings.size())
        m_bindings.append(Binding(sender, signalIndex, receiver, adapter));
    else
        m_bindings[slotIndex] = Binding(sender, signalIndex, receiver, adapter);

    auto sender_d = getObjectData(sender, true);
    auto receiver_d = (receiver && receiver != sender) ? getObjectData(receiver, true) : 0;
    Q_ASSERT(sender_d);
    BindingList::add(sender_d->receivers, slotIndex);
    if (receiver_d) {
        BindingList::add(receiver_d->senders, slotIndex);

        // make the sender and the receiver aware of each other
        receiver_d->senders->other = sender_d->receivers;
        sender_d->receivers->other = receiver_d->senders;
    }

    static_cast<ConnectNotifyObject *>(sender)->callConnectNotify(signal);
    return true;
}
예제 #5
0
ClientConnection::ClientConnection(TCPsocket sock, ClientManager *manager) :
		socket(sock), status(0), manager(manager)
{
	printf("ClientConnection()\n");

	bindings[SDLK_LEFT]  = bindings[SDLK_a] = Binding(&Entity::left, 200);
	bindings[SDLK_RIGHT] = bindings[SDLK_d] = Binding(&Entity::right, 200);
	bindings[SDLK_UP]    = bindings[SDLK_w] = Binding(&Entity::up, 200);
	bindings[SDLK_DOWN]  = bindings[SDLK_s] = Binding(&Entity::down, 200);

	bindings[SDLK_SPACE] = bindings[SDLK_e] = Binding(&Entity::prepare_action, &Entity::action);
	bindings[SDLK_LSHIFT]= bindings[SDLK_f] = Binding(&Entity::prepare_grab, &Entity::grab);
	bindings[SDLK_LCTRL] = bindings[SDLK_g] = Binding(&Entity::prepare_drop, &Entity::drop);
	bindings[SDLK_LALT]  = bindings[SDLK_q] = Binding(&Entity::prepare_swap, &Entity::swap);

	name = SDLNet_ResolveIP(SDLNet_TCP_GetPeerAddress(socket));
	update_entity_connection();

	old_x = get_x();
	old_y = get_y();

	send_mutex = SDL_CreateMutex();
	messages_mutex = SDL_CreateMutex();

	send_thread = SDL_CreateThread(send_thread_func, this);
	recieve_thread = SDL_CreateThread(recieve_thread_func, this);

	char data[] = { 'b', 151, 130, 42 }; // set background
	int len = sizeof(data);
	send(data, len);
}
예제 #6
0
void
S9xProcessEvents (bool8 block)
{
#ifdef USE_JOYSTICK
    JoyEvent event;
    Binding  binding;

    if (S9xGrabJoysticks ())
    {
        for (int i = 0; gui_config->joystick[i]; i++)
        {
            while (gui_config->joystick[i]->get_event (&event))
            {
                binding = Binding (i, event.parameter, 0);
                S9xReportButton (binding.hex (), event.state == JOY_PRESSED ? 1 : 0);
                gui_config->screensaver_needs_reset = TRUE;
            }
        }

        S9xReleaseJoysticks ();
    }
#endif

    return;
}
// -----------------------------------------------------------------------------
// CRegBindingImplementation::HandleError
// -----------------------------------------------------------------------------
//
TBool
CRegBindingImplementation::HandleError(CConnectionCallback& aCallback,
                                       TInt aError,
                                       TUint32 aRequestId,
                                       const CRegistrationState& aUnregistered)
    {
    __TEST_INVARIANT;
    __SIP_ASSERT_RETURN_VALUE(aError != KErrNone, EFalse);

    RemoveRegisteredContact();
	ChangeState(&aUnregistered);

	CConnectionCallback::TCallbackMethod callback =
		CConnectionCallback::EErrorOccuredInRegistration;	
	CSIPClientTransaction* ta = FindTransaction(aRequestId);
    if (ta)
        {
        ta->ChangeState(CSIPTransactionBase::ETerminated);
        callback =
        	CConnectionCallback::EErrorOccuredInRegistrationWithTransaction;
        }

	aCallback.Set(callback, ta, &Binding(), NULL, NULL, aError);

	__TEST_INVARIANT;
    return ETrue;
    }
예제 #8
0
static gboolean
poll_joystick (gpointer data)
{
    Snes9xPreferences *window = (Snes9xPreferences *) data;
    JoyEvent          event;
    Binding           binding;
    int               i, focus;

    for (i = 0; window->config->joystick[i]; i++)
    {
        while (window->config->joystick[i]->get_event (&event))
        {
            if (event.state == JOY_PRESSED)
            {
                if ((focus = window->get_focused_binding ()) >= 0)
                {
                    binding = Binding (i,
                                       event.parameter,
                                       window->config->joystick_threshold);

                    window->store_binding (b_links[focus].button_name,
                                           binding);

                    window->config->flush_joysticks ();
                    return TRUE;
                }

            }
        }
    }

    return TRUE;
}
예제 #9
0
파일: baseTexture.cpp 프로젝트: 400dama/USD
/* virtual */
GlfTexture::BindingVector
GlfBaseTexture::GetBindings(TfToken const & identifier,
                             GLuint samplerName) const
{
    return BindingVector(1,
                Binding(identifier, GlfTextureTokens->texels,
                        GL_TEXTURE_2D, _textureName, samplerName));
}
예제 #10
0
    void Container::bindAs(){
        bool tests = type_tests<T,Contract>(); // Compile time tests.
        (void) tests; //fix unused variable warning
        must_not_have<Contract>(); // A contract can't be registered twice

        typeMap[std::type_index(typeid(Contract))]
                = Binding(std::type_index(typeid(T)), false);
    }
예제 #11
0
    void Container::bindAsNothing(){
        bool tests = reduced_type_tests<T>(); // Compile time tests.
        (void) tests; //fix unused variable warning
        must_not_have<T>(); // A Concrete type can't be registered twice.


        typeMap[std::type_index(typeid(T))]
                = Binding(std::type_index(typeid(T)), false);
    }
T_tree insert(string key, void *value, T_tree t) {
  if (t==NULL) {

    return Tree(NULL, Binding(key, value), NULL);

  } else if (strcmp(key, t->binding->key) < 0) {

    return Tree(insert(key, value, t->left), t->binding, t->right);

  } else if (strcmp(key, t->binding->key) > 0) {

    return Tree(t->left, t->binding, insert(key, value, t->right));

  } else {

    return Tree(t->left, Binding(key, value), t->right);
  }
}
void FMovieSceneMultiPropertyRecorder::CreateSection(UObject* InObjectToRecord, class UMovieScene* InMovieScene, const FGuid& Guid, float Time)
{
	ObjectToRecord = InObjectToRecord;

	// collect all properties to record from classes we are recording
	TArray<FName> PropertiesToRecord;

	const FPropertiesToRecordForClass* PropertiesToRecordForClassPtr = nullptr;
	const USequenceRecorderSettings* Settings = GetDefault<USequenceRecorderSettings>();
	for (const FPropertiesToRecordForClass& PropertiesToRecordForClass : Settings->ClassesAndPropertiesToRecord)
	{
		if (*PropertiesToRecordForClass.Class == InObjectToRecord->GetClass() && PropertiesToRecordForClass.Properties.Num() > 0)
		{
			PropertiesToRecord.Append(PropertiesToRecordForClass.Properties);
		}
	}

	// create a recorder for each property name
	for (const FName& PropertyName : PropertiesToRecord)
	{
		FTrackInstancePropertyBindings Binding(PropertyName, PropertyName.ToString());
		Binding.UpdateBinding(InObjectToRecord);
		UProperty* Property = Binding.GetProperty(InObjectToRecord);
		if (Property != nullptr)
		{
			if (Property->IsA<UBoolProperty>())
			{
				PropertyRecorders.Add(MakeShareable(new FMovieScenePropertyRecorder<bool>(Binding)));
			}
			else if (Property->IsA<UByteProperty>())
			{
				PropertyRecorders.Add(MakeShareable(new FMovieScenePropertyRecorder<uint8>(Binding)));
			}
			else if (Property->IsA<UFloatProperty>())
			{
				PropertyRecorders.Add(MakeShareable(new FMovieScenePropertyRecorder<float>(Binding)));
			}
			else if (UStructProperty* StructProperty = Cast<UStructProperty>(Property))
			{
				if (StructProperty->Struct->GetFName() == NAME_Vector)
				{
					PropertyRecorders.Add(MakeShareable(new FMovieScenePropertyRecorder<FVector>(Binding)));
				}
				else if (StructProperty->Struct->GetFName() == NAME_Color)
				{
					PropertyRecorders.Add(MakeShareable(new FMovieScenePropertyRecorder<FColor>(Binding)));
				}
			}

			PropertyRecorders.Last()->Create(InObjectToRecord, InMovieScene, Guid, Time);
		}
	}
}
예제 #14
0
static gboolean
event_key_press (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
    Binding           key_binding;
    int               focus;
    GtkNotebook       *notebook;
    GtkToggleButton   *toggle;
    Snes9xPreferences *window = (Snes9xPreferences *) user_data;

    if ((focus = window->get_focused_binding ()) < 0)
    {
        return FALSE; /* Don't keep key for ourselves */
    }

    /* Allow modifier keys to be used if page is set to the joypad bindings. */
    notebook = GTK_NOTEBOOK (window->get_widget ("preferences_notebook"));
    toggle = GTK_TOGGLE_BUTTON (window->get_widget ("use_modifiers"));

    if (gtk_notebook_get_current_page (notebook) != 4 ||
        !gtk_toggle_button_get_active (toggle))
    {
        /* Don't allow modifiers that we track to be bound */
        if (event->keyval == GDK_Control_L ||
            event->keyval == GDK_Control_R ||
            event->keyval == GDK_Shift_L   ||
            event->keyval == GDK_Shift_R   ||
            event->keyval == GDK_Alt_L     ||
            event->keyval == GDK_Alt_R)
        {
            return FALSE;
        }
    }

    key_binding = Binding (event);

    /* Allows ESC key to clear the key binding */
    if (event->keyval == GDK_Escape)
    {
        if (event->state & GDK_SHIFT_MASK)
        {
            key_binding.clear ();
        }
        else
        {
            window->focus_next ();
            return TRUE;
        }
    }

    window->store_binding (b_links[focus].button_name, key_binding);

    return TRUE;
}
예제 #15
0
Binding S9xGetBindingByName (const char *name)
{
    for (int i = 0; i < NUM_EMU_LINKS; i++)
    {
        if (!strcasecmp (b_links[i + NUM_JOYPAD_LINKS].snes9x_name, name))
        {
            return gui_config->shortcut[i];
        }
    }

    return Binding ();
}
예제 #16
0
int
Snes9xConfig::parse_binding (xmlNodePtr node, int joypad_number)
{
    char    *name = NULL;
    char    *type = NULL;
    Binding b;

    for (xmlAttrPtr attr = node->properties; attr; attr = attr->next)
    {
        if (!xmlStrcasecmp (attr->name, BAD_CAST "name"))
            name = (char *) attr->children->content;

        else if (!xmlStrcasecmp (attr->name, BAD_CAST "binding"))
            type = (char *) attr->children->content;
    }

    b = Binding ((unsigned int) strtoul (type, NULL, 10));

    if (joypad_number > -1 && joypad_number < NUM_JOYPAD_LINKS)
    {
        for (int i = 0; i < NUM_JOYPAD_LINKS; i++)
        {
            if (!strcasecmp (b_links[i].snes9x_name, name))
            {
                Binding *buttons = (Binding *) &pad[joypad_number];

                if (b.is_key () || b.is_joy ())
                    buttons[i] = b;
                else
                    buttons[i].clear ();
            }
        }
    }
    else
    {
        for (int i = NUM_JOYPAD_LINKS; b_links[i].snes9x_name; i++)
        {
            if (!strcasecmp (b_links[i].snes9x_name, name))
            {
                if (b.is_key () || b.is_joy ())
                    shortcut[i - NUM_JOYPAD_LINKS] = b;
                else
                    shortcut[i - NUM_JOYPAD_LINKS].clear ();

            }
        }
    }

    return 0;
}
예제 #17
0
파일: CVar.cpp 프로젝트: Antidote/Orion
CVar::Binding CVar::toBinding(bool* isValid) const
{
    if (m_type != Bind)
    {
        if (com_developer && com_developer->toBoolean())
            orConsoleRef.print(orConsoleRef.Warning, "CVar %s is not a binding", name().c_str());

        if (isValid != NULL)
            *isValid = false;

        return Binding();
    }

    if (isValid != NULL)
        *isValid = true;

    return m_binding;
}
inline void QtBoostIntegrationBindingObject::unbindHelper(BindingList *bindings, const T &checkFn)
{
    for (auto binding = bindings; binding; ) {
        auto next = binding->next;
        auto &b = m_bindings[binding->id];
        int id = binding->id;

        if (checkFn(b, id)) {
            Q_ASSERT(b.signalIndex >= 0);
            delete b.adapter;
            m_bindings[id] = Binding();
            m_freeList.push_back(id);

            if (binding->other)
                binding->other->remove();
            binding->remove();
        }

        binding = next;
    }
}
예제 #19
0
////////////////////////////////////////////////////////////////////////////////
// publishInternal
BcBool EvtPublisher::publishInternal( EvtID ID, const EvtBaseEvent& EventBase, BcSize EventSize, BcBool AllowProxy )
{
	BcAssert( BcIsGameThread() );
	BcUnusedVar( EventSize );

#if PSY_USE_PROFILER
	PSY_PROFILER_INSTANT_EVENT( boost::str( boost::format( "EvtPublisher::publishInternal( ID: %1%, Size: %2% )" ) % ID % EventSize ) );
#endif

	// Proxy event through all attached proxies if this event allows it.
	if( AllowProxy == BcTrue )
	{
		for( TProxyListIterator It( Proxies_.begin() ); It != Proxies_.end(); ++It )
		{	
			EvtProxy* pProxy( *It );
			eEvtReturn RetVal = pProxy->proxy( ID, EventBase, EventSize );

			switch( RetVal )
			{
			// Event passed. Publisher, or next proxy can deal with it.
			case evtRET_PASS:
				break;
			// Event blocked. If we are a parent, we want our child publisher to abort (normal behaviour).
			case evtRET_BLOCK:
				return BcFalse;
				break;
			// Unsupported enum value.
			default:
				BcBreakpoint;
				break;
			}
		}
	}

	// Update binding map before going ahead.
	updateBindingMap();
	
	// If we have a parent, publish to them first.
	BcBool ShouldPublish = BcTrue;
	
	if( pParent_ != NULL )
	{
		ShouldPublish = pParent_->publishInternal( ID, EventBase, EventSize );
	}

	// Only publish if the previous call to our parent allows us to.
	if( ShouldPublish == BcTrue )
	{
		// Find the appropriate binding list.
		TBindingListMapIterator BindingListMapIterator = BindingListMap_.find( ID );
		
		// Add list if we need to, and grab iterator.
		if( BindingListMapIterator != BindingListMap_.end() )
		{
			// Iterate over all bindings in list and call.
			TBindingList& BindingList = BindingListMapIterator->second;
			TBindingListIterator Iter = BindingList.begin();
			
			while( Iter != BindingList.end() )
			{
				EvtBinding& Binding = (*Iter);
				
				// Call binding and handle it's return.
				eEvtReturn RetVal = Binding( ID, EventBase );
				switch( RetVal )
				{
					case evtRET_PASS:
						++Iter;
						break;

					case evtRET_BLOCK:
						return BcFalse;
						break;

					case evtRET_REMOVE:
						Iter = BindingList.erase( Iter );
						break;
						
					default:
						BcBreakpoint;
						break;
				}
			}
		}
	}

	return BcTrue;
}
예제 #20
0
	virtual Binding GetUniformBinding(uniform_id_t id)
	{
		CStrIntern idIntern(id);
		return Binding(GetUniformVertexIndex(idIntern), GetUniformFragmentIndex(idIntern));
	}
예제 #21
0
	virtual Binding GetUniformBinding(CStrIntern id)
	{
		return Binding(GetUniformVertexIndex(id), GetUniformFragmentIndex(id));
	}
예제 #22
0
	virtual Binding GetUniformBinding(uniform_id_t id)
	{
		return Binding(-1, GetUniformIndex(id));
	}
예제 #23
0
////////////////////////////////////////////////////////////////////////////////
// publishInternal
BcBool EvtPublisher::publishInternal( EvtID ID, const EvtBaseEvent& EventBase, BcSize EventSize )
{
	BcAssert( BcIsGameThread() );
	BcUnusedVar( EventSize );
	
	/*
	{
		BcChar PrefixA = ( ID >> 24 ) & 0xff;
		BcChar PrefixB = ( ID >> 16 ) & 0xff;
		BcU32 Group = ( ID >> 8 ) & 0xff;
		BcU32 Item = ( ID ) & 0xff;
		
		BcPrintf( "EvtPublish: %x, \"%c%c\": Group=%u Item=%u\n", ID, PrefixA, PrefixB, Group, Item );
	}
	 //*/

	// Update binding map before going ahead.
	updateBindingMap();
	
	// If we have a parent, publish to them first.
	BcBool ShouldPublish = BcTrue;
	
	if( pParent_ != NULL )
	{
		ShouldPublish = pParent_->publishInternal( ID, EventBase, EventSize );
	}

	// Only publish if the previous call to our parent allows us to.
	if( ShouldPublish == BcTrue )
	{
		// Find the appropriate binding list.
		TBindingListMapIterator BindingListMapIterator = BindingListMap_.find( ID );
		
		// Add list if we need to, and grab iterator.
		if( BindingListMapIterator != BindingListMap_.end() )
		{
			// Iterate over all bindings in list and call.
			TBindingList& BindingList = BindingListMapIterator->second;
			TBindingListIterator Iter = BindingList.begin();
			
			while( Iter != BindingList.end() )
			{
				EvtBinding& Binding = (*Iter);
				
				// Call binding and handle it's return.
				eEvtReturn RetVal = Binding( ID, EventBase );
				switch( RetVal )
				{
					case evtRET_PASS:
						++Iter;
						break;

					case evtRET_BLOCK:
						return BcFalse;
						break;

					case evtRET_REMOVE:
						Iter = BindingList.erase( Iter );
						break;
						
					default:
						BcBreakpoint;
						break;
				}
			}
		}
	}

	return BcTrue;
}
예제 #24
0
void PlayerAI::LoadBindings()
{
	TiXmlDocument doc("Controls.xml");
	bool xml_error = false;
	if(doc.LoadFile())
	{
		TiXmlElement* root = doc.FirstChildElement("Controls");
		if(root)
		{
			TiXmlElement* player = root->FirstChildElement("PlayerBindings");
			while(player)
			{
				int player_id = 0;
				if(player->QueryIntAttribute("id", &player_id) == TIXML_SUCCESS)
				{
					TiXmlElement* ic = player->FirstChildElement("InputConfig");
					while(ic)
					{
						std::string action_string;
						if(ic->QueryValueAttribute("Action", &action_string) != TIXML_SUCCESS)
						{
							Logger::ErrorOut() << "Error reading action attribute, continuing\n";
							continue;
						}
						std::string binding_type_string;
						if(ic->QueryValueAttribute("BindingType", &binding_type_string) != TIXML_SUCCESS)
						{
							Logger::ErrorOut() << "Error reading binding attribute, continuing\n";
							continue;
						}
						
						Action::Enum action = Action::FromStr(action_string);
						BindingType::Enum binding_type = BindingType::FromStr(binding_type_string);
						TiXmlElement* binding = ic->FirstChildElement("Binding");
						if(binding)
						{
							switch(binding_type)
							{
								case BindingType::KeyboardBinding:
									{
										int key = 0;
										if(binding->QueryValueAttribute("Key", &key) == TIXML_SUCCESS)
										{
											bindings[player_id].push_back(InputConfig(binding_type, Binding((SDLKey)key), action));
										} else
										{
											Logger::ErrorOut() << "Missing Key attribute, continuing\n";
											continue;
										}
									}
									break;
								case BindingType::JoystickButtonBinding:
									{
										int joystick_index = 0;
										int joystick_button_index = 0;
										if(binding->QueryValueAttribute("JoystickIndex", &joystick_index) == TIXML_SUCCESS && 
										   binding->QueryValueAttribute("JoystickButton", &joystick_button_index) == TIXML_SUCCESS)
										{
											bindings[player_id].push_back(InputConfig(binding_type, Binding(JoystickButton::Create(joystick_index, joystick_button_index)), action));
										} else
										{
											Logger::ErrorOut() << "Missing JoystickIndex or JoystickButton atttribute, continuing\n";
										}
									}
									break;
								case BindingType::JoystickAxisBinding:
									{
										int joystick_index = 0;
										int joystick_axis_index = 0;
										if(binding->QueryValueAttribute("JoystickIndex", &joystick_index) == TIXML_SUCCESS && 
										   binding->QueryValueAttribute("JoystickAxis", &joystick_axis_index) == TIXML_SUCCESS)
										{
											bindings[player_id].push_back(InputConfig(binding_type, Binding(JoystickAxis::Create(joystick_index, joystick_axis_index)), action));
										} else
										{
											Logger::ErrorOut() << "Missing JoystickIndex or JoystickAxis atttribute, continuing\n";
										}
									}
									break;
								case BindingType::MouseAxisBinding:
									{
										std::string axis;
										if(binding->QueryValueAttribute("MouseAxis", &axis) == TIXML_SUCCESS)
										{
											MouseAxis::Enum mouse_axis = MouseAxis::FromStr(axis);
											if(mouse_axis != MouseAxis::InvalidFirst && mouse_axis != MouseAxis::InvalidLast)
											{
												bindings[player_id].push_back(InputConfig(binding_type, Binding(mouse_axis), action));
											} else
											{
												Logger::ErrorOut() << "MouseAxis attribute incorrect: " << axis << "\n";
											}
										} else
										{
											Logger::ErrorOut() << "Missing MouseAxis attribute\n";
										}
									}
									break;
								case BindingType::MouseButtonBinding:
									{
										std::string button;
										if(binding->QueryValueAttribute("MouseButton", &button) == TIXML_SUCCESS)
										{
											MouseButton::Enum mouse_button = MouseButton::FromStr(button);
											if(mouse_button != MouseButton::InvalidFirst && mouse_button != MouseButton::InvalidLast)
											{
												bindings[player_id].push_back(InputConfig(binding_type, Binding(mouse_button), action));
											} else
											{
												Logger::ErrorOut() << "Missing MouseAxis attribute\n";
											}

										} else
										{
											Logger::ErrorOut() << "Missing MouseButton attribute\n";
										}
									}
									break;

							}
						} else 
						{
							xml_error = true;
							Logger::ErrorOut() << "Missing Binding element\n";
						}

						
						ic = ic->NextSiblingElement("InputConfig");
					}
					
				} else xml_error = true;
				player = player->NextSiblingElement("PlayerBindings");
			}
		} else xml_error = true;
	} else xml_error = true;
	if(xml_error)
	{
		ResetToDefault();
	}
}
예제 #25
0
void PlayerAI::ResetToDefault()
{
	bindings.clear();
	std::vector<InputConfig> p1;
	std::vector<InputConfig> p2;
	p1.push_back(InputConfig(BindingType::KeyboardBinding, Binding(SDLK_a), Action::MoveLeft));
	p1.push_back(InputConfig(BindingType::KeyboardBinding, Binding(SDLK_d), Action::MoveRight));
	p1.push_back(InputConfig(BindingType::KeyboardBinding, Binding(SDLK_w), Action::MoveUp));
	p1.push_back(InputConfig(BindingType::KeyboardBinding, Binding(SDLK_s), Action::MoveDown));
	p1.push_back(InputConfig(BindingType::MouseAxisBinding, Binding(MouseAxis::MouseX), Action::LookXAxis));
	p1.push_back(InputConfig(BindingType::MouseAxisBinding, Binding(MouseAxis::MouseY), Action::LookYAxis));
	p1.push_back(InputConfig(BindingType::KeyboardBinding, Binding(SDLK_LCTRL), Action::Boost));
	p1.push_back(InputConfig(BindingType::MouseButtonBinding, Binding(MouseButton::LeftMouseButton), Action::Fire));
	p1.push_back(InputConfig(BindingType::MouseButtonBinding, Binding(MouseButton::RightMouseButton), Action::Boost));
	p1.push_back(InputConfig(BindingType::MouseButtonBinding, Binding(MouseButton::MiddleMouseButton), Action::Target));
	
	p2.push_back(InputConfig(BindingType::JoystickAxisBinding, Binding(JoystickAxis::Create(0,0)), Action::XMovement));
	p2.push_back(InputConfig(BindingType::JoystickAxisBinding, Binding(JoystickAxis::Create(0,1)), Action::YMovement));
	p2.push_back(InputConfig(BindingType::JoystickAxisBinding, Binding(JoystickAxis::Create(0,0)), Action::LookXAxis));
	p2.push_back(InputConfig(BindingType::JoystickAxisBinding, Binding(JoystickAxis::Create(0,1)), Action::LookYAxis));
	p2.push_back(InputConfig(BindingType::JoystickButtonBinding, Binding(JoystickButton::Create(0,0)), Action::Fire));
	p2.push_back(InputConfig(BindingType::JoystickButtonBinding, Binding(JoystickButton::Create(0,1)), Action::Boost));
	p2.push_back(InputConfig(BindingType::JoystickButtonBinding, Binding(JoystickButton::Create(0,2)), Action::LockAngle));
	p2.push_back(InputConfig(BindingType::JoystickButtonBinding, Binding(JoystickButton::Create(0,3)), Action::LockMovement));
	p2.push_back(InputConfig(BindingType::JoystickButtonBinding, Binding(JoystickButton::Create(0,5)), Action::LookBackwards));

	bindings[0] = p1;
	bindings[1] = p2;
}
예제 #26
0
파일: binding.hpp 프로젝트: anrl/freeflow
// Push a partial binding into the binding list. 
inline void 
Binding_list::push(std::uint16_t n)
{
  assert(!is_full());
  bindings[++current] = Binding(n);
}