Commit 49201df4 authored by 魔大农's avatar 魔大农

Changed name

parent ae574bf2
......@@ -32,4 +32,4 @@ Makefile*
# Urho3D
/Urho3D
Quarto
Quatter
No preview for this file type
LIBS += ../Urho3DQtemplate/Urho3D/lib/libUrho3D.a \
LIBS += ../Quatter/Urho3D/lib/libUrho3D.a \
-lpthread \
-ldl \
-lGL
......@@ -8,8 +8,8 @@ DEFINES += URHO3D_COMPILE_QT
QMAKE_CXXFLAGS += -std=c++1y
INCLUDEPATH += \
../Urho3DQtemplate/Urho3D/include \
../Urho3DQtemplate/Urho3D/include/Urho3D/ThirdParty \
../Quatter/Urho3D/include \
../Quatter/Urho3D/include/Urho3D/ThirdParty \
TEMPLATE = app
CONFIG += console
......@@ -20,14 +20,16 @@ SOURCES += \
luckey.cpp \
mastercontrol.cpp \
inputmaster.cpp \
quartocam.cpp \
quattercam.cpp \
board.cpp \
piece.cpp
piece.cpp \
master.cpp
HEADERS += \
luckey.h \
mastercontrol.h \
inputmaster.h \
quartocam.h \
quattercam.h \
board.h \
piece.h
piece.h \
master.h
#include "inputmaster.h"
#include "quartocam.h"
#include "quattercam.h"
InputMaster::InputMaster(Context* context, MasterControl* masterControl) : Object(context),
masterControl_{masterControl},
InputMaster::InputMaster(Context* context, MasterControl* masterControl) : Master(context, masterControl),
input_{GetSubsystem<Input>()}
{
SubscribeToEvent(E_MOUSEBUTTONDOWN, URHO3D_HANDLER(InputMaster, HandleMouseButtonDown));
......@@ -75,3 +74,8 @@ void InputMaster::HandleJoystickButtonUp(StringHash eventType, VariantMap &event
int button = eventData[P_BUTTON].GetInt();
if (pressedJoystickButtons_.Contains(button)) pressedJoystickButtons_.Erase(button);
}
void InputMaster::HandleUpdate(StringHash eventType, VariantMap &eventData)
{
}
#ifndef INPUTMASTER_H
#define INPUTMASTER_H
#include <Urho3D/Urho3D.h>
#include "mastercontrol.h"
namespace Urho3D {
class Drawable;
class Node;
class Scene;
class Sprite;
}
using namespace Urho3D;
#include "master.h"
enum class JoystickButton {SELECT, LEFTSTICK, RIGHTSTICK, START, DPAD_UP, DPAD_RIGHT, DPAD_DOWN, DPAD_LEFT, L2, R2, L1, R1, TRIANGLE, CIRCLE, CROSS, SQUARE};
class InputMaster : public Object
class InputMaster : public Master
{
URHO3D_OBJECT(InputMaster, Object);
URHO3D_OBJECT(InputMaster, Master);
public:
InputMaster(Context* context, MasterControl* masterControl);
WeakPtr<Node> firstHit_;
private:
MasterControl* masterControl_;
Input* input_;
HashSet<int> pressedKeys_;
......@@ -35,6 +24,7 @@ private:
void HandleMouseButtonUp(StringHash eventType, VariantMap &eventData);
void HandleJoystickButtonDown(StringHash eventType, VariantMap &eventData);
void HandleJoystickButtonUp(StringHash eventType, VariantMap &eventData);
void HandleUpdate(StringHash eventType, VariantMap &eventData);
};
#endif // INPUTMASTER_H
#include "master.h"
Master::Master(Context* context, MasterControl *masterControl): Object(context),
masterControl_{masterControl}
{
}
#ifndef MASTER_H
#define MASTER_H
#include <Urho3D/Urho3D.h>
#include "mastercontrol.h"
namespace Urho3D {
class Drawable;
class Node;
class Scene;
class Sprite;
}
using namespace Urho3D;
class Master : public Object
{
URHO3D_OBJECT(Master, Object);
public:
Master(Context *context, MasterControl* masterControl);
protected:
MasterControl* masterControl_;
// virtual void HandleUpdate(StringHash eventType, VariantMap &eventData);
};
#endif // MASTER_H
#include "mastercontrol.h"
#include "inputmaster.h"
#include "quartocam.h"
#include "quattercam.h"
#include "board.h"
URHO3D_DEFINE_APPLICATION_MAIN(MasterControl);
......@@ -13,8 +13,8 @@ MasterControl::MasterControl(Context *context):
void MasterControl::Setup()
{
engineParameters_["WindowTitle"] = "Quarto";
engineParameters_["LogName"] = GetSubsystem<FileSystem>()->GetAppPreferencesDir("urho3d", "logs")+"Quarto.log";
engineParameters_["WindowTitle"] = "Quatter";
engineParameters_["LogName"] = GetSubsystem<FileSystem>()->GetAppPreferencesDir("urho3d", "logs")+"Quatter.log";
// engineParameters_["FullScreen"] = false;
// engineParameters_["WindowWidth"] = 960;
// engineParameters_["WindowHeight"] = 540;
......@@ -47,7 +47,7 @@ void MasterControl::CreateScene()
{
world.scene = new Scene(context_);
world.scene->CreateComponent<Octree>();
world.camera = new QuartoCam(context_, this);
world.camera = new QuatterCam(context_, this);
CreateLights();
Node* tableNode = world.scene->CreateChild("Table");
......
......@@ -13,14 +13,14 @@ class Sprite;
using namespace Urho3D;
class QuartoCam;
class QuatterCam;
class InputMaster;
enum class GamePhase{PLAYER1PICKS, PLAYER2PUTS, PLAYER2PICKS, PLAYER1PUTS};
typedef struct GameWorld
{
SharedPtr<QuartoCam> camera;
SharedPtr<QuatterCam> camera;
SharedPtr<Scene> scene;
struct {
SharedPtr<Node> sceneCursor;
......
#include "quartocam.h"
#include "quattercam.h"
QuartoCam::QuartoCam(Context *context, MasterControl *masterControl):
QuatterCam::QuatterCam(Context *context, MasterControl *masterControl):
Object(context)
{
masterControl_ = masterControl;
......@@ -18,7 +18,7 @@ QuartoCam::QuartoCam(Context *context, MasterControl *masterControl):
SetupViewport();
}
void QuartoCam::SetupViewport()
void QuatterCam::SetupViewport()
{
//Set up a viewport to the Renderer subsystem so that the 3D scene can be seen
SharedPtr<Viewport> viewport(new Viewport(context_, masterControl_->world.scene, camera_));
......@@ -38,12 +38,12 @@ void QuartoCam::SetupViewport()
renderer->SetViewport(0, viewport_);
}
Vector3 QuartoCam::GetWorldPosition()
Vector3 QuatterCam::GetWorldPosition()
{
return rootNode_->GetWorldPosition();
}
Quaternion QuartoCam::GetRotation()
Quaternion QuatterCam::GetRotation()
{
return rootNode_->GetRotation();
}
......@@ -16,13 +16,13 @@ class Camera;
using namespace Urho3D;
class QuartoCam : public Object
class QuatterCam : public Object
{
URHO3D_OBJECT(QuartoCam, Object);
URHO3D_OBJECT(QuatterCam, Object);
friend class MasterControl;
friend class InputMaster;
public:
QuartoCam(Context *context, MasterControl* masterControl);
QuatterCam(Context *context, MasterControl* masterControl);
SharedPtr<Camera> camera_;
SharedPtr<Viewport> viewport_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment