minor fixes to color picker / small speed improvement
This commit is contained in:
parent
8e02443f0a
commit
cd0af92fb3
@ -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() {
|
||||
|
@ -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();
|
||||
|
@ -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()
|
||||
|
@ -3663,62 +3663,69 @@ 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 (t==PT_GAS||t==PT_NBLE)
|
||||
if (elements[t].HotAir)
|
||||
{
|
||||
if (pv[y/CELL][x/CELL]<3.5f)
|
||||
pv[y/CELL][x/CELL] += elements[t].HotAir*(3.5f-pv[y/CELL][x/CELL]);
|
||||
if (y+CELL<YRES && pv[y/CELL+1][x/CELL]<3.5f)
|
||||
pv[y/CELL+1][x/CELL] += elements[t].HotAir*(3.5f-pv[y/CELL+1][x/CELL]);
|
||||
if (x+CELL<XRES)
|
||||
if (t==PT_GAS||t==PT_NBLE)
|
||||
{
|
||||
if (pv[y/CELL][x/CELL+1]<3.5f)
|
||||
pv[y/CELL][x/CELL+1] += elements[t].HotAir*(3.5f-pv[y/CELL][x/CELL+1]);
|
||||
if (y+CELL<YRES && pv[y/CELL+1][x/CELL+1]<3.5f)
|
||||
pv[y/CELL+1][x/CELL+1] += elements[t].HotAir*(3.5f-pv[y/CELL+1][x/CELL+1]);
|
||||
if (pv[y/CELL][x/CELL]<3.5f)
|
||||
pv[y/CELL][x/CELL] += elements[t].HotAir*(3.5f-pv[y/CELL][x/CELL]);
|
||||
if (y+CELL<YRES && pv[y/CELL+1][x/CELL]<3.5f)
|
||||
pv[y/CELL+1][x/CELL] += elements[t].HotAir*(3.5f-pv[y/CELL+1][x/CELL]);
|
||||
if (x+CELL<XRES)
|
||||
{
|
||||
if (pv[y/CELL][x/CELL+1]<3.5f)
|
||||
pv[y/CELL][x/CELL+1] += elements[t].HotAir*(3.5f-pv[y/CELL][x/CELL+1]);
|
||||
if (y+CELL<YRES && pv[y/CELL+1][x/CELL+1]<3.5f)
|
||||
pv[y/CELL+1][x/CELL+1] += elements[t].HotAir*(3.5f-pv[y/CELL+1][x/CELL+1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else//add the hotair variable to the pressure map, like black hole, or white hole.
|
||||
{
|
||||
pv[y/CELL][x/CELL] += elements[t].HotAir;
|
||||
if (y+CELL<YRES)
|
||||
pv[y/CELL+1][x/CELL] += elements[t].HotAir;
|
||||
if (x+CELL<XRES)
|
||||
else//add the hotair variable to the pressure map, like black hole, or white hole.
|
||||
{
|
||||
pv[y/CELL][x/CELL+1] += elements[t].HotAir;
|
||||
pv[y/CELL][x/CELL] += elements[t].HotAir;
|
||||
if (y+CELL<YRES)
|
||||
pv[y/CELL+1][x/CELL+1] += elements[t].HotAir;
|
||||
pv[y/CELL+1][x/CELL] += elements[t].HotAir;
|
||||
if (x+CELL<XRES)
|
||||
{
|
||||
pv[y/CELL][x/CELL+1] += elements[t].HotAir;
|
||||
if (y+CELL<YRES)
|
||||
pv[y/CELL+1][x/CELL+1] += elements[t].HotAir;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Gravity mode by Moach
|
||||
switch (gravityMode)
|
||||
if (elements[t].Gravity || !(elements[t].Properties & TYPE_SOLID))
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
pGravX = 0.0f;
|
||||
pGravY = elements[t].Gravity;
|
||||
break;
|
||||
case 1:
|
||||
pGravX = pGravY = 0.0f;
|
||||
break;
|
||||
case 2:
|
||||
pGravD = 0.01f - hypotf((x - XCNTR), (y - YCNTR));
|
||||
pGravX = elements[t].Gravity * ((float)(x - XCNTR) / pGravD);
|
||||
pGravY = elements[t].Gravity * ((float)(y - YCNTR) / pGravD);
|
||||
break;
|
||||
}
|
||||
//Get some gravity from the gravity map
|
||||
if (t==PT_ANAR)
|
||||
{
|
||||
// perhaps we should have a ptypes variable for this
|
||||
pGravX -= gravx[(y/CELL)*(XRES/CELL)+(x/CELL)];
|
||||
pGravY -= gravy[(y/CELL)*(XRES/CELL)+(x/CELL)];
|
||||
}
|
||||
else if(t!=PT_STKM && t!=PT_STKM2 && t!=PT_FIGH && !(elements[t].Properties & TYPE_SOLID))
|
||||
{
|
||||
pGravX += gravx[(y/CELL)*(XRES/CELL)+(x/CELL)];
|
||||
pGravY += gravy[(y/CELL)*(XRES/CELL)+(x/CELL)];
|
||||
//Gravity mode by Moach
|
||||
switch (gravityMode)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
pGravX = 0.0f;
|
||||
pGravY = elements[t].Gravity;
|
||||
break;
|
||||
case 1:
|
||||
pGravX = pGravY = 0.0f;
|
||||
break;
|
||||
case 2:
|
||||
pGravD = 0.01f - hypotf((x - XCNTR), (y - YCNTR));
|
||||
pGravX = elements[t].Gravity * ((float)(x - XCNTR) / pGravD);
|
||||
pGravY = elements[t].Gravity * ((float)(y - YCNTR) / pGravD);
|
||||
break;
|
||||
}
|
||||
//Get some gravity from the gravity map
|
||||
if (t==PT_ANAR)
|
||||
{
|
||||
// perhaps we should have a ptypes variable for this
|
||||
pGravX -= gravx[(y/CELL)*(XRES/CELL)+(x/CELL)];
|
||||
pGravY -= gravy[(y/CELL)*(XRES/CELL)+(x/CELL)];
|
||||
}
|
||||
else if(t!=PT_STKM && t!=PT_STKM2 && t!=PT_FIGH && !(elements[t].Properties & TYPE_SOLID))
|
||||
{
|
||||
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))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user