コード例 #1
0
ファイル: Looper.cpp プロジェクト: saltisgood/XD-Input
void Hook::Remapper::remapPriv(Hook::ControllerState &state) const
{
	ControllerState swapState(state);

	for (auto& iter : mMappings)
	{
		setButtonValue(state, iter.first, getButtonValue(swapState, iter.second));
	}
}
コード例 #2
0
ファイル: ofxGamepad.cpp プロジェクト: Gahzi/ofxGamepad
void ofxGamepad::draw(int x, int y)
{
	int curX=0;
	int highestY;

	ofPushMatrix();
	ofTranslate(x, y);
	ofSetColor(255);
	ofPushMatrix();
	ofRotate(90);
	ofDrawBitmapString(name+" ("+ofToString(id)+")", 0, 0);
	ofPopMatrix();
	curX=17;

	int margin=3;
	ofRectangle axisSize(curX,0,85, 17);
	for(int i=0; i<getNumAxis(); i++) {
		ofSetColor(70);
		ofRect(axisSize);
		ofSetColor(255);
		float x =  ofMap(getAxisValue(i), -1, 1, axisSize.x, axisSize.width+axisSize.x);
		ofLine(x, axisSize.y, x, axisSize.y+axisSize.height);
		ofSetColor(20);
		ofDrawBitmapString(ofToString(i), axisSize.x, axisSize.y+axisSize.height-1);
		axisSize.y+=axisSize.height+margin;
		if(axisSize.y>highestY)
			highestY=axisSize.y;
	}

	curX+=axisSize.width+margin;
	ofRectangle btnSize(curX,0,17,17);
	for(int i=0; i<getNumButtons(); i++) {
		if(getButtonValue(i))
			ofSetColor(255);
		else
			ofSetColor(70);
		ofRect(btnSize);
		btnSize.y+=btnSize.height+margin;
		ofSetColor(20);
		ofDrawBitmapString(ofToString(i), btnSize.x, btnSize.y-4);
		if(btnSize.y>highestY)
			highestY=axisSize.y;
	}
	curX+=btnSize.width;

	ofPopMatrix();

	drawSize.x=curX;
	drawSize.y=highestY;
}
コード例 #3
0
void WebDB::setDimmerValue(uint _id, uchar val)
{
	if (_id < getDBButtonMaxRecords())
	{
		recordButton = &m_button;
		getButtonValue(_id);
		contador = 0;
		recordButton->dimmerValue = val;
		for( int j = getDBButtonStart() + (sizeof(DBButtonRecord) * _id);
			j < getDBButtonStart() + ((sizeof(DBButtonRecord) * _id) + sizeof(DBButtonRecord)); j++)
		{
			EEPROM.write(j, ((uchar*)recordButton)[contador]);
			contador++;
		}
	}
}