Skip to content

Commit

Permalink
xrEProps: port GameTypeForm
Browse files Browse the repository at this point in the history
Some improvements for NumericVector and ShaderFunction
  • Loading branch information
Xottab-DUTY committed Feb 26, 2018
1 parent f23abf1 commit 4f1bdda
Show file tree
Hide file tree
Showing 11 changed files with 361 additions and 15 deletions.
36 changes: 36 additions & 0 deletions src/editors/xrECore/Props/GameType.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "pch.hpp"
#include "GameType.h"
#include "xrServerEntities/gametype_chooser.h"

namespace XRay
{
namespace ECore
{
namespace Props
{
bool GameType::Run(pcstr title, GameTypeChooser* data)
{
gameTypes = data;

checkSingle->Checked = gameTypes->MatchType(eGameIDSingle);
checkDM->Checked = gameTypes->MatchType(eGameIDDeathmatch);
checkTDM->Checked = gameTypes->MatchType(eGameIDTeamDeathmatch);
checkAfHunt->Checked = gameTypes->MatchType(eGameIDArtefactHunt);
checkCTA->Checked = gameTypes->MatchType(eGameIDCaptureTheArtefact);

return ShowDialog() == Windows::Forms::DialogResult::OK;
}

System::Void GameType::buttonOk_Click(System::Object^ sender, System::EventArgs^ e)
{
gameTypes->m_GameType.zero();
gameTypes->m_GameType.set(eGameIDSingle, checkSingle->Checked);
gameTypes->m_GameType.set(eGameIDDeathmatch, checkDM->Checked);
gameTypes->m_GameType.set(eGameIDTeamDeathmatch, checkTDM->Checked);
gameTypes->m_GameType.set(eGameIDArtefactHunt, checkAfHunt->Checked);
gameTypes->m_GameType.set(eGameIDCaptureTheArtefact, checkCTA->Checked);
}

} // namespace Props
} // namespace ECore
} // namespace XRay
159 changes: 159 additions & 0 deletions src/editors/xrECore/Props/GameType.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
#pragma once

namespace XRay
{
namespace ECore
{
namespace Props
{
ref class GameType;
}
}
}

struct GameTypeChooser;

namespace XRay
{
namespace ECore
{
namespace Props
{
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

public ref class GameType : public System::Windows::Forms::Form
{
public:
GameType(void)
{
InitializeComponent();
}

protected:
~GameType()
{
if (components)
{
delete components;
}
}

public:
bool Run(pcstr title, GameTypeChooser* data);

private:
GameTypeChooser* gameTypes;

private: System::Void buttonOk_Click(System::Object^ sender, System::EventArgs^ e);

private: System::Windows::Forms::CheckBox^ checkSingle;
private: System::Windows::Forms::CheckBox^ checkDM;
private: System::Windows::Forms::CheckBox^ checkTDM;
private: System::Windows::Forms::CheckBox^ checkAfHunt;
private: System::Windows::Forms::CheckBox^ checkCTA;

private: System::Windows::Forms::Button^ buttonOk;
private: System::Windows::Forms::Button^ buttonCancel;

private: System::Windows::Forms::Panel^ panel1;
private:
System::ComponentModel::Container^ components;

#pragma region Windows Form Designer generated code
void InitializeComponent(void)
{
this->checkSingle = (gcnew System::Windows::Forms::CheckBox());
this->checkDM = (gcnew System::Windows::Forms::CheckBox());
this->checkTDM = (gcnew System::Windows::Forms::CheckBox());
this->checkAfHunt = (gcnew System::Windows::Forms::CheckBox());
this->checkCTA = (gcnew System::Windows::Forms::CheckBox());
this->buttonOk = (gcnew System::Windows::Forms::Button());
this->buttonCancel = (gcnew System::Windows::Forms::Button());
this->panel1 = (gcnew System::Windows::Forms::Panel());
this->panel1->SuspendLayout();
this->SuspendLayout();
this->checkSingle->AutoSize = true;
this->checkSingle->Location = System::Drawing::Point(3, 3);
this->checkSingle->Name = L"checkSingle";
this->checkSingle->Size = System::Drawing::Size(55, 17);
this->checkSingle->TabIndex = 0;
this->checkSingle->Text = L"Single";
this->checkSingle->UseVisualStyleBackColor = true;
this->checkDM->AutoSize = true;
this->checkDM->Location = System::Drawing::Point(3, 26);
this->checkDM->Name = L"checkDM";
this->checkDM->Size = System::Drawing::Size(78, 17);
this->checkDM->TabIndex = 1;
this->checkDM->Text = L"Deathmatch";
this->checkDM->UseVisualStyleBackColor = true;
this->checkTDM->AutoSize = true;
this->checkTDM->Location = System::Drawing::Point(3, 49);
this->checkTDM->Name = L"checkTDM";
this->checkTDM->Size = System::Drawing::Size(108, 17);
this->checkTDM->TabIndex = 2;
this->checkTDM->Text = L"Team Deathmatch";
this->checkTDM->UseVisualStyleBackColor = true;
this->checkAfHunt->AutoSize = true;
this->checkAfHunt->Location = System::Drawing::Point(3, 72);
this->checkAfHunt->Name = L"checkAfHunt";
this->checkAfHunt->Size = System::Drawing::Size(89, 17);
this->checkAfHunt->TabIndex = 3;
this->checkAfHunt->Text = L"Artefact Hunt";
this->checkAfHunt->UseVisualStyleBackColor = true;
this->checkCTA->AutoSize = true;
this->checkCTA->Location = System::Drawing::Point(3, 95);
this->checkCTA->Name = L"checkCTA";
this->checkCTA->Size = System::Drawing::Size(121, 17);
this->checkCTA->TabIndex = 4;
this->checkCTA->Text = L"Capture the Artefact";
this->checkCTA->UseVisualStyleBackColor = true;
this->buttonOk->DialogResult = System::Windows::Forms::DialogResult::OK;
this->buttonOk->Location = System::Drawing::Point(0, 115);
this->buttonOk->Name = L"buttonOk";
this->buttonOk->Size = System::Drawing::Size(64, 23);
this->buttonOk->TabIndex = 5;
this->buttonOk->Text = L"Ok";
this->buttonOk->UseVisualStyleBackColor = true;
this->buttonOk->Click += gcnew System::EventHandler(this, &GameType::buttonOk_Click);
this->buttonCancel->DialogResult = System::Windows::Forms::DialogResult::Cancel;
this->buttonCancel->Location = System::Drawing::Point(63, 115);
this->buttonCancel->Name = L"buttonCancel";
this->buttonCancel->Size = System::Drawing::Size(64, 23);
this->buttonCancel->TabIndex = 6;
this->buttonCancel->Text = L"Cancel";
this->buttonCancel->UseVisualStyleBackColor = true;
this->panel1->Controls->Add(this->checkSingle);
this->panel1->Controls->Add(this->checkDM);
this->panel1->Controls->Add(this->checkTDM);
this->panel1->Controls->Add(this->checkCTA);
this->panel1->Controls->Add(this->checkAfHunt);
this->panel1->Location = System::Drawing::Point(0, 0);
this->panel1->Name = L"panel1";
this->panel1->Size = System::Drawing::Size(127, 115);
this->panel1->TabIndex = 7;
this->AcceptButton = this->buttonOk;
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->CancelButton = this->buttonCancel;
this->ClientSize = System::Drawing::Size(127, 138);
this->Controls->Add(this->panel1);
this->Controls->Add(this->buttonOk);
this->Controls->Add(this->buttonCancel);
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedToolWindow;
this->Name = L"GameType";
this->Text = L"GameType";
this->panel1->ResumeLayout(false);
this->panel1->PerformLayout();
this->ResumeLayout(false);

}
#pragma endregion
};
} // namespace Props
} // namespace ECore
} // namespace XRay
120 changes: 120 additions & 0 deletions src/editors/xrECore/Props/GameType.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
13 changes: 3 additions & 10 deletions src/editors/xrECore/Props/NumericVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,9 @@ System::Void NumericVector::buttonApply_Click(System::Object^ sender, System::Ev
Value->set((float)numX->Value, (float)numY->Value, (float)numZ->Value);
}


