本文整理汇总了C++中SetInt函数的典型用法代码示例。如果您正苦于以下问题:C++ SetInt函数的具体用法?C++ SetInt怎么用?C++ SetInt使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetInt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prLID_GetAbsInfo
int prLID_GetAbsInfo(VMGlobals *g, int numArgsPushed)
{
PyrSlot* args = g->sp - 2;
int evtCode;
int err;
PyrObject* obj = SC_LID::getObject(args+0);
if (!obj) return errWrongType;
err = slotIntVal(args+1, &evtCode);
if (err) return err;
if (!isKindOfSlot(args+2, s_absInfoClass->u.classobj))
return errWrongType;
PyrObject* infoObj = slotRawObject(&args[2]);
SC_LID* dev = SC_LID::getDevice(obj);
if (!dev) return errFailed;
struct input_absinfo info;
err = dev->getAbsInfo(evtCode, &info);
if (err) return err;
SetInt(infoObj->slots+0, info.value);
SetInt(infoObj->slots+1, info.minimum);
SetInt(infoObj->slots+2, info.maximum);
SetInt(infoObj->slots+3, info.fuzz);
SetInt(infoObj->slots+4, info.flat);
slotCopy(&args[0], &args[2]);
return errNone;
}
示例2: OnInitDialog
bool OnInitDialog()
{
SetInt(IDC_EDIT1,p.x);
SetInt(IDC_EDIT2,p.y);
return true;
}
示例3: SetMatrix4
void Shader::UpdateUniforms(RenderingEngine& _renderingEngine) {
for (unsigned int i = 0; i < shaderData->uniformNames.size(); i++) {
string uniformName = shaderData->uniformNames[i];
string uniformType = shaderData->uniformTypes[i];
if (uniformName.substr(0, 2) == "R_") {
string unprefixedName = uniformName.substr(2, uniformName.length());
if (unprefixedName == "lightMatrix") {
SetMatrix4(uniformName, 1, _renderingEngine.GetLightMatrix());
} else if (uniformType == "sampler2D") {
int samplerSlot = _renderingEngine.GetSamplerSlot(unprefixedName);
_renderingEngine.GetTexture(unprefixedName)->Bind(samplerSlot);
SetInt(uniformName, samplerSlot);
} else if (uniformType == "vec3") {
SetVector3(uniformName, *_renderingEngine.GetVector3(unprefixedName));
} else if (uniformType == "float") {
SetFloat(uniformName, *_renderingEngine.GetFloat(unprefixedName));
} else if (uniformType == "int") {
if (uniformName == "R_DIR_LIGHT_COUNT") {
SetInt(uniformName, _renderingEngine.GetActiveDirLights().size());
} if (uniformName == "R_POINT_LIGHT_COUNT") {
SetInt(uniformName, _renderingEngine.GetActivePointLights().size());
}
} else if (uniformType == "DirLight") {
SetDirectionalLights(uniformName, _renderingEngine.GetActiveDirLights());
} else if (uniformType == "PointLight") {
SetPointLights(uniformName, _renderingEngine.GetActivePointLights());
} else {
throw "Invalid R_ Uniform:" + uniformName;
}
}
}
}
示例4: PushQueueEvents_CalibratedValue
void PushQueueEvents_CalibratedValue (){
IOHIDEventStruct event;
pRecDevice pCurrentHIDDevice = HIDGetFirstDevice ();
int numdevs = gNumberOfHIDDevices;
unsigned char result;
for(int i=0; i< numdevs; i++){
result = HIDGetEvent(pCurrentHIDDevice, (void*) &event);
if(result && compiledOK) {
SInt32 value = event.value;
int vendorID = pCurrentHIDDevice->vendorID;
int productID = pCurrentHIDDevice->productID;
int locID = pCurrentHIDDevice->locID;
IOHIDElementCookie cookie = (IOHIDElementCookie) event.elementCookie;
pRecElement pCurrentHIDElement = HIDGetFirstDeviceElement (pCurrentHIDDevice, kHIDElementTypeAll);
// use gElementCookie to find current element
while (pCurrentHIDElement && ( (pCurrentHIDElement->cookie) != cookie))
pCurrentHIDElement = HIDGetNextDeviceElement (pCurrentHIDElement, kHIDElementTypeAll);
if (pCurrentHIDElement)
{
value = HIDCalibrateValue(value, pCurrentHIDElement);
//find element to calibrate
VMGlobals *g = gMainVMGlobals;
pthread_mutex_lock (&gLangMutex);
g->canCallOS = false; // cannot call the OS
++g->sp; SetObject(g->sp, s_hid->u.classobj); // Set the class HIDService
//set arguments:
++g->sp;SetInt(g->sp, vendorID);
++g->sp;SetInt(g->sp, productID);
++g->sp;SetInt(g->sp, locID);
++g->sp;SetInt(g->sp, (int) cookie);
++g->sp;SetInt(g->sp, value);
runInterpreter(g, s_hidAction, 6);
g->canCallOS = false; // cannot call the OS
pthread_mutex_unlock (&gLangMutex);
}
}
/* FIXME: this does not seem to be working!
if ( !HIDIsValidDevice(pCurrentHIDDevice) )
{ // readError
post("HID: read Error\n");
int locID = pCurrentHIDDevice->locID;
VMGlobals *g = gMainVMGlobals;
pthread_mutex_lock (&gLangMutex);
g->canCallOS = false; // cannot call the OS
++g->sp; SetObject(g->sp, s_hid->u.classobj); // Set the class HIDService
++g->sp;SetInt(g->sp, locID);
runInterpreter(g, s_readError, 2);
g->canCallOS = false; // cannot call the OS
pthread_mutex_unlock (&gLangMutex);
}*/
pCurrentHIDDevice = HIDGetNextDevice(pCurrentHIDDevice);
}
}
示例5: TRACK_KV_ADD
KeyValues::KeyValues(const char *setName, const char *firstKey, int firstValue, const char *secondKey, int secondValue)
{
TRACK_KV_ADD(this, setName);
Init();
SetName(setName);
SetInt(firstKey, firstValue);
SetInt(secondKey, secondValue);
}
示例6: ConvertReplyAddress
PyrObject* ConvertReplyAddress(ReplyAddress *inReply)
{
VMGlobals *g = gMainVMGlobals;
PyrObject *obj = instantiateObject(g->gc, s_netaddr->u.classobj, 2, true, false);
PyrSlot *slots = obj->slots;
SetInt(slots+0, ntohl(inReply->mSockAddr.sin_addr.s_addr));
SetInt(slots+1, ntohs(inReply->mSockAddr.sin_port));
return obj;
}
示例7: inv_hack_on
void inv_hack_on()
{
cInv = TRUE;
ZeroMemory(pak, 20);
SetShort(0, 0);
SetShort(0, 2);
SetShort(0xAD9, 4);
SetShort(GetClientID(), 6);
SetInt(0, 8);
SetInt(2, 12);
SetInt(1, 16);
SendPacket(pak, 20);
}
示例8: switch
/////////////////////////////////////////////////////////
// Resets a value with a string, preserving current type
void VariableData::ResetWith(wxString value) {
switch (type) {
case VARDATA_INT: {
long temp = 0;
value.ToLong(&temp);
SetInt(temp);
break;
}
case VARDATA_FLOAT: {
double temp = 0;
value.ToDouble(&temp);
SetFloat(temp);
break;
}
case VARDATA_BOOL:
if (value == _T("1")) SetBool(true);
else SetBool(false);
break;
case VARDATA_COLOUR: {
long r=0,g=0,b=0;
value.Mid(1,2).ToLong(&r,16);
value.Mid(3,2).ToLong(&g,16);
value.Mid(5,2).ToLong(&b,16);
SetColour(wxColour(r,g,b));
break;
}
default:
SetText(value);
break;
}
}
示例9: prGetLangPort
int prGetLangPort(VMGlobals *g, int numArgsPushed)
{
PyrSlot *a = g->sp;
if (!gUDPport) return errFailed;
SetInt(a, gUDPport->RealPortNum());
return errNone;
}
示例10: SetInt
void flext_base::cb_int(flext_hdr *c,long v)
{
t_atom atom; SetInt(atom,v);
Locker lock(c);
int const ci = proxy_getinlet((t_object *)&c->obj);
thisObject(c)->CbMethodHandler(ci,sym_int,1,&atom);
}
示例11: m_packed_init
TBValue::TBValue(TYPE type)
: m_packed_init(0)
{
switch (type)
{
case TYPE_NULL:
SetNull();
break;
case TYPE_STRING:
SetString("", SET_AS_STATIC);
break;
case TYPE_FLOAT:
SetFloat(0);
break;
case TYPE_INT:
SetInt(0);
break;
case TYPE_OBJECT:
SetObject(nullptr);
break;
case TYPE_ARRAY:
if (TBValueArray *arr = new TBValueArray())
SetArray(arr, SET_TAKE_OWNERSHIP);
break;
default:
assert(!"Not implemented!");
};
}
示例12: prPipeOpen
int prPipeOpen(struct VMGlobals *g, int numArgsPushed)
{
PyrSlot *a, *b, *c;
char mode[12];
PyrFile *pfile;
FILE *file;
a = g->sp - 2;
b = g->sp - 1;
c = g->sp;
if (NotObj(c) || !isKindOf(slotRawObject(c), class_string)
|| NotObj(b) || !isKindOf(slotRawObject(b), class_string))
return errWrongType;
if (slotRawObject(c)->size > 11) return errFailed;
pfile = (PyrFile*)slotRawObject(a);
char *commandLine = (char*)malloc(slotRawObject(b)->size + 1);
memcpy(commandLine, slotRawString(b)->s, slotRawObject(b)->size);
commandLine[slotRawString(b)->size] = 0;
memcpy(mode, slotRawString(c)->s, slotRawObject(c)->size);
mode[slotRawString(c)->size] = 0;
pid_t pid;
file = sc_popen(commandLine, &pid, mode);
free(commandLine);
if (file) {
SetPtr(&pfile->fileptr, file);
SetInt(a, pid);
} else {
SetNil(a);
}
return errNone;
}
示例13: PerformOSCBundle
void PerformOSCBundle(int inSize, char* inData, PyrObject *replyObj, int inPortNum)
{
// convert all data to arrays
int64 oscTime = OSCtime(inData + 8);
double seconds = OSCToElapsedTime(oscTime);
VMGlobals *g = gMainVMGlobals;
char *data = inData + 16;
char* dataEnd = inData + inSize;
while (data < dataEnd) {
int32 msgSize = OSCint(data);
data += sizeof(int32);
if (IsBundle(data))
{
PerformOSCBundle(msgSize, data, replyObj, inPortNum);
}
else // is a message
{
++g->sp; SetObject(g->sp, g->process);
++g->sp; SetFloat(g->sp, seconds);
++g->sp; SetObject(g->sp, replyObj);
++g->sp; SetInt(g->sp, inPortNum);
PyrObject *arrayObj = ConvertOSCMessage(msgSize, data);
++g->sp; SetObject(g->sp, arrayObj);
runInterpreter(g, s_recvoscmsg, 5);
}
data += msgSize;
}
}
示例14: PriorityQueueAdd
void PriorityQueueAdd(struct VMGlobals *g, PyrObject* queueobj, PyrSlot* item, double time)
{
PyrObject *schedq, *newschedq;
int size, maxsize;
PyrSlot *schedqSlot = queueobj->slots;
if (!IsObj(schedqSlot)) {
size = 32;
schedq = newPyrArray(g->gc, size, 0, true);
schedq->size = 1;
SetInt(schedq->slots + 0, 0); // stability count
SetObject(schedqSlot, schedq);
g->gc->GCWriteNew(queueobj, schedq); // we know schedq is white so we can use GCWriteNew
} else {
schedq = slotRawObject(schedqSlot);
maxsize = ARRAYMAXINDEXSIZE(schedq);
size = schedq->size;
if (size+3 > maxsize) {
newschedq = newPyrArray(g->gc, maxsize*2, 0, true);
newschedq->size = size;
slotCopy(newschedq->slots, schedq->slots, size);
assert(IsInt(newschedq->slots));
SetObject(schedqSlot, newschedq);
g->gc->GCWriteNew(queueobj, newschedq); // we know newschedq is white so we can use GCWriteNew
schedq = newschedq;
}
}
addheap(g, schedq, time, item);
}
示例15: switch
/*************************************
* operator =
*************************************/
SHVDataVariant& SHVDataVariantImpl::operator=(const SHVDataVariant& val)
{
switch (val.GetDataType())
{
case SHVDataVariant::TypeInt:
SetInt(val.AsInt());
break;
case SHVDataVariant::TypeInt64:
SetInt64(val.AsInt64());
break;
case SHVDataVariant::TypeBool:
SetBool(val.AsBool());
break;
case SHVDataVariant::TypeDouble:
SetDouble(val.AsDouble());
break;
case SHVDataVariant::TypeString:
SetString(val.AsString());
break;
case SHVDataVariant::TypeTime:
SetTime(val.AsTime());
break;
}
return *this;
}