| 97 | } |
| 98 | |
| 99 | static Sprite* engine_inj_create_lump(const Color4B& color, int height, int width) |
| 100 | { |
| 101 | unsigned int* pixels((unsigned int*)malloc(height * width * sizeof(unsigned int))); |
| 102 | |
| 103 | // Fill Pixels |
| 104 | uint32_t* ptr = pixels; |
| 105 | const Color4B fillColor = Color4B::WHITE; |
| 106 | for (int i = 0; i < height * width; ++i) |
| 107 | { |
| 108 | ptr[i] = engine_inj_c4b2dw(fillColor); // 0xffffffff; |
| 109 | } |
| 110 | |
| 111 | // create cursor by pixels |
| 112 | Texture2D* texture = new Texture2D(); |
| 113 | |
| 114 | texture->initWithData(pixels, height * width * sizeof(unsigned int), backend::PixelFormat::RGBA8, width, height); |
| 115 | |
| 116 | auto cursor = Sprite::createWithTexture(texture); |
| 117 | |
| 118 | cursor->setColor(Color3B(color)); |
| 119 | cursor->setOpacity(color.a); |
| 120 | |
| 121 | texture->release(); |
| 122 | |
| 123 | free(pixels); |
| 124 | |
| 125 | return cursor; |
| 126 | } |
| 127 | |
| 128 | namespace ui |
| 129 | { |
no test coverage detected