Skip to content

Commit 4f1bdda

Browse files
committed
xrEProps: port GameTypeForm
Some improvements for NumericVector and ShaderFunction
1 parent f23abf1 commit 4f1bdda

File tree

11 files changed

+361
-15
lines changed

11 files changed

+361
-15
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#include "pch.hpp"
2+
#include "GameType.h"
3+
#include "xrServerEntities/gametype_chooser.h"
4+
5+
namespace XRay
6+
{
7+
namespace ECore
8+
{
9+
namespace Props
10+
{
11+
bool GameType::Run(pcstr title, GameTypeChooser* data)
12+
{
13+
gameTypes = data;
14+
15+
checkSingle->Checked = gameTypes->MatchType(eGameIDSingle);
16+
checkDM->Checked = gameTypes->MatchType(eGameIDDeathmatch);
17+
checkTDM->Checked = gameTypes->MatchType(eGameIDTeamDeathmatch);
18+
checkAfHunt->Checked = gameTypes->MatchType(eGameIDArtefactHunt);
19+
checkCTA->Checked = gameTypes->MatchType(eGameIDCaptureTheArtefact);
20+
21+
return ShowDialog() == Windows::Forms::DialogResult::OK;
22+
}
23+
24+
System::Void GameType::buttonOk_Click(System::Object^ sender, System::EventArgs^ e)
25+
{
26+
gameTypes->m_GameType.zero();
27+
gameTypes->m_GameType.set(eGameIDSingle, checkSingle->Checked);
28+
gameTypes->m_GameType.set(eGameIDDeathmatch, checkDM->Checked);
29+
gameTypes->m_GameType.set(eGameIDTeamDeathmatch, checkTDM->Checked);
30+
gameTypes->m_GameType.set(eGameIDArtefactHunt, checkAfHunt->Checked);
31+
gameTypes->m_GameType.set(eGameIDCaptureTheArtefact, checkCTA->Checked);
32+
}
33+
34+
} // namespace Props
35+
} // namespace ECore
36+
} // namespace XRay
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
#pragma once
2+
3+
namespace XRay
4+
{
5+
namespace ECore
6+
{
7+
namespace Props
8+
{
9+
ref class GameType;
10+
}
11+
}
12+
}
13+
14+
struct GameTypeChooser;
15+
16+
namespace XRay
17+
{
18+
namespace ECore
19+
{
20+
namespace Props
21+
{
22+
using namespace System;
23+
using namespace System::ComponentModel;
24+
using namespace System::Collections;
25+
using namespace System::Windows::Forms;
26+
using namespace System::Data;
27+
using namespace System::Drawing;
28+
29+
public ref class GameType : public System::Windows::Forms::Form
30+
{
31+
public:
32+
GameType(void)
33+
{
34+
InitializeComponent();
35+
}
36+
37+
protected:
38+
~GameType()
39+
{
40+
if (components)
41+
{
42+
delete components;
43+
}
44+
}
45+
46+
public:
47+
bool Run(pcstr title, GameTypeChooser* data);
48+
49+
private:
50+
GameTypeChooser* gameTypes;
51+
52+
private: System::Void buttonOk_Click(System::Object^ sender, System::EventArgs^ e);
53+
54+
private: System::Windows::Forms::CheckBox^ checkSingle;
55+
private: System::Windows::Forms::CheckBox^ checkDM;
56+
private: System::Windows::Forms::CheckBox^ checkTDM;
57+
private: System::Windows::Forms::CheckBox^ checkAfHunt;
58+
private: System::Windows::Forms::CheckBox^ checkCTA;
59+
60+
private: System::Windows::Forms::Button^ buttonOk;
61+
private: System::Windows::Forms::Button^ buttonCancel;
62+
63+
private: System::Windows::Forms::Panel^ panel1;
64+
private:
65+
System::ComponentModel::Container^ components;
66+
67+
#pragma region Windows Form Designer generated code
68+
void InitializeComponent(void)
69+
{
70+
this->checkSingle = (gcnew System::Windows::Forms::CheckBox());
71+
this->checkDM = (gcnew System::Windows::Forms::CheckBox());
72+
this->checkTDM = (gcnew System::Windows::Forms::CheckBox());
73+
this->checkAfHunt = (gcnew System::Windows::Forms::CheckBox());
74+
this->checkCTA = (gcnew System::Windows::Forms::CheckBox());
75+
this->buttonOk = (gcnew System::Windows::Forms::Button());
76+
this->buttonCancel = (gcnew System::Windows::Forms::Button());
77+
this->panel1 = (gcnew System::Windows::Forms::Panel());
78+
this->panel1->SuspendLayout();
79+
this->SuspendLayout();
80+
this->checkSingle->AutoSize = true;
81+
this->checkSingle->Location = System::Drawing::Point(3, 3);
82+
this->checkSingle->Name = L"checkSingle";
83+
this->checkSingle->Size = System::Drawing::Size(55, 17);
84+
this->checkSingle->TabIndex = 0;
85+
this->checkSingle->Text = L"Single";
86+
this->checkSingle->UseVisualStyleBackColor = true;
87+
this->checkDM->AutoSize = true;
88+
this->checkDM->Location = System::Drawing::Point(3, 26);
89+
this->checkDM->Name = L"checkDM";
90+
this->checkDM->Size = System::Drawing::Size(78, 17);
91+
this->checkDM->TabIndex = 1;
92+
this->checkDM->Text = L"Deathmatch";
93+
this->checkDM->UseVisualStyleBackColor = true;
94+
this->checkTDM->AutoSize = true;
95+
this->checkTDM->Location = System::Drawing::Point(3, 49);
96+
this->checkTDM->Name = L"checkTDM";
97+
this->checkTDM->Size = System::Drawing::Size(108, 17);
98+
this->checkTDM->TabIndex = 2;
99+
this->checkTDM->Text = L"Team Deathmatch";
100+
this->checkTDM->UseVisualStyleBackColor = true;
101+
this->checkAfHunt->AutoSize = true;
102+
this->checkAfHunt->Location = System::Drawing::Point(3, 72);
103+
this->checkAfHunt->Name = L"checkAfHunt";
104+
this->checkAfHunt->Size = System::Drawing::Size(89, 17);
105+
this->checkAfHunt->TabIndex = 3;
106+
this->checkAfHunt->Text = L"Artefact Hunt";
107+
this->checkAfHunt->UseVisualStyleBackColor = true;
108+
this->checkCTA->AutoSize = true;
109+
this->checkCTA->Location = System::Drawing::Point(3, 95);
110+
this->checkCTA->Name = L"checkCTA";
111+
this->checkCTA->Size = System::Drawing::Size(121, 17);
112+
this->checkCTA->TabIndex = 4;
113+
this->checkCTA->Text = L"Capture the Artefact";
114+
this->checkCTA->UseVisualStyleBackColor = true;
115+
this->buttonOk->DialogResult = System::Windows::Forms::DialogResult::OK;
116+
this->buttonOk->Location = System::Drawing::Point(0, 115);
117+
this->buttonOk->Name = L"buttonOk";
118+
this->buttonOk->Size = System::Drawing::Size(64, 23);
119+
this->buttonOk->TabIndex = 5;
120+
this->buttonOk->Text = L"Ok";
121+
this->buttonOk->UseVisualStyleBackColor = true;
122+
this->buttonOk->Click += gcnew System::EventHandler(this, &GameType::buttonOk_Click);
123+
this->buttonCancel->DialogResult = System::Windows::Forms::DialogResult::Cancel;
124+
this->buttonCancel->Location = System::Drawing::Point(63, 115);
125+
this->buttonCancel->Name = L"buttonCancel";
126+
this->buttonCancel->Size = System::Drawing::Size(64, 23);
127+
this->buttonCancel->TabIndex = 6;
128+
this->buttonCancel->Text = L"Cancel";
129+
this->buttonCancel->UseVisualStyleBackColor = true;
130+
this->panel1->Controls->Add(this->checkSingle);
131+
this->panel1->Controls->Add(this->checkDM);
132+
this->panel1->Controls->Add(this->checkTDM);
133+
this->panel1->Controls->Add(this->checkCTA);
134+
this->panel1->Controls->Add(this->checkAfHunt);
135+
this->panel1->Location = System::Drawing::Point(0, 0);
136+
this->panel1->Name = L"panel1";
137+
this->panel1->Size = System::Drawing::Size(127, 115);
138+
this->panel1->TabIndex = 7;
139+
this->AcceptButton = this->buttonOk;
140+
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
141+
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
142+
this->CancelButton = this->buttonCancel;
143+
this->ClientSize = System::Drawing::Size(127, 138);
144+
this->Controls->Add(this->panel1);
145+
this->Controls->Add(this->buttonOk);
146+
this->Controls->Add(this->buttonCancel);
147+
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedToolWindow;
148+
this->Name = L"GameType";
149+
this->Text = L"GameType";
150+
this->panel1->ResumeLayout(false);
151+
this->panel1->PerformLayout();
152+
this->ResumeLayout(false);
153+
154+
}
155+
#pragma endregion
156+
};
157+
} // namespace Props
158+
} // namespace ECore
159+
} // namespace XRay
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<root>
3+
<!--
4+
Microsoft ResX Schema
5+
6+
Version 2.0
7+
8+
The primary goals of this format is to allow a simple XML format
9+
that is mostly human readable. The generation and parsing of the
10+
various data types are done through the TypeConverter classes
11+
associated with the data types.
12+
13+
Example:
14+
15+
... ado.net/XML headers & schema ...
16+
<resheader name="resmimetype">text/microsoft-resx</resheader>
17+
<resheader name="version">2.0</resheader>
18+
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19+
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20+
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21+
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22+
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23+
<value>[base64 mime encoded serialized .NET Framework object]</value>
24+
</data>
25+
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26+
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27+
<comment>This is a comment</comment>
28+
</data>
29+
30+
There are any number of "resheader" rows that contain simple
31+
name/value pairs.
32+
33+
Each data row contains a name, and value. The row also contains a
34+
type or mimetype. Type corresponds to a .NET class that support
35+
text/value conversion through the TypeConverter architecture.
36+
Classes that don't support this are serialized and stored with the
37+
mimetype set.
38+
39+
The mimetype is used for serialized objects, and tells the
40+
ResXResourceReader how to depersist the object. This is currently not
41+
extensible. For a given mimetype the value must be set accordingly:
42+
43+
Note - application/x-microsoft.net.object.binary.base64 is the format
44+
that the ResXResourceWriter will generate, however the reader can
45+
read any of the formats listed below.
46+
47+
mimetype: application/x-microsoft.net.object.binary.base64
48+
value : The object must be serialized with
49+
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50+
: and then encoded with base64 encoding.
51+
52+
mimetype: application/x-microsoft.net.object.soap.base64
53+
value : The object must be serialized with
54+
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55+
: and then encoded with base64 encoding.
56+
57+
mimetype: application/x-microsoft.net.object.bytearray.base64
58+
value : The object must be serialized into a byte array
59+
: using a System.ComponentModel.TypeConverter
60+
: and then encoded with base64 encoding.
61+
-->
62+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63+
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64+
<xsd:element name="root" msdata:IsDataSet="true">
65+
<xsd:complexType>
66+
<xsd:choice maxOccurs="unbounded">
67+
<xsd:element name="metadata">
68+
<xsd:complexType>
69+
<xsd:sequence>
70+
<xsd:element name="value" type="xsd:string" minOccurs="0" />
71+
</xsd:sequence>
72+
<xsd:attribute name="name" use="required" type="xsd:string" />
73+
<xsd:attribute name="type" type="xsd:string" />
74+
<xsd:attribute name="mimetype" type="xsd:string" />
75+
<xsd:attribute ref="xml:space" />
76+
</xsd:complexType>
77+
</xsd:element>
78+
<xsd:element name="assembly">
79+
<xsd:complexType>
80+
<xsd:attribute name="alias" type="xsd:string" />
81+
<xsd:attribute name="name" type="xsd:string" />
82+
</xsd:complexType>
83+
</xsd:element>
84+
<xsd:element name="data">
85+
<xsd:complexType>
86+
<xsd:sequence>
87+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89+
</xsd:sequence>
90+
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93+
<xsd:attribute ref="xml:space" />
94+
</xsd:complexType>
95+
</xsd:element>
96+
<xsd:element name="resheader">
97+
<xsd:complexType>
98+
<xsd:sequence>
99+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100+
</xsd:sequence>
101+
<xsd:attribute name="name" type="xsd:string" use="required" />
102+
</xsd:complexType>
103+
</xsd:element>
104+
</xsd:choice>
105+
</xsd:complexType>
106+
</xsd:element>
107+
</xsd:schema>
108+
<resheader name="resmimetype">
109+
<value>text/microsoft-resx</value>
110+
</resheader>
111+
<resheader name="version">
112+
<value>2.0</value>
113+
</resheader>
114+
<resheader name="reader">
115+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116+
</resheader>
117+
<resheader name="writer">
118+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119+
</resheader>
120+
</root>

