Skip to content

Instantly share code, notes, and snippets.

View jonyrock's full-sized avatar
💭
chilling protocol in progress

Alexey Velikiy jonyrock

💭
chilling protocol in progress
View GitHub Profile
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));
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++)
{
// 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;
class SunNode : public cocos2d::Node {
public:
virtual bool init();
CREATE_FUNC(SunNode);
private:
cocos2d::Size _size;
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!!
@jonyrock
jonyrock / main.py
Last active February 20, 2018 10:49
from somemodule import A, aFoo
def myMethod(self):
print("olololo")
A.foo = myMethod
a = A()
a.foo() # olololo
aa = aFoo()
aa.foo() # olololo
__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()