本文整理汇总了C++中setLocation函数的典型用法代码示例。如果您正苦于以下问题:C++ setLocation函数的具体用法?C++ setLocation怎么用?C++ setLocation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setLocation函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setLocation
void RenderScrollbarPart::paintIntoRect(GraphicsContext* graphicsContext, int tx, int ty, const IntRect& rect)
{
// Make sure our dimensions match the rect.
setLocation(rect.x() - tx, rect.y() - ty);
setWidth(rect.width());
setHeight(rect.height());
if (graphicsContext->paintingDisabled())
return;
// Now do the paint.
RenderObject::PaintInfo paintInfo(graphicsContext, rect, PaintPhaseBlockBackground, false, 0, 0);
paint(paintInfo, tx, ty);
paintInfo.phase = PaintPhaseChildBlockBackgrounds;
paint(paintInfo, tx, ty);
paintInfo.phase = PaintPhaseFloat;
paint(paintInfo, tx, ty);
paintInfo.phase = PaintPhaseForeground;
paint(paintInfo, tx, ty);
paintInfo.phase = PaintPhaseOutline;
paint(paintInfo, tx, ty);
}
示例2: welcome
void welcome(GWindow window)
{
GRect rectW = newGRect(0, 0, WIDTH, HEIGHT);
setFilled(rectW, true);
setColor(rectW, "#008080");
add(window, rectW);
GLabel labelW = newGLabel("Hello World!!");
setFont(labelW, "SansSerif-32");
setLabel(labelW, "Tic-Tac-Toe");
add(window, labelW);
double x = WIDTH/2 - getWidth(labelW)/2;
double y = HEIGHT/2;
setLocation(labelW, x, y);
// Wait for Click
waitForClick();
// Remove Welcome Message
removeGWindow(window, labelW);
}
示例3: Read
MonoRecorder::MonoRecorder(bool fromFile) {
is_truncated = is_processed = false;
if ( fromFile ) {
stamped_offset = 0;
Read(false);
assertid("OUT1");
filename = ReadString();
float t = ReadFloat();
if ( Datatype::PeakId() == "anim" ) {
animation = new Animated<gmtl::Point3f>();
} else {
setLocation(ReadVec());
animation = 0;
}
std::cout << this->toString();
} else {
animation = 0;
filename = "";
}
has_samples = save_processed = false;
tracks.push_back(new RecorderTrack());
}
示例4: Read
SoundFile::SoundFile() {
Read(false);
assertid("SSRC");
filename = ReadString();
WaveFile w(filename.c_str());
data = w.ToFloat();
sample_owner = true;
sample_length = w.GetSampleSize();
if ( !data || !sample_length ) {
throw DatatypeException("Failed to open sound file " + filename);
}
soundfiles[0] = soundfiles[1] = soundfiles[2] = 0;
data_low = data_mid = data_high = 0;
mesh = 0;
animation = 0;
if ( Datatype::PeakId() == "anim" ) {
animation = new Animated<gmtl::Point3f>();
} else if ( Datatype::PeakId() == "mesh" ) {
Datatype::prefix = " +- " + Datatype::prefix;
mesh = new Mesh();
Datatype::prefix = Datatype::prefix.substr(4);
} else {
setLocation(ReadPoint());
}
if ( Datatype::PeakId() == "flt4" ) {
gain = Datatype::ReadFloat();
} else {
gain = 1.0f;
}
if ( Datatype::PeakId() == "flt4" ) {
offset = (unsigned int) (Datatype::ReadFloat() * 44100.0f);
} else {
offset = 0;
}
std::cout << this->toString();
std::cout << Datatype::stringblock;
Datatype::stringblock = "";
}
示例5: getHeadsetJack
MockInputDeviceNode* getHeadsetJack() {
auto node = new MockInputDeviceNode();
node->setPath("/dev/input/event3");
node->setName("apq8064-tabla-snd-card Headset Jack");
node->setLocation("ALSA");
// UniqueId not set
node->setBusType(0);
node->setVendorId(0);
node->setProductId(0);
node->setVersion(0);
// No keys
// No relative axes
// No absolute axes
node->addSwitch(SW_HEADPHONE_INSERT);
node->addSwitch(SW_MICROPHONE_INSERT);
node->addSwitch(SW_LINEOUT_INSERT);
// ASUS adds some proprietary switches, but we'll only see two of them.
node->addSwitch(0x0e); // SW_HPHL_OVERCURRENT
node->addSwitch(0x0f); // SW_HPHR_OVERCURRENT
// No forcefeedback
node->addInputProperty(INPUT_PROP_DIRECT);
return node;
}
示例6: checkForEvent
/**
* Detects the paddle based on the location of the mouse pointer
*/
void checkForEvent(Paddle *bat)
{
GEvent event = getNextEvent(MOUSE_EVENT);
if (event != NULL)
{
if (getEventType(event) == MOUSE_MOVED)
{
double xCoordinate = getX(event) - getWidth(bat->paddle) / 2;
setLocation(bat->paddle, xCoordinate, HEIGHT - PADDLE_HEIGHT - 100);
// mouse moving right
if (xCoordinate > bat->x)
{
strcpy(bat->direction, "right\0");
}
else if(xCoordinate < bat->x)
{
strcpy(bat->direction, "left\0");
}
bat->x = xCoordinate;
}
}
}
示例7: qDebug
bool Shorty::keyReleaseEventHandler(QEvent *event){
qDebug(shorty_Main()) << "Key relese event. the key is" << ((QKeyEvent*)event)->key()
<< "Our location is" << getLocation() << "now it'll be" << getLocation()-1;
pressedKeys -= ((QKeyEvent*)event)->key();
setLocation(getLocation()-1);
qDebug(shorty_Main()) << "errorFlag is" << errorFlag;
if (errorFlag) {
if (keysPressed == 0) {
qDebug(shorty_Main()) << "Clearing flag" << getLocation();
errorFlag = !errorFlag;
updateText();
}
else{
qDebug(shorty_Main()) << "There are still" << keysPressed << "pressed keys";
return true;
}
}
else {
qDebug() << keysPressed << "No errorFlag";
unPaint(getLocation());
}
return true;
}
示例8: setLocation
CCylinder::CCylinder(float x, float y, float z)
{
m_sizeX= x; m_sizeY= y; m_sizeZ= z;
setLocation(0.0,0.0,0.0);
m_control= new CCylinderControl(this);
s= gluNewQuadric();
d1= gluNewQuadric(); gluQuadricOrientation(d1, GLU_OUTSIDE);
d2= gluNewQuadric(); gluQuadricOrientation(d1, GLU_INSIDE);
m_ratio= 1;
diskATrans= new hduMatrix ( );
diskBTrans= new hduMatrix ( );
diskAShape= new CDisk ();
diskBShape= new CDisk ();
diskAShape->AddDependant ( this );
diskAShape->AddDependant ( this );
customCylinder= new CHapticCylinder ( this );
diskA= new CHapticDisk ( diskATrans );
diskB= new CHapticDisk ( diskBTrans );
}
示例9: setType
GameOver::GameOver() {
setType("GameOver");
// link to "message" sprite
ResourceManager &resource_manager = ResourceManager::getInstance();
Sprite *p_temp_sprite = resource_manager.getSprite("gameover");
if (!p_temp_sprite) {
LogManager &log_manager = LogManager::getInstance();
log_manager.writeLog("GameOver::GameOver(): Warning! Sprite 'gameover' not found");
} else {
setSprite(p_temp_sprite);
setSpriteSlowdown(15);
setTransparency('#'); // transparent character
time_to_live = p_temp_sprite->getFrameCount() * 15;
}
// put in center of screen
setLocation(CENTER_CENTER);
// register for step event
registerInterest(STEP_EVENT);
}
示例10: main
int main(void)
{
GWindow window = newGWindow(320, 240);
GOval circle = newGOval(0,0,50,50);
setColor(circle, "RED");
setFilled(circle, true);
add(window, circle);
while ( true )
{
GEvent event = getNextEvent( MOUSE_EVENT );
if( event != NULL )
{
if( getEventType(event) == MOUSE_MOVED )
{
double x = getX(event) - getWidth(circle) / 2;
double y = getY(event) - getWidth(circle) /2;
setLocation(circle, x, y);
}
}
}
}
示例11: updateScoreboard
/**
* Updates scoreboard's label, keeping it centered in window.
*/
void updateScoreboard(GWindow window, GLabel label, int points)
{
// update label
char s[12];
sprintf(s, "%i", points);
if (points == 51)
{
setLabel(label, "WIN!");
}
else if (points == 0)
{
setLabel(label, ":(");
}
else
{
setLabel(label, s);
}
// center label in window
double x = (getWidth(window) - getWidth(label)) / 2;
double y = (getHeight(window) - getHeight(label)) / 2;
setLocation(label, x, y);
}
示例12: setResource
void Path::setLocation( const String &loc )
{
uint32 pos = loc.find( ":" );
if ( pos != String::npos )
{
if( loc.find( ":", pos + 1 ) != String::npos )
{
m_bValid = false;
}
else
{
setResource( loc.subString( 0, pos ) );
setLocation( loc.subString( pos + 1 ) );
}
}
else
{
if( m_location != loc )
{
m_location = loc;
uint32 pos1 = m_location.find( "\\" );
while( pos1 != String::npos )
{
m_location.setCharAt( pos1, '/' );
pos1 = m_location.find( "\\", pos1 );
}
// remove trailing "/"
if ( m_location.size() > 1 && m_location.getCharAt( m_location.length() - 1 ) == '/' )
m_location.remove( m_location.length() - 1, 1 );
compose();
}
}
}
示例13: l_setLocation
static int l_setLocation(lua_State *L) {
Player *player;
Room *newLocation;
const char *playerName;
const char *roomName;
int n = lua_gettop(L);
/* script must provide player name and room name as arguments */
if (n < 2) {
lua_pushboolean(L, 0);
lua_pushstring(L, "must pass player and room names to setLocation");
return 2;
}
playerName = lua_tostring(L, 1);
roomName = lua_tostring(L, 2);
player = g_hash_table_lookup(g_players, playerName);
if (NULL == player) {
lua_pushboolean(L, 0);
lua_pushstring(L, "player doesn't exist");
return 2;
}
newLocation = g_hash_table_lookup(g_rooms, roomName);
if (NULL == newLocation) {
lua_pushboolean(L, 0);
lua_pushstring(L, "room doesn't exist");
return 2;
}
setLocation(player, newLocation, 0);
lua_pushboolean(L, 1);
return 1;
}
示例14: hasMoves
/*Determine whether Color has legal Moves on Board*/
int hasMoves(Game *game, Color col){
ListNode *temp = (ListNode*)malloc(sizeof(ListNode));
if (temp == NULL) exitOnError("malloc");
int flag = 0;
temp->move = NULL;
temp->next = NULL;
ListNode *head = temp;
int i, j;
for (i = 0; i < BOARD_SIZE; i++){
for (j = 0; j < BOARD_SIZE; j++){
if (sameCol(game->board[i][j], col)){
Location *loc = setLocation(i, j);
flag = getMovesSinglePiece(game, loc, temp);
free(loc);
}
if (flag){
freeList(head);
return 1;
}
}
}
freeList(head);
return 0;
}
示例15: initBricks
/**
* Initializes window with a grid of bricks.
*/
void initBricks(GWindow window)
{
int brickLocationX = 2;
int brickLocationY = 50;
char* colors[5] = {"RED", "ORANGE", "YELLOW", "GREEN", "CYAN"};
for (int i = 0; i < ROWS; i++)
{
for (int j = 0; j < COLS; j++)
{
GRect brick = newGRect(0, 0, BWIDTH, BHEIGHT);
setFilled(brick, true);
setColor(brick, colors[i]);
setLocation(brick, brickLocationX, brickLocationY);
brickLocationX += 40;
add(window, brick);
if (j == 9)
{
brickLocationX = 2;
brickLocationY += 14;
}
}
}
}