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


C++ Drawable::draw方法代码示例

本文整理汇总了C++中Drawable::draw方法的典型用法代码示例。如果您正苦于以下问题:C++ Drawable::draw方法的具体用法?C++ Drawable::draw怎么用?C++ Drawable::draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drawable的用法示例。


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

示例1: lua_Drawable_draw

int lua_Drawable_draw(lua_State* state)
{
    // Get the number of parameters.
    int paramCount = lua_gettop(state);

    // Attempt to match the parameters to a valid binding.
    switch (paramCount)
    {
        case 1:
        {
            if ((lua_type(state, 1) == LUA_TUSERDATA))
            {
                Drawable* instance = getInstance(state);
                unsigned int result = instance->draw();

                // Push the return value onto the stack.
                lua_pushunsigned(state, result);

                return 1;
            }

            lua_pushstring(state, "lua_Drawable_draw - Failed to match the given parameters to a valid function signature.");
            lua_error(state);
            break;
        }
        case 2:
        {
            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
                lua_type(state, 2) == LUA_TBOOLEAN)
            {
                // Get parameter 1 off the stack.
                bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);

                Drawable* instance = getInstance(state);
                unsigned int result = instance->draw(param1);

                // Push the return value onto the stack.
                lua_pushunsigned(state, result);

                return 1;
            }

            lua_pushstring(state, "lua_Drawable_draw - Failed to match the given parameters to a valid function signature.");
            lua_error(state);
            break;
        }
        default:
        {
            lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
            lua_error(state);
            break;
        }
    }
    return 0;
}
开发者ID:0chunhui,项目名称:GamePlay,代码行数:55,代码来源:lua_Drawable.cpp

示例2: drawScene

bool InputSample::drawScene(Node* node)
{
    Drawable* drawable = node->getDrawable();
    if (drawable)
        drawable->draw();
    return true;
}
开发者ID:ConfusedReality,项目名称:pkg_game-engine_gameplay,代码行数:7,代码来源:InputSample.cpp

示例3: render

void BaseLevel::render(){

    
    vector<GameObject *> gameObjects = sceneManager->getObjects();
    
    mat4 cameraMatrix = currentCamera->matrix();
    mat4 identityMatrix = mat4();
    
    windowManager->beforeRender();
    
    for (int i=0; i<gameObjects.size(); i++){
        GameObject *gameObject = gameObjects[i];
        Drawable *mesh = gameObject->getMesh();
        
        vec3 pos = gameObject->getPhysicsObject()->pos;
        mat4 uM = glm::translate(identityMatrix, pos);
        mat4 rot = gameObject->getPhysicsObject()->rot;
        
        mesh->setMatrices(&uM,&cameraMatrix,rot);
        mesh->draw();
    }
    
    hudRenderer->render();
    
    windowManager->afterRender();

}
开发者ID:mha1993,项目名称:engine,代码行数:27,代码来源:BaseLevel.cpp

示例4: createFromDrawable

void Buffer::createFromDrawable(Drawable &obj) {
   shouldDelete = true;

   if (obj.getW() > 512 || obj.getH() > 512)
      throw RubyException(rb_eRuntimeError, "Drawable too big for a buffer.");

   int width = obj.getW();
   int height = obj.getH();
   img = oslCreateImage(width, height, OSL_IN_VRAM, OSL_PF_8888);
   if (!img) {
      img = oslCreateImage(width, height, OSL_IN_RAM, OSL_PF_8888);
      if (!img)
	 throw RubyException(rb_eRuntimeError, "Buffer could not be created");
   }
   else {
      Buffer::registerInVram(img);
   }

   OSL_IMAGE *old = oslGetDrawBuffer();
   setActual();

   obj.clearMove();
   obj.setPos(0, 0);
   obj.draw();
   obj.cancelMove();

   oslSetDrawBuffer(old);
}
开发者ID:Epictetus,项目名称:Joyau,代码行数:28,代码来源:Buffer.cpp

示例5: drawScene

bool TemplateGame::drawScene(Node* node)
{
    // If the node visited contains a drawable object, draw it
    Drawable* drawable = node->getDrawable(); 
    if (drawable)
        drawable->draw(_wireframe);

    return true;
}
开发者ID:03050903,项目名称:GamePlay,代码行数:9,代码来源:TemplateGame.cpp

示例6: drawScreenDrawables

	void AiEngine::drawScreenDrawables() const
	{
		ScreenDrawablesSet::const_iterator it;
		for (it = screenDrawables.begin(); it != screenDrawables.end(); it++)
		{
			screenCanvas.reset();

			Drawable *drawable = *it;
			drawable->draw(screenCanvas);
		}
	}
开发者ID:hackcraft-sk,项目名称:swarm,代码行数:11,代码来源:AiEngine.cpp

示例7: drawMapDrawables

	void AiEngine::drawMapDrawables() const
	{
		MapDrawablesSet::const_iterator it;
		for (it = mapDrawables.begin(); it != mapDrawables.end(); it++)
		{
			mapCanvas.reset();

			Drawable *drawable = *it;
			drawable->draw(mapCanvas);
		}
	}
开发者ID:hackcraft-sk,项目名称:swarm,代码行数:11,代码来源:AiEngine.cpp

示例8: w_draw

	/**
	* Draws an Image at the specified coordinates, with rotation and
	* scaling along both axes.
	* @param x The x-coordinate.
	* @param y The y-coordinate.
	* @param angle The amount of rotation.
	* @param sx The scale factor along the x-axis. (1 = normal).
	* @param sy The scale factor along the y-axis. (1 = normal).
	* @param ox The offset along the x-axis.
	* @param oy The offset along the y-axis.
	**/
	int w_draw(lua_State * L)
	{
		Drawable * drawable = luax_checktype<Drawable>(L, 1, "Drawable", GRAPHICS_DRAWABLE_T);
		float x = (float)luaL_optnumber(L, 2, 0.0f);
		float y = (float)luaL_optnumber(L, 3, 0.0f);
		float angle = (float)luaL_optnumber(L, 4, 0.0f);
		float sx = (float)luaL_optnumber(L, 5, 1.0f);
		float sy = (float)luaL_optnumber(L, 6, sx);
		float ox = (float)luaL_optnumber(L, 7, 0);
		float oy = (float)luaL_optnumber(L, 8, 0);
		drawable->draw(x, y, angle, sx, sy, ox, oy);
		return 0;
	}
开发者ID:AnisB,项目名称:love,代码行数:24,代码来源:wrap_Graphics.cpp

示例9: draw

    void draw()
    {
        Rectanglei pos;
        if(self.hasChangedPlace(pos) || !bgBuf->isReady())
        {
            // Update the background quad.
            VertexBuf::Builder bgVerts;
            self.glMakeGeometry(bgVerts);
            bgBuf->setVertices(gl::TriangleStrip, bgVerts, gl::Static);
        }

        // Draw the background.
        background.draw();

        Rectanglei vp = self.viewport();
        if(vp.height() > 0)
        {
            GLState &st = GLState::push();
            // Leave room for the indicator in the scissor.
            st.setScissor(vp.adjusted(Vector2i(), Vector2i(self.rightMargin(), 0)));

            // First draw the shadow of the text.
            uMvpMatrix = projMatrix * Matrix4f::translate(
                         Vector2f(vp.topLeft + Vector2i(0, contentOffsetForDrawing)));
            uShadowColor = Vector4f(0, 0, 0, 1);
            contents.draw();

            // Draw the text itself.
            uMvpMatrix = projMatrix * Matrix4f::translate(
                         Vector2f(vp.topLeft + Vector2i(0, contentOffsetForDrawing - 1)));
            uShadowColor = Vector4f(1, 1, 1, 1);
            contents.draw();

            GLState::pop();
        }

        // We don't need to keep all entries ready for drawing immediately.
        releaseExcessComposedEntries();
    }
开发者ID:roman313,项目名称:Doomsday-Engine,代码行数:39,代码来源:logwidget.cpp

示例10: drawScene

