コード例 #1
0
ファイル: pvt_base.cpp プロジェクト: brbr520/bs-eagle
void
pvt_base::check_oil_common (const vector_t &pressure, const vector_t &fvf, const vector_t &visc)
{
    for (t_long i = 0, cnt = (t_long)pressure.size (); i < cnt; ++i)
    {
        if (pressure[i] < 0)
        {
            // TODO: LOG
            BS_ASSERT (false) (pressure[i]);
            throw bs_exception ("", "pressure should be greater than 0");
        }
        if (fvf[i] < 0)
        {
            // TODO:LOG
            BS_ASSERT (false) (fvf[i]);
            throw bs_exception ("", "fvf should be greater than 0");
        }
        if (visc[i] < 0)
        {
            // TODO: LOG
            BS_ASSERT (false) (visc[i]);
            throw bs_exception ("", "viscosity should be greater than 0");
        }
    }
}
コード例 #2
0
static int getSoundPanning(lua_State *L) {
	Kernel *pKernel = Kernel::getInstance();
	BS_ASSERT(pKernel);
	SoundEngine *pSfx = pKernel->getSfx();
	BS_ASSERT(pSfx);

	lua_pushnumber(L, pSfx->getSoundPanning(static_cast<uint>(luaL_checknumber(L, 1))));

	return 1;
}
コード例 #3
0
static int stopSound(lua_State *L) {
	Kernel *pKernel = Kernel::getInstance();
	BS_ASSERT(pKernel);
	SoundEngine *pSfx = pKernel->getSfx();
	BS_ASSERT(pSfx);

	pSfx->stopSound(static_cast<uint>(luaL_checknumber(L, 1)));

	return 0;
}
コード例 #4
0
static int isSoundPaused(lua_State *L) {
	Kernel *pKernel = Kernel::getInstance();
	BS_ASSERT(pKernel);
	SoundEngine *pSfx = pKernel->getSfx();
	BS_ASSERT(pSfx);

	lua_pushbooleancpp(L, pSfx->isSoundPaused(static_cast<uint>(luaL_checknumber(L, 1))));

	return 1;
}
コード例 #5
0
static int setSoundPanning(lua_State *L) {
	Kernel *pKernel = Kernel::getInstance();
	BS_ASSERT(pKernel);
	SoundEngine *pSfx = pKernel->getSfx();
	BS_ASSERT(pSfx);

	pSfx->setSoundPanning(static_cast<uint>(luaL_checknumber(L, 1)), static_cast<float>(luaL_checknumber(L, 2)));

	return 0;
}
コード例 #6
0
static int getVolume(lua_State *L) {
	Kernel *pKernel = Kernel::getInstance();
	BS_ASSERT(pKernel);
	SoundEngine *pSfx = pKernel->getSfx();
	BS_ASSERT(pSfx);

	lua_pushnumber(L, pSfx->getVolume(static_cast<SoundEngine::SOUND_TYPES>(static_cast<uint>(luaL_checknumber(L, 1)))));

	return 1;
}
コード例 #7
0
static int pauseAll(lua_State *L) {
	Kernel *pKernel = Kernel::getInstance();
	BS_ASSERT(pKernel);
	SoundEngine *pSfx = pKernel->getSfx();
	BS_ASSERT(pSfx);

	pSfx->pauseAll();

	return 0;
}
コード例 #8
0
ファイル: pvt_base.cpp プロジェクト: brbr520/bs-eagle
pvt_base::pvt_base ( )
{
    p_step = 0;
    surface_density = 0;
    init_dependent = true;
    pvt_input_props = BS_KERNEL.create_object ("table");
    pvt_props_table = BS_KERNEL.create_object ("table");

    BS_ASSERT (pvt_input_props);
    BS_ASSERT (pvt_props_table);
}
コード例 #9
0
  void
  data_serializer::save (const sp_storage_t &storage, const sp_obj &obj) const
    {
      BS_ASSERT (storage);
      BS_ASSERT (obj);

      const sp_storage_t &locked_storage (storage);
      data_storage &st = *locked_storage;

      BS_ASSERT (false && "BASE METHOD CALL") (storage->bs_resolve_type ().stype_) (obj->bs_resolve_type ().stype_);
      st.save ("base method call", "---");
    }
