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


C++ LoadSprite函数代码示例

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


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

示例1: InitEnt

Entity* InitEnt(Entity *ent, int x, int y, int vy, int onGround, char* imagel, char* imager, int xframe, int yframe)
{
	ent = (Entity*)malloc(sizeof(Entity));
	ent->x = x;
	ent->y = y;
	ent->vy = vy;
	ent->flag = IDLE;
	ent->sprl = LoadSprite(imagel, xframe, yframe);
	ent->sprr = LoadSprite(imager, xframe, yframe);
	ent->spr = ent->sprl;
	ent->frame = 0;
	ent->used = 1;
	ent->onGround = 0;
	ent->hurtbox.x = 0;
	ent->hurtbox.y = 0;
	ent->hurtbox.w = 320;
	ent->hurtbox.h = 240;
	ent->hitboxR.x = 160;
	ent->hitboxR.y = 110;
	ent->hitboxR.w = 160;
	ent->hitboxR.h = 20;
	ent->hitboxL.x = 160;
	ent->hitboxL.y = 110;
	ent->hitboxL.w = -160;
	ent->hitboxL.h = 20;
	return ent;
}
开发者ID:Darksim150,项目名称:276,代码行数:27,代码来源:entity.c

示例2: SetUpTitle

void SetUpTitle()
{
	Button* NewGame, *Continue,*Editor;
	Editor_Panel* panel;
	Label* Title;
	NewGame = CreateEditorButton(NULL,CreateSDL_Rect(100,200,255,100));
	Continue = CreateEditorButton(NULL,CreateSDL_Rect(300,330,255,100));
	Editor = CreateEditorButton(NULL,CreateSDL_Rect(500,460,255,100));
	
	NewGame->sprite = LoadSprite("images/New_Game_Button.png",255,100);
	NewGame->sprite->fpl = 1;
	strcpy(NewGame->name,"NewGame");
	Continue->sprite = LoadSprite("images/Continue_Button.png",255,100);
	Continue->sprite->fpl = 1;
	strcpy(Continue->name,"Continue");
	Editor->sprite = LoadSprite("images/Level_Editor_Button.png",255,100);
	Editor->sprite->fpl = 1;
	strcpy(Editor->name,"Editor");
	Title = CreateEditorLabel(NULL,CreateSDL_Rect(0,0,350,200));
	Title->sprite = LoadSprite("images/Aard_Title.png",350,200);
	
	panel = CreateEditorPanel(CreateSDL_Rect(0,0,800,600));
	panel->buttons = g_list_append(panel->buttons,NewGame);
	panel->buttons = g_list_append(panel->buttons,Continue);
	panel->buttons = g_list_append(panel->buttons,Editor);
	panel->labels = g_list_append(panel->labels,Title);
	MainEditorPanels = g_list_append(MainEditorPanels,panel);
	
	atexit(FreeEveryThing);

}
开发者ID:jam92,项目名称:IT276-Aard,代码行数:31,代码来源:game_title.c

示例3: CreateCombination

// This is where the bones of the project are forged
// (loading sprites, for example)
BOOL CGameLogic::Init(CGame *game)
{
	// Initialize the combination
	m_combo = CreateCombination();
	m_nodes = m_combo;
	for (unsigned i = 0; i < m_nodes.size(); i++)
		m_nodes[i] = i;

	// Load sprites
	auto path = game->GetExecutablePath();

	// Slider (Mid-section)
	CSprite *spr = nullptr;
	if (!LoadSprite(path, L"sliderMid.png", game->GetRenderer(), &spr))
		return FALSE;
	m_sprites.push_back(spr);
	spr->SetPosition(0, 0);

	// Slider (nodes)
	for (auto i = 0; i < 5; i++) {
		spr = nullptr;
		if (!LoadSprite(path, L"sliderNode.png", game->GetRenderer(), &spr))
			return FALSE;
		m_sprites.push_back(spr);
	}

	return TRUE;
}
开发者ID:MichaelSpectre,项目名称:FireMarblePuzzle,代码行数:30,代码来源:GameLogic.cpp

