Merge branch 'GameClient' of https://github.com/dean11/Danbias into GameClient
This commit is contained in:
commit
0876e5797a
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ShowAllFiles>false</ShowAllFiles>
|
<ShowAllFiles>true</ShowAllFiles>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
|
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>
|
||||||
|
|
|
@ -7,9 +7,6 @@
|
||||||
|
|
||||||
#include "EventButtonGUI.h"
|
#include "EventButtonGUI.h"
|
||||||
|
|
||||||
//Only for testing because we don't have any other input
|
|
||||||
#include "../WindowManager/WindowShell.h"
|
|
||||||
|
|
||||||
namespace DanBias
|
namespace DanBias
|
||||||
{
|
{
|
||||||
namespace Client
|
namespace Client
|
||||||
|
@ -18,24 +15,25 @@ namespace DanBias
|
||||||
class ButtonEllipse : public EventButtonGUI<Owner>
|
class ButtonEllipse : public EventButtonGUI<Owner>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ButtonEllipse()
|
ButtonEllipse(std::wstring textureName, std::wstring buttonText,
|
||||||
: EventButtonGUI(), radius(0)
|
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
||||||
|
Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||||
|
: EventButtonGUI(textureName, buttonText, textColor, backColor, hoverColor, pressedColor, owner, pos, size, resize)
|
||||||
{}
|
{}
|
||||||
ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, Owner owner, Oyster::Math::Float3 pos,
|
ButtonEllipse(std::wstring textureName, std::wstring buttonText,
|
||||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
||||||
: EventButtonGUI(textureName, buttonText, textColor, owner, pos, size, resize)
|
EventFunc func, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||||
|
: EventButtonGUI(textureName, buttonText, textColor, backColor, hoverColor, pressedColor, func, pos, size, resize)
|
||||||
{}
|
{}
|
||||||
ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Oyster::Math::Float3 pos,
|
ButtonEllipse(std::wstring textureName, std::wstring buttonText,
|
||||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
||||||
: EventButtonGUI(textureName, buttonText, textColor, func, pos, size, resize)
|
EventFunc func, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||||
|
: EventButtonGUI(textureName, buttonText, textColor, backColor, hoverColor, pressedColor, func, owner, pos, size, resize)
|
||||||
{}
|
{}
|
||||||
ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Owner owner, Oyster::Math::Float3 pos,
|
ButtonEllipse(std::wstring textureName, std::wstring buttonText,
|
||||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
||||||
: EventButtonGUI(textureName, buttonText, textColor, func, owner, pos, size, resize)
|
EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
||||||
{}
|
: EventButtonGUI(textureName, buttonText, textColor, backColor, hoverColor, pressedColor, func, owner, userData, pos, size, resize)
|
||||||
ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float4 textColor, EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos,
|
|
||||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height)
|
|
||||||
: EventButtonGUI(textureName, buttonText, textColor, func, owner, userData, pos, size, resize)
|
|
||||||
{}
|
{}
|
||||||
virtual ~ButtonEllipse()
|
virtual ~ButtonEllipse()
|
||||||
{}
|
{}
|
||||||
|
@ -43,7 +41,6 @@ namespace DanBias
|
||||||
//Circle vs point collision
|
//Circle vs point collision
|
||||||
bool Collision(Oyster::Event::MouseInput& input)
|
bool Collision(Oyster::Event::MouseInput& input)
|
||||||
{
|
{
|
||||||
//Should come from the InputClass
|
|
||||||
float xMouse = input.x, yMouse = input.y;
|
float xMouse = input.x, yMouse = input.y;
|
||||||
|
|
||||||
double normx = (xMouse - pos.x) / size.x;
|
double normx = (xMouse - pos.x) / size.x;
|
||||||
|
|
|
@ -6,9 +6,6 @@
|
||||||
#define DANBIAS_CLIENT_BUTTON_RECTANGLE_H
|
#define DANBIAS_CLIENT_BUTTON_RECTANGLE_H
|
||||||
|
|
||||||
#include "EventButtonGUI.h"
|
#include "EventButtonGUI.h"
|
||||||
#include <iostream>
|
|
||||||
//Only for testing because we don't have any other input
|
|
||||||
#include "../WindowManager/WindowShell.h"
|
|
||||||
|
|
||||||
namespace DanBias
|
namespace DanBias
|
||||||
{
|
{
|
||||||
|
@ -18,55 +15,46 @@ namespace DanBias
|
||||||
class ButtonRectangle : public EventButtonGUI<Owner>
|
class ButtonRectangle : public EventButtonGUI<Owner>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ButtonRectangle()
|
ButtonRectangle(std::wstring textureName, std::wstring buttonText,
|
||||||
: EventButtonGUI(), width(0), height(0)
|
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
||||||
|
Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None)
|
||||||
|
: EventButtonGUI(textureName, buttonText
|
||||||
|
, textColor, backColor, hoverColor, pressedColor
|
||||||
|
, owner, pos, size, resize)
|
||||||
{}
|
{}
|
||||||
ButtonRectangle(std::wstring textureName, std::wstring buttonText,
|
ButtonRectangle(std::wstring textureName, std::wstring buttonText,
|
||||||
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
||||||
Owner owner, Oyster::Math::Float3 pos,
|
EventFunc func, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None)
|
||||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None)
|
: EventButtonGUI(textureName, buttonText
|
||||||
: EventButtonGUI(textureName, buttonText,
|
, textColor, backColor, hoverColor, pressedColor
|
||||||
textColor, backColor, hoverColor, pressedColor,
|
, func, pos, size, resize)
|
||||||
owner, pos, size, resize)
|
|
||||||
{}
|
{}
|
||||||
ButtonRectangle(std::wstring textureName, std::wstring buttonText,
|
ButtonRectangle(std::wstring textureName, std::wstring buttonText,
|
||||||
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
||||||
EventFunc func, Oyster::Math::Float3 pos,
|
EventFunc func, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None)
|
||||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None)
|
: EventButtonGUI(textureName, buttonText
|
||||||
: EventButtonGUI(textureName, buttonText,
|
, textColor, backColor, hoverColor, pressedColor
|
||||||
textColor, backColor, hoverColor, pressedColor,
|
, func, owner, pos, size, resize)
|
||||||
func, pos, size, resize)
|
|
||||||
{}
|
{}
|
||||||
ButtonRectangle(std::wstring textureName, std::wstring buttonText,
|
ButtonRectangle(std::wstring textureName, std::wstring buttonText,
|
||||||
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
||||||
EventFunc func, Owner owner, Oyster::Math::Float3 pos,
|
EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None)
|
||||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None)
|
: EventButtonGUI(textureName, buttonText
|
||||||
: EventButtonGUI(textureName, buttonText,
|
, textColor, backColor, hoverColor, pressedColor
|
||||||
textColor, backColor, hoverColor, pressedColor,
|
, func, owner, userData, pos, size, resize)
|
||||||
func, owner, pos, size, resize)
|
|
||||||
{}
|
|
||||||
ButtonRectangle(std::wstring textureName, std::wstring buttonText,
|
|
||||||
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
|
||||||
EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos,
|
|
||||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None)
|
|
||||||
: EventButtonGUI(textureName, buttonText,
|
|
||||||
textColor, backColor, hoverColor, pressedColor,
|
|
||||||
func, owner, userData, pos, size, resize)
|
|
||||||
{}
|
{}
|
||||||
virtual ~ButtonRectangle()
|
virtual ~ButtonRectangle()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//Circle vs point collision
|
//Rectangle vs point collision
|
||||||
bool Collision(Oyster::Event::MouseInput& input)
|
bool Collision(Oyster::Event::MouseInput& input)
|
||||||
{
|
{
|
||||||
//Should come from the InputClass
|
|
||||||
float xMouse = input.x, yMouse = input.y;
|
float xMouse = input.x, yMouse = input.y;
|
||||||
|
|
||||||
float widthTemp = pos.x - size.x * 0.5f;
|
float widthTemp = pos.x - size.x * 0.5f;
|
||||||
float widthTemp2 = pos.x + size.x * 0.5f;
|
float widthTemp2 = pos.x + size.x * 0.5f;
|
||||||
float heightTemp = pos.y - size.y * 0.5f;
|
float heightTemp = pos.y - size.y * 0.5f;
|
||||||
float heightTemp2 = pos.y + size.y * 0.5f;
|
float heightTemp2 = pos.y + size.y * 0.5f;
|
||||||
//std::cout << p.x << ' ' << p.y << ' ' << widthTemp << ' ' << heightTemp << std::endl;
|
|
||||||
|
|
||||||
if(xMouse >= widthTemp && xMouse <= widthTemp2 &&
|
if(xMouse >= widthTemp && xMouse <= widthTemp2 &&
|
||||||
yMouse >= heightTemp && yMouse <= heightTemp2)
|
yMouse >= heightTemp && yMouse <= heightTemp2)
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include "EventHandler/EventButton.h"
|
#include "EventHandler/EventButton.h"
|
||||||
#include "DllInterfaces/GFXAPI.h"
|
#include "DllInterfaces/GFXAPI.h"
|
||||||
|
#include "../WindowManager/WindowShell.h"
|
||||||
|
|
||||||
namespace DanBias
|
namespace DanBias
|
||||||
{
|
{
|
||||||
|
@ -37,26 +38,27 @@ namespace DanBias
|
||||||
textColor(textColor), backColor(backColor), hoverColor(hoverColor), pressedColor(pressedColor)
|
textColor(textColor), backColor(backColor), hoverColor(hoverColor), pressedColor(pressedColor)
|
||||||
{
|
{
|
||||||
CreateTexture(textureName);
|
CreateTexture(textureName);
|
||||||
|
this->resizedSize = size;
|
||||||
if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize);
|
if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize);
|
||||||
}
|
}
|
||||||
EventButtonGUI(std::wstring textureName, std::wstring buttonText,
|
EventButtonGUI(std::wstring textureName, std::wstring buttonText,
|
||||||
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
||||||
EventFunc func, Oyster::Math::Float3 pos,
|
EventFunc func, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None)
|
||||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None)
|
|
||||||
: EventButton(func), pos(pos), size(size), texture(NULL), buttonText(buttonText),
|
: EventButton(func), pos(pos), size(size), texture(NULL), buttonText(buttonText),
|
||||||
textColor(textColor), backColor(backColor), hoverColor(hoverColor), pressedColor(pressedColor)
|
textColor(textColor), backColor(backColor), hoverColor(hoverColor), pressedColor(pressedColor)
|
||||||
{
|
{
|
||||||
CreateTexture(textureName);
|
CreateTexture(textureName);
|
||||||
|
this->resizedSize = size;
|
||||||
if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize);
|
if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize);
|
||||||
}
|
}
|
||||||
EventButtonGUI(std::wstring textureName, std::wstring buttonText,
|
EventButtonGUI(std::wstring textureName, std::wstring buttonText,
|
||||||
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
Oyster::Math::Float4 textColor, Oyster::Math::Float4 backColor, Oyster::Math::Float4 hoverColor, Oyster::Math::Float4 pressedColor,
|
||||||
EventFunc func, Owner owner, Oyster::Math::Float3 pos,
|
EventFunc func, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None)
|
||||||
Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_None)
|
|
||||||
: EventButton(func, owner), pos(pos), size(size), texture(NULL), buttonText(buttonText),
|
: EventButton(func, owner), pos(pos), size(size), texture(NULL), buttonText(buttonText),
|
||||||
textColor(textColor), backColor(backColor), hoverColor(hoverColor), pressedColor(pressedColor)
|
textColor(textColor), backColor(backColor), hoverColor(hoverColor), pressedColor(pressedColor)
|
||||||
{
|
{
|
||||||
CreateTexture(textureName);
|
CreateTexture(textureName);
|
||||||
|
this->resizedSize = size;
|
||||||
if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize);
|
if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize);
|
||||||
}
|
}
|
||||||
EventButtonGUI(std::wstring textureName, std::wstring buttonText,
|
EventButtonGUI(std::wstring textureName, std::wstring buttonText,
|
||||||
|
@ -66,6 +68,7 @@ namespace DanBias
|
||||||
textColor(textColor), backColor(backColor), hoverColor(hoverColor), pressedColor(pressedColor)
|
textColor(textColor), backColor(backColor), hoverColor(hoverColor), pressedColor(pressedColor)
|
||||||
{
|
{
|
||||||
CreateTexture(textureName);
|
CreateTexture(textureName);
|
||||||
|
this->resizedSize = size;
|
||||||
if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize);
|
if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize);
|
||||||
}
|
}
|
||||||
virtual ~EventButtonGUI()
|
virtual ~EventButtonGUI()
|
||||||
|
@ -92,15 +95,15 @@ namespace DanBias
|
||||||
|
|
||||||
if(EventButton<Owner>::GetState() == ButtonState_None)
|
if(EventButton<Owner>::GetState() == ButtonState_None)
|
||||||
{
|
{
|
||||||
Oyster::Graphics::API::RenderGuiElement(texture, pos, size, backColor);
|
Oyster::Graphics::API::RenderGuiElement(texture, pos, resizedSize, backColor);
|
||||||
}
|
}
|
||||||
else if(EventButton<Owner>::GetState() == ButtonState_Hover)
|
else if(EventButton<Owner>::GetState() == ButtonState_Hover)
|
||||||
{
|
{
|
||||||
Oyster::Graphics::API::RenderGuiElement(texture, pos, size, hoverColor);
|
Oyster::Graphics::API::RenderGuiElement(texture, pos, resizedSize, hoverColor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Oyster::Graphics::API::RenderGuiElement(texture, pos, size, pressedColor);
|
Oyster::Graphics::API::RenderGuiElement(texture, pos, resizedSize, pressedColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -121,15 +124,18 @@ namespace DanBias
|
||||||
GetClientRect(WindowShell::GetHWND(), &r);
|
GetClientRect(WindowShell::GetHWND(), &r);
|
||||||
|
|
||||||
if(resize == ResizeAspectRatio_Height)
|
if(resize == ResizeAspectRatio_Height)
|
||||||
size.y *= (float)r.right/(float)r.bottom;
|
resizedSize.y = size.y * ((float)r.right/(float)r.bottom);
|
||||||
else if(resize == ResizeAspectRatio_Width)
|
else if(resize == ResizeAspectRatio_Width)
|
||||||
size.x *= (float)r.bottom/(float)r.right;
|
resizedSize.x = size.x * ((float)r.bottom/(float)r.right);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Oyster::Math::Float3 pos;
|
Oyster::Math::Float3 pos;
|
||||||
Oyster::Math::Float2 size;
|
Oyster::Math::Float2 size;
|
||||||
|
|
||||||
|
//The new calculated resize, it's only used for the button not the text right now.
|
||||||
|
Oyster::Math::Float2 resizedSize;
|
||||||
|
|
||||||
Oyster::Graphics::API::Texture texture;
|
Oyster::Graphics::API::Texture texture;
|
||||||
|
|
||||||
std::wstring buttonText;
|
std::wstring buttonText;
|
||||||
|
|
|
@ -4,12 +4,19 @@
|
||||||
using namespace ::Oyster::Math3D;
|
using namespace ::Oyster::Math3D;
|
||||||
using namespace ::Utility::Value;
|
using namespace ::Utility::Value;
|
||||||
|
|
||||||
|
inline Quaternion Transform( const Quaternion &transformer, const Quaternion &transformee )
|
||||||
|
{
|
||||||
|
// return transformer * transformee;
|
||||||
|
return transformee * transformer;
|
||||||
|
}
|
||||||
|
|
||||||
Camera_FPSV2::Camera_FPSV2()
|
Camera_FPSV2::Camera_FPSV2()
|
||||||
{ // this->head is default set to identity uniformprojection at origo
|
{ // this->head is default set to identity uniformprojection at origo
|
||||||
this->pitchUp = 0.0f;
|
this->pitchUp = 0.0f;
|
||||||
this->headOffset =
|
this->headOffset =
|
||||||
this->body.translation = Float3::null;
|
this->body.translation = Float3::null;
|
||||||
this->body.rotation = Quaternion::identity;
|
this->body.rotation = Quaternion::identity;
|
||||||
|
this->pitchHaveChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Camera_FPSV2::~Camera_FPSV2() {}
|
Camera_FPSV2::~Camera_FPSV2() {}
|
||||||
|
@ -21,6 +28,7 @@ Camera_FPSV2 & Camera_FPSV2::operator = ( const Camera_FPSV2 &camera )
|
||||||
this->headOffset = camera.headOffset;
|
this->headOffset = camera.headOffset;
|
||||||
this->body.translation = camera.body.translation;
|
this->body.translation = camera.body.translation;
|
||||||
this->body.rotation = camera.body.rotation;
|
this->body.rotation = camera.body.rotation;
|
||||||
|
this->pitchHaveChanged = camera.pitchHaveChanged;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,8 +46,14 @@ void Camera_FPSV2::SetPosition( const Float3 &translation )
|
||||||
|
|
||||||
void Camera_FPSV2::SetRotation( const Quaternion &rotation )
|
void Camera_FPSV2::SetRotation( const Quaternion &rotation )
|
||||||
{
|
{
|
||||||
|
if( !Within(rotation.GetNorm(), .99f, 1.01f) )
|
||||||
|
{ // HACK: bug trap
|
||||||
|
const char *breakPoint = "Caught an invalid rotation!";
|
||||||
|
}
|
||||||
|
|
||||||
this->body.rotation = rotation;
|
this->body.rotation = rotation;
|
||||||
this->head.SetRotation( rotation * Rotation(this->pitchUp, this->GetNormalOf(Float3::standard_unit_x) ) );
|
this->head.SetRotation( Transform(rotation, Rotation(this->pitchUp, WorldAxisOf(rotation, Float3::standard_unit_x))) );
|
||||||
|
this->pitchHaveChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera_FPSV2::SetAngular( const Float3 &axis )
|
void Camera_FPSV2::SetAngular( const Float3 &axis )
|
||||||
|
@ -64,6 +78,12 @@ void Camera_FPSV2::SetPerspectiveProjection( Float verticalFoV, Float aspectRati
|
||||||
|
|
||||||
void Camera_FPSV2::UpdateOrientation()
|
void Camera_FPSV2::UpdateOrientation()
|
||||||
{
|
{
|
||||||
|
if( this->pitchHaveChanged )
|
||||||
|
{
|
||||||
|
this->head.SetRotation( Transform(this->body.rotation, Rotation(this->pitchUp, WorldAxisOf(this->body.rotation, Float3::standard_unit_x))) );
|
||||||
|
this->pitchHaveChanged = false;
|
||||||
|
}
|
||||||
|
|
||||||
Float4x4 orientation;
|
Float4x4 orientation;
|
||||||
OrientationMatrix( this->body.rotation, this->body.translation, orientation );
|
OrientationMatrix( this->body.rotation, this->body.translation, orientation );
|
||||||
|
|
||||||
|
@ -73,7 +93,8 @@ void Camera_FPSV2::UpdateOrientation()
|
||||||
void Camera_FPSV2::SnapUpToNormal( const Float3 &normal )
|
void Camera_FPSV2::SnapUpToNormal( const Float3 &normal )
|
||||||
{
|
{
|
||||||
this->body.rotation = Rotation( SnapAngularAxis(AngularAxis(this->body.rotation), WorldAxisOf(this->body.rotation, Float3::standard_unit_y), normal) );
|
this->body.rotation = Rotation( SnapAngularAxis(AngularAxis(this->body.rotation), WorldAxisOf(this->body.rotation, Float3::standard_unit_y), normal) );
|
||||||
this->head.SetRotation( this->body.rotation * Rotation(this->pitchUp * Float3::standard_unit_x) );
|
this->head.SetRotation( Transform(this->body.rotation, Rotation(this->pitchUp, WorldAxisOf(this->body.rotation, Float3::standard_unit_x))) );
|
||||||
|
this->pitchHaveChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera_FPSV2::Move( const Float3 &deltaPosition )
|
void Camera_FPSV2::Move( const Float3 &deltaPosition )
|
||||||
|
@ -84,8 +105,8 @@ void Camera_FPSV2::Move( const Float3 &deltaPosition )
|
||||||
|
|
||||||
void Camera_FPSV2::Rotate( const Quaternion &deltaRotation )
|
void Camera_FPSV2::Rotate( const Quaternion &deltaRotation )
|
||||||
{
|
{
|
||||||
this->head.Rotate( deltaRotation );
|
|
||||||
this->body.rotation *= deltaRotation;
|
this->body.rotation *= deltaRotation;
|
||||||
|
this->pitchHaveChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera_FPSV2::Rotate( const Float3 &deltaAngularAxis )
|
void Camera_FPSV2::Rotate( const Float3 &deltaAngularAxis )
|
||||||
|
@ -115,8 +136,13 @@ void Camera_FPSV2::StrafeLeft( Float distance )
|
||||||
|
|
||||||
void Camera_FPSV2::PitchUp( Float radian )
|
void Camera_FPSV2::PitchUp( Float radian )
|
||||||
{
|
{
|
||||||
|
if( radian >= 0.5f )
|
||||||
|
{ // HACK: debugging
|
||||||
|
const char *breakPoint = "";
|
||||||
|
}
|
||||||
|
|
||||||
this->pitchUp = Clamp( this->pitchUp + radian, -0.48f * pi, 0.48f * pi );
|
this->pitchUp = Clamp( this->pitchUp + radian, -0.48f * pi, 0.48f * pi );
|
||||||
this->head.SetRotation( this->body.rotation * Rotation(this->pitchUp, Float3::standard_unit_x) );
|
this->pitchHaveChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera_FPSV2::PitchDown( Float radian )
|
void Camera_FPSV2::PitchDown( Float radian )
|
||||||
|
@ -147,6 +173,12 @@ const Float3 & Camera_FPSV2::GetPosition() const
|
||||||
|
|
||||||
Float4x4 & Camera_FPSV2::GetViewMatrix( Float4x4 &targetMem ) const
|
Float4x4 & Camera_FPSV2::GetViewMatrix( Float4x4 &targetMem ) const
|
||||||
{
|
{
|
||||||
|
if( this->pitchHaveChanged )
|
||||||
|
{
|
||||||
|
this->head.SetRotation( Transform(this->body.rotation, Rotation(this->pitchUp, WorldAxisOf(this->body.rotation, Float3::standard_unit_x))) );
|
||||||
|
this->pitchHaveChanged = false;
|
||||||
|
}
|
||||||
|
|
||||||
return this->head.GetViewMatrix( targetMem );
|
return this->head.GetViewMatrix( targetMem );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,11 +189,23 @@ const Float4x4 & Camera_FPSV2::GetProjectionMatrix() const
|
||||||
|
|
||||||
Float4x4 & Camera_FPSV2::GetViewsProjMatrix( Float4x4 &targetMem ) const
|
Float4x4 & Camera_FPSV2::GetViewsProjMatrix( Float4x4 &targetMem ) const
|
||||||
{
|
{
|
||||||
|
if( this->pitchHaveChanged )
|
||||||
|
{
|
||||||
|
this->head.SetRotation( Transform(this->body.rotation, Rotation(this->pitchUp, WorldAxisOf(this->body.rotation, Float3::standard_unit_x))) );
|
||||||
|
this->pitchHaveChanged = false;
|
||||||
|
}
|
||||||
|
|
||||||
return this->head.GetViewsProjMatrix( targetMem );
|
return this->head.GetViewsProjMatrix( targetMem );
|
||||||
}
|
}
|
||||||
|
|
||||||
Float3 Camera_FPSV2::GetNormalOf( const Float3 &axis ) const
|
Float3 Camera_FPSV2::GetNormalOf( const Float3 &axis ) const
|
||||||
{
|
{
|
||||||
|
if( this->pitchHaveChanged )
|
||||||
|
{
|
||||||
|
this->head.SetRotation( Transform(this->body.rotation, Rotation(this->pitchUp, WorldAxisOf(this->body.rotation, Float3::standard_unit_x))) );
|
||||||
|
this->pitchHaveChanged = false;
|
||||||
|
}
|
||||||
|
|
||||||
return this->head.GetNormalOf( axis );
|
return this->head.GetNormalOf( axis );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,6 +221,12 @@ Float3 Camera_FPSV2::GetUp() const
|
||||||
|
|
||||||
Float3 Camera_FPSV2::GetLook() const
|
Float3 Camera_FPSV2::GetLook() const
|
||||||
{
|
{
|
||||||
|
if( this->pitchHaveChanged )
|
||||||
|
{
|
||||||
|
this->head.SetRotation( Transform(this->body.rotation, Rotation(this->pitchUp, WorldAxisOf(this->body.rotation, Float3::standard_unit_x))) );
|
||||||
|
this->pitchHaveChanged = false;
|
||||||
|
}
|
||||||
|
|
||||||
return this->head.GetNormalOf( -Float3::standard_unit_z );
|
return this->head.GetNormalOf( -Float3::standard_unit_z );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
::Oyster::Math::Float3 GetForward() const;
|
::Oyster::Math::Float3 GetForward() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Camera_BasicV2 head;
|
mutable Camera_BasicV2 head;
|
||||||
::Oyster::Math::Float pitchUp;
|
::Oyster::Math::Float pitchUp;
|
||||||
::Oyster::Math::Float3 headOffset;
|
::Oyster::Math::Float3 headOffset;
|
||||||
struct
|
struct
|
||||||
|
@ -58,6 +58,7 @@ private:
|
||||||
::Oyster::Math::Float3 translation;
|
::Oyster::Math::Float3 translation;
|
||||||
::Oyster::Math::Quaternion rotation;
|
::Oyster::Math::Quaternion rotation;
|
||||||
} body;
|
} body;
|
||||||
|
mutable bool pitchHaveChanged;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -190,45 +190,45 @@ bool GameState::Render()
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
// RB DEBUG render wire frame
|
// RB DEBUG render wire frame
|
||||||
if(this->privData->renderWhireframe)
|
//if(this->privData->renderWhireframe)
|
||||||
{
|
//{
|
||||||
Oyster::Graphics::API::StartRenderWireFrame();
|
// Oyster::Graphics::API::StartRenderWireFrame();
|
||||||
|
//
|
||||||
Oyster::Math3D::Float4x4 translation = Oyster::Math3D::TranslationMatrix(Float3( 0,132, 20));
|
// Oyster::Math3D::Float4x4 translation = Oyster::Math3D::TranslationMatrix(Float3( 0,132, 20));
|
||||||
Oyster::Math3D::Float4x4 scale = Oyster::Math3D::ScalingMatrix(Float3( 0.5f, 0.5f, 0.5f));
|
// Oyster::Math3D::Float4x4 scale = Oyster::Math3D::ScalingMatrix(Float3( 0.5f, 0.5f, 0.5f));
|
||||||
Oyster::Math3D::Float4x4 world = translation * scale;
|
// Oyster::Math3D::Float4x4 world = translation * scale;
|
||||||
Oyster::Graphics::API::RenderDebugCube( world );
|
// Oyster::Graphics::API::RenderDebugCube( world );
|
||||||
Oyster::Graphics::API::RenderDebugCube(this->privData->player.getRBWorld());
|
// Oyster::Graphics::API::RenderDebugCube(this->privData->player.getRBWorld());
|
||||||
|
//
|
||||||
staticObject = this->privData->staticObjects->begin();
|
// staticObject = this->privData->staticObjects->begin();
|
||||||
for( ; staticObject != this->privData->staticObjects->end(); ++staticObject )
|
// for( ; staticObject != this->privData->staticObjects->end(); ++staticObject )
|
||||||
{
|
// {
|
||||||
if( staticObject->second->getBRtype() == RB_Type_Cube)
|
// if( staticObject->second->getBRtype() == RB_Type_Cube)
|
||||||
{
|
// {
|
||||||
Oyster::Graphics::API::RenderDebugCube( staticObject->second->getRBWorld());
|
// Oyster::Graphics::API::RenderDebugCube( staticObject->second->getRBWorld());
|
||||||
}
|
// }
|
||||||
if( staticObject->second->getBRtype() == RB_Type_Sphere)
|
// if( staticObject->second->getBRtype() == RB_Type_Sphere)
|
||||||
{
|
// {
|
||||||
Oyster::Graphics::API::RenderDebugSphere( staticObject->second->getRBWorld());
|
// Oyster::Graphics::API::RenderDebugSphere( staticObject->second->getRBWorld());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
dynamicObject = this->privData->dynamicObjects->begin();
|
// dynamicObject = this->privData->dynamicObjects->begin();
|
||||||
for( ; dynamicObject != this->privData->dynamicObjects->end(); ++dynamicObject )
|
// for( ; dynamicObject != this->privData->dynamicObjects->end(); ++dynamicObject )
|
||||||
{
|
// {
|
||||||
if( dynamicObject->second )
|
// if( dynamicObject->second )
|
||||||
{
|
// {
|
||||||
if( dynamicObject->second->getBRtype() == RB_Type_Cube)
|
// if( dynamicObject->second->getBRtype() == RB_Type_Cube)
|
||||||
{
|
// {
|
||||||
Oyster::Graphics::API::RenderDebugCube( dynamicObject->second->getRBWorld());
|
// Oyster::Graphics::API::RenderDebugCube( dynamicObject->second->getRBWorld());
|
||||||
}
|
// }
|
||||||
if( dynamicObject->second->getBRtype() == RB_Type_Sphere)
|
// if( dynamicObject->second->getBRtype() == RB_Type_Sphere)
|
||||||
{
|
// {
|
||||||
Oyster::Graphics::API::RenderDebugSphere( dynamicObject->second->getRBWorld());
|
// Oyster::Graphics::API::RenderDebugSphere( dynamicObject->second->getRBWorld());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
// !RB DEBUG
|
// !RB DEBUG
|
||||||
|
|
||||||
Oyster::Graphics::API::EndFrame();
|
Oyster::Graphics::API::EndFrame();
|
||||||
|
@ -480,10 +480,16 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
|
||||||
// if is this player. Remember to change camera
|
// if is this player. Remember to change camera
|
||||||
if( this->privData->myId == decoded.object_ID )
|
if( this->privData->myId == decoded.object_ID )
|
||||||
{
|
{
|
||||||
|
if( !Within(position.Dot(position), 2500.0f, 90000.0f) )
|
||||||
|
{ // HACK: bug trap
|
||||||
|
const char *breakPoint = "Something is wrong.";
|
||||||
|
//position = Float3( 0.0f, 160.0f, 0.0f );
|
||||||
|
}
|
||||||
|
|
||||||
this->privData->camera.SetPosition( position );
|
this->privData->camera.SetPosition( position );
|
||||||
this->privData->camera.SetRotation( rotation );
|
this->privData->camera.SetRotation( rotation );
|
||||||
this->privData->player.setPos( position );
|
this->privData->player.setPos( position );
|
||||||
//this->privData->player.setRot( rotation );
|
this->privData->player.setRot( rotation );
|
||||||
}
|
}
|
||||||
|
|
||||||
C_DynamicObj *object = (*this->privData->dynamicObjects)[decoded.object_ID];
|
C_DynamicObj *object = (*this->privData->dynamicObjects)[decoded.object_ID];
|
||||||
|
|
|
@ -126,9 +126,6 @@ void LanMenuState::ChangeState( ClientState next )
|
||||||
// attempt to connect to lobby
|
// attempt to connect to lobby
|
||||||
if( !this->privData->nwClient->Connect(this->privData->connectPort, (*this->privData->connectIP)[0]) )
|
if( !this->privData->nwClient->Connect(this->privData->connectPort, (*this->privData->connectIP)[0]) )
|
||||||
return;
|
return;
|
||||||
//this->privData->nwClient->Disconnect();
|
|
||||||
//if( !this->privData->nwClient->Reconnect() )
|
|
||||||
//return;
|
|
||||||
break;
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ using namespace GameLogic;
|
||||||
void Player::PlayerCollision(Oyster::Physics::ICustomBody *rigidBodyPlayer, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss)
|
void Player::PlayerCollision(Oyster::Physics::ICustomBody *rigidBodyPlayer, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss)
|
||||||
{
|
{
|
||||||
|
|
||||||
Player *player = ((Game::PlayerData*)(rigidBodyPlayer->GetCustomTag()))->player;
|
Player *player = ((Player*)(rigidBodyPlayer->GetCustomTag()));
|
||||||
Object *realObj = (Object*)obj->GetCustomTag(); //needs to be changed?
|
Object *realObj = (Object*)obj->GetCustomTag(); //needs to be changed?
|
||||||
|
|
||||||
switch (realObj->GetObjectType())
|
switch (realObj->GetObjectType())
|
||||||
|
|
|
@ -123,7 +123,6 @@ bool Game::NewFrame()
|
||||||
|
|
||||||
for (unsigned int i = 0; i < this->players.Size(); i++)
|
for (unsigned int i = 0; i < this->players.Size(); i++)
|
||||||
{
|
{
|
||||||
this->onMoveFnc(this->players[i]);
|
|
||||||
if(this->players[i] && this->players[i]->player) this->players[i]->player->EndFrame();
|
if(this->players[i] && this->players[i]->player) this->players[i]->player->EndFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,11 +37,13 @@
|
||||||
this.panel_serverOptions = new System.Windows.Forms.Panel();
|
this.panel_serverOptions = new System.Windows.Forms.Panel();
|
||||||
this.panel_commands = new System.Windows.Forms.Panel();
|
this.panel_commands = new System.Windows.Forms.Panel();
|
||||||
this.timeLimit = new System.Windows.Forms.NumericUpDown();
|
this.timeLimit = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.mapName = new System.Windows.Forms.ComboBox();
|
||||||
this.gameModes = new System.Windows.Forms.ComboBox();
|
this.gameModes = new System.Windows.Forms.ComboBox();
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
this.forceStart = new System.Windows.Forms.CheckBox();
|
this.forceStart = new System.Windows.Forms.CheckBox();
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
this.label4 = new System.Windows.Forms.Label();
|
this.label4 = new System.Windows.Forms.Label();
|
||||||
|
this.label5 = new System.Windows.Forms.Label();
|
||||||
this.labelClientsConnected = new System.Windows.Forms.Label();
|
this.labelClientsConnected = new System.Windows.Forms.Label();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
this.nrOfClients = new System.Windows.Forms.NumericUpDown();
|
this.nrOfClients = new System.Windows.Forms.NumericUpDown();
|
||||||
|
@ -51,22 +53,20 @@
|
||||||
this.splitter1 = new System.Windows.Forms.Splitter();
|
this.splitter1 = new System.Windows.Forms.Splitter();
|
||||||
this.clientInfoBox = new System.Windows.Forms.ListBox();
|
this.clientInfoBox = new System.Windows.Forms.ListBox();
|
||||||
this.panel_CommanArea = new System.Windows.Forms.Panel();
|
this.panel_CommanArea = new System.Windows.Forms.Panel();
|
||||||
this.label5 = new System.Windows.Forms.Label();
|
|
||||||
this.mapName = new System.Windows.Forms.ComboBox();
|
|
||||||
this.panelServerCommands = new System.Windows.Forms.Panel();
|
this.panelServerCommands = new System.Windows.Forms.Panel();
|
||||||
this.buttonExecuteSend = new System.Windows.Forms.Button();
|
this.dataProtocolFields = new System.Windows.Forms.TableLayoutPanel();
|
||||||
this.panel2 = new System.Windows.Forms.Panel();
|
this.panel2 = new System.Windows.Forms.Panel();
|
||||||
|
this.button2 = new System.Windows.Forms.Button();
|
||||||
|
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||||
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||||
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
|
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
|
||||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
|
||||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||||
this.label6 = new System.Windows.Forms.Label();
|
this.label6 = new System.Windows.Forms.Label();
|
||||||
this.label7 = new System.Windows.Forms.Label();
|
this.label7 = new System.Windows.Forms.Label();
|
||||||
this.label8 = new System.Windows.Forms.Label();
|
this.label8 = new System.Windows.Forms.Label();
|
||||||
this.dataProtocolFields = new System.Windows.Forms.TableLayoutPanel();
|
|
||||||
this.buttonAddNewDataField = new System.Windows.Forms.Button();
|
|
||||||
this.button2 = new System.Windows.Forms.Button();
|
|
||||||
this.buttonsAtBottom = new System.Windows.Forms.TableLayoutPanel();
|
this.buttonsAtBottom = new System.Windows.Forms.TableLayoutPanel();
|
||||||
|
this.buttonAddNewDataField = new System.Windows.Forms.Button();
|
||||||
|
this.buttonExecuteSend = new System.Windows.Forms.Button();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.listenPort)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.listenPort)).BeginInit();
|
||||||
this.panel_serverOptions.SuspendLayout();
|
this.panel_serverOptions.SuspendLayout();
|
||||||
this.panel_commands.SuspendLayout();
|
this.panel_commands.SuspendLayout();
|
||||||
|
@ -75,10 +75,10 @@
|
||||||
this.panel_clientArea.SuspendLayout();
|
this.panel_clientArea.SuspendLayout();
|
||||||
this.panel_CommanArea.SuspendLayout();
|
this.panel_CommanArea.SuspendLayout();
|
||||||
this.panelServerCommands.SuspendLayout();
|
this.panelServerCommands.SuspendLayout();
|
||||||
|
this.dataProtocolFields.SuspendLayout();
|
||||||
this.panel2.SuspendLayout();
|
this.panel2.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
|
||||||
this.tableLayoutPanel1.SuspendLayout();
|
this.tableLayoutPanel1.SuspendLayout();
|
||||||
this.dataProtocolFields.SuspendLayout();
|
|
||||||
this.buttonsAtBottom.SuspendLayout();
|
this.buttonsAtBottom.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
|
@ -204,6 +204,19 @@
|
||||||
0,
|
0,
|
||||||
0});
|
0});
|
||||||
//
|
//
|
||||||
|
// mapName
|
||||||
|
//
|
||||||
|
this.mapName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.mapName.FormattingEnabled = true;
|
||||||
|
this.mapName.IntegralHeight = false;
|
||||||
|
this.mapName.Items.AddRange(new object[] {
|
||||||
|
"Set directory"});
|
||||||
|
this.mapName.Location = new System.Drawing.Point(72, 7);
|
||||||
|
this.mapName.Name = "mapName";
|
||||||
|
this.mapName.Size = new System.Drawing.Size(163, 21);
|
||||||
|
this.mapName.TabIndex = 10;
|
||||||
|
this.mapName.SelectedIndexChanged += new System.EventHandler(this.mapName_SelectedIndexChanged);
|
||||||
|
//
|
||||||
// gameModes
|
// gameModes
|
||||||
//
|
//
|
||||||
this.gameModes.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
this.gameModes.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
@ -255,6 +268,15 @@
|
||||||
this.label4.TabIndex = 8;
|
this.label4.TabIndex = 8;
|
||||||
this.label4.Text = "Map name";
|
this.label4.Text = "Map name";
|
||||||
//
|
//
|
||||||
|
// label5
|
||||||
|
//
|
||||||
|
this.label5.AutoSize = true;
|
||||||
|
this.label5.Location = new System.Drawing.Point(23, 147);
|
||||||
|
this.label5.Name = "label5";
|
||||||
|
this.label5.Size = new System.Drawing.Size(81, 13);
|
||||||
|
this.label5.TabIndex = 8;
|
||||||
|
this.label5.Text = "Lobby clients: 0";
|
||||||
|
//
|
||||||
// labelClientsConnected
|
// labelClientsConnected
|
||||||
//
|
//
|
||||||
this.labelClientsConnected.AutoSize = true;
|
this.labelClientsConnected.AutoSize = true;
|
||||||
|
@ -360,27 +382,6 @@
|
||||||
this.panel_CommanArea.Size = new System.Drawing.Size(241, 616);
|
this.panel_CommanArea.Size = new System.Drawing.Size(241, 616);
|
||||||
this.panel_CommanArea.TabIndex = 9;
|
this.panel_CommanArea.TabIndex = 9;
|
||||||
//
|
//
|
||||||
// label5
|
|
||||||
//
|
|
||||||
this.label5.AutoSize = true;
|
|
||||||
this.label5.Location = new System.Drawing.Point(23, 147);
|
|
||||||
this.label5.Name = "label5";
|
|
||||||
this.label5.Size = new System.Drawing.Size(81, 13);
|
|
||||||
this.label5.TabIndex = 8;
|
|
||||||
this.label5.Text = "Lobby clients: 0";
|
|
||||||
//
|
|
||||||
// mapName
|
|
||||||
//
|
|
||||||
this.mapName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
|
||||||
this.mapName.FormattingEnabled = true;
|
|
||||||
this.mapName.IntegralHeight = false;
|
|
||||||
this.mapName.Items.AddRange(new object[] {
|
|
||||||
"Set default"});
|
|
||||||
this.mapName.Location = new System.Drawing.Point(72, 7);
|
|
||||||
this.mapName.Name = "mapName";
|
|
||||||
this.mapName.Size = new System.Drawing.Size(163, 21);
|
|
||||||
this.mapName.TabIndex = 10;
|
|
||||||
//
|
|
||||||
// panelServerCommands
|
// panelServerCommands
|
||||||
//
|
//
|
||||||
this.panelServerCommands.Controls.Add(this.dataProtocolFields);
|
this.panelServerCommands.Controls.Add(this.dataProtocolFields);
|
||||||
|
@ -391,17 +392,24 @@
|
||||||
this.panelServerCommands.TabIndex = 8;
|
this.panelServerCommands.TabIndex = 8;
|
||||||
this.panelServerCommands.Visible = false;
|
this.panelServerCommands.Visible = false;
|
||||||
//
|
//
|
||||||
// buttonExecuteSend
|
// dataProtocolFields
|
||||||
//
|
//
|
||||||
this.buttonExecuteSend.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.dataProtocolFields.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single;
|
||||||
this.buttonExecuteSend.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
this.dataProtocolFields.ColumnCount = 1;
|
||||||
this.buttonExecuteSend.Location = new System.Drawing.Point(116, 0);
|
this.dataProtocolFields.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 21F));
|
||||||
this.buttonExecuteSend.Margin = new System.Windows.Forms.Padding(0);
|
this.dataProtocolFields.Controls.Add(this.panel2, 0, 1);
|
||||||
this.buttonExecuteSend.Name = "buttonExecuteSend";
|
this.dataProtocolFields.Controls.Add(this.tableLayoutPanel1, 0, 0);
|
||||||
this.buttonExecuteSend.Size = new System.Drawing.Size(117, 21);
|
this.dataProtocolFields.Controls.Add(this.buttonsAtBottom, 0, 2);
|
||||||
this.buttonExecuteSend.TabIndex = 0;
|
this.dataProtocolFields.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.buttonExecuteSend.Text = "Send";
|
this.dataProtocolFields.Location = new System.Drawing.Point(0, 0);
|
||||||
this.buttonExecuteSend.UseVisualStyleBackColor = true;
|
this.dataProtocolFields.Margin = new System.Windows.Forms.Padding(0);
|
||||||
|
this.dataProtocolFields.Name = "dataProtocolFields";
|
||||||
|
this.dataProtocolFields.RowCount = 3;
|
||||||
|
this.dataProtocolFields.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 27F));
|
||||||
|
this.dataProtocolFields.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 27F));
|
||||||
|
this.dataProtocolFields.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||||
|
this.dataProtocolFields.Size = new System.Drawing.Size(241, 85);
|
||||||
|
this.dataProtocolFields.TabIndex = 9;
|
||||||
//
|
//
|
||||||
// panel2
|
// panel2
|
||||||
//
|
//
|
||||||
|
@ -415,6 +423,27 @@
|
||||||
this.panel2.Size = new System.Drawing.Size(233, 21);
|
this.panel2.Size = new System.Drawing.Size(233, 21);
|
||||||
this.panel2.TabIndex = 0;
|
this.panel2.TabIndex = 0;
|
||||||
//
|
//
|
||||||
|
// button2
|
||||||
|
//
|
||||||
|
this.button2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.button2.FlatAppearance.BorderColor = System.Drawing.Color.Black;
|
||||||
|
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||||
|
this.button2.Location = new System.Drawing.Point(184, 0);
|
||||||
|
this.button2.Margin = new System.Windows.Forms.Padding(0);
|
||||||
|
this.button2.Name = "button2";
|
||||||
|
this.button2.Size = new System.Drawing.Size(49, 21);
|
||||||
|
this.button2.TabIndex = 0;
|
||||||
|
this.button2.Text = "remove";
|
||||||
|
this.button2.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// textBox1
|
||||||
|
//
|
||||||
|
this.textBox1.Dock = System.Windows.Forms.DockStyle.Left;
|
||||||
|
this.textBox1.Location = new System.Drawing.Point(120, 0);
|
||||||
|
this.textBox1.Name = "textBox1";
|
||||||
|
this.textBox1.Size = new System.Drawing.Size(64, 20);
|
||||||
|
this.textBox1.TabIndex = 12;
|
||||||
|
//
|
||||||
// comboBox1
|
// comboBox1
|
||||||
//
|
//
|
||||||
this.comboBox1.Dock = System.Windows.Forms.DockStyle.Left;
|
this.comboBox1.Dock = System.Windows.Forms.DockStyle.Left;
|
||||||
|
@ -447,21 +476,13 @@
|
||||||
this.numericUpDown1.Size = new System.Drawing.Size(42, 20);
|
this.numericUpDown1.Size = new System.Drawing.Size(42, 20);
|
||||||
this.numericUpDown1.TabIndex = 11;
|
this.numericUpDown1.TabIndex = 11;
|
||||||
//
|
//
|
||||||
// textBox1
|
|
||||||
//
|
|
||||||
this.textBox1.Dock = System.Windows.Forms.DockStyle.Left;
|
|
||||||
this.textBox1.Location = new System.Drawing.Point(120, 0);
|
|
||||||
this.textBox1.Name = "textBox1";
|
|
||||||
this.textBox1.Size = new System.Drawing.Size(64, 20);
|
|
||||||
this.textBox1.TabIndex = 12;
|
|
||||||
//
|
|
||||||
// tableLayoutPanel1
|
// tableLayoutPanel1
|
||||||
//
|
//
|
||||||
this.tableLayoutPanel1.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single;
|
this.tableLayoutPanel1.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single;
|
||||||
this.tableLayoutPanel1.ColumnCount = 3;
|
this.tableLayoutPanel1.ColumnCount = 3;
|
||||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 35.29412F));
|
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 35.29412F));
|
||||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 64.70588F));
|
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 64.70588F));
|
||||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 110F));
|
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 112F));
|
||||||
this.tableLayoutPanel1.Controls.Add(this.label6, 0, 0);
|
this.tableLayoutPanel1.Controls.Add(this.label6, 0, 0);
|
||||||
this.tableLayoutPanel1.Controls.Add(this.label7, 1, 0);
|
this.tableLayoutPanel1.Controls.Add(this.label7, 1, 0);
|
||||||
this.tableLayoutPanel1.Controls.Add(this.label8, 2, 0);
|
this.tableLayoutPanel1.Controls.Add(this.label8, 2, 0);
|
||||||
|
@ -495,57 +516,12 @@
|
||||||
// label8
|
// label8
|
||||||
//
|
//
|
||||||
this.label8.AutoSize = true;
|
this.label8.AutoSize = true;
|
||||||
this.label8.Location = new System.Drawing.Point(123, 1);
|
this.label8.Location = new System.Drawing.Point(122, 1);
|
||||||
this.label8.Name = "label8";
|
this.label8.Name = "label8";
|
||||||
this.label8.Size = new System.Drawing.Size(34, 13);
|
this.label8.Size = new System.Drawing.Size(34, 13);
|
||||||
this.label8.TabIndex = 8;
|
this.label8.TabIndex = 8;
|
||||||
this.label8.Text = "Value";
|
this.label8.Text = "Value";
|
||||||
//
|
//
|
||||||
// dataProtocolFields
|
|
||||||
//
|
|
||||||
this.dataProtocolFields.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single;
|
|
||||||
this.dataProtocolFields.ColumnCount = 1;
|
|
||||||
this.dataProtocolFields.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 21F));
|
|
||||||
this.dataProtocolFields.Controls.Add(this.panel2, 0, 1);
|
|
||||||
this.dataProtocolFields.Controls.Add(this.tableLayoutPanel1, 0, 0);
|
|
||||||
this.dataProtocolFields.Controls.Add(this.buttonsAtBottom, 0, 2);
|
|
||||||
this.dataProtocolFields.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
||||||
this.dataProtocolFields.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.dataProtocolFields.Margin = new System.Windows.Forms.Padding(0);
|
|
||||||
this.dataProtocolFields.Name = "dataProtocolFields";
|
|
||||||
this.dataProtocolFields.RowCount = 3;
|
|
||||||
this.dataProtocolFields.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 27F));
|
|
||||||
this.dataProtocolFields.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 27F));
|
|
||||||
this.dataProtocolFields.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
|
||||||
this.dataProtocolFields.Size = new System.Drawing.Size(241, 85);
|
|
||||||
this.dataProtocolFields.TabIndex = 9;
|
|
||||||
//
|
|
||||||
// buttonAddNewDataField
|
|
||||||
//
|
|
||||||
this.buttonAddNewDataField.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
||||||
this.buttonAddNewDataField.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
|
||||||
this.buttonAddNewDataField.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.buttonAddNewDataField.Margin = new System.Windows.Forms.Padding(0);
|
|
||||||
this.buttonAddNewDataField.Name = "buttonAddNewDataField";
|
|
||||||
this.buttonAddNewDataField.Size = new System.Drawing.Size(116, 21);
|
|
||||||
this.buttonAddNewDataField.TabIndex = 1;
|
|
||||||
this.buttonAddNewDataField.Text = "Add field";
|
|
||||||
this.buttonAddNewDataField.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonAddNewDataField.Click += new System.EventHandler(this.buttonAddNewDataField_Click);
|
|
||||||
//
|
|
||||||
// button2
|
|
||||||
//
|
|
||||||
this.button2.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
||||||
this.button2.FlatAppearance.BorderColor = System.Drawing.Color.Black;
|
|
||||||
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
|
||||||
this.button2.Location = new System.Drawing.Point(184, 0);
|
|
||||||
this.button2.Margin = new System.Windows.Forms.Padding(0);
|
|
||||||
this.button2.Name = "button2";
|
|
||||||
this.button2.Size = new System.Drawing.Size(49, 21);
|
|
||||||
this.button2.TabIndex = 0;
|
|
||||||
this.button2.Text = "remove";
|
|
||||||
this.button2.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// buttonsAtBottom
|
// buttonsAtBottom
|
||||||
//
|
//
|
||||||
this.buttonsAtBottom.ColumnCount = 2;
|
this.buttonsAtBottom.ColumnCount = 2;
|
||||||
|
@ -561,6 +537,31 @@
|
||||||
this.buttonsAtBottom.Size = new System.Drawing.Size(233, 21);
|
this.buttonsAtBottom.Size = new System.Drawing.Size(233, 21);
|
||||||
this.buttonsAtBottom.TabIndex = 10;
|
this.buttonsAtBottom.TabIndex = 10;
|
||||||
//
|
//
|
||||||
|
// buttonAddNewDataField
|
||||||
|
//
|
||||||
|
this.buttonAddNewDataField.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.buttonAddNewDataField.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||||
|
this.buttonAddNewDataField.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.buttonAddNewDataField.Margin = new System.Windows.Forms.Padding(0);
|
||||||
|
this.buttonAddNewDataField.Name = "buttonAddNewDataField";
|
||||||
|
this.buttonAddNewDataField.Size = new System.Drawing.Size(116, 21);
|
||||||
|
this.buttonAddNewDataField.TabIndex = 1;
|
||||||
|
this.buttonAddNewDataField.Text = "Add field";
|
||||||
|
this.buttonAddNewDataField.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonAddNewDataField.Click += new System.EventHandler(this.buttonAddNewDataField_Click);
|
||||||
|
//
|
||||||
|
// buttonExecuteSend
|
||||||
|
//
|
||||||
|
this.buttonExecuteSend.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.buttonExecuteSend.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||||
|
this.buttonExecuteSend.Location = new System.Drawing.Point(116, 0);
|
||||||
|
this.buttonExecuteSend.Margin = new System.Windows.Forms.Padding(0);
|
||||||
|
this.buttonExecuteSend.Name = "buttonExecuteSend";
|
||||||
|
this.buttonExecuteSend.Size = new System.Drawing.Size(117, 21);
|
||||||
|
this.buttonExecuteSend.TabIndex = 0;
|
||||||
|
this.buttonExecuteSend.Text = "Send";
|
||||||
|
this.buttonExecuteSend.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// Form1
|
// Form1
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
@ -581,12 +582,12 @@
|
||||||
this.panel_clientArea.ResumeLayout(false);
|
this.panel_clientArea.ResumeLayout(false);
|
||||||
this.panel_CommanArea.ResumeLayout(false);
|
this.panel_CommanArea.ResumeLayout(false);
|
||||||
this.panelServerCommands.ResumeLayout(false);
|
this.panelServerCommands.ResumeLayout(false);
|
||||||
|
this.dataProtocolFields.ResumeLayout(false);
|
||||||
this.panel2.ResumeLayout(false);
|
this.panel2.ResumeLayout(false);
|
||||||
this.panel2.PerformLayout();
|
this.panel2.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
|
||||||
this.tableLayoutPanel1.ResumeLayout(false);
|
this.tableLayoutPanel1.ResumeLayout(false);
|
||||||
this.tableLayoutPanel1.PerformLayout();
|
this.tableLayoutPanel1.PerformLayout();
|
||||||
this.dataProtocolFields.ResumeLayout(false);
|
|
||||||
this.buttonsAtBottom.ResumeLayout(false);
|
this.buttonsAtBottom.ResumeLayout(false);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,16 @@ namespace StandAloneLauncher
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
string[] maps = Directory.GetFiles("..\\Content\\Worlds\\");
|
|
||||||
|
|
||||||
|
string[] maps = Directory.GetFiles("..\\Content\\Worlds\\");
|
||||||
for (int i = 0; i < maps.Length; i++)
|
for (int i = 0; i < maps.Length; i++)
|
||||||
{
|
{
|
||||||
string temp = maps[i].Split('\\').Last() ;
|
string temp = maps[i].Split('\\').Last();
|
||||||
this.mapName.Items.Add(temp);
|
string type = temp.Split('.').Last();
|
||||||
|
if (type == "bias")
|
||||||
|
{
|
||||||
|
this.mapName.Items.Add(temp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.gameModes.SelectedIndex = 0;
|
this.gameModes.SelectedIndex = 0;
|
||||||
|
@ -58,6 +62,19 @@ namespace StandAloneLauncher
|
||||||
{
|
{
|
||||||
if (this.serverIsRunning)
|
if (this.serverIsRunning)
|
||||||
{
|
{
|
||||||
|
if (gameIsStarted)
|
||||||
|
{
|
||||||
|
//this.gameServer.GameStop();
|
||||||
|
|
||||||
|
this.gameIsStarted = false;
|
||||||
|
this.buttonStartGame.Text = "Start Game";
|
||||||
|
this.mapName.Enabled = true;
|
||||||
|
this.nrOfClients.Enabled = true;
|
||||||
|
this.gameModes.Enabled = true;
|
||||||
|
this.timeLimit.Enabled = true;
|
||||||
|
this.forceStart.Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
this.serverIsRunning = false;
|
this.serverIsRunning = false;
|
||||||
this.gameServer.ServerStop();
|
this.gameServer.ServerStop();
|
||||||
this.listenPort.Enabled = true;
|
this.listenPort.Enabled = true;
|
||||||
|
@ -66,7 +83,7 @@ namespace StandAloneLauncher
|
||||||
this.serverToggle.Text = "Start server";
|
this.serverToggle.Text = "Start server";
|
||||||
this.ServerInfoTextArea.AppendText(DateTime.Now.ToUniversalTime() + "\n\t" + "Server terminated!\n");
|
this.ServerInfoTextArea.AppendText(DateTime.Now.ToUniversalTime() + "\n\t" + "Server terminated!\n");
|
||||||
this.panel_commands.Visible = false;
|
this.panel_commands.Visible = false;
|
||||||
this.panelServerCommands.Visible = false;
|
//this.panelServerCommands.Visible = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -89,11 +106,11 @@ namespace StandAloneLauncher
|
||||||
this.gameServer.ServerStart();
|
this.gameServer.ServerStart();
|
||||||
this.panel_commands.Visible = true;
|
this.panel_commands.Visible = true;
|
||||||
this.ServerInfoTextArea.AppendText(DateTime.Now.ToUniversalTime() + "\n\t" + "Server initiated!\n\tListening on port " + this.listenPort.Value.ToString() + "\n\tLocal IP: " + info.serverIp + "\n");
|
this.ServerInfoTextArea.AppendText(DateTime.Now.ToUniversalTime() + "\n\t" + "Server initiated!\n\tListening on port " + this.listenPort.Value.ToString() + "\n\tLocal IP: " + info.serverIp + "\n");
|
||||||
this.panelServerCommands.Visible = true;
|
//this.panelServerCommands.Visible = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.ServerInfoTextArea.AppendText(DateTime.Now.ToUniversalTime() + "\n\t" + "Failed to initiate the server!");
|
this.ServerInfoTextArea.AppendText(DateTime.Now.ToUniversalTime() + "\n\t" + "Failed to initiate the server!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,6 +121,9 @@ namespace StandAloneLauncher
|
||||||
{
|
{
|
||||||
//this.gameServer.GameSetGameMode(this.gameModes.SelectedText);
|
//this.gameServer.GameSetGameMode(this.gameModes.SelectedText);
|
||||||
this.gameServer.GameSetGameTime((int)this.timeLimit.Value);
|
this.gameServer.GameSetGameTime((int)this.timeLimit.Value);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.gameServer.GameSetMapName(this.mapName.Text);
|
this.gameServer.GameSetMapName(this.mapName.Text);
|
||||||
this.gameServer.GameSetMaxClients((int)this.nrOfClients.Value);
|
this.gameServer.GameSetMaxClients((int)this.nrOfClients.Value);
|
||||||
|
|
||||||
|
@ -125,6 +145,8 @@ namespace StandAloneLauncher
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//this.gameServer.GameStop();
|
||||||
|
|
||||||
this.gameIsStarted = false;
|
this.gameIsStarted = false;
|
||||||
this.buttonStartGame.Text = "Start Game";
|
this.buttonStartGame.Text = "Start Game";
|
||||||
this.mapName.Enabled = true;
|
this.mapName.Enabled = true;
|
||||||
|
@ -154,5 +176,29 @@ namespace StandAloneLauncher
|
||||||
this.dataProtocolFields.RowStyles.Add(new RowStyle(SizeType.Absolute, 27));
|
this.dataProtocolFields.RowStyles.Add(new RowStyle(SizeType.Absolute, 27));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void mapName_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if ( this.panel_commands.Visible && (this.mapName.SelectedItem.ToString() == "Set directory"))
|
||||||
|
{
|
||||||
|
FolderBrowserDialog f = new FolderBrowserDialog();
|
||||||
|
DialogResult r = f.ShowDialog();
|
||||||
|
if (r == System.Windows.Forms.DialogResult.OK)
|
||||||
|
{
|
||||||
|
this.mapName.Items.Clear();
|
||||||
|
this.mapName.Items.Add("Set directory");
|
||||||
|
string[] maps = Directory.GetFiles(f.SelectedPath);
|
||||||
|
for (int i = 0; i < maps.Length; i++)
|
||||||
|
{
|
||||||
|
string temp = maps[i].Split('\\').Last();
|
||||||
|
string type = temp.Split('.').Last();
|
||||||
|
if (type == "bias")
|
||||||
|
{
|
||||||
|
this.mapName.Items.Add(temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,8 +157,6 @@ std::vector<SmartPointer<ObjectTypeHeader>> LevelParser::Parse(std::string filen
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//this is a hotfix, fix so you only load the relevant data when the file is updated
|
//this is a hotfix, fix so you only load the relevant data when the file is updated
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
//Couldn't find specialType
|
//Couldn't find specialType
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -49,7 +49,16 @@ namespace LinearAlgebra
|
||||||
Quaternion<ScalarType> operator - ( const Quaternion<ScalarType> &quaternion ) const;
|
Quaternion<ScalarType> operator - ( const Quaternion<ScalarType> &quaternion ) const;
|
||||||
Quaternion<ScalarType> operator - ( ) const;
|
Quaternion<ScalarType> operator - ( ) const;
|
||||||
|
|
||||||
|
Quaternion<ScalarType> & Conjugate( );
|
||||||
|
Quaternion<ScalarType> & Normalize( );
|
||||||
|
Quaternion<ScalarType> & Inverse( );
|
||||||
|
|
||||||
Quaternion<ScalarType> GetConjugate( ) const;
|
Quaternion<ScalarType> GetConjugate( ) const;
|
||||||
|
Quaternion<ScalarType> GetNormalized( ) const;
|
||||||
|
Quaternion<ScalarType> GetInversed( ) const;
|
||||||
|
ScalarType GetNorm( ) const;
|
||||||
|
ScalarType GetModulus( ) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -205,11 +214,54 @@ namespace LinearAlgebra
|
||||||
return Quaternion<ScalarType>(-this->imaginary, -this->real);
|
return Quaternion<ScalarType>(-this->imaginary, -this->real);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename ScalarType>
|
||||||
|
inline Quaternion<ScalarType> & Quaternion<ScalarType>::Conjugate( )
|
||||||
|
{
|
||||||
|
this->imaginary = -this->imaginary;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename ScalarType>
|
||||||
|
inline Quaternion<ScalarType> & Quaternion<ScalarType>::Normalize( )
|
||||||
|
{
|
||||||
|
return *this /= this->GetModulus();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename ScalarType>
|
||||||
|
inline Quaternion<ScalarType> & Quaternion<ScalarType>::Inverse( )
|
||||||
|
{
|
||||||
|
return this->Conjugate() /= this->GetNorm();
|
||||||
|
}
|
||||||
|
|
||||||
template<typename ScalarType>
|
template<typename ScalarType>
|
||||||
inline Quaternion<ScalarType> Quaternion<ScalarType>::GetConjugate( ) const
|
inline Quaternion<ScalarType> Quaternion<ScalarType>::GetConjugate( ) const
|
||||||
{
|
{
|
||||||
return Quaternion<ScalarType>(-this->imaginary, this->real );
|
return Quaternion<ScalarType>(-this->imaginary, this->real );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename ScalarType>
|
||||||
|
inline Quaternion<ScalarType> Quaternion<ScalarType>::GetNormalized( ) const
|
||||||
|
{
|
||||||
|
return *this / this->GetModulus();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename ScalarType>
|
||||||
|
inline Quaternion<ScalarType> Quaternion<ScalarType>::GetInversed( ) const
|
||||||
|
{
|
||||||
|
return this->GetConjugate() /= this->GetNorm();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename ScalarType>
|
||||||
|
inline ScalarType Quaternion<ScalarType>::GetNorm( ) const
|
||||||
|
{
|
||||||
|
return this->imaginary.Dot(this->imaginary) + this->real * this->real;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename ScalarType>
|
||||||
|
inline ScalarType Quaternion<ScalarType>::GetModulus( ) const
|
||||||
|
{
|
||||||
|
return (ScalarType)::std::sqrt( this->GetNorm() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -337,7 +337,11 @@ namespace Utility
|
||||||
|
|
||||||
template<typename ValueType>
|
template<typename ValueType>
|
||||||
inline ValueType Clamp( const ValueType &value, const ValueType &min, const ValueType &max )
|
inline ValueType Clamp( const ValueType &value, const ValueType &min, const ValueType &max )
|
||||||
{ return value < min ? Max( value, max ) : min; }
|
{
|
||||||
|
if( value < min ) return min;
|
||||||
|
if( value > max ) return max;
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
template<typename ValueType>
|
template<typename ValueType>
|
||||||
inline ValueType Average( const ValueType &valueA, const ValueType &valueB )
|
inline ValueType Average( const ValueType &valueA, const ValueType &valueB )
|
||||||
|
|
|
@ -290,9 +290,12 @@ bool NetworkClient::Connect(ConnectionInfo& socket)
|
||||||
|
|
||||||
bool NetworkClient::Connect(unsigned short port, const char serverIP[])
|
bool NetworkClient::Connect(unsigned short port, const char serverIP[])
|
||||||
{
|
{
|
||||||
if(this->IsConnected()) return false;
|
//Return true if you are already connected.
|
||||||
if(this->privateData) return false;
|
if(this->IsConnected())
|
||||||
if(!this->privateData) this->privateData = new PrivateData();
|
return true;
|
||||||
|
|
||||||
|
if(!this->privateData)
|
||||||
|
this->privateData = new PrivateData();
|
||||||
|
|
||||||
int result = this->privateData->connection.Connect(port, serverIP, false);
|
int result = this->privateData->connection.Connect(port, serverIP, false);
|
||||||
|
|
||||||
|
@ -319,10 +322,10 @@ bool NetworkClient::Connect(unsigned short port, std::wstring serverIP)
|
||||||
|
|
||||||
bool NetworkClient::Reconnect()
|
bool NetworkClient::Reconnect()
|
||||||
{
|
{
|
||||||
|
//Return true if you are already connected.
|
||||||
if(this->IsConnected())
|
if(this->IsConnected())
|
||||||
return false;
|
return true;
|
||||||
//if(this->privateData)
|
|
||||||
//return false;
|
|
||||||
if(!this->privateData) this->privateData = new PrivateData();
|
if(!this->privateData) this->privateData = new PrivateData();
|
||||||
|
|
||||||
int result = this->privateData->connection.Reconnect();
|
int result = this->privateData->connection.Reconnect();
|
||||||
|
@ -342,11 +345,10 @@ void NetworkClient::Disconnect()
|
||||||
{
|
{
|
||||||
if(!privateData) return;
|
if(!privateData) return;
|
||||||
|
|
||||||
privateData->thread.Terminate();
|
privateData->thread.Stop();
|
||||||
privateData->connection.Disconnect();
|
privateData->connection.Disconnect();
|
||||||
this->privateData->sendQueue.Clear();
|
this->privateData->sendQueue.Clear();
|
||||||
this->privateData->recieveQueue.Clear();
|
this->privateData->recieveQueue.Clear();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkClient::Send(CustomProtocolObject& protocol)
|
void NetworkClient::Send(CustomProtocolObject& protocol)
|
||||||
|
|
|
@ -91,14 +91,14 @@ int Connection::Reconnect()
|
||||||
if(this->socket == -1 || this->socket == 0) InitiateSocket();
|
if(this->socket == -1 || this->socket == 0) InitiateSocket();
|
||||||
|
|
||||||
struct hostent *hostEnt;
|
struct hostent *hostEnt;
|
||||||
if((hostEnt = gethostbyname(lastConnectAddr.c_str())) == NULL)
|
if((hostEnt = gethostbyname(this->lastConnectAddr.c_str())) == NULL)
|
||||||
{
|
{
|
||||||
return WSAGetLastError();
|
return WSAGetLastError();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sockaddr_in server;
|
struct sockaddr_in server;
|
||||||
server.sin_family = AF_INET;
|
server.sin_family = AF_INET;
|
||||||
server.sin_port = htons(lastConnectPort);
|
server.sin_port = htons(this->lastConnectPort);
|
||||||
server.sin_addr.s_addr = *(unsigned long*) hostEnt->h_addr;
|
server.sin_addr.s_addr = *(unsigned long*) hostEnt->h_addr;
|
||||||
|
|
||||||
SetBlockingMode(true);
|
SetBlockingMode(true);
|
||||||
|
|
Loading…
Reference in New Issue