minor fixes to color picker / small speed improvement

This commit is contained in:
jacob1 2013-02-08 11:39:14 -05:00
parent 8e02443f0a
commit cd0af92fb3
4 changed files with 66 additions and 56 deletions

View File

@ -169,7 +169,7 @@ void ColourPickerActivity::OnMouseDown(int x, int y, unsigned button)
{
x -= Position.X+5;
y -= Position.Y+5;
if(x >= 0 && x <= 256 && y >= 0 && y < 127)
if(x >= 0 && x < 256 && y >= 0 && y <= 128)
{
mouseDown = true;
currentHue = (float(x)/float(255))*359.0f;
@ -185,7 +185,7 @@ void ColourPickerActivity::OnMouseDown(int x, int y, unsigned button)
currentHue = 0;
}
if(x >= 0 && x <= 256 && y >= 131 && y < 142)
if(x >= 0 && x < 256 && y >= 132 && y <= 142)
{
valueMouseDown = true;
currentValue = x;
@ -295,13 +295,18 @@ void ColourPickerActivity::OnDraw()
g->blendpixel(value+offsetX, i+offsetY+127+5, cr, cg, cb, currentAlpha);
}
//draw color square pointer
int currentHueX = clamp_flt(currentHue, 0, 359);
int currentSaturationY = ((255-currentSaturation)/2);
g->xor_line(offsetX+currentHueX, offsetY+currentSaturationY-5, offsetX+currentHueX, offsetY+currentSaturationY+5);
g->xor_line(offsetX+currentHueX-5, offsetY+currentSaturationY, offsetX+currentHueX+5, offsetY+currentSaturationY);
g->xor_line(offsetX+currentHueX, offsetY+currentSaturationY-5, offsetX+currentHueX, offsetY+currentSaturationY-1);
g->xor_line(offsetX+currentHueX, offsetY+currentSaturationY+1, offsetX+currentHueX, offsetY+currentSaturationY+5);
g->xor_line(offsetX+currentHueX-5, offsetY+currentSaturationY, offsetX+currentHueX-1, offsetY+currentSaturationY);
g->xor_line(offsetX+currentHueX+1, offsetY+currentSaturationY, offsetX+currentHueX+5, offsetY+currentSaturationY);
g->xor_line(offsetX+currentValue, offsetY+4+128, offsetX+currentValue, offsetY+13+128);
g->xor_line(offsetX+currentValue+1, offsetY+4+128, offsetX+currentValue+1, offsetY+13+128);
//draw brightness bar pointer
int currentValueX = restrict_flt(currentValue, 0, 254);
g->xor_line(offsetX+currentValueX, offsetY+4+128, offsetX+currentValueX, offsetY+13+128);
g->xor_line(offsetX+currentValueX+1, offsetY+4+128, offsetX+currentValueX+1, offsetY+13+128);
}
ColourPickerActivity::~ColourPickerActivity() {

View File

@ -843,13 +843,11 @@ void GameModel::FrameStep(int frames)
void GameModel::ClearSimulation()
{
//Load defaults
sim->gravityMode = 0;
sim->air->airMode = 0;
sim->legacy_enable = false;
sim->water_equal_test = false;
sim->grav->stop_grav_async();
sim->SetEdgeMode(edgeMode);
sim->clear_sim();

View File

@ -86,7 +86,7 @@ void LocalBrowserController::removeSelectedC()
};
std::vector<std::string> selected = browserModel->GetSelected();
new TaskWindow("Removing saves", new RemoveSavesTask(this, selected));
new TaskWindow("Removing stamps", new RemoveSavesTask(this, selected));
}
void LocalBrowserController::RescanStamps()

View File

@ -3663,6 +3663,8 @@ void Simulation::update_particles_i(int start, int inc)
vx[y/CELL][x/CELL] = vx[y/CELL][x/CELL]*elements[t].AirLoss + elements[t].AirDrag*parts[i].vx;
vy[y/CELL][x/CELL] = vy[y/CELL][x/CELL]*elements[t].AirLoss + elements[t].AirDrag*parts[i].vy;
if (elements[t].HotAir)
{
if (t==PT_GAS||t==PT_NBLE)
{
if (pv[y/CELL][x/CELL]<3.5f)
@ -3689,7 +3691,9 @@ void Simulation::update_particles_i(int start, int inc)
pv[y/CELL+1][x/CELL+1] += elements[t].HotAir;
}
}
}
if (elements[t].Gravity || !(elements[t].Properties & TYPE_SOLID))
{
//Gravity mode by Moach
switch (gravityMode)
{
@ -3719,6 +3723,9 @@ void Simulation::update_particles_i(int start, int inc)
pGravX += gravx[(y/CELL)*(XRES/CELL)+(x/CELL)];
pGravY += gravy[(y/CELL)*(XRES/CELL)+(x/CELL)];
}
}
else
pGravX = pGravY = 0;
//velocity updates for the particle
if (t != PT_SPNG || !(parts[i].flags&FLAG_MOVABLE))
{