当前位置: 首页>>代码示例>>C++>>正文


C++ CGPointMake函数代码示例

本文整理汇总了C++中CGPointMake函数的典型用法代码示例。如果您正苦于以下问题:C++ CGPointMake函数的具体用法?C++ CGPointMake怎么用?C++ CGPointMake使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CGPointMake函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CGPointMake

void SpriteEaseBounceInOut::onEnter()
{
	EaseSpriteDemo::onEnter();

		CCActionInterval* move = CCMoveBy::actionWithDuration(3, CGPointMake(350,0));
	CCActionInterval* move_back = move->reverse();
	
	CCActionInterval* move_ease = CCEaseBounceInOut::actionWithAction((CCActionInterval*)(move->copy()->autorelease()) );
	CCActionInterval* move_ease_back = move_ease->reverse();
	
	CCFiniteTimeAction* seq1 = CCSequence::actions( move, move_back, NULL);
	CCFiniteTimeAction* seq2 = CCSequence::actions( move_ease, move_ease_back, NULL);
	
	this->positionForTwo();
	
	m_grossini->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq1));
	m_tamara->runAction( CCRepeatForever::actionWithAction((CCActionInterval*)seq2));
}
开发者ID:valentinvit,项目名称:cocos2d-x,代码行数:18,代码来源:EaseActionsTest.cpp

示例2: mac_warp_mouse

void
mac_warp_mouse()
{
#ifndef ACTIVEGS
	Rect		port_rect;
	Point		win_origin_pt;
	CGPoint		cgpoint;
	CGDisplayErr	cg_err;
	
	GetPortBounds(GetWindowPort(g_main_window), &port_rect);
	SetPt(&win_origin_pt, port_rect.left, port_rect.top);
	LocalToGlobal(&win_origin_pt);
	
	cgpoint = CGPointMake( (float)(win_origin_pt.h + X_A2_WINDOW_WIDTH/2),
						  (float)(win_origin_pt.v + X_A2_WINDOW_HEIGHT/2));
	cg_err = CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, cgpoint);
#endif
}
开发者ID:chinnytp,项目名称:kegs,代码行数:18,代码来源:macdriver_kegs.c

示例3: alignSpritesLeft

//------------------------------------------------------------------
//
// ActionRepeat
//
//------------------------------------------------------------------
void ActionRepeat::onEnter()
{
    ActionsDemo::onEnter();

    alignSpritesLeft(2);


    CCActionInterval*  a1 = CCMoveBy::actionWithDuration(1, CGPointMake(150,0));
    CCActionInterval*  action1 = CCRepeat::actionWithAction(
                                     CCSequence::actions( CCPlace::actionWithPosition(CGPointMake(60,60)), a1, NULL) ,
                                     3);
    CCAction*  action2 = CCRepeatForever::actionWithAction(
                             (CCActionInterval*)(CCSequence::actions((CCActionInterval*)(a1->copy()->autorelease()), a1->reverse(), NULL))
                         );

    m_kathia->runAction(action1);
    m_tamara->runAction(action2);
}
开发者ID:shootan,项目名称:Terraria,代码行数:23,代码来源:ActionsTest.cpp

示例4: centerSprites

//------------------------------------------------------------------
//
// ActionBezier
//
//------------------------------------------------------------------
void ActionBezier::onEnter()
{
    ActionsDemo::onEnter();

    CGSize s = CCDirector::sharedDirector()->getWinSize();

    //
    // startPosition can be any coordinate, but since the movement
    // is relative to the Bezier curve, make it (0,0)
    //

    centerSprites(3);

    // sprite 1
    ccBezierConfig bezier;
    bezier.controlPoint_1 = CGPointMake(0, s.height/2);
    bezier.controlPoint_2 = CGPointMake(300, -s.height/2);
    bezier.endPosition = CGPointMake(300,100);

    CCActionInterval*  bezierForward = CCBezierBy::actionWithDuration(3, bezier);
    CCActionInterval*  bezierBack = bezierForward->reverse();
    CCAction*  rep = CCRepeatForever::actionWithAction((CCActionInterval*)CCSequence::actions( bezierForward, bezierBack, NULL));


    // sprite 2
    m_tamara->setPosition(CGPointMake(80,160));
    ccBezierConfig bezier2;
    bezier2.controlPoint_1 = CGPointMake(100, s.height/2);
    bezier2.controlPoint_2 = CGPointMake(200, -s.height/2);
    bezier2.endPosition = CGPointMake(240,160);

    CCActionInterval*  bezierTo1 = CCBezierTo::actionWithDuration(2, bezier2);

    // sprite 3
    m_kathia->setPosition(CGPointMake(400,160));
    CCActionInterval*  bezierTo2 = CCBezierTo::actionWithDuration(2, bezier2);

    m_grossini->runAction( rep);
    m_tamara->runAction(bezierTo1);
    m_kathia->runAction(bezierTo2);

}
开发者ID:shootan,项目名称:Terraria,代码行数:47,代码来源:ActionsTest.cpp

