commit x64 compilation from lulu cause the other branch dont seems to compile properly at home
This commit is contained in:
67
include/engine/ui/ui_sprite.cpp
Normal file
67
include/engine/ui/ui_sprite.cpp
Normal file
@ -0,0 +1,67 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#include "ui/ui_sprite.h"
|
||||
#include "ui/ui_ace_manager.h"
|
||||
#include "core/render_resource_factory.h"
|
||||
#include "core/camera.h"
|
||||
|
||||
using namespace GS;
|
||||
using namespace GS::S2D;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void Sprite::RenderSetup(Core::ResourceFactories *f)
|
||||
{
|
||||
if ((render_data = new RenderData))
|
||||
if (f && f->render)
|
||||
if (!texture.IsEmpty())
|
||||
render_data->texture = f->render->LoadTexture(texture);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Sprite::ExecCommand(ACE::Command *cmd, float dt)
|
||||
{
|
||||
float k = dt / cmd->duration_left;
|
||||
|
||||
switch (cmd->code)
|
||||
{
|
||||
case ACE_toalpha:
|
||||
opacity = Types::Clamp(opacity + (cmd->parm[0] - opacity) * k);
|
||||
return true;
|
||||
|
||||
case ACE_toposition:
|
||||
position.x += (cmd->parm[0] - position.x) * k;
|
||||
position.y += (cmd->parm[1] - position.y) * k;
|
||||
SetPosition(position.x, position.y);
|
||||
return true;
|
||||
|
||||
case ACE_toscale:
|
||||
scale.x += (cmd->parm[0] - scale.x) * k;
|
||||
scale.y += (cmd->parm[1] - scale.y) * k;
|
||||
return true;
|
||||
|
||||
case ACE_toangle:
|
||||
angle += (Units::Deg(cmd->parm[0]) - angle) * k;
|
||||
SetRotation(angle);
|
||||
return true;
|
||||
}
|
||||
return ACE::Unit::ExecCommand(cmd, dt);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
Sprite::Sprite()
|
||||
{
|
||||
opacity = 1;
|
||||
|
||||
uv_origin.Set(0, 0);
|
||||
|
||||
type = Type_Sprite;
|
||||
event_table = new EventTable;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user