System::Void NumericVector::buttonOk_Click(System::Object^ sender, System::EventArgs^ e)
{
buttonApply_Click(sender, e);
this->Close();
}

System::Void NumericVector::buttonCancel_Click(System::Object^ sender, System::EventArgs^ e)
{
this->Close();
}

System::Void NumericVector::buttonReset_Click(System::Object^ sender, System::EventArgs^ e)
Expand All @@ -110,13 +103,13 @@ System::Void NumericVector::NumericVector_KeyPress(System::Object^ sender, Syste
switch (e->KeyChar)
{
case (Char)Keys::Space:
buttonApply_Click(sender, e);
buttonApply->PerformClick();
break;
case (Char)Keys::Enter:
buttonOk_Click(sender, e);
buttonOk->PerformClick();
break;
case (Char)Keys::Escape:
buttonCancel_Click(sender, e);
buttonCancel->PerformClick();
break;
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/editors/xrECore/Props/NumericVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public ref class NumericVector : public System::Windows::Forms::Form

private: System::Void buttonApply_Click(System::Object^ sender, System::EventArgs^ e);
private: System::Void buttonOk_Click(System::Object^ sender, System::EventArgs^ e);
private: System::Void buttonCancel_Click(System::Object^ sender, System::EventArgs^ e);
private: System::Void buttonReset_Click(System::Object^ sender, System::EventArgs^ e);
private: System::Void buttonImmediate_Click(System::Object^ sender, System::EventArgs^ e);
private: System::Void NumericVector_KeyPress(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e);
Expand Down Expand Up @@ -91,20 +90,21 @@ private: System::Windows::Forms::Label^ labelZ;
this->buttonImmediate = (gcnew System::Windows::Forms::Button());
this->checkImmediate = (gcnew System::Windows::Forms::CheckBox());
this->SuspendLayout();
this->buttonOk->DialogResult = System::Windows::Forms::DialogResult::OK;
this->buttonOk->Location = System::Drawing::Point(136, 21);
this->buttonOk->Name = L"buttonOk";
this->buttonOk->Size = System::Drawing::Size(50, 22);
this->buttonOk->TabIndex = 0;
this->buttonOk->Text = L"Ok";
this->buttonOk->UseVisualStyleBackColor = true;
this->buttonOk->Click += gcnew System::EventHandler(this, &NumericVector::buttonOk_Click);
this->buttonCancel->DialogResult = System::Windows::Forms::DialogResult::Cancel;
this->buttonCancel->Location = System::Drawing::Point(136, 42);
this->buttonCancel->Name = L"buttonCancel";
this->buttonCancel->Size = System::Drawing::Size(50, 22);
this->buttonCancel->TabIndex = 1;
this->buttonCancel->Text = L"Cancel";
this->buttonCancel->UseVisualStyleBackColor = true;
this->buttonCancel->Click += gcnew System::EventHandler(this, &NumericVector::buttonCancel_Click);
this->buttonReset->Location = System::Drawing::Point(136, 63);
this->buttonReset->Name = L"buttonReset";
this->buttonReset->Size = System::Drawing::Size(50, 22);
Expand Down Expand Up @@ -184,8 +184,10 @@ private: System::Windows::Forms::Label^ labelZ;
this->checkImmediate->Size = System::Drawing::Size(15, 14);
this->checkImmediate->TabIndex = 11;
this->checkImmediate->UseVisualStyleBackColor = true;
this->AcceptButton = this->buttonOk;
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->CancelButton = this->buttonCancel;
this->ClientSize = System::Drawing::Size(186, 85);
this->Controls->Add(this->checkImmediate);
this->Controls->Add(this->buttonImmediate);
Expand Down
Loading

0 comments on commit 4f1bdda

Please sign in to comment.