- Ja funciona el selector de templates
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <SDL2/SDL.h>
|
||||
#include "actor.h"
|
||||
#include <vector>
|
||||
#include "room.h"
|
||||
|
||||
namespace modules
|
||||
{
|
||||
@@ -28,26 +29,32 @@ namespace modules
|
||||
|
||||
draw::cls(2);
|
||||
|
||||
draw::stencil::enable();
|
||||
draw::stencil::clear(255);
|
||||
//draw::stencil::enable();
|
||||
//draw::stencil::clear(255);
|
||||
|
||||
int x=0, y=0;
|
||||
|
||||
for (int i=0; i<templates.size(); ++i)
|
||||
{
|
||||
draw::stencil::set(i);
|
||||
//draw::stencil::set(i);
|
||||
draw::swapcol(1, TEAL);
|
||||
actor::drawAt(templates[i], x*40, y*40);
|
||||
draw::print(templates[i]->name, (x*40), (y*40)+30, LIGHT+WHITE, BLACK);
|
||||
x++; if (x==13) { x=0;y++; }
|
||||
actor::drawAt(templates[i], x*65, y*40);
|
||||
draw::print(templates[i]->name, (x*65), (y*40)+30, LIGHT+WHITE, BLACK);
|
||||
x++; if (x==8) { x=0;y++; }
|
||||
}
|
||||
|
||||
draw::render();
|
||||
|
||||
if (input::mouseClk(1)) {
|
||||
const int clicked = draw::stencil::query(input::mouseX(), input::mouseY());
|
||||
if (clicked!=255) {
|
||||
//room::load(clicked);
|
||||
//const int clicked = draw::stencil::query(input::mouseX(), input::mouseY());
|
||||
const int clicked = (input::mouseX()/65) + (input::mouseY()/40) * 8;
|
||||
if (clicked<=actor::templates::size()) {
|
||||
actor::actor_t *new_act = actor::duplicate(actor::templates::get(clicked));
|
||||
actor::setUniqueName(new_act);
|
||||
actor::setDirty(new_act, true);
|
||||
actor::select(new_act);
|
||||
room::editor::modify();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user