コード例 #10
0
bool SoundEngine::registerScriptBindings() {
	Kernel *pKernel = Kernel::getInstance();
	BS_ASSERT(pKernel);
	ScriptEngine *pScript = pKernel->getScript();
	BS_ASSERT(pScript);
	lua_State *L = static_cast<lua_State *>(pScript->getScriptObject());
	BS_ASSERT(L);

	if (!LuaBindhelper::addFunctionsToLib(L, SFX_LIBRARY_NAME, SFX_FUNCTIONS)) return false;
	if (!LuaBindhelper::addConstantsToLib(L, SFX_LIBRARY_NAME, SFX_CONSTANTS)) return false;

	return true;
}
コード例 #11
0
static int init(lua_State *L) {
	Kernel *pKernel = Kernel::getInstance();
	BS_ASSERT(pKernel);
	SoundEngine *pSfx = pKernel->getSfx();
	BS_ASSERT(pSfx);

	if (lua_gettop(L) == 0)
		lua_pushbooleancpp(L, pSfx->init(44100, 32));
	else if (lua_gettop(L) == 1)
		lua_pushbooleancpp(L, pSfx->init(static_cast<uint>(luaL_checknumber(L, 1)), 32));
	else
		lua_pushbooleancpp(L, pSfx->init(static_cast<uint>(luaL_checknumber(L, 1)), static_cast<uint>(luaL_checknumber(L, 2))));

	return 1;
}
コード例 #12
0
ファイル: well_factory.cpp プロジェクト: bs-eagle/bs-eagle
  well_factory::sp_well_t
  well_factory::create_well (const std::string & /*group_name*/, const std::string &well_name) const
    {
      BS_ASSERT (well_name.size ());

      sp_well_t w = BS_KERNEL.create_object (wells::default_well::bs_type (), true);
      BS_ASSERT (w) (well_name);

      w->set_name (well_name);

      //sp_well_t w = BS_KERNEL.create_object_v2 <wells::default_well > (well_name, true);
      //BS_ERROR (w, "well_factory::create_well: Can't create well");

      return w;
    }
コード例 #13
0
	ScriptManagedResource::ScriptManagedResource(MonoObject* instance, const HManagedResource& resource)
		:ScriptObject(instance), mResource(resource)
	{
		BS_ASSERT(instance != nullptr);

		MonoUtil::getClassName(instance, mNamespace, mType);
	}