示例5: CGRectMake

void GraphicsLayerCACF::updateLayerSize()
{
    CGRect rect = CGRectMake(0, 0, m_size.width(), m_size.height());
    if (m_transformLayer) {
        m_transformLayer->setBounds(rect);
        // The anchor of the contents layer is always at 0.5, 0.5, so the position is center-relative.
        CGPoint centerPoint = CGPointMake(m_size.width() / 2.0f, m_size.height() / 2.0f);
        m_layer->setPosition(centerPoint);
    }
    
    m_layer->setBounds(rect);
    
    // Note that we don't resize m_contentsLayer. It's up the caller to do that.

    // if we've changed the bounds, we need to recalculate the position
    // of the layer, taking anchor point into account.
    updateLayerPosition();
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:18,代码来源:GraphicsLayerCACF.cpp

示例6: TIPGradientFindEndpointsForRotation

// angle in degrees
void TIPGradientFindEndpointsForRotation( CGRect rect, float angle, CGPoint *startPoint, CGPoint *endPoint)
{
    if(angle == 0) {
        *startPoint = CGPointMake(rect.origin.x, rect.origin.y);	//right of rect
        *endPoint   = CGPointMake(rect.origin.x + rect.size.width, rect.origin.y);	//left  of rect
    } else if(angle == 90) {
        *startPoint = CGPointMake(rect.origin.x, rect.origin.y);	//bottom of rect
        *endPoint   = CGPointMake(rect.origin.x, rect.origin.y + rect.size.height);	//top    of rect
    } else {
        float x,y;
        float sina, cosa, tana;

        float length;
        float deltax,
              deltay;

        float rangle = angle * pi/180;	//convert the angle to radians

        if(fabsf(tanf(rangle))<=1)	//for range [-45,45], [135,225]
        {
            x = rect.size.width;
            y = rect.size.height;

            sina = sin(rangle);
            cosa = cos(rangle);
            tana = tan(rangle);

            length = x/fabsf(cosa)+(y-x*fabsf(tana))*fabsf(sina);

            deltax = length*cosa/2;
            deltay = length*sina/2;
        }
        else						//for range [45,135], [225,315]
        {
            x = rect.size.height;
            y = rect.size.width;

            sina = sin(rangle - 90*pi/180);
            cosa = cos(rangle - 90*pi/180);
            tana = tan(rangle - 90*pi/180);

            length = x/fabsf(cosa)+(y-x*fabsf(tana))*fabsf(sina);

            deltax =-length*sina/2;
            deltay = length*cosa/2;
        }

        *startPoint = CGPointMake( (rect.origin.x+rect.size.width/2.0f)-deltax, (rect.origin.y+rect.size.height/2.0f)-deltay);
        *endPoint   = CGPointMake( (rect.origin.x+rect.size.width/2.0f)+deltax, (rect.origin.y+rect.size.height/2.0f)+deltay);
    }
}
开发者ID:samiamwork,项目名称:Questionable,代码行数:52,代码来源:TIPGradient.c

示例7: SendMouseMove

static inline void SendMouseMove(int X, int Y) {
	CGPoint point = GetMouseLoc();
	CGRect ssize = CGDisplayBounds(CGMainDisplayID());
	int newX = point.x + X, newY = point.y + Y;
	newX = newX < 0 ? 0 : newX;
	newY = newY < 0 ? 0 : newY;
	newX = newX > ssize.size.width - 1 ? ssize.size.width - 1 : newX;
	newY = newY > ssize.size.height - 2 ? ssize.size.height - 1 : newY;

	CGEventRef move = CGEventCreateMouseEvent(
        NULL, kCGEventMouseMoved,
        CGPointMake(newX, newY),
        kCGMouseButtonLeft // ignored
    );

    CGEventPost(kCGHIDEventTap, move);

    CFRelease(move);
}
开发者ID:shengyu7697,项目名称:SimpleComputerRemote,代码行数:19,代码来源:input_darwin.c

示例8: TilePDFWithCGLayer

void TilePDFWithCGLayer(CGContextRef context, CFURLRef url)
{
    // Again this should really be computed based on
    // the area intended to be tiled.
    float fillwidth = 612., fillheight = 792.;
    CGSize s;
    float tileX, tileY, tileOffsetX, tileOffsetY;
    float w, h;
    CGLayerRef layer = createLayerWithImageForContext(context, url);
    if(layer == NULL){
	    fprintf(stderr, "Couldn't create the layer!\n");
	    return;
    }
    
    // Compute the tile size and offset.
    s = CGLayerGetSize(layer);
    tileX = s.width;
    tileY = s.height;

#if DOSCALING
    // Space the tiles by the tile width and height
    // plus an extra 2 units in each dimension.
    tileOffsetX = 2. + tileX;
    tileOffsetY = 2. + tileY;
#else
	// Add 6 units to the offset in each direction
	// if there is no scaling of the source PDF document.
    tileOffsetX = 6. + tileX;
    tileOffsetY = 6. + tileY;
#endif

    // Now draw the contents of the layer to the context.
    // The layer is drawn at its true size (the size of
    // the tile) with its origin located at the corner
    // of each tile.
    for(h = 0; h < fillheight ; h += tileOffsetY)
		for(w = 0; w < fillwidth ; w += tileOffsetX){
			CGContextDrawLayerAtPoint(context, CGPointMake(w, h), layer);
		}
    
    // Release the layer when done drawing with it.
    CGLayerRelease(layer);
}
开发者ID:yarshure,项目名称:ProgrammingWithQuartz-Code,代码行数:43,代码来源:BitmapContext.c

示例9: GiveFocusToScreen

void GiveFocusToScreen(int ScreenIndex)
{
    screen_info *Screen = GetDisplayFromScreenID(ScreenIndex);
    if(Screen)
    {
        CGPoint CursorPos = CGPointMake(Screen->X + (Screen->Width / 2),
                                        Screen->Y + (Screen->Height / 2));

        CGEventRef MoveEvent = CGEventCreateMouseEvent(NULL, kCGEventLeftMouseDown, CursorPos, kCGMouseButtonLeft);
        CGEventSetFlags(MoveEvent, 0);
        CGEventPost(kCGHIDEventTap, MoveEvent);
        CFRelease(MoveEvent);

        DEBUG("GiveFocusToScreen() " << ScreenIndex)
        UpdateActiveWindowList(Screen);
        tree_node *NewFocusNode = GetFirstLeafNode(Screen->Space[Screen->ActiveSpace].RootNode);
        SetWindowFocusByNode(NewFocusNode);
    }
}
开发者ID:sukee,项目名称:kwm,代码行数:19,代码来源:display.cpp

示例10: CGPointMake

//------------------------------------------------------------------
//
// TestLayer
//
//------------------------------------------------------------------
void TestLayer::onEnter()
{
	CCLayer::onEnter();

	float x,y;
	
	CGSize size = CCDirector::sharedDirector()->getWinSize();
	x = size.width;
	y = size.height;

	//NSArray *array = [UIFont familyNames];
	//for( NSString *s in array )
	//	NSLog( s );
	CCLabel* label = CCLabel::labelWithString("cocos2d", "Tahoma", 64);

	label->setPosition( CGPointMake(x/2,y/2) );
	
	addChild(label);
}
开发者ID:charlesa101,项目名称:cocos2d-x,代码行数:24,代码来源:RotateWorldTest.cpp

示例11: selectAreaMac

bool GTMouseDriver::moveTo(const QPoint& p)
{
    int x = p.x();
    int y = p.y();
    if (bp.testFlag(Qt::LeftButton)) {
        return selectAreaMac(x, y);
    }

    DRIVER_CHECK(isPointInsideScreen(x, y), "Invalid coordinates");

    CGEventRef event = CGEventCreateMouseEvent(NULL, kCGEventMouseMoved, CGPointMake(x, y), 0 /*ignored*/);
    DRIVER_CHECK(event != NULL, "Can't create event");

    CGEventPost(kCGSessionEventTap, event);
    CFRelease(event);
    GTGlobals::sleep(100);

    return true;
}
开发者ID:ugeneunipro,项目名称:QSpec,代码行数:19,代码来源:GTMouseDriverMac.cpp

示例12: CGEventCreateMouseEvent

void XInputSimulatorImplMacOs::mouseMoveTo(int x, int y)
{

    //TODO screen check see moveRelative

    CGEventRef mouseEv = CGEventCreateMouseEvent(
                NULL, kCGEventMouseMoved,
                CGPointMake(x, y),
                kCGMouseButtonLeft);

    std::cout << "mv: " << mouseEv << std::endl;

    CGEventPost(kCGHIDEventTap, mouseEv);

    CFRelease(mouseEv);

    this->currentX = x;
    this->currentY = y;
}
开发者ID:thisispoker,项目名称:alphapoker,代码行数:19,代码来源:xinputsimulatorimplmacos.cpp

示例13: ActivateScreen

void ActivateScreen(screen_info *Screen)
{
    CGPoint CursorPos = GetCursorPos();
    CGPoint ClickPos = CGPointMake(Screen->X, Screen->Y);

    CGEventRef MoveEvent = CGEventCreateMouseEvent(NULL, kCGEventLeftMouseDown, ClickPos, kCGMouseButtonLeft);
    CGEventSetFlags(MoveEvent, 0);
    CGEventPost(kCGHIDEventTap, MoveEvent);
    CFRelease(MoveEvent);

    MoveEvent = CGEventCreateMouseEvent(NULL, kCGEventLeftMouseUp, ClickPos, kCGMouseButtonLeft);
    CGEventSetFlags(MoveEvent, 0);
    CGEventPost(kCGHIDEventTap, MoveEvent);
    CFRelease(MoveEvent);

    MoveEvent = CGEventCreateMouseEvent(NULL, kCGEventMouseMoved, CursorPos, kCGMouseButtonLeft);
    CGEventSetFlags(MoveEvent, 0);
    CGEventPost(kCGHIDEventTap, MoveEvent);
    CFRelease(MoveEvent);
}
开发者ID:sukee,项目名称:kwm,代码行数:20,代码来源:display.cpp

示例14: CGPointMake

void MacOSMouseOStream::doubleClick(pair<uint32_t, uint32_t> mouse, int clickCount) {
#if __APPLE__
    CGPoint point = CGPointMake(mouse.first, mouse.second);
    CGEventRef theEvent = CGEventCreateMouseEvent(
        NULL, kCGEventLeftMouseDown, point, kCGMouseButtonLeft);

    ProcessSerialNumber psn = { 0, kNoProcess };
    GetFrontProcess( &psn );

    CGEventSetIntegerValueField(theEvent, kCGMouseEventClickState, clickCount);
    CGEventPostToPSN(&psn, theEvent);
    CGEventSetType(theEvent, kCGEventLeftMouseUp);
    CGEventPostToPSN(&psn, theEvent);
    CGEventSetType(theEvent, kCGEventLeftMouseDown);
    CGEventPostToPSN(&psn, theEvent);
    CGEventSetType(theEvent, kCGEventLeftMouseUp);
    CGEventPostToPSN(&psn, theEvent);
    CFRelease(theEvent);
#endif
}
开发者ID:damellis,项目名称:ESP,代码行数:20,代码来源:ostream.cpp

示例15: setCursorPos

FREObject setCursorPos(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[])
{
    int tx = 0;
    int ty = 0;
    FREGetObjectAsInt32(argv[0], &tx);
    FREGetObjectAsInt32(argv[1], &ty);

    //as3Print("Set cursor pos \n");//,tx,ty);

    CGPoint point;
    point.x = tx;
    point.y = ty;

    CGAssociateMouseAndMouseCursorPosition(true);
    
    //CGWarpMouseCursorPosition(point);
   // printf("Error : %i\n",error);
    CGDisplayMoveCursorToPoint(CGMainDisplayID(),point);

    CGAssociateMouseAndMouseCursorPosition(true);
    CGEventRef mouse = CGEventCreateMouseEvent (NULL, kCGEventMouseMoved, CGPointMake(tx, ty),0);
    CGEventPost(kCGHIDEventTap, mouse);
    CFRelease(mouse);
    
    
    CGEventRef event = CGEventCreate(NULL);
    CGPoint cursorGet = CGEventGetLocation(event);
    CFRelease(event);
    
    
    
    char msg[256];
    sprintf(msg,"After set, check pos %f %f\n",cursorGet.x, cursorGet.y);
    //as3Print(msg);
    
    FREObject result;
    FRENewObjectFromBool(1, &result);
    //FRENewObjectFromBool(true,&result);
    return result;
}
开发者ID:benkuper,项目名称:AIR-NativeExtensions,代码行数:40,代码来源:ExtendedMouse.c


注:本文中的CGPointMake函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。