示例4: LoadReferencedSprites

	void __cdecl LoadReferencedSprites() { // replaces sub_42B510
		memset( Loaded_Sprite_Array, 0, sizeof( Loaded_Sprite_Array ) );
		int loaded_count = 0;
		
		for( int i = SPRITE_FIRST; i <= SPRITE_LAST; i++ ){
			if( SpriteTable[i].ref_count != 0 ){ // load sprite if used
				char szPath[MAX_PATH];
				wsprintfA( szPath, GetGameDirStr( "[SPRITES]\\%s.spr" ), SpriteTable[i].name );				
				LoadSprite( *((DWORD*)0x005014BC), 0, szPath, &(Loaded_Sprite_Array[loaded_count]) );
				if( Loaded_Sprite_Array[loaded_count] != 0 ){
					SpriteTable[i].loaded_index_sprites = (WORD) loaded_count;
					loaded_count++;
				}
			}
		}
		for( int i = X_SPRITE_FIRST; i <= X_SPRITE_LAST; i++ ){
			if( SpriteTable[i].ref_count != 0 ){ // load sprite if used
				char szPath[MAX_PATH];
				wsprintfA( szPath, GetGameDirStr( "[SPRITES]\\%s.spr" ), SpriteTable[i].name );				
				LoadSprite( *((DWORD*)0x005014BC), 0, szPath, &(Loaded_Sprite_Array[loaded_count]) );
				if( Loaded_Sprite_Array[loaded_count] != 0 ){
					SpriteTable[i].loaded_index_sprites = (WORD) loaded_count;
					loaded_count++;
				}
			}
		}

		*((DWORD*)0x00502AF4) = 0x0042B430; // as per original, set function pointer 
	}
开发者ID:Ghabry,项目名称:Dark-Omen-Mod-Selector,代码行数:29,代码来源:xslots.cpp

示例5: InitVersus

void InitVersus(){	
	LoadStage(stage);
	InitFighters(c1,c2);
	DrawBG(HUDBG);
	pausescr = LoadSprite("images/pause.png",1024,768,1);
	p1vic = LoadSprite("images/p1win.png",1024,768,1);
	p2vic = LoadSprite("images/p2win.png",1024,768,1);
	drawvic = LoadSprite("images/draw.png",1024,768,1);
}
开发者ID:jc429,项目名称:276game,代码行数:9,代码来源:game.c

示例6: Assert

SpriteGroup *SpriteGroupList::GetSprite(uint32 index, GROUPTYPE type, LOADTYPE loadType,GAME_ACTION action)
{
	Assert(index >= 0);
	Assert(index < k_MAX_SPRITES);

	if((index < 0) || (index >= k_MAX_SPRITES))
		index = 0;

	SpriteGroup *group = m_spriteList[index];

	if (group) 
	{
		if (loadType != group->GetLoadType()) 
		{
			if ((loadType==LOADTYPE_FULL)||(loadType==LOADTYPE_INDEXED)) 
			{
				group->DeallocateStorage();
                (void) LoadSprite(index, type, loadType, action);
			}
		}
	}
	else 
    {
        if (SPRITELISTERR_OK == LoadSprite(index, type, loadType, action))
        {
            // No action: m_spriteList[index] initialised with data from file
        }
        else
        {
            return NULL;
        }
	} 

	switch (loadType) 
	{
	case LOADTYPE_BASIC:
		 m_spriteList[index]->AddRef();
		 break;
	case LOADTYPE_FULL:
	case LOADTYPE_INDEXED:
		 m_spriteList[index]->AddFullLoadRef();
		 break;
	default:
		 Assert(loadType == LOADTYPE_BASIC || loadType == LOADTYPE_FULL);
		 break;
	}

	return m_spriteList[index];
}
开发者ID:talentlesshack,项目名称:C2P2,代码行数:49,代码来源:SpriteGroupList.cpp