コード例 #14
0
bool AnimationResource::computeFeatures() {
	BS_ASSERT(_frames.size());

	// Alle Features werden als vorhanden angenommen
	_scalingAllowed = true;
	_alphaAllowed = true;
	_colorModulationAllowed = true;

	// Alle Frame durchgehen und alle Features deaktivieren, die auch nur von einem Frame nicht unterstützt werden.
	Common::Array<Frame>::const_iterator iter = _frames.begin();
	for (; iter != _frames.end(); ++iter) {
		BitmapResource *pBitmap;
		if (!(pBitmap = static_cast<BitmapResource *>(Kernel::getInstance()->getResourceManager()->requestResource((*iter).fileName)))) {
			BS_LOG_ERRORLN("Could not request \"%s\".", (*iter).fileName.c_str());
			return false;
		}

		if (!pBitmap->isScalingAllowed())
			_scalingAllowed = false;
		if (!pBitmap->isAlphaAllowed())
			_alphaAllowed = false;
		if (!pBitmap->isColorModulationAllowed())
			_colorModulationAllowed = false;

		pBitmap->release();
	}

	return true;
}
コード例 #15
0
bool Text::doRender() {
	// Font-Resource locken.
	FontResource *fontPtr = lockFontResource();
	if (!fontPtr)
		return false;

	// Charactermap-Resource locken.
	ResourceManager *rmPtr = getResourceManager();
	BitmapResource *charMapPtr;
	{
		Resource *pResource = rmPtr->requestResource(fontPtr->getCharactermapFileName());
		if (!pResource) {
			BS_LOG_ERRORLN("Could not request resource \"%s\".", fontPtr->getCharactermapFileName().c_str());
			return false;
		}
		if (pResource->getType() != Resource::TYPE_BITMAP) {
			BS_LOG_ERRORLN("Requested resource \"%s\" is not a bitmap.", fontPtr->getCharactermapFileName().c_str());
			return false;
		}

		charMapPtr = static_cast<BitmapResource *>(pResource);
	}

	// Framebufferobjekt holen.
	GraphicEngine *gfxPtr = Kernel::getInstance()->getGfx();
	BS_ASSERT(gfxPtr);

	bool result = true;
	Common::Array<Line>::iterator iter = _lines.begin();
	for (; iter != _lines.end(); ++iter) {
		// Feststellen, ob überhaupt Buchstaben der aktuellen Zeile vom Update betroffen sind.
		Common::Rect checkRect = (*iter).bbox;
		checkRect.translate(_absoluteX, _absoluteY);

		// Jeden Buchstaben einzeln Rendern.
		int curX = _absoluteX + (*iter).bbox.left;
		int curY = _absoluteY + (*iter).bbox.top;
		for (uint i = 0; i < (*iter).text.size(); ++i) {
			Common::Rect curRect = fontPtr->getCharacterRect((byte)(*iter).text[i]);

			Common::Rect renderRect(curX, curY, curX + curRect.width(), curY + curRect.height());
			int renderX = curX + (renderRect.left - renderRect.left);
			int renderY = curY + (renderRect.top - renderRect.top);
			renderRect.translate(curRect.left - curX, curRect.top - curY);
			result = charMapPtr->blit(renderX, renderY, Image::FLIP_NONE, &renderRect, _modulationColor);
			if (!result)
				break;

			curX += curRect.width() + fontPtr->getGapWidth();
		}
	}

	// Charactermap-Resource freigeben.
	charMapPtr->release();

	// Font-Resource freigeben.
	fontPtr->release();

	return result;
}
コード例 #16
0
  void
  data_storage_interface::save (const sp_obj &obj) const
    {
      // FIXME: Implement storage_
      if (!storage_)
        return ;

      BS_ASSERT (obj);
      const type_descriptor &td = obj->bs_resolve_type ();

      serializer_list_t::const_iterator it = serializer_list_->find (td.stype_);
      BS_ASSERT (it != serializer_list_->end ()) (td.stype_);

      if (it != serializer_list_->end ())
        it->second->save (storage_, obj);
    }
コード例 #17
0
void LuaCallback::unregisterCallbackFunction(lua_State *L, uint objectHandle) {
	BS_ASSERT(lua_isfunction(L, -1));
	ensureObjectCallbackTableExists(L, objectHandle);

	// Iterate over all elements of the object callback table and remove the function from it
	lua_pushnil(L);
	while (lua_next(L, -2) != 0) {
		// The value of the current element is the top of the stack, including the index

		// If the value is identical to the function parameters, it is removed from the table
		if (lua_equal(L, -1, -4)) {
			lua_pushvalue(L, -2);
			lua_pushnil(L);
			lua_settable(L, -5);

			// The function was found, iteration can be stopped
			lua_pop(L, 2);
			break;
		} else {
			// Pop value from the stack. The index is then ready for the next call to lua_next()
			lua_pop(L, 1);
		}
	}

	// Function and object table are popped from the stack
	lua_pop(L, 2);
}
コード例 #18
0
  void
  data_storage_interface::set_storage (const sp_storage_t &storage)
  {
    storage_ = storage;

    BS_ASSERT (storage_);
  }
コード例 #19
0
ファイル: jacobian.cpp プロジェクト: brbr520/bs-eagle
  jacobian::get_matrix (std::string const &name) const
  {
    BS_ASSERT (matrix);
    if (name == "trns") 
      return flux_conn->get_conn_trans ();

    return matrix->get_matrix (name);
  }
コード例 #20
0
  data_storage_interface::data_storage_interface (const data_storage_interface& dsi)
        : bs_refcounter (), objbase ()
  {
    storage_ = dsi.storage_;
    serializer_list_ = dsi.serializer_list_;

    BS_ASSERT (serializer_list_);
  }
