2022-06-24 16:23:26 +08:00
|
|
|
|
/**
|
|
|
|
|
* Copyright(c) Live2D Inc. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by the Live2D Open Software license
|
|
|
|
|
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <CubismFramework.hpp>
|
|
|
|
|
#include <Math/CubismMatrix44.hpp>
|
|
|
|
|
#include <Math/CubismViewMatrix.hpp>
|
|
|
|
|
#include "TouchManager.h"
|
|
|
|
|
#include "2d/CCSprite.h"
|
|
|
|
|
#include "cocos2d.h"
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include "LAppLive2DManager.hpp"
|
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
|
class LAppView : public axis::DrawNode
|
2022-06-24 16:23:26 +08:00
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
LAppView();
|
|
|
|
|
virtual ~LAppView() {}
|
|
|
|
|
|
|
|
|
|
virtual void onEnter();
|
|
|
|
|
virtual void onExit();
|
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
|
virtual void draw(axis::Renderer* renderer, const axis::Mat4& transform, uint32_t flags);
|
|
|
|
|
void onDraw(const axis::Mat4& transform, uint32_t flags);
|
2022-06-24 16:23:26 +08:00
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
|
void onTouchesBegan(const std::vector<axis::Touch*>& touches, axis::Event* event);
|
|
|
|
|
void onTouchesMoved(const std::vector<axis::Touch*>& touches, axis::Event* event);
|
|
|
|
|
void onTouchesEnded(const std::vector<axis::Touch*>& touches, axis::Event* event);
|
2022-06-24 16:23:26 +08:00
|
|
|
|
|
|
|
|
|
void updateViewMatrix(float dx, float dy, float cx, float cy, float scale);
|
|
|
|
|
float transformViewX(float deviceX);
|
|
|
|
|
float transformViewY(float deviceY);
|
|
|
|
|
float transformScreenX(float deviceX);
|
|
|
|
|
float transformScreenY(float deviceY);
|
|
|
|
|
|
|
|
|
|
void setDebugRectsNode(DrawNode* debugRects);
|
|
|
|
|
void drawDebugRects(LAppLive2DManager* manager) const;
|
|
|
|
|
|
|
|
|
|
static LAppView* createDrawNode();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
TouchManager* touchMgr;
|
|
|
|
|
Csm::CubismMatrix44* deviceToScreen;
|
|
|
|
|
Csm::CubismViewMatrix* viewMatrix;
|
|
|
|
|
Csm::Rendering::CubismCommandBuffer_Cocos2dx _commandBuffer;
|
|
|
|
|
DrawNode* _debugRects;
|
|
|
|
|
};
|