mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-11 13:21:10 +01:00
Fixed BrushAction.
This commit is contained in:
parent
5f683261ff
commit
b2d2a6fbe5
@ -34,7 +34,9 @@ void BrushAction::do_action(PaintCanvas *canvas, const Array &data) {
|
||||
|
||||
PoolVector2iArray pixels = PaintUtilities::get_pixels_in_line(data[0], data[1]);
|
||||
int brush_type = data[3];
|
||||
PoolVector2iArray brush = BrushPrefabs::get_brush(static_cast<BrushPrefabs::Type>(brush_type), data[4]);
|
||||
int brush_size = data[4];
|
||||
PoolVector2iArray brush = BrushPrefabs::get_brush(static_cast<BrushPrefabs::Type>(brush_type), brush_size);
|
||||
Color tcolor = data[2];
|
||||
|
||||
for (int i = 0; i < pixels.size(); ++i) {
|
||||
Vector2i pixel = pixels[i];
|
||||
@ -56,10 +58,10 @@ void BrushAction::do_action(PaintCanvas *canvas, const Array &data) {
|
||||
undo_colors.append(col);
|
||||
undo_cells.append(p);
|
||||
|
||||
canvas->set_pixel_v(pixel, data[2]);
|
||||
canvas->set_pixel_v(p, tcolor);
|
||||
|
||||
redo_cells.append(p);
|
||||
redo_colors.append(data[2]);
|
||||
redo_colors.append(tcolor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "bush_prefabs.h"
|
||||
#include "core/print_string.h"
|
||||
|
||||
/*
|
||||
const list = [
|
||||
@ -55,12 +56,12 @@ PoolVector2iArray BrushPrefabs::get_brush(const BrushPrefabs::Type type, int siz
|
||||
case CIRCLE: {
|
||||
size += 1;
|
||||
Vector2 center;
|
||||
int radius = size / 2.0;
|
||||
float radius = size / 2.0;
|
||||
|
||||
for (int x = 0; x < size; ++x) {
|
||||
for (int y = 0; y < size; ++y) {
|
||||
if (Vector2(x - radius, y - radius).length() < size / 3.0) {
|
||||
pixels.append(Vector2(x, y));
|
||||
pixels.append(Vector2i(x, y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user