bool SpaceshipGame::drawScene(Node* node, void* cookie)
{
    Drawable* drawable = node->getDrawable();
    if (drawable)
    {
        // Transparent nodes must be drawn last (stage 1)
        bool isTransparent = (node == _glowNode);

        // Skip transparent objects for stage 0
        if ((!isTransparent && (int*)cookie == 0) || (isTransparent && (int*)cookie == (int*)1))
            drawable->draw();
    }

    return true;
}
开发者ID:03050903,项目名称:GamePlay,代码行数:15,代码来源:SpaceshipGame.cpp

示例11: drawScene

bool TerrainSample::drawScene(Node* node)
{
    Camera* camera = _scene->getActiveCamera();
    Drawable* drawable = node->getDrawable();
    if (dynamic_cast<Model*>(drawable))
    {
        if (!node->getBoundingSphere().intersects(camera->getFrustum()))
            return true;
    }
    if (drawable)
    {
        bool wireframe = (node == _sky) ? false : _wireframe;
        drawable->draw(wireframe);
    }

	return true;
}
开发者ID:03050903,项目名称:GamePlay,代码行数:17,代码来源:TerrainSample.cpp

示例12: main

int main(int argc, char* argv[]) {
  BMP canvas;
  canvas.SetSize(128, 128);

  const Vector2 truck_center(64, 64);

  /* TODO: Why can't I construct a new Truck?  Is should be a valid Drawable.
   * Could it be missing something that would prevent it from being constructed?
   */
  Drawable* truck = new Truck(truck_center);

  truck->draw(&canvas);

  canvas.WriteToFile("test_pure_virtual.bmp");

  delete truck;
  return 0;
}
开发者ID:leloulight,项目名称:cs225,代码行数:18,代码来源:test_pure_virtual.cpp

示例13: draw

void Scene::draw() {
    
    // This whole process can be VERY optimized if needed
    
    std::vector<Drawable *> autoSort;
    std::vector<Drawable *>::iterator it;
    
    // Gather all auto-sort Drawables in a vector
    for(it = displayList.begin(); it < displayList.end(); ++it) {
        
        Drawable *drawable = (Drawable *) *it;
        
        if (drawable->isVisible() && drawable->isAutoZOrder()) {
            autoSort.push_back(drawable);
        }
    }
    
    // Sort this vector by Y position
    std::sort(autoSort.begin(), autoSort.end(), AutoZOrderSortPredicate);
    
    // Assigns z-order values to elements, starting with Z_ORDER_AUTO_START
    int z = Z_ORDER_AUTO_START;
    
    for(it = autoSort.begin(); it < autoSort.end(); ++it) {
        
        Drawable *drawable = (Drawable *) *it;
        drawable->setZOrder(z);
        z++;
    }
    
    // Sorts the display list based on the z-order values
    std::sort(displayList.begin(), displayList.end(), ZOrderSortPredicate);
    
    // Draws everything in the correct order
    for(it = displayList.begin(); it < displayList.end(); ++it) {
        
        Drawable *drawable = (Drawable *) *it;
        
        if (drawable->isVisible()) {
            drawable->draw();
        }
    }
}
开发者ID:fabiorodella,项目名称:LPC2012Game,代码行数:43,代码来源:Scene.cpp

示例14: RubyException

Buffer::Buffer(Drawable &obj): shouldDelete(true) {
   setClass("Buffer");

   if (obj.getW() > 512 || obj.getH() > 512)
      throw RubyException(rb_eRuntimeError, "Drawable too big for a buffer.");
   
   img = oslCreateImage(obj.getW(), obj.getH(), OSL_IN_VRAM, OSL_PF_8888);
   if (!img)
      throw RubyException(rb_eRuntimeError, "Buffer could not be created");
   
   OSL_IMAGE *old = oslGetDrawBuffer();
   setActual();

   obj.clearMove();
   obj.setPos(0, 0);
   obj.draw();
   obj.cancelMove();

   oslSetDrawBuffer(old);
}
开发者ID:bruni68510,项目名称:Joyau,代码行数:20,代码来源:Buffer.cpp

示例15: draw

 void RenderTarget::draw(Drawable& drawable, RenderStates states)
 {
     drawable.draw(*this, states);
 }
开发者ID:Ornito,项目名称:ODFAEG,代码行数:4,代码来源:renderTarget.cpp


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