コード例 #21
0
ファイル: well_factory.cpp プロジェクト: bs-eagle/bs-eagle
  well_factory::sp_connection_t
  well_factory::create_connection () const
    {
      sp_connection_t con = BS_KERNEL.create_object (wells::default_connection::bs_type (), true);
      BS_ASSERT (con);

      return con;
    }
コード例 #22
0
void Text::setAlpha(int alpha) {
	BS_ASSERT(alpha >= 0 && alpha < 256);
	uint newModulationColor = (_modulationColor & 0x00ffffff) | alpha << 24;
	if (newModulationColor != _modulationColor) {
		_modulationColor = newModulationColor;
		forceRefresh();
	}
}
コード例 #23
0
bool LuaScriptEngine::registerStandardLibExtensions() {
	lua_State *L = _state;
	BS_ASSERT(_state);

	if (!LuaBindhelper::addFunctionsToLib(L, "", GLOBAL_FUNCTIONS))
		return false;

	return true;
}
コード例 #24
0
ファイル: pvt_base.cpp プロジェクト: brbr520/bs-eagle
void pvt_base::check_pressure_interval (t_double min_p, t_double max_p)
{
    if (max_p - min_p < 1.0e-12)
    {
        // TODO: LOG
        BS_ASSERT (false) (max_p) (min_p);
        throw bs_exception ("", "invalid pressure interval");
    }
}
コード例 #25
0
  void
  data_storage_interface::register_serializer (const sp_serializer_t &serializer)
  {
    BS_ASSERT (serializer);
    BS_ASSERT (serializer->bs_resolve_type ().stype_.length ());

    const type_descriptor &td = serializer->handled_type ();
    BS_ASSERT (td.stype_.length ()) (serializer->bs_resolve_type ().stype_);

    const sp_serializer_list_t &locked_list (serializer_list_);
    serializer_list_t::iterator it = locked_list->find (td.stype_);
    BS_ASSERT (it == locked_list->end ());

    if (it == locked_list->end ())
      locked_list->insert (make_pair (td.stype_, serializer));
    else
      it->second = serializer;
  }
コード例 #26
0
ファイル: pvt_base.cpp プロジェクト: brbr520/bs-eagle
void pvt_base::check_common ()
{
    if (surface_density < 0)
    {
        // TODO: LOG
        BS_ASSERT (false) (surface_density);
        throw bs_exception ("", "surface density lower than 0");
    }
}
コード例 #27
0
  bool
  data_serializer_register_type (const plugin_descriptor &pd)
  {
    bool res = true;

    res &= BS_KERNEL.register_type (pd, data_serializer::bs_type ());
    BS_ASSERT (res);

    return res;
  }
コード例 #28
0
  bool
  data_storage_interface_register_type (const plugin_descriptor &pd)
  {
    bool res = true;

    res &= BS_KERNEL.register_type (pd, data_storage_interface::bs_type ());
    BS_ASSERT (res);

    return res;
  }
コード例 #29
0
ファイル: well_factory.cpp プロジェクト: bs-eagle/bs-eagle
  bool
  well_factory_register_type (const blue_sky::plugin_descriptor &pd)
  {
    bool res = true;

    res &= BS_KERNEL.register_type (pd, well_factory::bs_type ());
    BS_ASSERT (res);

    return res;
  }
コード例 #30
0
static int playSoundEx(lua_State *L) {
	Kernel *pKernel = Kernel::getInstance();
	BS_ASSERT(pKernel);
	SoundEngine *pSfx = pKernel->getSfx();
	BS_ASSERT(pSfx);

	Common::String fileName;
	SoundEngine::SOUND_TYPES type;
	float volume;
	float pan;
	bool loop;
	int loopStart;
	int loopEnd;
	uint layer;
	processPlayParams(L, fileName, type, volume, pan, loop, loopStart, loopEnd, layer);

	lua_pushnumber(L, pSfx->playSoundEx(fileName, type, volume, pan, loop, loopStart, loopEnd, layer));

	return 1;
}