Image image(filename);use
Image *image = LoadImage(filename);
TexBuilder texbuilder; texbuilder.size(512,512); texbuilder.depth(3); texbuilder.colormodel(TexBuilder::RGB); Texture tex = texbuilder.make();
VkDynamicDsStateCreateInfo dsInfo = { VK_STRUCTURE_TYPE_DYNAMIC_DS_STATE_CREATE_INFO }; dsInfo.minDepth = 0.0f; dsInfo.maxDepth = 1.0f; dsInfo.stencilReadMask = dsInfo.stencilWriteMask = 0xff; result = vkCreateDynamicDepthStencilState(m_device, &dsInfo, &m_dynstate.ds);
Renderer *renderer = new DXRenderer; Texture *tex = renderer.mkTexture(512,512,RGB);
Character *goblin = protogoblin->clone(); // maybe modify goblin to specialize
Singleton::instance() { if (! Singleton::ptr) Singleton::ptr = new Singleton; return Singleton::ptr; }or
Singleton::instance() { // godbolt.org: acquire guard, check status, init, release guard static Singleton *ptr = new Singleton; return ptr; }
class Adapter { Target target; method() { target.method(); } };or, for run-time adaptation
class Adapter { virtual method() = 0; }; class Specialization : public Adapter { Target target; virtual method() { target.method(); } }
class Interface { public: // methods private: class Implementation *pimpl; };
class Node { Node *left, *right; virtual void render() { left->render(); right->render(); } }; class GeoNode : public Node { Geometry geo; virtual void render() { geo.render(); } };
class Base {}; class Decorator : Base {} class Decorator1 : Decorator { Base *base; virtual method() { addStuff(); base->method(); } } class Decorator2 : Decorator { Base *base; virtual method() { otherStuff(); base->method(); } }
int webRequest(mg_connection *conn, int event) { if (check conn->uri) { // process return MG_TRUE; } // standard file return MG_FALSE; }
class Command { public: virtual void run() = 0; }; class DeleteCmd : public Command { public: virtual void run(); private: // command data };