示例7: RenderCb

static void RenderCb (Entity *ent, Camera &cam)
{
	//TurtleShell *self = TURTLE_SHELL (ent);
	Vec3f r,p;
	r = ent->bounds.half;
	p = ent->pos;

	if (DRAW_BOUNDS)
	{
		// draw bounds
		glDisable (GL_TEXTURE_2D);
		glColor3f (1.0,0.0,0.0);
		glBegin (GL_QUADS);

		glVertex3f (p.x-r.x, p.y+r.y, p.z);
		glVertex3f (p.x-r.x, p.y-r.y, p.z);
		glVertex3f (p.x+r.x, p.y-r.y, p.z);
		glVertex3f (p.x+r.x, p.y+r.y, p.z);

		glEnd ();
		glEnable (GL_TEXTURE_2D);
	}

	if (!g_sprites[TURTLE_SHELL].shader)
		LoadSprite (g_sprites+TURTLE_SHELL, "sprites/turtle_shell.sprt");

	Sprite *s;
	SpriteFrame *f;
	int anim;
	s = g_sprites + TURTLE_SHELL;
	anim = GetAnimFrame(TURTLE_SHELL (ent), s->fps)%s->numFrames;
	f = s->frames + anim;
	glColor3f (1.,1.,1.);
	glBindTexture (GL_TEXTURE_2D, s->shader->tex);

	float x1,x2,y1,y2;
	float w = s->w/2,
	      h = s->h/2;
	x1 = p.x-w + s->pos.x;
	y1 = p.y+h + s->pos.y;
	x2 = p.x+w + s->pos.x;
	y2 = p.y-h + s->pos.y;

	//glColor3f (1.0,0.0,0.0);
	//glDisable (GL_CULL_FACE);
	//glBlendFunc (GL_DST_COLOR, GL_ONE);
	glBegin (GL_QUADS);

	glTexCoord2f (f->p1.x,f->p2.y);glVertex3f (x1, y1, p.z);	

	glTexCoord2f (f->p1.x,f->p1.y);glVertex3f (x1, y2, p.z);

	glTexCoord2f (f->p2.x,f->p1.y);glVertex3f (x2, y2, p.z);

	glTexCoord2f (f->p2.x,f->p2.y);glVertex3f (x2, y1, p.z);

	glEnd ();
	//glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

}
开发者ID:philhey,项目名称:scroller,代码行数:60,代码来源:TurtleShell.cpp

示例8: LoadSprite

bool CannonType::InitCannonType (PipeType* pipe, int startingx, int width, int height, int spacing, const char * CannonSprite)
{
	mPipe = pipe;

	mCannonBG = LoadSprite(CannonSprite);

	//set the cannons up
	//start with the first cannon
	mCannons[0].x = startingx;
	mCannons[0].y = pipe->y + 30;
	mCannons[0].mCannonWidth = width;
	mCannons[0].mCannonHeight = height;
	mCannons[0].Loaded = 0;

	//setup the second cannon;
	mCannons[1].x = startingx + width + spacing;
	mCannons[1].y = pipe->y + 30;
	mCannons[1].mCannonWidth = width;
	mCannons[1].mCannonHeight = height;
	mCannons[1].Loaded = 0;

	//setup the last cannon;
	mCannons[2].x = startingx + width + spacing + width + spacing;
	mCannons[2].y = pipe->y + 30;
	mCannons[2].mCannonWidth = width;
	mCannons[2].mCannonHeight = height;
	mCannons[2].Loaded = 0;

	return true;
}
开发者ID:bwyyoung,项目名称:NYP_CPP_SPECTRALEFFECT,代码行数:30,代码来源:CannonType.cpp

示例9: sprintf

