Skip to content

Commit

Permalink
Music fixes finally.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nhawdge committed Jan 31, 2024
1 parent 30b3bc6 commit 4c7a351
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 23 deletions.
10 changes: 7 additions & 3 deletions NovemberPiratesEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ public void StartGame()
//Raylib.SetConfigFlags(ConfigFlags.FLAG_WINDOW_TOPMOST);
//Raylib.SetConfigFlags(ConfigFlags.FLAG_WINDOW_MAXIMIZED);
//Raylib.SetConfigFlags(ConfigFlags.FLAG_WINDOW_UNDECORATED);

Raylib.InitWindow(0,0, "November Pirates");

var width = Raylib.GetMonitorWidth(0);
var height = Raylib.GetMonitorHeight(0);
var monitor = Raylib.GetCurrentMonitor();
var width = Raylib.GetMonitorWidth(monitor);
var height = Raylib.GetMonitorHeight(monitor);

Raylib.SetWindowSize(width, height);

Raylib.InitWindow(width, height, "November Pirates");
Raylib.SetTargetFPS(60);
Raylib.InitAudioDevice();
Raylib.SetExitKey(0);
Expand Down
7 changes: 5 additions & 2 deletions Scenes/Menus/MainMenu/CreditsScene.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
using NovemberPirates.Scenes.Menus.Components;
using NovemberPirates.Components;
using NovemberPirates.Scenes.Menus.Components;
using NovemberPirates.Scenes.Menus.Systems;
using Raylib_CsLo;

namespace NovemberPirates.Scenes.Menus.MainMenu
{
internal class CreditsScene : BaseScene
{
public CreditsScene()
public CreditsScene(Singleton singleton)
{
Systems.Add(new MenuSystem());
Systems.Add(new MenuMusicSystem());

World.Create(singleton);

var index = 5;
World.Create(new UiContainer { Rectangle = new Rectangle() });

Expand Down
5 changes: 4 additions & 1 deletion Scenes/Menus/MainMenu/HowToPlayScene.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Arch.Core;
using Arch.Core.Extensions;
using NovemberPirates.Components;
using NovemberPirates.Scenes.Menus.Components;
using NovemberPirates.Scenes.Menus.Systems;
using Raylib_CsLo;
Expand All @@ -8,11 +9,13 @@ namespace NovemberPirates.Scenes.Menus.MainMenu
{
internal class HowToPlayScene : BaseScene
{
public HowToPlayScene()
public HowToPlayScene(Singleton singleton)
{
Systems.Add(new MenuSystem());
Systems.Add(new MenuMusicSystem());

World.Create(singleton);

var index = 5;

World.Create(new UiContainer { Rectangle = new Rectangle() });
Expand Down
12 changes: 8 additions & 4 deletions Scenes/Menus/MainMenu/MainMenuScene.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using NovemberPirates.Components;
using Arch.Core.Extensions;
using NovemberPirates.Components;
using NovemberPirates.Extensions;
using NovemberPirates.Scenes.Levels;
using NovemberPirates.Scenes.Levels.Components;
using NovemberPirates.Scenes.Menus.Components;
Expand All @@ -13,10 +15,12 @@ internal class MainMenuScene : BaseScene
{
public MainMenuScene()
{

Systems.Add(new MenuSystem());
Systems.Add(new MenuMusicSystem());

World.Create(new Singleton() { Music = AudioKey.DreamingOfTreasure });
var singleton = new Singleton() { Music = AudioKey.DreamingOfTreasure };
World.Create(singleton);

var width = Raylib.GetScreenWidth() * 0.7f;

Expand Down Expand Up @@ -45,7 +49,7 @@ public MainMenuScene()
Text = "HowToPlay",
Action = () =>
{
NovemberPiratesEngine.Instance.ActiveScene = new HowToPlayScene();
NovemberPiratesEngine.Instance.ActiveScene = new HowToPlayScene(singleton);
},
Order = 2,
TextSprite = new Sprite(TextureKey.Words, "Assets/Art/words")
Expand All @@ -65,7 +69,7 @@ public MainMenuScene()
Text = "Credits",
Action = () =>
{
NovemberPiratesEngine.Instance.ActiveScene = new CreditsScene();
NovemberPiratesEngine.Instance.ActiveScene = new CreditsScene(singleton);
},
Order = 3,
TextSprite = new Sprite(TextureKey.Words, "Assets/Art/words")
Expand Down
22 changes: 12 additions & 10 deletions Scenes/Menus/MainMenu/SettingsScene.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Arch.Core.Extensions;
using Arch.Core;
using NovemberPirates.Components;
using NovemberPirates.Scenes.Menus.Components;
using NovemberPirates.Scenes.Menus.Systems;
using Raylib_CsLo;
Expand All @@ -7,21 +8,22 @@ namespace NovemberPirates.Scenes.Menus.MainMenu
{
internal class SettingsScene : BaseScene
{
public SettingsScene()
public SettingsScene(Singleton singleton)
{
Systems.Add(new MenuSystem());
Systems.Add(new MenuMusicSystem());

var index = 5;
World.Create(singleton);

World.Create(new UiContainer { Rectangle = new Rectangle() });

var instructions = World.Create<UiTitle>();
instructions.Set(new UiTitle { Text = @"WASD to move Q/E or Arrow keys to shoot", Order = index++ });
var instructions2 = World.Create<UiTitle>();
instructions2.Set(new UiTitle { Text = @"f3 to change the wind", Order = index++ });
var instructions3 = World.Create<UiTitle>();
instructions3.Set(new UiTitle { Text = @"F2 for the debugger I'm proud of", Order = index++ });
var index = 5;

//var instructions = World.Create<UiTitle>();
//instructions.Set(new UiTitle { Text = @"WASD to move Q/E or Arrow keys to shoot", Order = index++ });
//var instructions2 = World.Create<UiTitle>();
//instructions2.Set(new UiTitle { Text = @"f3 to change the wind", Order = index++ });
//var instructions3 = World.Create<UiTitle>();
//instructions3.Set(new UiTitle { Text = @"F2 for the debugger I'm proud of", Order = index++ });

World.Create(new UiButton
{
Expand Down
1 change: 0 additions & 1 deletion Scenes/Menus/Systems/MenuMusicSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ internal override void Update(World world)
var singletonEntity = world.QueryFirst<Singleton>();
var singleton = singletonEntity.Get<Singleton>();


var music = AudioManager.Instance.GetMusic(singleton.Music);
if (Raylib.IsMusicStreamPlaying(music))
{
Expand Down
3 changes: 1 addition & 2 deletions Utilities/SettingsManager.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Security.Cryptography.X509Certificates;
using System.Text.Json;
using System.Text.Json;

namespace NovemberPirates.Utilities
{
Expand Down

0 comments on commit 4c7a351

Please sign in to comment.