src/editors/xrECore/Props/NumericVector.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,9 @@ System::Void NumericVector::buttonApply_Click(System::Object^ sender, System::Ev
8181
Value->set((float)numX->Value, (float)numY->Value, (float)numZ->Value);
8282
}
8383

84-
8584
System::Void NumericVector::buttonOk_Click(System::Object^ sender, System::EventArgs^ e)
8685
{
8786
buttonApply_Click(sender, e);
88-
this->Close();
89-
}
90-
91-
System::Void NumericVector::buttonCancel_Click(System::Object^ sender, System::EventArgs^ e)
92-
{
93-
this->Close();
9487
}
9588

9689
System::Void NumericVector::buttonReset_Click(System::Object^ sender, System::EventArgs^ e)
@@ -110,13 +103,13 @@ System::Void NumericVector::NumericVector_KeyPress(System::Object^ sender, Syste
110103
switch (e->KeyChar)
111104
{
112105
case (Char)Keys::Space:
113-
buttonApply_Click(sender, e);
106+
buttonApply->PerformClick();
114107
break;
115108
case (Char)Keys::Enter:
116-
buttonOk_Click(sender, e);
109+
buttonOk->PerformClick();
117110
break;
118111
case (Char)Keys::Escape:
119-
buttonCancel_Click(sender, e);
112+
buttonCancel->PerformClick();
120113
break;
121114
}
122115
}

