This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ClippingNode* createClippingNode() { | |
auto cl = ClippingNode::create(); | |
cl->setContentSize(Size(100, 100)); | |
cl->setAnchorPoint(Vec2(0.5, 0.5)); | |
auto stencil = DrawNode::create(); | |
//stencil->drawPoint(Vec2(0,0), 200, Color4F::WHITE); | |
vector<Vec2> pnts; | |
pnts.push_back(Vec2(0,0)); | |
pnts.push_back(Vec2(50,100)); | |
pnts.push_back(Vec2(100, 0)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void DrawNode::drawPolygon(Vec2 *verts, int count, const Color4F &fillColor, float borderWidth, const Color4F &borderColor) | |
{ | |
CCASSERT(count >= 0, "invalid count value"); | |
struct ExtrudeVerts {Vec2 offset, n;}; | |
struct ExtrudeVerts* extrude = (struct ExtrudeVerts*)malloc(sizeof(struct ExtrudeVerts)*count); | |
memset(extrude, 0, sizeof(struct ExtrudeVerts)*count); | |
for (int i = 0; i < count; i++) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// see drawPolygon at https://gist.github.com/jonyrock/493f71825a2564d18f19 | |
void drawRect(cocos2d::Vec2 points[4], cocos2d::Color4F color) { | |
Color4F borderColor(color); | |
borderColor.a = 0.5; | |
drawPolygon(points, 4, color, 0.5, borderColor); | |
} | |
void buggyDraw() { | |
float eps = 5; | |
vector<Vec2> ppnts; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SunNode : public cocos2d::Node { | |
public: | |
virtual bool init(); | |
CREATE_FUNC(SunNode); | |
private: | |
cocos2d::Size _size; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I/godot ( 1125): ***************** HELLO FROM JNI!!!!!!!! | |
I/godot ( 1125): *******CLASS FOUND!!! | |
I/godot ( 1125): STEP2, 0x1d2003ca | |
I/godot ( 1125): STEP3 -1311747048 | |
I/godot ( 1125): STEP4, 0x9a000029 | |
I/godot ( 1125): STEP4.5, 0x1d2003ce | |
I/godot ( 1125): STEP5 | |
I/godot ( 1125): STEP6 | |
I/godot ( 1125): *******GOT METHOD _file_open ok!! | |
I/godot ( 1125): *******GOT METHOD _file_get_size ok!! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from somemodule import A, aFoo | |
def myMethod(self): | |
print("olololo") | |
A.foo = myMethod | |
a = A() | |
a.foo() # olololo | |
aa = aFoo() | |
aa.foo() # olololo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__original_build_class__ = __build_class__ | |
def mybuild_class(func, name, *bases, metaclass=None, **kwds): | |
print('hello world') | |
return __original_build_class__(func, name, bases, metaclass, kwds) | |
__build_class__ = mybuild_class | |
a = A() |
NewerOlder