void SpriteGroupList::RefreshBasicLoads(GROUPTYPE groupType)
{

	ProgressWindow::BeginProgress(
		g_theProgressWindow,
		"InitProgressWindow",
		k_MAX_SPRITES-1 );

	MBCHAR s[_MAX_PATH];
	sprintf( s, g_theStringDB->GetNameStr("LOADING") );

	for (sint32 i=0; i<k_MAX_SPRITES; i++) 
	{
		UnitSpriteGroup *usg = (UnitSpriteGroup *)m_spriteList[i];

		if (usg && (usg->GetLoadType() == LOADTYPE_BASIC)) 
        {
			usg->DeallocateStorage();
			(void) LoadSprite(i, groupType, LOADTYPE_BASIC,(GAME_ACTION)0);
		}

		g_theProgressWindow->StartCountingTo( i, s );
	}

	ProgressWindow::EndProgress( g_theProgressWindow );
}
开发者ID:talentlesshack,项目名称:C2P2,代码行数:26,代码来源:SpriteGroupList.cpp

示例10: LoadSprite

Window *NewWindow(char *title,char *spritename,int x,int y, int w,int h,int c1,int c2,int layer,void (*drawwindow)(Window *self),void (*updatewindow)(Window *self))
{
  int i;
  for(i = 0;i < MAXWINDOWS;i++)
  {
    if(!WindowList[i].inuse)
    {
      WindowList[i].inuse = 1;
      if(spritename != NULL)
      {
        WindowList[i].sprite = LoadSprite(spritename,w,h);
        if(WindowList[i].sprite != NULL)WindowList[i].usesprite = 1;
        else WindowList[i].usesprite = 0;
      }
      else WindowList[i].usesprite = 0;
      if(title != NULL)
      {
        strcpy(WindowList[i].title,title);
      }
      WindowList[i].rect.x = x;
      WindowList[i].rect.y = y;
      WindowList[i].rect.w = w;
      WindowList[i].rect.h = h;
      WindowList[i].layer = layer;
      WindowList[i].fg = c1;
      WindowList[i].bg = c2;
      WindowList[i].drawwindow = drawwindow;
      WindowList[i].updatewindow = updatewindow;
      return &WindowList[i];
    }
  }
  return NULL;
}
开发者ID:FratStar,项目名称:AlienRush,代码行数:33,代码来源:window.c

示例11: entity_new

Entity *newCube(Vec3D position,const char *name)
{
    Entity * ent;
    char buffer[255];
    int i;
    ent = entity_new();
    if (!ent)
    {
        return NULL;
    }
    /*for (i = 0; i < 24;i++)
    {
        //sprintf(buffer,"models/robot/walk_bot_%06i.obj",i + 1);
        ent->objAnimation[i] = obj_load(buffer);
    }*/
    ent->objModel = obj_load("models/cube.obj");//ent->objAnimation[0];
	if( !ent->objModel )
		slog( "test" );
    ent->texture = LoadSprite("models/cube_text.png",1024,1024); //LoadSprite("models/robot/robot.png",1024,1024);
    vec3d_cpy(ent->body.position,position);
	vec3d_set(ent->scale,1,1,1);
	vec3d_set(ent->rotation,0,0,0);
	vec4d_set(ent->color,1,1,1,1);
    cube_set(ent->body.bounds,-1,-1,-1,2,2,2);
    ent->rotation.x = 90;
    sprintf(ent->name,"%s",name);
    ent->think = think;
    ent->state = 0;
    mgl_callback_set(&ent->body.touch,touch_callback,ent);
    return ent;
}
开发者ID:Mulambev,项目名称:Midterm,代码行数:31,代码来源:gametest3d.c

示例12: LoadSprite

