Added the possibility to create asymetrical populations and a crappy loading logo

This commit is contained in:
2022-05-05 14:23:57 +02:00
parent 674eb9dc22
commit 8276edd032
7 changed files with 109 additions and 64 deletions
+38 -15
View File
@@ -39,6 +39,7 @@ namespace PropagationRemasteredBeta
this.chkbxSaveFiles = new System.Windows.Forms.CheckBox();
this.tbxSaveFilePath = new System.Windows.Forms.TextBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.nupPopulationHeight = new System.Windows.Forms.NumericUpDown();
this.label12 = new System.Windows.Forms.Label();
this.btnRandomizeStats = new System.Windows.Forms.Button();
this.nupCureTime = new System.Windows.Forms.NumericUpDown();
@@ -55,18 +56,19 @@ namespace PropagationRemasteredBeta
this.label3 = new System.Windows.Forms.Label();
this.lblPopulationSizePrediction = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.nupPopulationSize = new System.Windows.Forms.NumericUpDown();
this.nupPopulationWidth = new System.Windows.Forms.NumericUpDown();
this.label1 = new System.Windows.Forms.Label();
this.btnRunSimulation = new System.Windows.Forms.Button();
this.btnOpenSimViewer = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nupPopulationHeight)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nupCureTime)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nupImmunes)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nupInfecteds)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nupMortality)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nupInfectiosity)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nupPopulationSize)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nupPopulationWidth)).BeginInit();
this.SuspendLayout();
//
// lblTitle
@@ -166,6 +168,7 @@ namespace PropagationRemasteredBeta
//
// groupBox2
//
this.groupBox2.Controls.Add(this.nupPopulationHeight);
this.groupBox2.Controls.Add(this.label12);
this.groupBox2.Controls.Add(this.btnRandomizeStats);
this.groupBox2.Controls.Add(this.nupCureTime);
@@ -182,7 +185,7 @@ namespace PropagationRemasteredBeta
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.lblPopulationSizePrediction);
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Controls.Add(this.nupPopulationSize);
this.groupBox2.Controls.Add(this.nupPopulationWidth);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Font = new System.Drawing.Font("Verdana", 12F);
this.groupBox2.Location = new System.Drawing.Point(12, 268);
@@ -192,6 +195,24 @@ namespace PropagationRemasteredBeta
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Simulation Settings";
//
// nupPopulationHeight
//
this.nupPopulationHeight.Location = new System.Drawing.Point(292, 69);
this.nupPopulationHeight.Maximum = new decimal(new int[] {
10000,
0,
0,
0});
this.nupPopulationHeight.Name = "nupPopulationHeight";
this.nupPopulationHeight.Size = new System.Drawing.Size(236, 32);
this.nupPopulationHeight.TabIndex = 22;
this.nupPopulationHeight.Value = new decimal(new int[] {
400,
0,
0,
0});
this.nupPopulationHeight.ValueChanged += new System.EventHandler(this.nupPopulationHeight_ValueChanged);
//
// label12
//
this.label12.AutoSize = true;
@@ -355,32 +376,32 @@ namespace PropagationRemasteredBeta
this.label2.TabIndex = 2;
this.label2.Text = "Simulated individuals :";
//
// nupPopulationSize
// nupPopulationWidth
//
this.nupPopulationSize.Location = new System.Drawing.Point(14, 69);
this.nupPopulationSize.Maximum = new decimal(new int[] {
this.nupPopulationWidth.Location = new System.Drawing.Point(14, 69);
this.nupPopulationWidth.Maximum = new decimal(new int[] {
10000,
0,
0,
0});
this.nupPopulationSize.Name = "nupPopulationSize";
this.nupPopulationSize.Size = new System.Drawing.Size(514, 32);
this.nupPopulationSize.TabIndex = 1;
this.nupPopulationSize.Value = new decimal(new int[] {
this.nupPopulationWidth.Name = "nupPopulationWidth";
this.nupPopulationWidth.Size = new System.Drawing.Size(236, 32);
this.nupPopulationWidth.TabIndex = 1;
this.nupPopulationWidth.Value = new decimal(new int[] {
400,
0,
0,
0});
this.nupPopulationSize.ValueChanged += new System.EventHandler(this.nupPopulationSize_ValueChanged);
this.nupPopulationWidth.ValueChanged += new System.EventHandler(this.nupPopulationSize_ValueChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(9, 41);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(71, 25);
this.label1.Size = new System.Drawing.Size(217, 25);
this.label1.TabIndex = 0;
this.label1.Text = "Size :";
this.label1.Text = "Size (width;height):";
//
// btnRunSimulation
//
@@ -423,12 +444,13 @@ namespace PropagationRemasteredBeta
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nupPopulationHeight)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nupCureTime)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nupImmunes)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nupInfecteds)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nupMortality)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nupInfectiosity)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nupPopulationSize)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nupPopulationWidth)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -444,7 +466,7 @@ namespace PropagationRemasteredBeta
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label lblPopulationSizePrediction;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.NumericUpDown nupPopulationSize;
private System.Windows.Forms.NumericUpDown nupPopulationWidth;
private System.Windows.Forms.NumericUpDown nupImmunes;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.NumericUpDown nupInfecteds;
@@ -466,5 +488,6 @@ namespace PropagationRemasteredBeta
private System.Windows.Forms.Button btnRandomName;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Button btnRandomizeStats;
private System.Windows.Forms.NumericUpDown nupPopulationHeight;
}
}
@@ -33,7 +33,7 @@ namespace PropagationRemasteredBeta
private void btnRunSimulation_Click(object sender, EventArgs e)
{
terrainSize = new Size(Convert.ToInt32(nupPopulationSize.Value), Convert.ToInt32(nupPopulationSize.Value));
terrainSize = new Size(Convert.ToInt32(nupPopulationWidth.Value), Convert.ToInt32(nupPopulationHeight.Value));
infectedProportion = Convert.ToInt32(nupInfecteds.Value);
resistantProportion = Convert.ToInt32(nupImmunes.Value);
deathRate = Convert.ToInt32(nupMortality.Value);
@@ -50,8 +50,11 @@ namespace PropagationRemasteredBeta
}
private void nupPopulationSize_ValueChanged(object sender, EventArgs e)
{
decimal value = nupPopulationSize.Value;
lblPopulationSizePrediction.Text = (value * value).ToString();
lblPopulationSizePrediction.Text = (nupPopulationWidth.Value * nupPopulationHeight.Value).ToString();
}
private void nupPopulationHeight_ValueChanged(object sender, EventArgs e)
{
lblPopulationSizePrediction.Text = (nupPopulationWidth.Value * nupPopulationHeight.Value).ToString();
}
private void Refresh()
{
@@ -76,5 +79,7 @@ namespace PropagationRemasteredBeta
{
}
}
}
@@ -79,6 +79,7 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@@ -93,5 +94,8 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\loading.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -1,49 +1,44 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Ce code a été généré par un outil.
// Version du runtime :4.0.30319.42000
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
// le code est régénéré.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PropagationRemasteredBeta.Properties
{
namespace PropagationRemasteredBeta.Properties {
using System;
/// <summary>
/// Une classe de ressource fortement typée destinée, entre autres, à la consultation des chaînes localisées.
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// Cette classe a été générée automatiquement par la classe StronglyTypedResourceBuilder
// à l'aide d'un outil, tel que ResGen ou Visual Studio.
// Pour ajouter ou supprimer un membre, modifiez votre fichier .ResX, puis réexécutez ResGen
// avec l'option /str ou régénérez votre projet VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
internal Resources() {
}
/// <summary>
/// Retourne l'instance ResourceManager mise en cache utilisée par cette classe.
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PropagationRemasteredBeta.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
@@ -52,20 +47,27 @@ namespace PropagationRemasteredBeta.Properties
}
/// <summary>
/// Remplace la propriété CurrentUICulture du thread actuel pour toutes
/// les recherches de ressources à l'aide de cette classe de ressource fortement typée.
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set
{
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap loading {
get {
object obj = ResourceManager.GetObject("loading", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}
@@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@@ -60,6 +60,7 @@
: 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">
@@ -68,9 +69,10 @@
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<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">
@@ -85,9 +87,10 @@
<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" msdata:Ordinal="1" />
<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">
@@ -109,9 +112,13 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="loading" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\loading.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

@@ -69,6 +69,10 @@ namespace PropagationRemasteredBeta
}
else
{
//I dont know why but this does not display immediatly after pressing the button
pbxTerrain.Image = Properties.Resources.loading;
//this.Invalidate();
started = true;
btnStartNormal.Text = "Stop";
btnStartOneForAll.Text = "Stop";
@@ -76,6 +80,8 @@ namespace PropagationRemasteredBeta
t = new Terrain(terrainSize, infectedProportion, resistantProportion, deathRate, infectionRate, cureTime);
frameCount = 0;
pbxTerrain.Image = Properties.Resources.loading;
switch (mode)
{
case 1:
@@ -124,8 +130,6 @@ namespace PropagationRemasteredBeta
BufferImage = t.Display();
if (needToSave)
{
Save(BufferImage, frameCount);
@@ -137,7 +141,6 @@ namespace PropagationRemasteredBeta
lblFrameCount.Text = frameCount.ToString();
lblTotalTime.Text = totalTime.ToString();
//refresh all the stats
lblMemory.Text = GetMemoryUsage().ToString() + " Mb";
lblelementsCounter.Text = t.DRAWED_ELEMENTS.ToString();
@@ -196,6 +199,7 @@ namespace PropagationRemasteredBeta
private void SimulationVue_Load(object sender, EventArgs e)
{
lblSimulationName.Text = simulationName;
//pbxTerrain.Image = Properties.Resources.loading;
}
}
}