mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-02-04 02:24:00 +00:00
remove semi-broken editor tile alignment functions and related code
This commit is contained in:
parent
74ad8f7804
commit
c7c9cae999
4 changed files with 0 additions and 137 deletions
|
@ -513,11 +513,6 @@ void SceneEditor::init()
|
||||||
addAction(MakeFunctionEvent(SceneEditor, mouseButtonLeftUp), MOUSE_BUTTON_LEFT, 0);
|
addAction(MakeFunctionEvent(SceneEditor, mouseButtonLeftUp), MOUSE_BUTTON_LEFT, 0);
|
||||||
addAction(MakeFunctionEvent(SceneEditor, mouseButtonRightUp), MOUSE_BUTTON_RIGHT, 0);
|
addAction(MakeFunctionEvent(SceneEditor, mouseButtonRightUp), MOUSE_BUTTON_RIGHT, 0);
|
||||||
|
|
||||||
addAction(MakeFunctionEvent(SceneEditor, alignHorz), KEY_C, 1);
|
|
||||||
addAction(MakeFunctionEvent(SceneEditor, alignVert), KEY_V, 1);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
addAction(MakeFunctionEvent(SceneEditor, placeElement), KEY_SPACE, 1);
|
addAction(MakeFunctionEvent(SceneEditor, placeElement), KEY_SPACE, 1);
|
||||||
|
|
||||||
addAction(MakeFunctionEvent(SceneEditor, enterName), KEY_N, 0);
|
addAction(MakeFunctionEvent(SceneEditor, enterName), KEY_N, 0);
|
||||||
|
@ -627,76 +622,6 @@ void SceneEditor::init()
|
||||||
doPrevElement();
|
doPrevElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneEditor::alignHorz()
|
|
||||||
{
|
|
||||||
if (core->getShiftState()) return;
|
|
||||||
if (editType == ET_ELEMENTS && state == ES_SELECTING && editingElement)
|
|
||||||
{
|
|
||||||
TileVector t(editingElement->position);
|
|
||||||
int startOn = dsq->game->getGrid(t);
|
|
||||||
TileVector c=t;
|
|
||||||
bool found = false;
|
|
||||||
int dir = -1;
|
|
||||||
for (int i = 1; i < 5; i++)
|
|
||||||
{
|
|
||||||
// search down
|
|
||||||
c.y = t.y + i;
|
|
||||||
if (dsq->game->getGrid(c) != startOn)
|
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
dir = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
c.y = t.y - i;
|
|
||||||
if (dsq->game->getGrid(c) != startOn)
|
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
dir = -1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (found)
|
|
||||||
{
|
|
||||||
editingElement->position.y = c.worldVector().y + (editingElement->texture->getPixelHeight()/2)*(-dir);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SceneEditor::alignVert()
|
|
||||||
{
|
|
||||||
if (core->getShiftState()) return;
|
|
||||||
if (editType == ET_ELEMENTS && state == ES_SELECTING && editingElement)
|
|
||||||
{
|
|
||||||
TileVector t(editingElement->position);
|
|
||||||
int startOn = dsq->game->getGrid(t);
|
|
||||||
TileVector c=t;
|
|
||||||
bool found = false;
|
|
||||||
int dir = -1;
|
|
||||||
for (int i = 1; i < 5; i++)
|
|
||||||
{
|
|
||||||
// search down
|
|
||||||
c.x = t.x + i;
|
|
||||||
if (dsq->game->getGrid(c) != startOn)
|
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
dir = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
c.x = t.x - i;
|
|
||||||
if (dsq->game->getGrid(c) != startOn)
|
|
||||||
{
|
|
||||||
found = true;
|
|
||||||
dir = -1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (found)
|
|
||||||
{
|
|
||||||
editingElement->position.x = c.worldVector().x + (editingElement->texture->getPixelWidth()/2)*(-dir);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SceneEditor::createAquarian()
|
void SceneEditor::createAquarian()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -114,9 +114,6 @@ public:
|
||||||
|
|
||||||
void exitMoveState();
|
void exitMoveState();
|
||||||
|
|
||||||
void alignHorz();
|
|
||||||
void alignVert();
|
|
||||||
|
|
||||||
EditTypes editType;
|
EditTypes editType;
|
||||||
EditorStates state;
|
EditorStates state;
|
||||||
|
|
||||||
|
|
|
@ -137,62 +137,6 @@ void Texture::destroy()
|
||||||
core->removeTexture(this);
|
core->removeTexture(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: this should be recorded at load-time -- fg
|
|
||||||
int Texture::getPixelWidth()
|
|
||||||
{
|
|
||||||
int w = 0, h = 0;
|
|
||||||
unsigned int size = 0;
|
|
||||||
unsigned char *data = getBufferAndSize(&w, &h, &size);
|
|
||||||
if (!data)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
size_t smallestx = -1, largestx = 0;
|
|
||||||
for (unsigned int x = 0; x < unsigned(w); x++)
|
|
||||||
{
|
|
||||||
for (unsigned int y = 0; y < unsigned(h); y++)
|
|
||||||
{
|
|
||||||
unsigned int p = (y*unsigned(w)*4) + (x*4) + 3;
|
|
||||||
if (p < size && data[p] >= 254)
|
|
||||||
{
|
|
||||||
if (x < smallestx)
|
|
||||||
smallestx = x;
|
|
||||||
if (x > largestx)
|
|
||||||
largestx = x;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(data);
|
|
||||||
return largestx - smallestx;
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: same as above
|
|
||||||
int Texture::getPixelHeight()
|
|
||||||
{
|
|
||||||
int w = 0, h = 0;
|
|
||||||
unsigned int size = 0;
|
|
||||||
unsigned char *data = getBufferAndSize(&w, &h, &size);
|
|
||||||
if (!data)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
size_t smallesty = -1, largesty = 0;
|
|
||||||
for (unsigned int x = 0; x < unsigned(w); x++)
|
|
||||||
{
|
|
||||||
for (unsigned int y = 0; y < unsigned(h); y++)
|
|
||||||
{
|
|
||||||
size_t p = (y*unsigned(w)*4) + (x*4) + 3;
|
|
||||||
if (p < size && data[p] >= 254)
|
|
||||||
{
|
|
||||||
if (y < smallesty)
|
|
||||||
smallesty = y;
|
|
||||||
if (y > largesty)
|
|
||||||
largesty = y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(data);
|
|
||||||
return largesty - smallesty;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Texture::reload()
|
void Texture::reload()
|
||||||
{
|
{
|
||||||
debugLog("RELOADING TEXTURE: " + name + " with loadName " + loadName + "...");
|
debugLog("RELOADING TEXTURE: " + name + " with loadName " + loadName + "...");
|
||||||
|
|
|
@ -43,9 +43,6 @@ public:
|
||||||
void apply(bool repeat = false) const;
|
void apply(bool repeat = false) const;
|
||||||
void unload();
|
void unload();
|
||||||
|
|
||||||
int getPixelWidth();
|
|
||||||
int getPixelHeight();
|
|
||||||
|
|
||||||
void destroy();
|
void destroy();
|
||||||
|
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
Loading…
Add table
Reference in a new issue