better menu
This commit is contained in:
parent
d2ebbdef62
commit
17017d631e
455
.gitignore
vendored
455
.gitignore
vendored
@ -1,4 +1,406 @@
|
||||
# ---> Godot
|
||||
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/godot,jetbrains,csharp,visualstudiocode
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=godot,jetbrains,csharp,visualstudiocode
|
||||
|
||||
### Csharp ###
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.tlog
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool
|
||||
coverage*.json
|
||||
coverage*.xml
|
||||
coverage*.info
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
|
||||
*.vbp
|
||||
|
||||
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
|
||||
*.dsw
|
||||
*.dsp
|
||||
|
||||
# Visual Studio 6 technical files
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# Visual Studio History (VSHistory) files
|
||||
.vshistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
|
||||
# VS Code files for those working on multiple tools
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
*.code-workspace
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Windows Installer files from build outputs
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# JetBrains Rider
|
||||
*.sln.iml
|
||||
|
||||
### Godot ###
|
||||
# Godot-specific ignores
|
||||
.import/
|
||||
export.cfg
|
||||
@ -11,7 +413,7 @@ export_presets.cfg
|
||||
.mono/
|
||||
data_*/
|
||||
|
||||
# ---> JetBrains
|
||||
### JetBrains ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
@ -75,6 +477,9 @@ atlassian-ide-plugin.xml
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# SonarLint plugin
|
||||
.idea/sonarlint/
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
@ -87,3 +492,49 @@ fabric.properties
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
### JetBrains Patch ###
|
||||
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
|
||||
|
||||
# *.iml
|
||||
# modules.xml
|
||||
# .idea/misc.xml
|
||||
# *.ipr
|
||||
|
||||
# Sonarlint plugin
|
||||
# https://plugins.jetbrains.com/plugin/7973-sonarlint
|
||||
.idea/**/sonarlint/
|
||||
|
||||
# SonarQube Plugin
|
||||
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
|
||||
.idea/**/sonarIssues.xml
|
||||
|
||||
# Markdown Navigator plugin
|
||||
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
|
||||
.idea/**/markdown-navigator.xml
|
||||
.idea/**/markdown-navigator-enh.xml
|
||||
.idea/**/markdown-navigator/
|
||||
|
||||
# Cache file creation bug
|
||||
# See https://youtrack.jetbrains.com/issue/JBR-2257
|
||||
.idea/$CACHE_FILE$
|
||||
|
||||
# CodeStream plugin
|
||||
# https://plugins.jetbrains.com/plugin/12206-codestream
|
||||
.idea/codestream.xml
|
||||
|
||||
### VisualStudioCode ###
|
||||
!.vscode/*.code-snippets
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
|
||||
# Built Visual Studio Code Extensions
|
||||
*.vsix
|
||||
|
||||
### VisualStudioCode Patch ###
|
||||
# Ignore all local history of files
|
||||
.history
|
||||
.ionide
|
||||
|
||||
# Support for Project snippet scope
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/godot,jetbrains,csharp,visualstudiocode
|
||||
|
1
.idea/.idea.Particles/.idea/.name
Normal file
1
.idea/.idea.Particles/.idea/.name
Normal file
@ -0,0 +1 @@
|
||||
Particles
|
11
Main.cs
11
Main.cs
@ -4,14 +4,21 @@ using System;
|
||||
public class Main : Node
|
||||
{
|
||||
|
||||
public void StartSimulation(int nParticles)
|
||||
public void StartSimulation(int seed, int nParticles)
|
||||
{
|
||||
var particleSimulationPackedScene = GD.Load<PackedScene>("res://ParticleSimulation/ParticleSimulationScene.tscn");
|
||||
var particleSimulationScene = particleSimulationPackedScene.Instance<ParticleSimulationScene>();
|
||||
particleSimulationScene.Name = "Simulation";
|
||||
AddChild(particleSimulationScene);
|
||||
particleSimulationScene.Initialize(nParticles);
|
||||
particleSimulationScene.Initialize(seed, nParticles);
|
||||
GetNode<Control>("MainMenu").Hide();
|
||||
//OS.WindowResizable = false;
|
||||
}
|
||||
|
||||
public void ExitToMenu()
|
||||
{
|
||||
GetNode("Simulation").QueueFree();
|
||||
GetNode<Control>("MainMenu").Show();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,24 +4,51 @@ using System;
|
||||
public class MainMenu : Control
|
||||
{
|
||||
|
||||
// Nodes for menu items
|
||||
private Main _main;
|
||||
private Button _simulateButton;
|
||||
private Button _toggleFullScreenButton;
|
||||
private TextEdit _seedText;
|
||||
private TextEdit _particleCountText;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
// Init nodes
|
||||
_main = GetTree().Root.GetNode<Main>("Main");
|
||||
_simulateButton = GetNode("MenuButtons").GetNode<Button>("SimulateButton");
|
||||
_toggleFullScreenButton = GetNode("MenuButtons").GetNode<Button>("ToggleFullscreenButton");
|
||||
_seedText = GetNode("MenuButtons").GetNode<TextEdit>("SeedText");
|
||||
_particleCountText = GetNode("MenuButtons").GetNode<TextEdit>("ParticleCountText");
|
||||
|
||||
// Connect signals
|
||||
_simulateButton.Connect("pressed", this, nameof(_OnSimulatePressed));
|
||||
_toggleFullScreenButton.Connect("pressed", this, nameof(_OnToggleFullscreenPressed));
|
||||
|
||||
// Random seed
|
||||
GD.Randomize();
|
||||
var randomSeed = (int)GD.Randi();
|
||||
_seedText.Text = randomSeed.ToString();
|
||||
}
|
||||
|
||||
public void _on_Button_pressed()
|
||||
public void _OnSimulatePressed()
|
||||
{
|
||||
var nParticles = GetNode<VBoxContainer>("MenuButtons").GetNode<TextEdit>("TextEdit").Text.ToInt();
|
||||
_main.StartSimulation(nParticles);
|
||||
// Start simulation with seed and number of particles
|
||||
var nParticles = _particleCountText.Text.ToInt();
|
||||
var seed = _seedText.Text.ToInt();
|
||||
_main.StartSimulation(seed, nParticles);
|
||||
}
|
||||
|
||||
public void _on_ToggleFullscreen_pressed()
|
||||
public void _OnToggleFullscreenPressed()
|
||||
{
|
||||
if (OS.WindowFullscreen)
|
||||
OS.WindowFullscreen = false;
|
||||
else
|
||||
OS.WindowFullscreen = true;
|
||||
OS.WindowFullscreen = !OS.WindowFullscreen;
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
// Quit only if menu is visible
|
||||
if (Visible && @event.IsActionPressed("quit"))
|
||||
{
|
||||
GetTree().Quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,57 +24,74 @@ anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -150.0
|
||||
margin_top = -105.315
|
||||
margin_top = -132.0
|
||||
margin_right = 150.0
|
||||
margin_bottom = 192.685
|
||||
margin_bottom = 337.685
|
||||
custom_constants/separation = 12
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Label" type="Label" parent="MenuButtons"]
|
||||
[node name="ParticleCountLabel" type="Label" parent="MenuButtons"]
|
||||
margin_right = 300.0
|
||||
margin_bottom = 27.0
|
||||
text = "Number of Particles"
|
||||
align = 1
|
||||
|
||||
[node name="TextEdit" type="TextEdit" parent="MenuButtons"]
|
||||
[node name="ParticleCountText" type="TextEdit" parent="MenuButtons"]
|
||||
margin_top = 39.0
|
||||
margin_right = 300.0
|
||||
margin_bottom = 103.769
|
||||
rect_min_size = Vector2( 0, 64.769 )
|
||||
text = "1000"
|
||||
|
||||
[node name="Button" type="Button" parent="MenuButtons"]
|
||||
[node name="SeedLabel" type="Label" parent="MenuButtons"]
|
||||
margin_top = 115.0
|
||||
margin_right = 300.0
|
||||
margin_bottom = 166.251
|
||||
margin_bottom = 142.0
|
||||
text = "Optional Seed Number"
|
||||
align = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="SeedText" type="TextEdit" parent="MenuButtons"]
|
||||
margin_top = 154.0
|
||||
margin_right = 300.0
|
||||
margin_bottom = 218.769
|
||||
rect_min_size = Vector2( 0, 64.769 )
|
||||
text = "12345"
|
||||
|
||||
[node name="SimulateButton" type="Button" parent="MenuButtons"]
|
||||
margin_top = 230.0
|
||||
margin_right = 300.0
|
||||
margin_bottom = 281.251
|
||||
text = "Simulate!"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Warning" type="Label" parent="MenuButtons"]
|
||||
margin_top = 178.0
|
||||
margin_top = 293.0
|
||||
margin_right = 300.0
|
||||
margin_bottom = 223.0
|
||||
margin_bottom = 338.0
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "Simulation cannot be resized
|
||||
once simulation starts!"
|
||||
align = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MenuButtons"]
|
||||
margin_top = 235.0
|
||||
margin_top = 350.0
|
||||
margin_right = 300.0
|
||||
margin_bottom = 235.0
|
||||
margin_bottom = 350.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ToggleFullscreen" type="Button" parent="MenuButtons"]
|
||||
margin_top = 247.0
|
||||
[node name="ToggleFullscreenButton" type="Button" parent="MenuButtons"]
|
||||
margin_top = 362.0
|
||||
margin_right = 300.0
|
||||
margin_bottom = 298.251
|
||||
margin_bottom = 413.251
|
||||
text = "Toggle Fullscreen"
|
||||
|
||||
[node name="Logo" type="TextureRect" parent="."]
|
||||
@ -83,10 +100,10 @@ anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -342.0
|
||||
margin_top = -357.183
|
||||
margin_right = 1578.0
|
||||
margin_bottom = 726.817
|
||||
margin_left = -339.0
|
||||
margin_top = -384.0
|
||||
margin_right = 1581.0
|
||||
margin_bottom = 700.0
|
||||
rect_scale = Vector2( 0.35, 0.35 )
|
||||
mouse_filter = 2
|
||||
texture = ExtResource( 2 )
|
||||
@ -94,5 +111,4 @@ __meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[connection signal="pressed" from="MenuButtons/Button" to="." method="_on_Button_pressed"]
|
||||
[connection signal="pressed" from="MenuButtons/ToggleFullscreen" to="." method="_on_ToggleFullscreen_pressed"]
|
||||
[connection signal="pressed" from="MenuButtons/ToggleFullscreenButton" to="." method="_on_ToggleFullscreen_pressed"]
|
||||
|
@ -22,12 +22,23 @@ public class MenuBackground : Node2D
|
||||
int addCount = nParticles - currentCount;
|
||||
for (int i = 0; i < addCount; i++)
|
||||
{
|
||||
|
||||
CreateParticle();
|
||||
}
|
||||
}
|
||||
// TODO pick random particles to delete
|
||||
}
|
||||
|
||||
//TODO add private method to add particles
|
||||
private void CreateParticle()
|
||||
{
|
||||
var particlePackedScene = GD.Load<PackedScene>("res://ParticleSimulation/ParticleNode.tscn");
|
||||
var particleNode = particlePackedScene.Instance<ParticleNode>();
|
||||
_particleNodes.AddChild(particleNode);
|
||||
var screenSize = GetViewportRect().Size;
|
||||
var position = new Vector2(
|
||||
(float) GD.RandRange(0, screenSize.x),
|
||||
(float) GD.RandRange(0, screenSize.y));
|
||||
particleNode.Position = position;
|
||||
}
|
||||
|
||||
public override void _Process(float delta)
|
||||
{
|
||||
|
@ -10,13 +10,11 @@ public class ParticleSimulationScene : Node2D
|
||||
private ParticleSimulation _particleSimulation;
|
||||
public float PhysicsInterpolationFraction;
|
||||
|
||||
public void Initialize(int nParticles)
|
||||
public void Initialize(int seed, int nParticles)
|
||||
{
|
||||
_particleNodes = GetNode<Node2D>("ParticleNodes");
|
||||
GD.Randomize();
|
||||
ulong randomSeed = GD.Randi();
|
||||
GD.Seed(randomSeed);
|
||||
GD.Print("Last Seed: " + randomSeed);
|
||||
GD.Seed((ulong)seed);
|
||||
GD.Print("Last Seed: " + seed);
|
||||
var viewSize = GetViewportRect().Size;
|
||||
var zoom = GetNode<Camera2D>("Camera2D").Zoom;
|
||||
var spaceSize = new Vector2(viewSize.x * zoom.x, viewSize.y * zoom.y);
|
||||
@ -30,7 +28,8 @@ public class ParticleSimulationScene : Node2D
|
||||
|
||||
public override void _Process(float delta)
|
||||
{
|
||||
if (Input.IsActionJustPressed("quit")) GetTree().Quit();
|
||||
if (Input.IsActionJustPressed("quit"))
|
||||
GetParent<Main>().ExitToMenu();
|
||||
if (Input.IsActionJustPressed("reset")) GetTree().ReloadCurrentScene();
|
||||
PhysicsInterpolationFraction = Engine.GetPhysicsInterpolationFraction();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user