• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ createSurface函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: updateGL

static int updateGL(struct engine* engine) {
	GK_BOOL init = engine->context == EGL_NO_CONTEXT;
    EGLint w, h;
	
	if (init) {
		initDisplay(engine);
		createSurface(engine);
		engine->context = eglCreateContext(engine->display, engine->config, NULL, NULL);
	}else {
		createSurface(engine);
	}

	if (!bindContext(engine, GK_TRUE))
		return -1;
	
	GLEE_EXT_framebuffer_object = (strstr((const char*)glGetString(GL_EXTENSIONS), "OES_framebuffer_object")?GK_TRUE:GK_FALSE);

    eglQuerySurface(engine->display, engine->surface, EGL_WIDTH, &w);
    eglQuerySurface(engine->display, engine->surface, EGL_HEIGHT, &h);

	if (init) {
		gkScreenSize.width = w;
		gkScreenSize.height = h;
	} else {
		onWindowSizeChanged(GK_SIZE(w, h));
	}
	
	engine->initialized = GK_TRUE;
	engine->animating = GK_TRUE;
	
    return 0;
}
开发者ID:amineas,项目名称:libGK,代码行数:32,代码来源:gkPlatformAndroid.c


示例2: createSurface

bool COpenGL::createSurfaces()
{
	// This function creates the surfaces which are needed for the game.
	const CRect<Uint16> gamerect = m_VidConfig.m_GameRect;
    ScrollSurface = createSurface( "ScrollSurface", true,
								  512, 512,
								  RES_BPP,
								  m_Mode, screen->format );

    g_pLogFile->textOut("Blitsurface = creatergbsurface<br>");

    BlitSurface = createSurface( "BlitSurface", true,
    		getPowerOfTwo(gamerect.w),
    		getPowerOfTwo(gamerect.h),
    		RES_BPP,
    		m_Mode, screen->format );

    g_pLogFile->textOut("FilteredSurface = creatergbsurface<br>");

	FilteredSurface = createSurface( "FilteredSurface", true,
				BlitSurface->w*m_VidConfig.m_ScaleXFilter,
				BlitSurface->h*m_VidConfig.m_ScaleXFilter,
				RES_BPP,
				m_Mode, screen->format );

	m_dst_slice = FilteredSurface->w*screen->format->BytesPerPixel;

	if(m_VidConfig.m_ScaleXFilter == 1)
	{
		FXSurface = createSurface( "FXSurface", true,
						getPowerOfTwo(gamerect.w),
						getPowerOfTwo(gamerect.h),
						RES_BPP,
						m_Mode, screen->format );
	}
	else
	{
		FXSurface = createSurface( "FXSurface", false,
				gamerect.w,
				gamerect.h,
				RES_BPP,
				m_Mode, screen->format );

		//Set surface alpha
	}

	g_pGfxEngine->Palette.setFXSurface( FXSurface );

	Scaler.setFilterFactor(m_VidConfig.m_ScaleXFilter);
	Scaler.setFilterType(m_VidConfig.m_normal_scale);
	Scaler.setDynamicFactor( float(FilteredSurface->w)/float(screen->w),
							 float(FilteredSurface->h)/float(screen->h));


	return true;
}
开发者ID:pelya,项目名称:Commander-Genius,代码行数:56,代码来源:COpenGL.cpp


示例3: createSurface

void MapperGui::prepareWorldImage(){
    /**************************************
            Make sure the Cache exists
            and is still relevent
    ***************************************/
    //  check if the map has been edited since last drawn
    //  if so, regen layer images
    if( mapTouched ){
        //  check if there a no world
        if( world != NULL ){
            //  check if layers are initialised
            if( !world->empty() ){
                Layer& workingLayer = world->getLayer(layerToggleBox->getWorkingLayer());
                //  check if the worldImage exists and is coherrent
                if( worldImage == NULL ){
                    //  there is no world image, create one
                    worldImage = createSurface(
                                 workingLayer.getWidth()*
                                 workingLayer.getTileWidth(),
                                 workingLayer.getHeight()*
                                 workingLayer.getTileHeight(),
                                 graphics->getTarget()->format->BitsPerPixel,
                                 SDL_SWSURFACE );
                } else
                //  a world image exists, but it is the wrong dimensions
                if ( ( worldImage->w != workingLayer.getWidth()*
                                        workingLayer.getTileWidth() ) ||
                     ( worldImage->h != workingLayer.getHeight()*
                                        workingLayer.getTileHeight() )   )
                {
                    //free old image
                    SDL_FreeSurface(worldImage);
                    //creaet new one of correct dimensions
                    worldImage = createSurface(
                                workingLayer.getWidth()*
                                workingLayer.getTileWidth(),
                                workingLayer.getHeight()*
                                workingLayer.getTileHeight(),
                                graphics->getTarget()->format->BitsPerPixel,
                                SDL_SWSURFACE );
                }
                //match the dimensions of the world image and the PlaceHolder
                worldImagePlaceHolder->setWidth( worldImage->w );
                worldImagePlaceHolder->setHeight( worldImage->h );

                //now that worldImage is properly initialised, draw the world onto it
                drawWorld();
            }   // end layers exists
        }// end if world exists
        mapTouched = 0;
    }// end if touched
}
开发者ID:hoodwolf,项目名称:Infraelly,代码行数:52,代码来源:MapperGui.cpp