src/editors/xrECore/Props/NumericVector.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ public ref class NumericVector : public System::Windows::Forms::Form
4949

5050
private: System::Void buttonApply_Click(System::Object^ sender, System::EventArgs^ e);
5151
private: System::Void buttonOk_Click(System::Object^ sender, System::EventArgs^ e);
52-
private: System::Void buttonCancel_Click(System::Object^ sender, System::EventArgs^ e);
5352
private: System::Void buttonReset_Click(System::Object^ sender, System::EventArgs^ e);
5453
private: System::Void buttonImmediate_Click(System::Object^ sender, System::EventArgs^ e);
5554
private: System::Void NumericVector_KeyPress(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e);
@@ -91,20 +90,21 @@ private: System::Windows::Forms::Label^ labelZ;
9190
this->buttonImmediate = (gcnew System::Windows::Forms::Button());
9291
this->checkImmediate = (gcnew System::Windows::Forms::CheckBox());
9392
this->SuspendLayout();
93+
this->buttonOk->DialogResult = System::Windows::Forms::DialogResult::OK;
9494
this->buttonOk->Location = System::Drawing::Point(136, 21);
9595
this->buttonOk->Name = L"buttonOk";
9696
this->buttonOk->Size = System::Drawing::Size(50, 22);
9797
this->buttonOk->TabIndex = 0;
9898
this->buttonOk->Text = L"Ok";
9999
this->buttonOk->UseVisualStyleBackColor = true;
100100
this->buttonOk->Click += gcnew System::EventHandler(this, &NumericVector::buttonOk_Click);
101+
this->buttonCancel->DialogResult = System::Windows::Forms::DialogResult::Cancel;
101102
this->buttonCancel->Location = System::Drawing::Point(136, 42);
102103
this->buttonCancel->Name = L"buttonCancel";
103104
this->buttonCancel->Size = System::Drawing::Size(50, 22);
104105
this->buttonCancel->TabIndex = 1;
105106
this->buttonCancel->Text = L"Cancel";
106107
this->buttonCancel->UseVisualStyleBackColor = true;
107-
this->buttonCancel->Click += gcnew System::EventHandler(this, &NumericVector::buttonCancel_Click);
108108
this->buttonReset->Location = System::Drawing::Point(136, 63);
109109
this->buttonReset->Name = L"buttonReset";
110110
this->buttonReset->Size = System::Drawing::Size(50, 22);
@@ -184,8 +184,10 @@ private: System::Windows::Forms::Label^ labelZ;
184184
this->checkImmediate->Size = System::Drawing::Size(15, 14);
185185
this->checkImmediate->TabIndex = 11;
186186
this->checkImmediate->UseVisualStyleBackColor = true;
187+
this->AcceptButton = this->buttonOk;
187188
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
188189
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
190+
this->CancelButton = this->buttonCancel;
189191
this->ClientSize = System::Drawing::Size(186, 85);
190192
this->Controls->Add(this->checkImmediate);
191193
this->Controls->Add(this->buttonImmediate);

0 commit comments

Comments
 (0)