int FalconScriptingModule::executeScriptGlobal(const CEGUI::String& function_name)
{
    Falcon::Item* func = d_vm->findGlobalItem(Falcon::String(function_name.c_str()));
    if(func != NULL && func->isCallable()) {
        d_vm->callItem(*func, 0);
        d_vm->reset();
        Falcon::Item& ret = d_vm->regA();
        return ret.forceInteger();
    }
    return 0;
}
bool FalconScriptingModule::executeScriptedEventHandler(const CEGUI::String& handler_name, const CEGUI::EventArgs& e)
{
    Falcon::Item* func = d_vm->findGlobalItem(Falcon::String(handler_name.c_str()));
    if(func != NULL && func->isCallable()) {
        d_vm->pushParam(3);
        d_vm->callItem(*func, 1);
        d_vm->reset();
        Falcon::Item& ret = d_vm->regA();
        return ret.isBoolean() ? ret.asBoolean() : true;
    }
    return false;
}
FALCON_FUNC dfsapi_thor_Action::combineOr(Falcon::VMachine* vm)
{
    dfsapi_thor_Action* self = Falcon::dyncast<dfsapi_thor_Action*>(vm->self().asObject());
    Falcon::Item* toBeAnd = vm->param(0);
    if(toBeAnd == NULL || !toBeAnd->isObject()) {
        throw new Falcon::ParamError(Falcon::ErrorParam(Falcon::e_inv_params, __LINE__).extra("thorAction"));
    }

    dfsapi_thor_Action* other = Falcon::dyncast<dfsapi_thor_Action*>(toBeAnd->asObject());
    Falcon::Item* dfsata_cls = vm->findWKI("thorAction");
    vm->retval(new dfsapi_thor_Action(dfsata_cls->asClass(), *self->action() || *other->action()));
}
FALCON_FUNC renderLayout(Falcon::VMachine* vm)
{
    RenderWindow* win = RenderWindowManager::getRenderWindow("ROOT");
    Falcon::Item* loc = vm->param(0);
    if(loc == NULL || !loc->isString()) {
        throw new Falcon::ParamError(Falcon::ErrorParam(Falcon::e_inv_params, __LINE__).extra("S"));
    }

    std::string rloc = Falcon::AutoCString(loc->asString()).c_str();
    poco_assert(win != NULL);
    win->displayWindow(win->renderLayout(rloc));
    vm->retnil();
}
Example #5
0
bool Rectangle::setProperty( const Falcon::String& s, const Falcon::Item& it )
{
    assert( m_obj );
    GdkRectangle* m_rectangle = (GdkRectangle*) m_obj;

    if ( s == "x" )
        m_rectangle->x = it.forceInteger();
    else
    if ( s == "y" )
        m_rectangle->y = it.forceInteger();
    else
    if ( s == "width" )
        m_rectangle->width = it.forceInteger();
    else
    if ( s == "height" )
        m_rectangle->height = it.forceInteger();
    else
        return false;
    return true;
}
Example #6
0
FALCON_FUNC FWrapLog(Falcon::VMachine* vm)
{
	Falcon::Item* lglv = vm->param(0);
	Falcon::Item* message = vm->param(1);
	
	if((lglv == NULL || !lglv->isInteger())
		|| (message == NULL || !message->isString()))
	{
		throw new Falcon::ParamError(Falcon::ErrorParam(Falcon::e_inv_params, __LINE__)
		.extra("LOG_LEVEL, String"));
	}
	
	PE::Logging::Levels lvl = PE::Logging::Levels(lglv->forceInteger());
	std::string mess = FString::fromStringS(*message->asString());

	Log::log(lvl, mess);
}
void dfsapi_thor_Action::init(Falcon::VMachine* vm)
{
    dfsapi_thor_Action* self = Falcon::dyncast<dfsapi_thor_Action*>(vm->self().asObject());
    Falcon::Item* keyobut = vm->param(0);
    Falcon::Item* act = vm->param(1);
    if(keyobut == NULL || !keyobut->isOrdinal()) {
        throw new Falcon::ParamError(Falcon::ErrorParam(Falcon::e_inv_params, __LINE__).extra("I, [I]"));
    }

    Falcon::int64 kob = keyobut->forceInteger();
    if(kob - (Falcon::int64)sf::Keyboard::KeyCount > 0) {
        sf::Mouse::Button but = sf::Mouse::Button(kob - ((Falcon::int64)sf::Keyboard::KeyCount + 1));
        if(act != NULL)
            self->action().reset(new thor::Action(but, (thor::Action::ActionType)act->forceInteger()));
        else
            self->action().reset(new thor::Action(but));
    } else {
        sf::Keyboard::Key key = (sf::Keyboard::Key)kob;
        if(act != NULL)
            self->action().reset(new thor::Action(key, (thor::Action::ActionType)act->forceInteger()));
        else
            self->action().reset(new thor::Action(key));
    }
}
Example #8
0
bool Geometry::setProperty( const Falcon::String& s, const Falcon::Item& it )
{
    assert( m_obj );
    GdkGeometry* m_geom = (GdkGeometry*) m_obj;

    if ( s == "min_width" )
        m_geom->min_width = it.forceInteger();
    else
    if ( s == "min_height" )
        m_geom->min_height = it.forceInteger();
    else
    if ( s == "max_width" )
        m_geom->max_width = it.forceInteger();
    else
    if ( s == "max_height" )
        m_geom->max_height = it.forceInteger();
    else
    if ( s == "base_width" )
        m_geom->base_width = it.forceInteger();
    else
    if ( s == "base_height" )
        m_geom->base_height = it.forceInteger();
    else
    if ( s == "width_inc" )
        m_geom->width_inc = it.forceInteger();
    else
    if ( s == "height_inc" )
        m_geom->height_inc = it.forceInteger();
    else
    if ( s == "min_aspect" )
        m_geom->min_aspect = it.forceNumeric();
    else
    if ( s == "max_aspect" )
        m_geom->max_aspect = it.forceNumeric();
    else
    if ( s == "win_gravity" )
        m_geom->win_gravity = (GdkGravity) it.forceInteger();
    else
        return false;
    return true;
}