示例4: defined

void tst_QOpenGL::openGLPaintDevice()
{
#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(__x86_64__)
    QSKIP("QTBUG-22617");
#endif

    QFETCH(int, surfaceClass);
    QScopedPointer<QSurface> surface(createSurface(surfaceClass));

    QOpenGLContext ctx;
    QVERIFY(ctx.create());

    QSurfaceFormat format = ctx.format();
    if (format.majorVersion() < 2)
        QSKIP("This test requires at least OpenGL 2.0");
    QVERIFY(ctx.makeCurrent(surface.data()));

    const QSize size(128, 128);

    QImage image(size, QImage::Format_RGB32);
    QPainter p(&image);
    p.fillRect(0, 0, image.width() / 2, image.height() / 2, Qt::red);
    p.fillRect(image.width() / 2, 0, image.width() / 2, image.height() / 2, Qt::green);
    p.fillRect(image.width() / 2, image.height() / 2, image.width() / 2, image.height() / 2, Qt::blue);
    p.fillRect(0, image.height() / 2, image.width() / 2, image.height() / 2, Qt::white);
    p.end();

    QOpenGLFramebufferObject fbo(size);
    QVERIFY(fbo.bind());

    QOpenGLPaintDevice device(size);
    QVERIFY(p.begin(&device));
    p.fillRect(0, 0, image.width() / 2, image.height() / 2, Qt::red);
    p.fillRect(image.width() / 2, 0, image.width() / 2, image.height() / 2, Qt::green);
    p.fillRect(image.width() / 2, image.height() / 2, image.width() / 2, image.height() / 2, Qt::blue);
    p.fillRect(0, image.height() / 2, image.width() / 2, image.height() / 2, Qt::white);
    p.end();

    QImage actual = fbo.toImage().convertToFormat(QImage::Format_RGB32);
    QCOMPARE(image.size(), actual.size());
    QCOMPARE(image, actual);

    QVERIFY(p.begin(&device));
    p.fillRect(0, 0, image.width(), image.height(), Qt::black);
    p.drawImage(0, 0, image);
    p.end();

    actual = fbo.toImage().convertToFormat(QImage::Format_RGB32);
    QCOMPARE(image.size(), actual.size());
    QCOMPARE(image, actual);

    QVERIFY(p.begin(&device));
    p.fillRect(0, 0, image.width(), image.height(), Qt::black);
    p.fillRect(0, 0, image.width(), image.height(), QBrush(image));
    p.end();

    actual = fbo.toImage().convertToFormat(QImage::Format_RGB32);
    QCOMPARE(image.size(), actual.size());
    QCOMPARE(image, actual);
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:60,代码来源:tst_qopengl.cpp


示例5: drawTextBox

void drawTextBox(SDL_Surface *dst, const string s[], int numLines, TTF_Font *font, int x, int y){
    SDL_Color col = {0xDD, 0xDD, 0xDD, 0xDD};
    int max_w = 0, pos = y, w, h;
    SDL_Surface **textImgs = new SDL_Surface *[numLines];
    for(int i=0; i<numLines; i++){
        TTF_SizeText(font, s[i].c_str(), &w, &h);
        textImgs[i] = TTF_RenderText_Blended(font, s[i].c_str(), col);
        if(w > max_w) max_w = w;
    }

    SDL_Surface *bg = createSurface(max_w + 8, h*numLines);
    SDL_FillRect(bg, NULL, 0);
    SDL_SetAlpha(bg, SDL_SRCALPHA, 128);
    x -= bg->w/2;
    blitSurface(bg, dst, x, y);
    SDL_FreeSurface(bg);

    for(int i=0; i<numLines; i++){
        if(textImgs[i]){
            blitSurface(textImgs[i], dst, x+4 ,y+h*i);
            SDL_FreeSurface(textImgs[i]);
        }
    }
    delete [] textImgs;
}
开发者ID:Lonnifer,项目名称:Blockenspiel,代码行数:25,代码来源:sdl_wrapper.cpp


示例6: createSurface

SDL_Surface *getImageFromTexMap(SDL_Surface *tm, int x, int y, int w, int h){
    SDL_Surface *dst = createSurface(w,h); 
    SDL_SetColorKey( dst, SDL_RLEACCEL | SDL_SRCCOLORKEY, 0 );
    blitClippedSurface(tm, x, y, w, h, dst, 0, 0);

    return dst;
}
开发者ID:Lonnifer,项目名称:Blockenspiel,代码行数:7,代码来源:sdl_wrapper.cpp


示例7: switch

status_t BnSurfaceComposerClient::onTransact(
    uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
     switch(code) {
        case CREATE_SURFACE: {
            CHECK_INTERFACE(ISurfaceComposerClient, data, reply);
            surface_data_t params;
            String8 name = data.readString8();
            DisplayID display = data.readInt32();
            uint32_t w = data.readInt32();
            uint32_t h = data.readInt32();
            PixelFormat format = data.readInt32();
            uint32_t flags = data.readInt32();
            sp<ISurface> s = createSurface(&params, name, display, w, h,
                    format, flags);
            params.writeToParcel(reply);
            reply->writeStrongBinder(s->asBinder());
            return NO_ERROR;
        } break;
        case DESTROY_SURFACE: {
            CHECK_INTERFACE(ISurfaceComposerClient, data, reply);
            reply->writeInt32( destroySurface( data.readInt32() ) );
            return NO_ERROR;
        } break;
        default:
            return BBinder::onTransact(code, data, reply, flags);
    }
}
开发者ID:10x-Amin,项目名称:frameworks_base,代码行数:28,代码来源:ISurfaceComposerClient.cpp


示例8: createSurface

SurfacePtr VaapiEncoderBase::createSurface(VideoFrameRawData* frame)
{
    SurfacePtr surface = createSurface(frame->fourcc);
    SurfacePtr nil;
    if (!surface)
        return nil;

    ImagePtr image = VaapiImage::derive(surface);
    if (!image) {
        ERROR("VaapiImage::derive() failed");
        return nil;
    }
    ImageRawPtr raw = mapVaapiImage(image);
    if (!raw) {
        ERROR("image->map() failed");
        return nil;
    }

    uint8_t* src = reinterpret_cast<uint8_t*>(frame->handle);
    if (!raw->copyFrom(src, frame->offset, frame->pitch)) {
        ERROR("copyfrom in buffer failed");
        return nil;
    }
    return surface;
}
开发者ID:keqiaox,项目名称:libyami,代码行数:25,代码来源:vaapiencoder_base.cpp


示例9: createSurface

void OpenGLGraphicsManager::displayActivityIconOnOSD(const Graphics::Surface *icon) {
#ifdef USE_OSD
	if (_osdIconSurface) {
		delete _osdIconSurface;
		_osdIconSurface = nullptr;

		// Make sure the icon is cleared on the next update
		_forceRedraw = true;
	}

	if (icon) {
		Graphics::Surface *converted = icon->convertTo(_defaultFormatAlpha);

		_osdIconSurface = createSurface(_defaultFormatAlpha);
		assert(_osdIconSurface);
		// We always filter the osd with GL_LINEAR. This assures it's
		// readable in case it needs to be scaled and does not affect it
		// otherwise.
		_osdIconSurface->enableLinearFiltering(true);

		_osdIconSurface->allocate(converted->w, converted->h);

		Graphics::Surface *dst = _osdIconSurface->getSurface();

		// Copy the icon to the texture
		dst->copyRectToSurface(*converted, 0, 0, Common::Rect(0, 0, converted->w, converted->h));

		converted->free();
		delete converted;
	}
#endif
}
开发者ID:86400,项目名称:scummvm,代码行数:32,代码来源:opengl-graphics.cpp


示例10: main

//---------------------------------------------------------------------
//---------------------------------------------------------------------
int main(int argc, char* argv[]) {
	createSurface();
	game.changeSize((int)game.mW, (int)game.mH);
	glClearColor(0.0f, 0.0f, 0.2f, 1.0f);	
	mainLoop();
	return 0;
}
开发者ID:dibanezalegria,项目名称:Cplusplus,代码行数:9,代码来源:Main.cpp


示例11: createSurface

Encode_Status VaapiEncoderH264::encodePicture(const PicturePtr& picture)
{
    Encode_Status ret = ENCODE_FAIL;

    SurfacePtr reconstruct = createSurface();
    if (!reconstruct)
        return ret;
    {
        AutoLock locker(m_paramLock);

#ifdef __BUILD_GET_MV__
        uint32_t size;
        void *buffer = NULL;
        getMVBufferSize(&size);
        if (!picture->editMVBuffer(buffer, &size))
            return ret;
#endif
        if (!ensureSequence (picture))
            return ret;
        if (!ensureMiscParams (picture.get()))
            return ret;
        if (!ensurePicture(picture, reconstruct))
            return ret;
        if (!ensureSlices (picture))
            return ret;
    }
    if (!picture->encode())
        return ret;

    if (!referenceListUpdate (picture, reconstruct))
        return ret;

    return ENCODE_SUCCESS;
}
开发者ID:01org,项目名称:libyami,代码行数:34,代码来源:vaapiencoder_h264.cpp


示例12: _glfwPlatformCreateWindow

int _glfwPlatformCreateWindow(_GLFWwindow* window,
                              const _GLFWwndconfig* wndconfig,
                              const _GLFWctxconfig* ctxconfig,
                              const _GLFWfbconfig* fbconfig)
{
    if (!_glfwCreateContext(window, ctxconfig, fbconfig))
        return GL_FALSE;

    if (!createSurface(window, wndconfig))
        return GL_FALSE;

    if (wndconfig->monitor)
    {
        wl_shell_surface_set_fullscreen(
            window->wl.shell_surface,
            WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
            0,
            wndconfig->monitor->wl.output);
    }
    else
    {
        wl_shell_surface_set_toplevel(window->wl.shell_surface);
    }

    return GL_TRUE;
}
开发者ID:Delwin9999,项目名称:glfw,代码行数:26,代码来源:wl_window.c


示例13: owfNativeStreamCreateImageStream

/*!---------------------------------------------------------------------------
 *  Create new off-screen image stream.
 *
 *  \param width            Stream image buffer width
 *  \param height           Stream image buffer height
 *  \param imageFormat      Stream image buffer format
 *  \param nbufs            Number of image buffers to allocate
 *
 *  \param Handle to newly created stream or OWF_INVALID_HANDLe if no
 *  stream could be created.
 *----------------------------------------------------------------------------*/
OWF_API_CALL OWFNativeStreamType
owfNativeStreamCreateImageStream(OWFint width,
                                 OWFint height,
                                 const OWF_IMAGE_FORMAT* format,
                                 OWFint nbufs)
        {
        RSurfaceManager surface_manager;
        TInt err=surface_manager.Open();
        if (err<KErrNone)
            {
            return WFC_INVALID_HANDLE;
            }
        TSurfaceId surface;
        
        surface = createSurface(surface_manager, width, height, format, nbufs);
        if (surface.IsNull())
            {
            return WFC_INVALID_HANDLE;
            }
        SymbianStreamType ns=WFC_INVALID_HANDLE;  //No more error checking required...
        SymbianStreamAcquire(&surface,&ns);
        
        surface_manager.CloseSurface(surface);
        if (ns)
            {
            WipeWriteBuffer(ns);
            }
        surface_manager.Close();
        return (OWFNativeStreamType)ns;
        }
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:41,代码来源:owfnativestreamstub.cpp


示例14: QFETCH

void tst_QOpenGL::fboSimpleRendering()
{
    QFETCH(int, surfaceClass);
    QScopedPointer<QSurface> surface(createSurface(surfaceClass));

    QOpenGLContext ctx;
    ctx.create();

    ctx.makeCurrent(surface.data());

    if (!QOpenGLFramebufferObject::hasOpenGLFramebufferObjects())
        QSKIP("QOpenGLFramebufferObject not supported on this platform");

    // No multisample with combined depth/stencil attachment:
    QOpenGLFramebufferObjectFormat fboFormat;
    fboFormat.setAttachment(QOpenGLFramebufferObject::NoAttachment);

    QOpenGLFramebufferObject *fbo = new QOpenGLFramebufferObject(200, 100, fboFormat);

    fbo->bind();

    glClearColor(1.0, 0.0, 0.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT);
    glFinish();

    QImage fb = fbo->toImage().convertToFormat(QImage::Format_RGB32);
    QImage reference(fb.size(), QImage::Format_RGB32);
    reference.fill(0xffff0000);

    QFUZZY_COMPARE_IMAGES(fb, reference);

    delete fbo;
}
开发者ID:SfietKonstantin,项目名称:radeon-qt5-qtbase-kms,代码行数:33,代码来源:tst_qopengl.cpp


示例15: ASSERT

bool Canvas2DLayerBridge::isValid()
{
    ASSERT(m_layer);
    if (m_context->webContext()->isContextLost() || !m_surfaceIsValid) {
        // Attempt to recover.
        m_layer->clearTexture();
        m_mailboxes.clear();
        RefPtr<GraphicsContext3D> sharedContext = SharedGraphicsContext3D::get();
        if (!sharedContext || sharedContext->webContext()->isContextLost()) {
            m_surfaceIsValid = false;
        } else {
            m_context = sharedContext;
            IntSize size(m_canvas->getTopDevice()->width(), m_canvas->getTopDevice()->height());
            SkAutoTUnref<SkSurface> surface(createSurface(m_context.get(), size));
            if (surface.get()) {
                m_canvas->setSurface(surface.get());
                m_surfaceIsValid = true;
                // FIXME: draw sad canvas picture into new buffer crbug.com/243842
            } else {
                // Surface allocation failed. Set m_surfaceIsValid to false to
                // trigger subsequent retry.
                m_surfaceIsValid = false;
            }
        }
    }
    if (!m_surfaceIsValid)
        setRateLimitingEnabled(false);
    return m_surfaceIsValid;

}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:30,代码来源:Canvas2DLayerBridge.cpp


示例16: m_display

EglContext::EglContext(EglContext* shared, const ContextSettings& settings, const WindowImpl* owner, unsigned int bitsPerPixel) :
m_display (EGL_NO_DISPLAY),
m_context (EGL_NO_CONTEXT),
m_surface (EGL_NO_SURFACE),
m_config  (NULL)
{
#ifdef SFML_SYSTEM_ANDROID

    // On Android, we must save the created context
    ActivityStates* states = getActivity(NULL);
    Lock lock(states->mutex);

    states->context = this;

#endif

    // Get the initialized EGL display
    m_display = getInitializedDisplay();

    // Get the best EGL config matching the requested video settings
    m_config = getBestConfig(m_display, bitsPerPixel, settings);
    updateSettings();

    // Create EGL context
    createContext(shared);

#if !defined(SFML_SYSTEM_ANDROID)
    // Create EGL surface (except on Android because the window is created
    // asynchronously, its activity manager will call it for us)
    createSurface((EGLNativeWindowType)owner->getSystemHandle());
#endif
}
开发者ID:CastBart,项目名称:AndroidTesting,代码行数:32,代码来源:EglContext.cpp


示例17: main

int main(int argc, char *argv[]) {

	// Init SDL video subsystem
	if ( SDL_Init (SDL_INIT_VIDEO) < 0 ) {
		
        fprintf(stderr, "Couldn't initialize SDL: %s\n",
			SDL_GetError());
		exit(1);
	}
	atexit(SDL_Quit);

    // Set GL context attributes
    initAttributes ();
    
    // Create GL context
    createSurface(0);
    
    // Get GL context attributes
    printAttributes();
    
    // Init GL state
    initGL();
    
    // Draw, get events...
    mainLoop();
    
    // Cleanup
	SDL_Quit();
	
    return 0;
}
开发者ID:julianh2o,项目名称:Gravity,代码行数:31,代码来源:main.cpp


示例18: rot_bitmap_layer_update_func

void rot_bitmap_layer_update_func (Layer* l,GContext* ctx) {
    ROT_BITMAP_GET;
    GPoint topOffset=getTopOffset ();
    setTopOffset(GPoint(0,0));
    GRect rect=GRect(0,0,l->frame.size.w,l->frame.size.h);

    SDL_Surface* sur=createSurface(rotbitmap->bitmap->bounds.size.w,rotbitmap->bitmap->bounds.size.h);
    SDL_FillRect(sur,0,0);
    graphics_context_set_compositing_mode (ctx,GCompOpAssign);
    graphics_draw_bitmap_in_rect_to (ctx,rotbitmap->bitmap,rect,sur);
    double angle=(double)rotbitmap->rotation/TRIG_MAX_ANGLE*360.0;
    SDL_Surface* rotated=rotozoomSurface(sur,-angle,1.0,SMOOTHING_OFF);
    SDL_FreeSurface(sur);
    GPoint offset=getPivotRotationOffset(rotbitmap->bitmap->bounds.size,GSize(rotated->w,rotated->h),rotbitmap->src_ic,angle);

    rotbitmap->dest_ic.x=l->frame.size.w/2; //TODO: Verify this
    rotbitmap->dest_ic.y=l->frame.size.h/2;

    setTopOffset(topOffset);
    if (rotbitmap->corner_clip_color!=GColorClear) {
        graphics_context_set_fill_color(ctx,rotbitmap->corner_clip_color);
        graphics_fill_rect(ctx,GRect(0,0,l->frame.size.w,l->frame.size.h),0,0);
    }
    graphics_context_set_compositing_mode (ctx,rotbitmap->compositing_mode);
    graphics_draw_surface_in_rect (ctx,rotated,GRect(rotbitmap->dest_ic.x-offset.x,rotbitmap->dest_ic.y-offset.y,rotated->w,rotated->h));
    SDL_FreeSurface(rotated);
}
开发者ID:BarlowRobert,项目名称:PebbleLocalSim,代码行数:27,代码来源:bitmap.c


示例19: createSurface

/**
 * Rendering a wordy tooltip (TTF to raster) can be expensive.
 * Instead of doing this each frame, do it once and cache the result.
 */
void WidgetTooltip::createBuffer(TooltipData &tip) {
	
	// concat multi-line tooltip, used in determining total display size
	string fulltext;
	fulltext = tip.lines[0];
	for (int i=1; i<tip.num_lines; i++) {
		fulltext = fulltext + "\n" + tip.lines[i];
	}
	
	// calculate the full size to display a multi-line tooltip
	Point size = font->calc_size(fulltext, width);
	size.x += margin + margin;
	size.y += margin + margin;
	
	// this SDL_Surface memory is freed when the TooltipData leaves scope
	// or when a clear() is called.
	tip.tip_buffer = createSurface(size.x, size.y);
	
	// Currently tooltips are always opaque
	SDL_SetAlpha(tip.tip_buffer, 0, 0);
	
	// style the tooltip background
	// currently this is plain black
	SDL_FillRect(tip.tip_buffer, NULL, 0);
	
	int cursor_y = margin;
	
	for (int i=0; i<tip.num_lines; i++) {
		font->render(tip.lines[i], margin, cursor_y, JUSTIFY_LEFT, tip.tip_buffer, size.x, tip.colors[i]);
		cursor_y = font->cursor_y;
	}

}
开发者ID:nobsod,项目名称:flare,代码行数:37,代码来源:WidgetTooltip.cpp


示例20: AnimatedSprite

AsScene2402TV::AsScene2402TV(NeverhoodEngine *vm, Klaymen *klaymen)
	: AnimatedSprite(vm, 1100), _klaymen(klaymen), _countdown1(0), _countdown2(0) {

	_x = 260;
	_y = 210;
	createSurface(100, 127, 90);
	setDoDeltaX(1);
	SetMessageHandler(&Sprite::handleMessage);
	if (!getGlobalVar(V_TV_JOKE_TOLD)) {
		loadSound(0, 0x58208810);
		_countdown1 = 48;
		startAnimation(0x4919397A, 0, -1);
		_newStickFrameIndex = 0;
		SetUpdateHandler(&AsScene2402TV::upWait);
	} else {
		int16 frameIndex;
		if (_klaymen->getX() > 320)
			_currFrameIndex = 29;
		frameIndex = CLIP<int16>((_klaymen->getX() - _x + 150) / 10, 0, 29);
		startAnimation(0x050A0103, frameIndex, -1);
		_newStickFrameIndex = frameIndex;
		_countdown1 = 0;
		SetUpdateHandler(&AsScene2402TV::upFocusKlaymen);
	}
}
开发者ID:jaeyeonkim,项目名称:scummvm-kor,代码行数:25,代码来源:module2400_sprites.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ createSymbol函数代码示例发布时间:2022-05-30
下一篇:
C++ createStringObjectFromLongLong函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap