diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java b/core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java
index 864938d83b35db74a152d17f90ef4480a30897d4..423469372609e4c3f53321bf2b00d0f37974519a 100644 (file)
package ru.deadsoftware.cavedroid.game;
import com.badlogic.gdx.Gdx;
package ru.deadsoftware.cavedroid.game;
import com.badlogic.gdx.Gdx;
+import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
-import com.badlogic.gdx.graphics.g2d.TextureRegion;
-import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Rectangle;
+import com.badlogic.gdx.scenes.scene2d.ui.Label;
+import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
+import com.badlogic.gdx.utils.ObjectMap;
import ru.deadsoftware.cavedroid.MainConfig;
import ru.deadsoftware.cavedroid.MainConfig;
-import ru.deadsoftware.cavedroid.game.mobs.Mob;
+import ru.deadsoftware.cavedroid.game.input.IGameInputHandler;
+import ru.deadsoftware.cavedroid.game.input.Joystick;
+import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction;
+import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction;
+import ru.deadsoftware.cavedroid.game.input.action.keys.MouseInputActionKey;
+import ru.deadsoftware.cavedroid.game.input.handler.mouse.CursorMouseInputHandler;
+import ru.deadsoftware.cavedroid.game.input.mapper.KeyboardInputActionMapper;
+import ru.deadsoftware.cavedroid.game.input.mapper.MouseInputActionMapper;
import ru.deadsoftware.cavedroid.game.mobs.MobsController;
import ru.deadsoftware.cavedroid.game.mobs.MobsController;
-import ru.deadsoftware.cavedroid.game.mobs.Player;
-import ru.deadsoftware.cavedroid.game.objects.Drop;
-import ru.deadsoftware.cavedroid.game.objects.DropController;
-import ru.deadsoftware.cavedroid.misc.ControlMode;
+import ru.deadsoftware.cavedroid.game.mobs.player.Player;
+import ru.deadsoftware.cavedroid.game.objects.TouchButton;
+import ru.deadsoftware.cavedroid.game.render.IGameRenderer;
+import ru.deadsoftware.cavedroid.game.ui.TooltipManager;
+import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsManager;
+import ru.deadsoftware.cavedroid.misc.Assets;
import ru.deadsoftware.cavedroid.misc.Renderer;
import ru.deadsoftware.cavedroid.misc.Renderer;
+import ru.deadsoftware.cavedroid.misc.utils.RenderingUtilsKt;
+import ru.deadsoftware.cavedroid.misc.utils.SpriteUtilsKt;
+import javax.annotation.CheckForNull;
import javax.inject.Inject;
import javax.inject.Inject;
-
-import static ru.deadsoftware.cavedroid.misc.Assets.guiMap;
-import static ru.deadsoftware.cavedroid.misc.Assets.textureRegions;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Set;
@GameScope
public class GameRenderer extends Renderer {
@GameScope
public class GameRenderer extends Renderer {
+ private static final float DRAG_THRESHOLD = 1f;
+ private static final TouchButton nullButton = new TouchButton(null, -1, true);
+
private final MainConfig mMainConfig;
private final MainConfig mMainConfig;
- private final GameInput mGameInput;
- private final GameWorld mGameWorld;
private final MobsController mMobsController;
private final MobsController mMobsController;
- private final DropController mDropController;
+ private final List<IGameRenderer> mRenderers;
+ private final CursorMouseInputHandler mCursorMouseInputHandler;
+ private final MouseInputActionMapper mMouseInputActionMapper;
+ private final KeyboardInputActionMapper mKeyboardInputActionMapper;
+ private final Set<IGameInputHandler<MouseInputAction>> mMouseInputHandlers;
+ private final Set<IGameInputHandler<KeyboardInputAction>> mKeyboardInputHandlers;
+ private final GameWindowsManager mGameWindowsManager;
+ private final TooltipManager mTooltipManager;
+
+ private final TouchButton mouseLeftTouchButton, mouseRightTouchButton;
@Inject
GameRenderer(MainConfig mainConfig,
@Inject
GameRenderer(MainConfig mainConfig,
- GameInput gameInput,
- GameWorld gameWorld,
MobsController mobsController,
MobsController mobsController,
- DropController dropController) {
+ Set<IGameRenderer> renderers,
+ CursorMouseInputHandler cursorMouseInputHandler,
+ MouseInputActionMapper mouseInputActionMapper,
+ KeyboardInputActionMapper keyboardInputActionMapper,
+ Set<IGameInputHandler<MouseInputAction>> mouseInputHandlers,
+ Set<IGameInputHandler<KeyboardInputAction>> keyboardInputHandlers,
+ GameWindowsManager gameWindowsManager,
+ TooltipManager tooltipManager) {
super(mainConfig.getWidth(), mainConfig.getHeight());
mMainConfig = mainConfig;
super(mainConfig.getWidth(), mainConfig.getHeight());
mMainConfig = mainConfig;
- mGameInput = gameInput;
- mGameWorld = gameWorld;
mMobsController = mobsController;
mMobsController = mobsController;
- mDropController = dropController;
+ mRenderers = new ArrayList<>(renderers);
+ mRenderers.sort(Comparator.comparingInt(IGameRenderer::getRenderLayer));
+ mCursorMouseInputHandler = cursorMouseInputHandler;
+ mMouseInputActionMapper = mouseInputActionMapper;
+ mKeyboardInputActionMapper = keyboardInputActionMapper;
+ mMouseInputHandlers = mouseInputHandlers;
+ mKeyboardInputHandlers = keyboardInputHandlers;
+ mGameWindowsManager = gameWindowsManager;
+ mTooltipManager = tooltipManager;
+
+ mouseLeftTouchButton = new TouchButton(new Rectangle(getWidth() / 2, 0f, getWidth() / 2, getHeight() / 2), Input.Buttons.LEFT, true);
+ mouseRightTouchButton = new TouchButton(new Rectangle(getWidth() / 2, getHeight() / 2, getWidth() / 2, getHeight() / 2), Input.Buttons.RIGHT, true);
+
+ mMainConfig.setJoystick(new Joystick(mMobsController.getPlayer().getSpeed()));
Gdx.gl.glClearColor(0f, .6f, .6f, 1f);
}
Gdx.gl.glClearColor(0f, .6f, .6f, 1f);
}
- private float drawX(int x) {
- return x * 16 - getCamX();
+ private float mTouchDownX, mTouchDownY;
+
+ private void updateCameraPosition() {
+ Player player = mMobsController.getPlayer();
+ setCamPos(player.getX() + player.getWidth() / 2 - getWidth() / 2,
+ player.getY() + player.getHeight() / 2 - getHeight() / 2);
}
}
- private float drawY(int y) {
- return y * 16 - getCamY();
+ private float transformScreenX(int screenX) {
+ return getWidth() / Gdx.graphics.getWidth() * screenX;
}
}
- private void drawWreck(int bl) {
- if (mGameInput.getBlockDamage() > 0) {
- int index = 10 * mGameInput.getBlockDamage() / GameItems.getBlock(bl).getHp();
- String key = "break_" + index;
- spriter.draw(textureRegions.get(key), mGameInput.getCurX() * 16 - getCamX(),
- mGameInput.getCurY() * 16 - getCamY());
- }
+ private float transformScreenY(int screenY) {
+ return getHeight() / Gdx.graphics.getHeight() * screenY;
}
}
- private void drawBlock(int x, int y, boolean drawBG) {
- if (drawBG) {
- if ((!mGameWorld.hasForeAt(x, y) || mGameWorld.getForeMapBlock(x, y).isTransparent())
- && mGameWorld.hasBackAt(x, y)) {
- spriter.draw(mGameWorld.getBackMapBlock(x, y).getTexture(), drawX(x), drawY(y));
- if (!mGameWorld.hasForeAt(x, y) && x == mGameInput.getCurX() && y == mGameInput.getCurY()) {
- drawWreck(mGameWorld.getBackMap(mGameInput.getCurX(), mGameInput.getCurY()));
- }
- }
- }
- if (mGameWorld.hasForeAt(x, y) && mGameWorld.getForeMapBlock(x, y).isBackground() == drawBG) {
- spriter.draw(mGameWorld.getForeMapBlock(x, y).getTexture(), drawX(x), drawY(y));
- if (x == mGameInput.getCurX() && y == mGameInput.getCurY()) {
- drawWreck(mGameWorld.getForeMap(mGameInput.getCurX(), mGameInput.getCurY()));
- }
+ private void handleMousePosition() {
+ final Rectangle viewport = getCameraViewport();
+
+ final float screenX = transformScreenX(Gdx.input.getX());
+ final float screenY = transformScreenY(Gdx.input.getY());
+
+ final MouseInputAction action = new MouseInputAction(
+ screenX,
+ screenY,
+ MouseInputActionKey.None.INSTANCE,
+ viewport);
+
+ mCursorMouseInputHandler.handle(action);
+
+ if (!mTooltipManager.getCurrentMouseTooltip().isEmpty()) {
+ RenderingUtilsKt.drawString(spriter, mTooltipManager.getCurrentMouseTooltip(), screenX + 1, screenY + 1, Color.BLACK);
+ RenderingUtilsKt.drawString(spriter, mTooltipManager.getCurrentMouseTooltip(), screenX, screenY, Color.WHITE);
}
}
}
}
- private void drawWorld(boolean bg) {
- int minX = (int) (getCamX() / 16) - 1;
- int minY = (int) (getCamY() / 16) - 1;
- int maxX = (int) ((getCamX() + getWidth()) / 16) + 1;
- int maxY = (int) ((getCamY() + getHeight()) / 16) + 1;
- if (minY < 0) {
- minY = 0;
- }
- if (maxY > mGameWorld.getHeight()) {
- maxY = mGameWorld.getHeight();
+ private boolean handleMouseAction(@CheckForNull MouseInputAction action) {
+ if (action == null) {
+ return false;
}
}
- for (int y = minY; y < maxY; y++) {
- for (int x = minX; x < maxX; x++) {
- drawBlock(x, y, bg);
- }
- }
- if (bg) {
- spriter.end();
- Gdx.gl.glEnable(GL20.GL_BLEND);
- Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
- shaper.begin(ShapeRenderer.ShapeType.Filled);
- shaper.setColor(0f, 0f, 0f, .5f);
- for (int y = minY; y < maxY; y++) {
- for (int x = minX; x < maxX; x++) {
- if ((!mGameWorld.hasForeAt(x, y) || mGameWorld.getForeMapBlock(x, y).isTransparent())
- && mGameWorld.hasBackAt(x, y)) {
- shaper.rect(drawX(x), drawY(y), 16, 16);
- }
- }
- }
- shaper.end();
- Gdx.gl.glDisable(GL20.GL_BLEND);
- spriter.begin();
- }
- }
- private void drawMob(Mob mob) {
- float mobDrawX = mob.getX() - getCamX();
- float mobDrawY = mob.getY() - getCamY();
+ boolean anyProcessed = false;
- if (mobDrawX + mob.getWidth() < 0 && mobDrawX + mGameWorld.getWidthPx() > 0) {
- mobDrawX += mGameWorld.getWidthPx();
- } else if (mobDrawX > getWidth() && mobDrawX + mob.getWidth() - mGameWorld.getWidthPx() > 0) {
- mobDrawX -= mGameWorld.getWidthPx();
- } else if (mobDrawX + mob.getWidth() < 0 && mobDrawX > getWidth()) {
- return;
+ for (IGameInputHandler<MouseInputAction> handler : mMouseInputHandlers) {
+ final boolean conditions = handler.checkConditions(action);
+ if (conditions) {
+ anyProcessed = true;
+ handler.handle(action);
+ break;
+ }
+// anyProcessed = anyProcessed || conditions;
}
}
-
- mob.draw(spriter, mobDrawX, mobDrawY);
+ return anyProcessed;
}
}
- private void drawDrop(Drop drop) {
+ private boolean onMouseActionEvent(int mouseX, int mouseY, int button, boolean touchUp, int pointer) {
+ @CheckForNull MouseInputAction action = mMouseInputActionMapper
+ .map((float) mouseX, (float) mouseY, getCameraViewport(), button, touchUp, pointer);
+ return handleMouseAction(action);
}
}
- @SuppressWarnings("IntegerDivisionInFloatingPointContext")
- private void drawCreative() {
- TextureRegion creative = textureRegions.get("creative");
- float x = getWidth() / 2 - (float) creative.getRegionWidth() / 2;
- float y = getHeight() / 2 - (float) creative.getRegionHeight() / 2;
- spriter.draw(creative, x, y);
- spriter.draw(textureRegions.get("handle"), x + 156,
- y + 18 + (mGameInput.getCreativeScroll() * (72f / GameProc.MAX_CREATIVE_SCROLL)));
- for (int i = mGameInput.getCreativeScroll() * 8; i < mGameInput.getCreativeScroll() * 8 + 40; i++) {
- if (i > 0 && i < GameItems.getItemsSize()) {
- if (GameItems.getItem(i).isBlock()) {
- spriter.draw(GameItems.getBlock(GameItems.getBlockIdByItemId(i)).getTexture(),
- x + 8 + ((i - mGameInput.getCreativeScroll() * 8) % 8) * 18,
- y + 18 + ((i - mGameInput.getCreativeScroll() * 8) / 8) * 18);
- } else {
- spriter.draw(GameItems.getItem(i).getTexture(),
- x + 8 + ((i - mGameInput.getCreativeScroll() * 8) % 8) * 18,
- y + 18 + ((i - mGameInput.getCreativeScroll() * 8) / 8) * 18);
- }
- }
- }
- for (int i = 0; i < 9; i++) {
- if (mMobsController.getPlayer().inventory[i] > 0) {
- if (GameItems.getItem(mMobsController.getPlayer().inventory[i]).isBlock()) {
- spriter.draw(GameItems.getBlock(GameItems.getBlockIdByItemId(mMobsController.getPlayer().inventory[i])).getTexture(),
- x + 8 + i * 18, y + creative.getRegionHeight() - 24);
- } else {
- spriter.draw(GameItems.getItem(mMobsController.getPlayer().inventory[i]).getTexture(),
- x + 8 + i * 18, y + creative.getRegionHeight() - 24);
- }
+ @Override
+ public boolean touchUp(int screenX, int screenY, int pointer, int button) {
+ float touchX = transformScreenX(screenX);
+ float touchY = transformScreenY(screenY);
+
+ if (mMainConfig.isTouch()) {
+ TouchButton touchedKey = getTouchedKey(touchX, touchY);
+ if (touchedKey.isMouse()) {
+ return onMouseActionEvent(screenX, screenY, touchedKey.getCode(), true, pointer);
+ } else {
+ return keyUp(touchedKey.getCode());
}
}
}
}
+ return onMouseActionEvent(screenX, screenY, button, true, pointer);
}
}
- private void drawGUI() {
- TextureRegion cursor = textureRegions.get("cursor");
- TextureRegion hotbar = textureRegions.get("hotbar");
- TextureRegion hotbarSelector = textureRegions.get("hotbar_selector");
-
- if (mGameWorld.hasForeAt(mGameInput.getCurX(), mGameInput.getCurY()) ||
- mGameWorld.hasBackAt(mGameInput.getCurX(), mGameInput.getCurY()) ||
- mGameInput.getControlMode() == ControlMode.CURSOR || mMainConfig.isTouch()) {
- spriter.draw(cursor, mGameInput.getCurX() * 16 - getCamX(), mGameInput.getCurY() * 16 - getCamY());
+ private TouchButton getTouchedKey(float touchX, float touchY) {
+ if (mGameWindowsManager.getCurrentWindowType() != GameUiWindow.NONE) {
+ return nullButton;
}
}
- spriter.draw(hotbar, getWidth() / 2 - (float) hotbar.getRegionWidth() / 2, 0);
- for (int i = 0; i < 9; i++) {
- if (mMobsController.getPlayer().inventory[i] > 0) {
- if (GameItems.getItem(mMobsController.getPlayer().inventory[i]).isBlock()) {
- spriter.draw(GameItems.getBlock(GameItems.getBlockIdByItemId(mMobsController.getPlayer().inventory[i])).getTexture(),
- getWidth() / 2 - (float) hotbar.getRegionWidth() / 2 + 3 + i * 20,
- 3);
- } else {
- spriter.draw(GameItems.getItem(mMobsController.getPlayer().inventory[i]).getTexture(),
- getWidth() / 2 - (float) hotbar.getRegionWidth() / 2 + 3 + i * 20,
- 3);
- }
+ for (ObjectMap.Entry<String, TouchButton> entry : Assets.guiMap) {
+ TouchButton button = entry.value;
+ if (button.getRect().contains(touchX, touchY)) {
+ return button;
}
}
}
}
- spriter.draw(hotbarSelector,
- getWidth() / 2 - (float) hotbar.getRegionWidth() / 2 - 1 + 20 * mMobsController.getPlayer().slot,
- -1);
- }
- private void drawTouchGui() {
- for (int i = 0; i < guiMap.size; i++) {
- Rectangle touchKey = guiMap.getValueAt(i).getRect();
- spriter.draw(textureRegions.get(guiMap.getKeyAt(i)),
- touchKey.x, touchKey.y, touchKey.width, touchKey.height);
+ if (mouseLeftTouchButton.getRect().contains(touchX, touchY)) {
+ return mouseLeftTouchButton;
}
}
- if (mGameInput.getControlMode() == ControlMode.CURSOR) {
- spriter.draw(textureRegions.get("shade"), 83, getHeight() - 21);
+
+ if (mouseRightTouchButton.getRect().contains(touchX, touchY)) {
+ return mouseRightTouchButton;
}
}
+
+ return nullButton;
}
}
- private void drawGamePlay() {
- Player player = mMobsController.getPlayer();
+ @Override
+ public boolean touchDown(int screenX, int screenY, int pointer, int button) {
+ float touchX = transformScreenX(screenX);
+ float touchY = transformScreenY(screenY);
- drawWorld(true);
- player.draw(spriter, player.getX() - getCamX() - player.getWidth() / 2, player.getY() - getCamY());
- mMobsController.forEach(this::drawMob);
- mDropController.forEach(this::drawDrop);
- drawWorld(false);
- drawGUI();
+ mTouchDownX = touchX;
+ mTouchDownY = touchY;
+
+ if (mMainConfig.isTouch()) {
+ TouchButton touchedKey = getTouchedKey(touchX, touchY);
+ if (touchedKey.isMouse()) {
+ return onMouseActionEvent(screenX, screenY, touchedKey.getCode(), false, pointer);
+ } else {
+ return keyDown(touchedKey.getCode());
+ }
+ }
+
+ return onMouseActionEvent(screenX, screenY, button, false, pointer);
}
}
- private void updateCameraPosition() {
- Player player = mMobsController.getPlayer();
- setCamPos(player.getX() + player.getWidth() / 2 - getWidth() / 2,
- player.getY() + player.getHeight() / 2 - getHeight() / 2);
+ @Override
+ public boolean touchDragged(int screenX, int screenY, int pointer) {
+ float touchX = transformScreenX(screenX);
+ float touchY = transformScreenY(screenY);
+
+ if (Math.abs(touchX - mTouchDownX) < 16 && Math.abs(touchY - mTouchDownY) < DRAG_THRESHOLD) {
+ return false;
+ }
+
+ @CheckForNull MouseInputAction action =
+ mMouseInputActionMapper.mapDragged(screenX, screenY, getCameraViewport(), pointer);
+ return handleMouseAction(action);
}
@Override
}
@Override
- public void render(float delta) {
- int fps = (int) (1 / delta);
- updateCameraPosition();
- mGameInput.moveCursor(this);
+ public boolean scrolled(float amountX, float amountY) {
+ @CheckForNull MouseInputAction action = mMouseInputActionMapper
+ .mapScrolled(Gdx.input.getX(), Gdx.input.getY(), amountX, amountY, getCameraViewport());
+ return handleMouseAction(action);
+ }
- Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
+ private boolean handleKeyboardAction(int keycode, boolean isKeyDown) {
+ @CheckForNull final KeyboardInputAction action = mKeyboardInputActionMapper
+ .map(keycode, isKeyDown);
- spriter.begin();
+ if (action == null) {
+ return false;
+ }
- drawGamePlay();
+ boolean anyProcessed = false;
- switch (mMainConfig.getGameUiWindow()) {
- case CREATIVE_INVENTORY:
- drawCreative();
+ for (IGameInputHandler<KeyboardInputAction> handler : mKeyboardInputHandlers) {
+ final boolean conditions = handler.checkConditions(action);
+ if (conditions) {
+ anyProcessed = true;
+ handler.handle(action);
break;
break;
- //TODO draw other ui windows
+ }
}
}
+ return anyProcessed;
+ }
- if (mMainConfig.isTouch()) {
- drawTouchGui();
- }
+ @Override
+ public boolean keyDown(int keycode) {
+ return handleKeyboardAction(keycode, true);
+ }
- spriter.end();
+ @Override
+ public boolean keyUp(int keycode) {
+ return handleKeyboardAction(keycode, false);
+ }
- if (mMainConfig.isShowMap()) {
- //DRAW MAP
- shaper.begin(ShapeRenderer.ShapeType.Filled);
- shaper.setColor(Color.LIGHT_GRAY);
- shaper.rect(0, 0, mGameWorld.getWidth(), 128);
- for (int y = 128; y < 256; y++) {
- for (int x = 0; x < getWidth(); x++) {
- if (mGameWorld.hasForeAt(x, y) || mGameWorld.hasBackAt(x, y)) {
- if (GameItems.isWater(mGameWorld.getForeMap(x, y))) {
- shaper.setColor(Color.BLUE);
- } else if (GameItems.isLava(mGameWorld.getForeMap(x, y))) {
- shaper.setColor(Color.RED);
- } else {
- if (mGameWorld.hasForeAt(x, y)) {
- shaper.setColor(Color.BLACK);
- } else {
- shaper.setColor(Color.DARK_GRAY);
- }
- }
- shaper.rect(x, y - 128, 1, 1);
- }
- }
- }
- shaper.setColor(Color.OLIVE);
- shaper.rect(mMobsController.getPlayer().getMapX(), mMobsController.getPlayer().getUpperMapY() - 128, 1, 2);
- shaper.end();
- //=================
- }
+ @Override
+ public void render(float delta) {
+ updateCameraPosition();
- if (mMainConfig.isShowInfo()) {
- spriter.begin();
- Player player = mMobsController.getPlayer();
- drawString("FPS: " + fps, 0, 0);
- drawString("X: " + player.getMapX(), 0, 10);
- drawString("Y: " + player.getUpperMapY(), 0, 20);
- drawString("CurX: " + mGameInput.getCurX(), 0, 30);
- drawString("CurY: " + mGameInput.getCurY(), 0, 40);
- drawString("Mobs: " + mMobsController.getSize(), 0, 50);
- drawString("Drops: " + mDropController.getSize(), 0, 60);
- drawString("Block: " + GameItems.getBlockKey(mGameWorld.getForeMap(mGameInput.getCurX(), mGameInput.getCurY())), 0, 70);
- drawString("Hand: " + GameItems.getItemKey(mMobsController.getPlayer().inventory[mMobsController.getPlayer().slot]), 0, 80);
- drawString("Game mode: " + player.gameMode, 0, 90);
- spriter.end();
+ if (mMainConfig.getJoystick() != null && mMainConfig.getJoystick().getActive()) {
+ mMainConfig.getJoystick().updateState(
+ transformScreenX(Gdx.input.getX(mMainConfig.getJoystick().getPointer())),
+ transformScreenY(Gdx.input.getY(mMainConfig.getJoystick().getPointer()))
+ );
}
}
+ Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
+
+ spriter.begin();
+ mRenderers.forEach(iGameRenderer -> iGameRenderer.draw(spriter, shaper, getCameraViewport(), delta));
+ handleMousePosition();
+ spriter.end();
+
}
}
}
}