本文整理汇总了C++中setFunction函数的典型用法代码示例。如果您正苦于以下问题:C++ setFunction函数的具体用法?C++ setFunction怎么用?C++ setFunction使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setFunction函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: StateBase
CourseMenu::CourseMenu(fw::GameBase& game)
: StateBase(game)
, courseMenu_({ game.getWindow().getSize().x / 2.f, 90.f })
{
std::string coursesText = framework::loadTextFromFile("data/courses.txt");
std::vector<std::string> coursesLines = framework::getLinesFromText(coursesText);
for(const auto line : coursesLines)
{
auto button = std::make_unique<fw::gui::Button>();
button->setText(line);
button->setFunction([&] ()
{
// empty action
});
courseMenu_.addWidget(std::move(button));
}
auto bback = std::make_unique<fw::gui::Button>();
bback->setText("Back");
bback->setFunction([&]()
{
game_.popState();
});
courseMenu_.addWidget(std::move(bback));
}
开发者ID:kubatrt,项目名称:KeyboardMaster,代码行数:27,代码来源:CourseMenu.cpp
示例2: if
void fitDialog::showExpression(int function)
{
if (categoryBox->currentItem() == 2)
{
explainBox->setText(myParser::explainFunction(function));
}
else if (categoryBox->currentItem() == 1)
{
explainBox->setText(builtInFunctions[function]);
setFunction(boxUseBuiltIn->isChecked());
}
else if (categoryBox->currentItem() == 0)
{
QStringList l = QStringList::split("=", userFunctions[function], true);
explainBox->setText(l[1]);
setFunction(boxUseBuiltIn->isChecked());
}
else if (categoryBox->currentItem() == 3)
{
if ((int)pluginFunctions.size() > 0)
{
explainBox->setText(pluginFunctions[function]);
setFunction(boxUseBuiltIn->isChecked());
}
else
explainBox->clear();
}
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:28,代码来源:fitDialog.cpp
示例3: deviceAccelerometerGetInterface
int deviceAccelerometerGetInterface(unsigned char commandHeader, DeviceInterfaceMode mode, bool fillDeviceArgumentList) {
if (commandHeader == COMMAND_ACCELEROMETER_GET_SAMPLE_COUNT) {
if (fillDeviceArgumentList) {
setFunction("getSampleCount", 0, 1);
setResultUnsignedHex4(0, "Sample count");
}
return commandLengthValueForMode(mode, 0, 4);
}
else if (commandHeader == COMMAND_ACCELEROMETER_GET_SAMPLE_RAW_DATA) {
if (fillDeviceArgumentList) {
setFunction("Sample Raw Data", 0, 5);
setResultUnsignedHex4(0, "X Raw Data");
setResultSeparator(1);
setResultUnsignedHex4(2, "Y Raw Data");
setResultSeparator(3);
setResultUnsignedHex4(4, "Z Raw Data");
}
return commandLengthValueForMode(mode, 0, 14);
}
else if (commandHeader == COMMAND_ACCELEROMETER_GET_SAMPLE_DATA_MILLIG_G) {
if (fillDeviceArgumentList) {
setFunction("Sample Data MilliG", 0, 5);
setResultUnsignedHex4(0, "X (mG)");
setResultSeparator(1);
setResultUnsignedHex4(2, "Y (mG)");
setResultSeparator(3);
setResultUnsignedHex4(4, "Z (mG)");
}
return commandLengthValueForMode(mode, 0, 14);
}
// TRESHOLD
else if (commandHeader == COMMAND_ACCELEROMETER_GET_THRESHOLD) {
if (fillDeviceArgumentList) {
setFunction("Get Threshold", 0, 1);
setResultUnsignedHex4(0, "Threshold (milli G)");
}
return commandLengthValueForMode(mode, 0, 4);
}
else if (commandHeader == COMMAND_ACCELEROMETER_SET_THRESHOLD) {
if (fillDeviceArgumentList) {
setFunction("Set Threshold", 1, 0);
setArgumentUnsignedHex4(0, "Threshold (milliG)");
}
return commandLengthValueForMode(mode, 4, 0);
}
// DEBUG
else if (commandHeader == COMMAND_ACCELEROMETER_DEBUG_CONFIG) {
if (fillDeviceArgumentList) {
setFunctionNoArgumentAndNoResult("Debug Config");
}
return commandLengthValueForMode(mode, 0, 0);
}
else if (commandHeader == COMMAND_ACCELEROMETER_DEBUG_VALUES) {
if (fillDeviceArgumentList) {
setFunctionNoArgumentAndNoResult("Debug Values");
}
return commandLengthValueForMode(mode, 0, 0);
}
return DEVICE_HEADER_NOT_HANDLED;
}
开发者ID:svanacker,项目名称:cen-electronic,代码行数:60,代码来源:accelerometerDeviceInterface.c
示例4: deviceTestGetInterface
int deviceTestGetInterface(char commandHeader, DeviceInterfaceMode mode, bool fillDeviceArgumentList) {
if (commandHeader == COMMAND_TEST) {
if (fillDeviceArgumentList) {
setFunction("test", 2, 1);
setArgumentUnsignedHex2(0, "a");
setArgumentUnsignedHex2(1, "b");
setResultUnsignedHex2(0, "result");
}
return commandLengthValueForMode(mode, 4, 2);
}
else if (commandHeader == COMMAND_SIMPLE_TEST) {
if (fillDeviceArgumentList) {
setFunctionNoArgumentAndNoResult("simpleTest");
}
return commandLengthValueForMode(mode, 0, 0);
}
else if (commandHeader == COMMAND_HEAVY_TEST) {
if (fillDeviceArgumentList) {
setFunction("heavyTest", 10, 1);
setArgumentUnsignedHex2(0, "a");
setArgumentUnsignedHex2(1, "b");
setArgumentUnsignedHex4(2, "c");
setArgumentUnsignedHex4(3, "d");
setArgumentUnsignedHex2(4, "e");
setArgumentSeparator(5);
setArgumentUnsignedHex2(6, "f");
setArgumentUnsignedHex4(7, "g");
setArgument(8, DEVICE_ARG_UNSIGNED_HEX_6, "h");
setArgumentUnsignedHex2(9, "i");
setResult(0, DEVICE_ARG_UNSIGNED_HEX_6, "result");
}
return commandLengthValueForMode(mode, 29, 6);
}
// Debug Test
else if (commandHeader == COMMAND_DEBUG_TEST) {
if (fillDeviceArgumentList) {
setFunctionNoArgumentAndNoResult("debugTest");
}
return commandLengthValueForMode(mode, 0, 0);
}
else if (commandHeader == COMMAND_GENERATE_NOTIFY_TEST) {
if (fillDeviceArgumentList) {
setFunction("generateNotifyTest", 1, 0);
setArgumentUnsignedHex2(0, "notifyTestValue");
}
return commandLengthValueForMode(mode, 2, 0);
}
// Handle a notification test
else if (mode == DEVICE_MODE_NOTIFY) {
if (commandHeader == NOTIFY_TEST) {
if (fillDeviceArgumentList) {
setNotification("notifyTest", 1);
setArgumentUnsignedHex2(0, "notifyArg0");
}
return 2;
}
}
return DEVICE_HEADER_NOT_HANDLED;
}
开发者ID:Aveline67,项目名称:cen-electronic,代码行数:60,代码来源:testDeviceInterface.c
示例5: deserialize_symbol
Item::e_sercode Item::deserialize_function( Stream *file, VMachine *vm )
{
if ( vm == 0 )
return sc_missvm;
Symbol *sym;
LiveModule *lmod;
e_sercode sc = deserialize_symbol( file, vm, &sym, &lmod );
if ( sc != sc_ok )
return sc;
// read the function called status
if ( ! sym->isFunction() ) {
// external function
setFunction( new CoreFunc( sym, lmod ) );
return sc_ok;
}
// internal function.
FuncDef *def = sym->getFuncDef();
// read the once status
uint32 itemId = def->onceItemId();
if( itemId != FuncDef::NO_STATE )
{
byte called;
file->read( &called, 1 );
if( called )
lmod->globals()[ itemId ].setInteger( 1 );
else
lmod->globals()[ itemId ].setNil();
}
CoreFunc* function = new CoreFunc( sym, lmod );
// read the closure state.
uint32 closlen;
file->read( &closlen, sizeof( closlen ) );
if( closlen != 0 )
{
ItemArray* closure = new ItemArray( closlen );
closure->resize( closlen );
// put the state in now, so we can destroy it in case of error.
function->closure( closure );
// deserialize all the items.
for( uint32 i = 0; i < closlen; i++ ) {
Item::e_sercode res = (*closure)[i].deserialize(file, vm );
if ( res != sc_ok )
return res;
}
}
setFunction( function );
return sc_ok;
}
开发者ID:IamusNavarathna,项目名称:lv3proj,代码行数:59,代码来源:itemserial.cpp
示例6: if
void FitDialog::showExpression(int function)
{
if (function < 0)
return;
if (categoryBox->currentRow() == 2)
{
explainBox->setText(MyParser::explainFunction(function));
}
else if (categoryBox->currentRow() == 1)
{
polynomOrderLabel->show();
polynomOrderBox->show();
switch(funcBox->currentRow ()) {
case 6: // Gauss
polynomOrderLabel->setText(tr("Peaks"));
explainBox->setText(MultiPeakFit::generateFormula(polynomOrderBox->value(), MultiPeakFit::Gauss));
break;
case 7: // Lorentz
polynomOrderLabel->setText(tr("Peaks"));
explainBox->setText(MultiPeakFit::generateFormula(polynomOrderBox->value(), MultiPeakFit::Lorentz));
break;
case 8: // Polynomial
polynomOrderLabel->setText(tr("Polynomial Order"));
explainBox->setText(PolynomialFit::generateFormula(polynomOrderBox->value()));
break;
default:
polynomOrderLabel->hide();
polynomOrderBox->hide();
polynomOrderBox->setValue(1);
explainBox->setText(d_built_in_functions[function]);
}
setFunction(boxUseBuiltIn->isChecked());
}
else if (categoryBox->currentRow() == 0)
{
if (d_user_functions.size() > function) {
QStringList l = d_user_functions[function].split("=");
explainBox->setText(l[1]);
} else
explainBox->clear();
setFunction(boxUseBuiltIn->isChecked());
}
else if (categoryBox->currentRow() == 3)
{
if (d_plugin_functions.size() > 0)
{
explainBox->setText(d_plugin_functions[function]);
setFunction(boxUseBuiltIn->isChecked());
}
else
explainBox->clear();
}
}
开发者ID:rgonzga,项目名称:scidavis,代码行数:55,代码来源:FitDialog.cpp
示例7: deviceIOExpanderGetInterface
int deviceIOExpanderGetInterface(unsigned char commandHeader, DeviceInterfaceMode mode, bool fillDeviceArgumentList) {
if (commandHeader == COMMAND_IO_EXPANDER_WRITE_SINGLE_BIT) {
if (fillDeviceArgumentList) {
setFunction("Write Single Bit", 5, 0);
setArgumentUnsignedHex2(0, "IO Expander Index");
setArgumentSeparator(1);
setArgumentUnsignedHex2(2, "IO Index");
setArgumentSeparator(3);
setArgumentUnsignedChar1(4, "Value (bool)");
}
return commandLengthValueForMode(mode, 7, 0);
}
if (commandHeader == COMMAND_IO_EXPANDER_WRITE_VALUE) {
if (fillDeviceArgumentList) {
setFunction("Write Value", 3, 0);
setArgumentUnsignedHex2(0, "IO Expander Index");
setArgumentSeparator(1);
setArgumentUnsignedHex2(2, "Value");
}
return commandLengthValueForMode(mode, 5, 0);
}
else if (commandHeader == COMMAND_IO_EXPANDER_READ_SINGLE_BIT) {
if (fillDeviceArgumentList) {
setFunction("Read Single Bit", 3, 1);
setArgumentUnsignedHex2(0, "IO Expander Index");
setArgumentSeparator(1);
setArgumentUnsignedHex2(2, "IO Index");
setResultUnsignedChar1(0, "Value (bool)");
}
return commandLengthValueForMode(mode, 5, 1);
}
else if (commandHeader == COMMAND_IO_EXPANDER_READ_VALUE) {
if (fillDeviceArgumentList) {
setFunction("Read Value", 1, 1);
setArgumentUnsignedHex2(0, "IO Expander Index");
setResultUnsignedHex2(0, "Value");
}
return commandLengthValueForMode(mode, 2, 2);
}
else if (commandHeader == COMMAND_IO_EXPANDER_DEBUG) {
if (fillDeviceArgumentList) {
setFunctionNoArgumentAndNoResult("Debug as Table");
}
return commandLengthValueForMode(mode, 0, 0);
}
return DEVICE_HEADER_NOT_HANDLED;
}
开发者ID:svanacker,项目名称:cen-electronic,代码行数:48,代码来源:ioExpanderDeviceInterface.c
示例8: deviceStrategy2018GetInterface
int deviceStrategy2018GetInterface(char commandHeader, DeviceInterfaceMode mode, bool fillDeviceArgumentList) {
if (commandHeader == STRATEGY_2018_DISTRIBUTOR_DEBUG_COMMAND) {
if (fillDeviceArgumentList) {
setFunctionNoArgumentAndNoResult("Strategy 2018 Distributor Debug");;
}
return commandLengthValueForMode(mode, 0, 0);
}
else if (commandHeader == STRATEGY_2018_GET_SCORE) {
if (fillDeviceArgumentList) {
setFunction("Strategy 2018 Distributor Debug", 0, 1);
setResultUnsignedHex2(0, "score");
}
return commandLengthValueForMode(mode, 0, 2);
}
else if (commandHeader == STRATEGY_2018_READ_BALL_COLOR_TYPE) {
if (fillDeviceArgumentList) {
setFunctionNoArgumentAndNoResult("Strategy 2018 Read Color Type");;
}
return commandLengthValueForMode(mode, 0, 0);
}
else if (commandHeader == STRATEGY_2018_UNICOLOR_COMMAND) {
if (fillDeviceArgumentList) {
setFunctionNoArgumentAndNoResult("Strategy 2018 Unicolor");;
}
return commandLengthValueForMode(mode, 0, 0);
}
return DEVICE_HEADER_NOT_HANDLED;
}
开发者ID:svanacker,项目名称:cen-electronic,代码行数:29,代码来源:strategyDeviceInterface2018.c
示例9: Expression
void Expression::fromParser(const Kernel::EParser& p)
{
m_op = p.operator_name();
bool special_case = p.name() == "+";
if (p.isFunct())
{
// create the arguments first
for(Kernel::EParser::iterator it=p.begin();it!= p.end();it++)
{
if (special_case &&((**it).name() == "-" && (**it).size() == 1))
{
special_case = false;
Expression* arg = new Expression(m_namespace,**((**it).begin()));
arg->m_op = "-";
m_terms.push_back(boost::shared_ptr<Expression>(arg));
}
else
{
Expression* arg = new Expression(m_namespace,**it);
m_terms.push_back(boost::shared_ptr<Expression>(arg));
}
}
// set the function object
setFunction(p.name());
}
else
{
setVariable(p.name());
}
}
开发者ID:rrnntt,项目名称:SmallProject,代码行数:30,代码来源:Expression.cpp
示例10: miosStudio
//==============================================================================
MidiSlider::MidiSlider(MiosStudio *_miosStudio, int _num, String _functionName, int _functionArg, int _midiChannel, int initialValue, bool _vertical)
: miosStudio(_miosStudio)
, sliderNum(_num)
, vertical(_vertical)
{
addAndMakeVisible(slider = new MidiSliderComponent(T("Slider")));
slider->setSliderStyle(vertical ? MidiSliderComponent::LinearVertical : MidiSliderComponent::LinearHorizontal);
slider->addListener(this);
// only used for horizontal sliders
addAndMakeVisible(sliderFunction = new ComboBox(String::empty));
sliderFunction->addListener(this);
// restore settings
PropertiesFile *propertiesFile = MiosStudioProperties::getInstance()->getCommonSettings(true);
if( propertiesFile ) {
_functionName = propertiesFile->getValue("slider" + String(sliderNum) + "FunctionName", _functionName);
_functionArg = propertiesFile->getIntValue("slider" + String(sliderNum) + "FunctionArg", _functionArg);
_midiChannel = propertiesFile->getIntValue("slider" + String(sliderNum) + "MidiChannel", _midiChannel);
initialValue = propertiesFile->getIntValue("slider" + String(sliderNum) + "InitialValue", initialValue);
}
setFunction(_functionName, _functionArg, _midiChannel, initialValue);
if( vertical )
setSize(24, 18+80);
else
setSize(128, 24+18);
}
开发者ID:JKcompute,项目名称:395_midi_controller,代码行数:30,代码来源:MidiSlider.cpp
示例11: LineVertex
void SurfaceVisual::initialize()
{
m_VertexBuffer.resize( 4 );
m_VertexBuffer.allocHostMemory();
m_VertexBuffer[ 0 ] = LineVertex( 0.0f, 0.0f );
m_VertexBuffer[ 1 ] = LineVertex( 0.0f, 1.0f );
m_VertexBuffer[ 2 ] = LineVertex( 1.0f, 1.0f );
m_VertexBuffer[ 3 ] = LineVertex( 1.0f, 0.0f );
m_VertexBuffer.copyToDevice();
ShaderManager& shaders = engine.shaders;
m_pVertexShader =
shaders.getShader<Shader::Type::Vertex>( "line" );
m_pTessControlShader =
shaders.getShader<Shader::Type::TessellationControl>( "surface" );
m_pTessEvalShader =
Shader::fromName( Shader::Type::TessellationEvaluation, "surface" );
m_pFragmentShader =
shaders.getShader<Shader::Type::Fragment>( "line" );
// setFunction( GpuFunctionSource( 2, 3,
// "return vec3( v, 0.0 );" ) );
setFunction( GpuFunctionSource( 2, 3,
"float R = 2.0;\n"
"float rmin = 1.0;\n"
"float rmax = R;\n"
"float s = R - v.y * ( ( rmax - rmin ) * 0.5 * ( sin( t ) + 1.0 ) + rmin );\n"
"return vec3( 10.0 * v.x - sin( 0.5 * t ) * 2.0 * ( ( s / R - 1.0 ) * ( s / R - 1.0 ) ), s * 2.0 * sin( 1.0 * f_time + PERIODS * v.x * TWO_PI ), s * 2.0 * cos( 1.0 * f_time + PERIODS * v.x * TWO_PI ) );" ) );
}
开发者ID:stesim,项目名称:interplot,代码行数:29,代码来源:surfacevisual.cpp
示例12: commonBeaconDeviceGetInterface
int commonBeaconDeviceGetInterface(char commandHeader, DeviceInterfaceMode mode, bool fillDeviceArgumentList) {
// Redirection
if (commandHeader == COMMAND_REDIRECT_TO_JENNIC) {
// same output / input
if (fillDeviceArgumentList) {
setFunctionNoArgumentAndNoResult("redirectToJennic");
}
return commandLengthValueForMode(mode, 0, 0);
}
else if (commandHeader == COMMAND_LOCAL_LIGHT) {
if (fillDeviceArgumentList) {
setFunction("localLight", 1, 2);
setArgumentUnsignedHex2(2, "on/off");
}
return commandLengthValueForMode(mode, 2, 0);
}
else if (commandHeader == COMMAND_SHOW_DATA_FROM_JENNIC) {
// both input/output
if (fillDeviceArgumentList) {
setFunctionNoArgumentAndNoResult("showDataFromJennic");
}
return commandLengthValueForMode(mode, 0, 0);
}
else if (commandHeader == COMMAND_RESET_JENNIC) {
// both input/output
if (fillDeviceArgumentList) {
setFunctionNoArgumentAndNoResult("resetJennic");
}
return commandLengthValueForMode(mode, 0, 0);
}
return DEVICE_HEADER_NOT_HANDLED;
}
开发者ID:Aveline67,项目名称:cen-electronic,代码行数:33,代码来源:commonBeaconDeviceInterface.c
示例13: deviceCodersGetInterface
int deviceCodersGetInterface(char header, int mode, BOOL fillDeviceArgumentList) {
if (header == COMMAND_CLEAR_CODERS) {
// Same INPUT / OUTPUT
if (fillDeviceArgumentList) {
setFunctionNoArgument("clrCoders");
}
return 0;
} else if (header == COMMAND_GET_WHEEL_POSITION) {
if (mode == DEVICE_MODE_INPUT) {
if (fillDeviceArgumentList) {
setFunctionNoArgument("codersVal");
}
return 0;
} else if (mode == DEVICE_MODE_OUTPUT) {
if (fillDeviceArgumentList) {
setFunction("codersVal", 3);
setArgument(0, DEVICE_ARG_UNSIGNED_HEX_8, "left");
setArgumentSeparator(1);
setArgument(2, DEVICE_ARG_UNSIGNED_HEX_8, "right");
}
return 17;
}
} else if (header == COMMAND_DEBUG_GET_WHEEL_POSITION) {
// Same INPUT / OUTPUT
if (fillDeviceArgumentList) {
setFunctionNoArgument("dbgCodersVal");
}
return 0;
}
return DEVICE_HEADER_NOT_HANDLED;
}
开发者ID:hternier,项目名称:cen-electronic,代码行数:31,代码来源:codersDeviceInterface.c
示例14: OVRCreateDXGIFactory2
HRESULT APIENTRY OVRCreateDXGIFactory2(
__in UINT flags,
__in const IID &riid,
__out void **ppFactory
)
{
HRESULT result = E_FAIL;
restoreFunction( (PROC)oldCreateDXGIFactory2, oldCreateDXGIFactory2Data );
if (IN_COMPATIBILITY_MODE())
{
result = (*oldCreateDXGIFactory2)(flags, riid, ppFactory);
}
else
{
WinCreateDXGIFactory2 createFunction = (WinCreateDXGIFactory2)GetProcAddress(rtFilterModule, "CreateDXGIFactory2");
result = (*createFunction)(flags, riid, ppFactory);
}
setFunction( (PROC)oldCreateDXGIFactory2, (PROC)OVRCreateDXGIFactory2, oldCreateDXGIFactory2Data );
printf("%s result 0x%x\n", __FUNCTION__, result);
return result;
}
开发者ID:Geocent,项目名称:node-hmd,代码行数:26,代码来源:OVR_Win32_RenderShim.cpp
示例15: OVRCreateDXGIFactory1
HRESULT APIENTRY OVRCreateDXGIFactory1(
__in REFIID riid,
__out void **ppFactory
)
{
HRESULT result = E_FAIL;
restoreFunction( (PROC)oldCreateDXGIFactory1, oldCreateDXGIFactory1Data );
if (IN_COMPATIBILITY_MODE())
{
result = (*oldCreateDXGIFactory1)(riid, ppFactory);
}
else
{
WinCreateDXGIFactory1 createFunction = (WinCreateDXGIFactory1)GetProcAddress(rtFilterModule, "CreateDXGIFactory1");
result = (*createFunction)(riid, ppFactory);
}
setFunction( (PROC)oldCreateDXGIFactory1, (PROC)OVRCreateDXGIFactory1, oldCreateDXGIFactory1Data );
printf("%s result 0x%x\n", __FUNCTION__, result);
return result;
}
开发者ID:Geocent,项目名称:node-hmd,代码行数:25,代码来源:OVR_Win32_RenderShim.cpp
示例16: deviceRobotConfigGetInterface
int deviceRobotConfigGetInterface(char commandHeader, DeviceInterfaceMode mode, bool fillDeviceArgumentList) {
if (commandHeader == COMMAND_GET_CONFIG) {
if (fillDeviceArgumentList) {
setFunction("getConfig", 0, 1);
setResultUnsignedHex4(0, "value");
}
return commandLengthValueForMode(mode, 0, 4);
}
else if (commandHeader == COMMAND_SET_CONFIG) {
if (fillDeviceArgumentList) {
setFunction("setConfig", 1, 0);
setArgumentUnsignedHex4(0, "value");
}
return commandLengthValueForMode(mode, 4, 0);
}
return DEVICE_HEADER_NOT_HANDLED;
}
开发者ID:Aveline67,项目名称:cen-electronic,代码行数:17,代码来源:robotConfigDeviceInterface.c
示例17: setupPlayIcon
bool CPlayButton::onMouseMsg( MouseMsg const& msg )
{
if ( msg.onLeftDown() )
{
if ( m_playInfo.type == PT_NULL )
return false;
sDragIcon->removeRectArea( 0 );
setupPlayIcon( sDragIcon );
sDragIcon->show( true );
Vec3D pos = mSprite->getWorldPosition();
pos[2] = -8000;
sDragIcon->setWorldPosition( pos );
CUISystem::getInstance().captureMouse( this );
}
else if ( msg.onLeftUp() )
{
CUISystem::getInstance().releaseMouse();
sDragIcon->show( false );
CWidget* ui = CUISystem::getInstance().hitTest( msg.getPos() );
if ( ui != this )
{
if ( ui )
{
CPlayButton* playbutton = dynamic_cast< CPlayButton* >( ui ) ;
if ( playbutton )
playbutton->onInputItem( this );
}
else
{
if ( m_cbType == CBT_FAST_PLAY_BAR )
setFunction( NULL , NULL );
}
// skip OnClick
return false;
}
}
if ( msg.isLeftDown() && msg.isDraging() )
{
if ( sDragIcon->isShow() )
{
Vec2i const& size = getSize();
MouseMsg const& msg = CUISystem::getInstance().getLastMouseMsg();
sDragIcon->setWorldPosition( Vec3D( msg.x() - size.x/2 , msg.y() - size.y/2 , -8000 ) );
}
}
CButtonUI::onMouseMsg( msg );
return false;
}
开发者ID:uvbs,项目名称:GameProject,代码行数:56,代码来源:CPlayButton.cpp
示例18: setFunction
void HybridComp::SetUpFRH002_Com_CEC05()
{
string fname[m_numFuncs];
unsigned fid[m_numFuncs];
for(int i=0;i<m_numFuncs;i++){
mp_height[i]=100*i;
}
fname[0] = "FUN_Weierstrass";
fname[1] = "FUN_Expanded_Scaffer_F6_CEC05";
fname[2] = "FUN_Griewank_Rosenbrock_F13_CEC05";
fname[3] = "FUN_Ackley";
fname[4] = "FUN_Rastrigin";
fname[5] = "FUN_Griewank";
fname[6] = "FUN_Noncont_Expanded_Scaffer_F6_CEC05";
fname[7] = "FUN_Noncont_Rastrigin";
fname[8] = "FUN_Elliptic";
fname[9] = "FUN_Sphere_Noisy_CEC05";
mp_stretchSeverity[0]=10;
mp_convergeSeverity[0]=2.;
for(int i=0;i<m_numFuncs;i++) fid[i]=Global::msm_pro[fname[i]];
setFunction(fid,fname);
mpp_f[0]->setSearchRange(-0.5,0.5);
mpp_f[1]->setSearchRange(-100, 100);
mpp_f[2]->setSearchRange(-5,5);
mpp_f[3]->setSearchRange(-32,32);
mpp_f[4]->setSearchRange(-5,5);
mpp_f[5]->setSearchRange(-5,5);
mpp_f[6]->setSearchRange(-100, 100);
mpp_f[7]->setSearchRange(-5,5);
mpp_f[8]->setSearchRange(-100,100);
mpp_f[9]->setSearchRange(-100,100);
mp_stretchSeverity[1]=5.0/20;
mp_stretchSeverity[2]=1.0;
mp_stretchSeverity[3]=5.0/32;
mp_stretchSeverity[4]=1.0;
mp_stretchSeverity[5]=5.0/100;
mp_stretchSeverity[6]=5.0/50;
mp_stretchSeverity[7]=1.0;
mp_stretchSeverity[8]=5.0/100;
mp_stretchSeverity[9]=5.0/100;
mp_convergeSeverity[1]=2.;
mp_convergeSeverity[2]=2.; mp_convergeSeverity[3]=2.;
mp_convergeSeverity[4]=2.; mp_convergeSeverity[5]=2.;
mp_convergeSeverity[6]=2; mp_convergeSeverity[7]=2;
mp_convergeSeverity[8]=2.; mp_convergeSeverity[9]=2.;
for(int i=0;i<m_numFuncs;i++){
mpp_f[i]->setScale(mp_stretchSeverity[i]);
}
setBias(260);
}
开发者ID:dcshen,项目名称:OFEC,代码行数:56,代码来源:FHybridComp.cpp
示例19: deviceTest2GetInterface
int deviceTest2GetInterface(char commandHeader, int mode, bool fillDeviceArgumentList) {
if (commandHeader == COMMAND_TEST2) {
if (fillDeviceArgumentList) {
setFunction("test2", 2, 1);
setArgumentUnsignedHex2(0, "a");
setArgumentUnsignedHex2(1, "b");
setResultUnsignedHex2(0, "result");
}
return commandLengthValueForMode(mode, 4, 2);
}
else if (commandHeader == COMMAND_INTENSIVE_TEST_DRIVER) {
if (fillDeviceArgumentList) {
setFunction("testDriverIntensive", 1, 0);
setArgumentUnsignedHex4(0, "count");
}
return commandLengthValueForMode(mode, 4, 0);
}
return DEVICE_HEADER_NOT_HANDLED;
}
开发者ID:Aveline67,项目名称:cen-electronic,代码行数:19,代码来源:test2DeviceInterface.c
示例20: deviceBatteryGetInterface
int deviceBatteryGetInterface(unsigned char commandHeader, DeviceInterfaceMode mode, bool fillDeviceArgumentList){
if (commandHeader == COMMAND_READ_BATTERY ) {
if (fillDeviceArgumentList) {
setFunction("Battery Read", 0, 1);
setResultUnsignedHex4(0, "Battery Value (mV)");
}
return commandLengthValueForMode(mode, 0, 4);
}
return DEVICE_HEADER_NOT_HANDLED;
}
开发者ID:svanacker,项目名称:cen-electronic,代码行数:10,代码来源:batteryDeviceInterface.c
注:本文中的setFunction函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论