本文整理汇总了C++中HGE类的典型用法代码示例。如果您正苦于以下问题:C++ HGE类的具体用法?C++ HGE怎么用?C++ HGE使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HGE类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hgeCreate
void BOSSbase::move(float dt)
{
HGE *hge = hgeCreate(HGE_VERSION);
if (move_delay == 0)
{
target_y = hge->Random_Int(70, SCREEN_HEIGHT - 20);
target_x = hge->Random_Int(12, SCREEN_WIDTH - 15);
move_delay = hge->Random_Int(100, 500);//1s~5s切换移动方向
}
else
{
move_delay--;
BALLbase::move(target_x, target_y, dt);
}
if (HP >= max)
{
HP = max;
masure = true;
}
if(HP<max)masure = false;
float add = HP / (float)max;
if (alive && HP>0)
{
scale = 0.1 + 0.9*add;
damage = 5 + 0.01*HP;
}
}
示例2: hgeCreate
void MUTI_SKILL_MANAGER::BornWithNumber(int number,float x,float y,float angle,int speed,bool lianfa, bool foe1,int damage1)
{
HGE *hge = hgeCreate(HGE_VERSION);
SKILL->born(0, 0, 0, 0);
if (lianfa)
{
SKILL->setCD(5);
lianfale = true;
}
else lianfale = false;
if (number > 1)
{
BASE_ARROW *arrow = new BASE_ARROW[number];
for (int i = 0; i < number; i++)
{
arrow[i].Init(x, y, angle-(i-0.5*number)*0.314, speed, foe1,damage1);// need test
arrows.push_back(arrow[i]);
}
arrow_count += number;
}
else
{
BASE_ARROW *arrow = new BASE_ARROW;
arrow->Init(x, y, angle, speed,foe1,damage1);
arrows.push_back(*arrow);
arrow_count += 1;
}
hge->Effect_Play(SKILL->sound);
arrows.shrink_to_fit();
//arrows.resize(arrow_count);
}
示例3: updateLayout
void Object::callRender(const hgeRect & clipRect)
{
if(!visible)
return;
if( layoutChanged )
updateLayout();
HGE * hge = getHGE();
hgeRect clip = hgeRect::Intersect(getRect(),clipRect);
// if avialable area is zero - return
if(clip.IsClean())
return;
// craw self
const bool uiDebug = false;
// draw children
if( clipChildren )
hge->Gfx_SetClipping(clip.x1, clip.y1, clip.x2 - clip.x1, clip.y2 - clip.y1);
if(uiDebug)
drawRect(hge, getRect(), ARGB(255,64,255,64));
onRender();
// turn off clipping
if( clipChildren )
hge->Gfx_SetClipping();
//clip = hgeRect::Intersect(getClientRect(),clipRect);
// render children
for(Children::iterator it = children.begin(); it != children.end(); ++it)
{
Object * object = it->get();
if(object)
object->callRender(clip);
}
}
示例4: hgeCreate
int CTextAction::execute( CGameState * )
{
HGE *hge = hgeCreate(HGE_VERSION);
float dt = hge->Timer_GetDelta();
int ret = m_textbox->Update(dt);
//DebugMsg("textbox ret: %d\n", ret);
bool lbtndown = hge->Input_KeyDown(HGEK_LBUTTON);
bool spacedown = hge->Input_KeyDown(HGEK_SPACE);
if (ret > 0)
{
if (m_showText && lbtndown)
{
return m_textbox->GetID();
}
if (spacedown)
{
m_showText = !m_showText;
m_textbox->Show(m_showText);
}
}
else
{
if (lbtndown)
{
//m_textbox->SpeedUpLine();
m_textbox->SpeedUpAll();
}
}
hge->Release();
return 0;
}
示例5: hgeCreate
void Robot::UseSkill()
{
if (!startattack)
{
HGE *hge = hgeCreate(HGE_VERSION);
float x, y;
hge->Input_GetMousePos(&x, &y);
backx = GetX();
backy = GetY();
switch (coretype)
{
//攻击型
//开始攻击
case Attack:
if (x<ACT_START_X || x>ACT_END_X || y<ACT_START_Y || y>ACT_END_Y)
{
if (!tremble)
tremble = 20;
return;
}
else
{
SetCollisionRange(40);
SetPos(x, y);
}
break;
//触发技能型
//跟hero做intercation将自身赋给hero然后自杀
case Magic:
break;
//BUFF型
//施放技能
case Buff:
{
int count = 0;
Hero *a = dynamic_cast<Hero*>(ObjectPool::GetObjPool().GetOurHero(GetType()));
for (int i = 0; i < STD_CORES; i++)
{
Robot *b = dynamic_cast<Robot*>(a->GetCOREs(i));
if (b && b->IsActive())
{
if (b->GetInnerCode() == GetInnerCode())
{
b->Suicide();
a->Interaction(b);
}
else
if (b->GetCoreType() == Buff)
count++;
}
}
SetSpeed(1500);
SetAim(25 + count * 50, 175);
}
break;
}
startattack = true;
}
}
示例6: hgeCreate
void Projectile::Init(Ship* owner, PROJECTILE_TYPE type, float x, float y, float w, bool active)
{
GameObject::Init(x, y, w, active);
this->type = type;
this->owner = owner;
HGE* hge = hgeCreate(HGE_VERSION);
switch (type)
{
case PROJ_BULLET:
{
tex = hge->Texture_Load("missile.png");
sprite.reset(new hgeSprite(tex, 0, 0, 40, 20));
sprite.get()->SetHotSpot(20, 10);
}
break;
case PROJ_SEEKING_MISSLE:
{
tex = hge->Texture_Load("missile.png");
sprite.reset(new hgeSprite(tex, 0, 0, 40, 20));
sprite.get()->SetHotSpot(20, 10);
}
break;
}
hge->Release();
}
示例7: hgeCreate
void AnimObject::Render()
{
if (anim)
{
HGE *hge = hgeCreate(HGE_VERSION);
if (!anim->IsPlaying())
anim->Play();
if (anim->GetFrame() < anim->GetFrames() - 1)
{
if (anim->GetFrame()>0)alreadyplayed = true;
anim->RenderEx(imgx, imgy, angle, size, size);
anim->Update(hge->Timer_GetDelta());
}
else
{
dead = true;
SAFE_DELETE(anim);
}
if (!dead && alreadyplayed && anim->GetFrame() == 0)
{
dead = true;
SAFE_DELETE(anim);
}
}
}
示例8: hgeCreate
MUTI_POOL::MUTI_POOL(const char *flie,int nframes, float w, float h, float centerx, float centery)
{
HGE *hge = hgeCreate(HGE_VERSION);
HTEXTURE pic = hge->Texture_Load(flie);
boom = new hgeAnimation(pic, nframes, 30, 0, 0, w, h);
boom->SetZ(SKILL_LAYER);
boom->SetHotSpot(centerx, centery);
}
示例9:
bool HGEGame::FrameFunction()
{
HGE* hge = ((HGEGame*)mInstance)->mHGE;
float elapsedTime = hge->Timer_GetDelta();
bool result = mInstance->GetStateManager()->Update(elapsedTime);
mInstance->GetScheduler()->Update(elapsedTime);
return result;
}
示例10: hgeCreate
void StaticMapObj::CollisionEntity::onCollision(iCollisionEntity &o, const iContactInfo &ci)
{
HGE *hge = hgeCreate(HGE_VERSION);
float deltaTime = hge->Timer_GetDelta();
hge->Release();
TankContactInfo &tci = (TankContactInfo &)ci;
Point2f contactPos = tci.getData()->GetContact(0);
Point2f dir = o.getBody().GetPointVelocity(contactPos, deltaTime);
Point2f impulse = dir * 0.001f;// * o.getBody().getMass();
Point2f force = impulse / deltaTime;
getBody().AddForce(force, contactPos);
}
示例11: hgeCreate
HGE *HGEInit()
{
HGE *h = hgeCreate(HGE_VERSION);
h->System_SetState(HGE_SCREENWIDTH, WWID);
h->System_SetState(HGE_SCREENHEIGHT, WHEI);
h->System_SetState(HGE_FRAMEFUNC, FrameFunc0);
h->System_SetState(HGE_RENDERFUNC, RenderFunc0);
h->System_SetState(HGE_WINDOWED, true);
h->System_SetState(HGE_USESOUND, false);
h->System_SetState(HGE_HIDEMOUSE, false);
h->System_SetState(HGE_TITLE, "HGE BWChess - Dates Call Back");
h->System_SetState(HGE_SHOWSPLASH, false);
return h;
}
示例12: hgeCreate
bool UIWindow::IsOnControl()
{
if (m_bShow && m_pBackGround)
{
float x,y;
HGE* hge = hgeCreate(HGE_VERSION);
hge->Input_GetMousePos(&x,&y);
if (x>=m_fPosX && x<=(m_fPosX+m_pBackGround->GetWidth()) && y>=m_fPosY && y<=(m_fPosY+m_pBackGround->GetHeight()))
return true;
hge->Release();
}
return false;
}
示例13: hgeCreate
HPBAR::HPBAR(const char* hp_tex, const char* shield_tex, const char* delay_tex)
{
HGE *hge = hgeCreate(HGE_VERSION);
tex1 = hge->Texture_Load(hp_tex);
tex2 = hge->Texture_Load(shield_tex);
tex3 = hge->Texture_Load(delay_tex);
spr1 = new hgeSprite(tex1, 0, 0, 100, 17);
spr2 = new hgeSprite(tex2, 0, 0, 100, 17);
spr3 = new hgeSprite(tex3, 0, 0, 100, 17);
spr3->SetColor(ARGB(255, 255, 0, 0));
spr1->SetColor(ARGB(255, 0, 255, 0));
spr2->SetColor(ARGB(255, 200, 200, 200));
font = new hgeFont("font1.fnt");
font->SetZ(SKILL_LAYER);
font->SetScale(0.75);
}
示例14: hgeCreate
Ship* Missile::Update(std::vector<Ship*> &shiplist, float timedelta)
{
HGE* hge = hgeCreate(HGE_VERSION);
float pi = 3.141592654f*2;
float oldx, oldy;
w_ += angular_velocity * timedelta;
if (w_ > pi)
w_ -= pi;
if (w_ < 0.0f)
w_ += pi;
oldx = x_;
oldy = y_;
x_ += velocity_x_ * timedelta;
y_ += velocity_y_ * timedelta;
for (std::vector<Ship*>::iterator thisship = shiplist.begin();
thisship != shiplist.end(); thisship++)
{
if( HasCollided( (*(*thisship)) ) )
{
return (*thisship);
}
}
float screenwidth = static_cast<float>(hge->System_GetState(HGE_SCREENWIDTH));
float screenheight = static_cast<float>(hge->System_GetState(HGE_SCREENHEIGHT));
float spritewidth = sprite_->GetWidth();
float spriteheight = sprite_->GetHeight();
if (x_ < -spritewidth/2)
x_ += screenwidth + spritewidth;
else if (x_ > screenwidth + spritewidth/2)
x_ -= screenwidth + spritewidth;
if (y_ < -spriteheight/2)
y_ += screenheight + spriteheight;
else if (y_ > screenheight + spriteheight/2)
y_ -= screenheight + spriteheight;
return nullptr;
}
示例15: WinMain
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
HGE* hge = hgeCreate(HGE_VERSION);
try
{
hge::init();
action::init();
hge::run();
action::halt();
hge::halt();
}
// Catch all Guichan exceptions.
catch (gcn::Exception e)
{
MessageBox(NULL,
e.getMessage().c_str(),
"Guichan exception",
MB_OK | MB_ICONERROR | MB_SYSTEMMODAL);
return 1;
}
// Catch all Std exceptions.
catch (std::exception e)
{
MessageBox(NULL,
e.what(),
"Std exception",
MB_OK | MB_ICONERROR | MB_SYSTEMMODAL);
return 1;
}
// Catch all unknown exceptions.
catch (...)
{
MessageBox(NULL,
hge->System_GetErrorMessage(),
"Unknown exception",
MB_OK | MB_ICONERROR | MB_SYSTEMMODAL);
return 1;
}
return 0;
}