示例#1
0
    void Canvas::frameEntered( float _time )
    {
        int width = mReqTexSize.width;
        int height = mReqTexSize.height;
        TextureUsage usage = getDefaultTextureUsage();
        PixelFormat format = getDefaultTextureFormat();

        validate( width, height, usage, format );

        bool create = checkCreate( width, height );

        if ( mTexResizeMode == TRM_PT_CONST_SIZE )
            create = false;

        if ( create )
        {
            createExactTexture( width, height, usage, format );
            correctUV();
        }
        else // I thought order is important
        {
            correctUV();
            requestUpdateCanvas( this, Event( false, true, mInvalidateData ) );
        }

        mInvalidateData = false;
        frameAdvise( false );
    }
示例#2
0
//--------------------------------------------------------------
void ofxBulletPatch::draw() {
    if(!checkCreate()) {
        ofLogWarning("ofxBulletPatch") << "draw() : must call create() first and add() after";
        return;
    }
    transformGL();
    getMesh().draw();
    restoreTransformGL();
}
示例#3
0
void GenerateShit::Update()
{
    if(!isActive) return;
    CheckBorder();
    checkCollision();
    checkDelete();
    checkCreate();

}
示例#4
0
	void Canvas::createTexture( int _width, int _height, TextureResizeMode _resizeMode, Ogre::TextureUsage _usage, Ogre::PixelFormat _format )
	{
		MYGUI_ASSERT( _width >= 0 && _height >= 0, "negative size" );

		if( mReqTexSize.empty() )
			mReqTexSize = IntSize( _width, _height );

		mTexResizeMode = _resizeMode;

		bool create = checkCreate( _width, _height );

		validateSize( _width, _height );

		if( create )
			createExactTexture( _width, _height, _usage, _format );
	}
示例#5
0
/**
 * Login Packet Create
 * Populate the backing ByteBuffer with the expected LoginPacket structure as defined in the protocol
 *
 * Struct:
 * INT: Protocol Version
 * INT: Size of Username
 * A_STR: Username
 *
 * @return Byte array of the same size as the ByteBuffer (pkt->size()) of the built packet
 */
byte* LoginPacket::create(bool force) {
	// Check for cached create data
	if(checkCreate(force))
		return createData;

	// Build the packet
	put(OP(LOGIN));
	putInt(PROTOCOL_VERSION); // The protocol version the program was compiled with
	putInt((int)username.size()+1);
	putBytes((byte *)username.c_str(), (int)username.size()+1);

	// Save created data
	saveCreate();

	// Return the created byte array
    return createData;
}
示例#6
0
    void Canvas::createTexture( int _width, int _height, TextureResizeMode _resizeMode, TextureUsage _usage, PixelFormat _format )
    {
        int width = std::max(1, _width);
        int height = std::max(1, _height);

        if ( mReqTexSize.empty() )
            mReqTexSize = IntSize( width, height );

        mTexResizeMode = _resizeMode;

        bool create = checkCreate( width, height );

        width = Bitwise::firstPO2From(width);
        height = Bitwise::firstPO2From(height);

        if ( create )
            createExactTexture( width, height, _usage, _format );
    }
示例#7
0
	void Canvas::createTexture( int _width, int _height, TextureResizeMode _resizeMode, TextureUsage _usage, PixelFormat _format )
	{
		mTexResizeMode = _resizeMode;

		int width = std::max(1, _width);
		int height = std::max(1, _height);

		if (_resizeMode == TRM_PT_CONST_SIZE)
		{
			mReqTexSize = IntSize(width, height);
		}
		else
		{
			mReqTexSize = IntSize(std::max(1, getWidth()), std::max(1, getHeight()));
		}

		bool create = checkCreate( width, height );

		width = Bitwise::firstPO2From(width);
		height = Bitwise::firstPO2From(height);

		if ( create )
			createExactTexture( width, height, _usage, _format );
	}
//--------------------------------------------------------------
void ofxBulletBaseShape::setActivationState( int a_state ) {
	if(checkCreate()) {
		_rigidBody->setActivationState( a_state );
	}
}
//--------------------------------------------------------------
void ofxBulletBaseShape::setFriction( float a_friction ) {
	if(checkCreate()) {
		_rigidBody->setFriction( btScalar(a_friction) );
	}
}
//--------------------------------------------------------------
void ofxBulletBaseShape::setRestitution( float a_res ) {
	if(checkCreate()) {
		_rigidBody->setRestitution( btScalar(a_res) );
	}
}