bool		Sample::Init()
{
	LoadSprite(L"Sprite.txt");

	int iIndex = I_Sprite.Load(L"TypeA", 
		L"../../data/bitmap1.bmp", 
		L"../../data/bitmap2.bmp");
	KSprite* pSprite = I_Sprite.Find(iIndex);
	pSprite->SetRectArray(m_SpriteList[0], 2.0f);

	iIndex = I_Sprite.Load(L"TypeB",
		L"../../data/bitmap1.bmp",
		L"../../data/bitmap2.bmp");
	pSprite = I_Sprite.Find(iIndex);
	pSprite->SetRectArray(m_SpriteList[1], 1.0f);

	iIndex = I_Sprite.Load(L"TypeC",
		L"../../data/bitmap1.bmp",
		L"../../data/bitmap2.bmp");
	pSprite = I_Sprite.Find(iIndex);
	pSprite->SetRectArray(m_SpriteList[2], 1.0f);

	m_Hero.Load(L"../../data/bitmap.bmp",
				L"../../data/bitmap.bmp");
	m_Effect.SetSprite(0);
	return true;
}
开发者ID:cyh065,项目名称:FirstProject,代码行数:27,代码来源:Sample.cpp

示例13: InitMouse

/*this only handles the drawing and animation of.  Assuming you have a 16 by 16  tiled sprite sheet.  This will not handle input*/
void InitMouse()
{
  Msprite = LoadSprite("images/mouse.png",16, 16);
  if(Msprite == NULL)fprintf(stdout,"mouse didn't load\n");
  Mouse.state = 0;
  Mouse.shown = 0;
  Mouse.frame = 0;
}
开发者ID:cjm43,项目名称:GameTest,代码行数:9,代码来源:mouse.c

示例14: LoadSprite

int CHudHealth::Draw(float flTime)
{
	int r, g, b;
	int a = 0, x, y;
	int HealthWidth;

	if ( (gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH) || gEngfuncs.IsSpectateOnly() )
		return 1;

	if ( !m_HSPRITE )
		m_HSPRITE = LoadSprite(PAIN_NAME);
	
	// Has health changed? Flash the health #
	if (m_fFade)
	{
		m_fFade -= (gHUD.m_flTimeDelta * 20);
		if (m_fFade <= 0)
		{
			a = MIN_ALPHA;
			m_fFade = 0;
		}

		// Fade the health number back to dim

		a = MIN_ALPHA +  (m_fFade/FADE_TIME) * 128;

	}
	else
		a = MIN_ALPHA;

	// If health is getting low, make it bright red
	if (m_iHealth <= 15)
		a = 255;
		
	GetPainColor( r, g, b );
	ScaleColors(r, g, b, a );

	// Only draw health if we have the suit.
	if (gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)))
	{
		HealthWidth = gHUD.GetSpriteRect(gHUD.m_HUD_number_0).right - gHUD.GetSpriteRect(gHUD.m_HUD_number_0).left;
		int CrossWidth = gHUD.GetSpriteRect(m_HUD_cross).right - gHUD.GetSpriteRect(m_HUD_cross).left;

		y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;
		x = CrossWidth /2;

		SPR_Set(gHUD.GetSprite(m_HUD_cross), r, g, b);
		SPR_DrawAdditive(0, x, y, &gHUD.GetSpriteRect(m_HUD_cross));

		x = CrossWidth + HealthWidth / 2;

		//x = gHUD.DrawHudNumber(x, y, DHN_3DIGITS | DHN_DRAWZERO, m_iHealth, r, g, b);
		gHUD.DrawHudNumber2( x, y, false, 3, m_iHealth, r, g, b);
	}

	DrawDamage(flTime);
	return DrawPain(flTime);
}
开发者ID:mittorn,项目名称:csdm,代码行数:58,代码来源:health.cpp

示例15: LoadFonts

/**
**	Load all fonts.
*/
global void LoadFonts(void)
{
    unsigned i;

    for( i=0; i<sizeof(Fonts)/sizeof(*Fonts); ++i ) {
	ShowLoadProgress("\tFonts %s\n",Fonts[i].File);
	LoadSprite(Fonts[i].File,&Fonts[i].Sprite);
    }
}
开发者ID:saniv,项目名称:freecraft-ale-clone,代码行数:12,代码来源:font.c


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