using props in Sound rather than setter functions; no idea if it's right, because there's no way to test

This commit is contained in:
Chris Forbes
2009-12-27 21:54:37 +13:00
parent 413cfcada6
commit 6ff4ea3717
2 changed files with 44 additions and 32 deletions

View File

@@ -82,9 +82,20 @@ namespace OpenRa.Game.Graphics
spriteRenderer.Flush(); spriteRenderer.Flush();
var selbox = Game.controller.SelectionBox; DrawBandBox();
if (selbox != null)
if (Game.controller.orderGenerator != null)
Game.controller.orderGenerator.Render();
lineRenderer.Flush();
spriteRenderer.Flush();
}
void DrawBandBox()
{ {
var selbox = Game.controller.SelectionBox;
if (selbox == null) return;
var a = selbox.Value.First; var a = selbox.Value.First;
var b = new float2(selbox.Value.Second.X - a.X, 0); var b = new float2(selbox.Value.Second.X - a.X, 0);
var c = new float2(0, selbox.Value.Second.Y - a.Y); var c = new float2(0, selbox.Value.Second.Y - a.Y);
@@ -98,13 +109,6 @@ namespace OpenRa.Game.Graphics
DrawSelectionBox(u, Color.Yellow, false); DrawSelectionBox(u, Color.Yellow, false);
} }
if (Game.controller.orderGenerator != null)
Game.controller.orderGenerator.Render();
lineRenderer.Flush();
spriteRenderer.Flush();
}
public void DrawSelectionBox(Actor selectedUnit, Color c, bool drawHealthBar) public void DrawSelectionBox(Actor selectedUnit, Color c, bool drawHealthBar)
{ {
var bounds = selectedUnit.Bounds; var bounds = selectedUnit.Bounds;
@@ -133,8 +137,7 @@ namespace OpenRa.Game.Graphics
if (selectedUnit.Owner == Game.LocalPlayer) if (selectedUnit.Owner == Game.LocalPlayer)
{ {
DrawPips(selectedUnit, xY); DrawPips(selectedUnit, xY);
DrawTags(selectedUnit, DrawTags(selectedUnit, new float2(.5f * (bounds.Left + bounds.Right ), xy.Y));
new float2(.5f * (bounds.Left + bounds.Right ), xy.Y));
} }
} }

View File

@@ -10,10 +10,11 @@ namespace OpenRa.Game
static ISoundEngine soundEngine; static ISoundEngine soundEngine;
static Cache<string, ISoundSource> sounds; static Cache<string, ISoundSource> sounds;
static ISound music; static ISound music;
//TODO: read these from somewhere? //TODO: read these from somewhere?
static float soundVolume; static float soundVolume;
static float musicVolume; static float musicVolume;
static bool paused;
static ISoundSource LoadSound(string filename) static ISoundSource LoadSound(string filename)
{ {
@@ -51,22 +52,30 @@ namespace OpenRa.Game
music.Volume = musicVolume; music.Volume = musicVolume;
} }
public static void Pause(bool doPause) public static bool Paused
{ {
soundEngine.SetAllSoundsPaused(doPause); get { return paused; }
set { paused = value; soundEngine.SetAllSoundsPaused(paused); }
} }
public static void SetVolume(float vol) public static float Volume
{ {
soundVolume = vol; get { return soundVolume; }
soundEngine.SoundVolume = vol; set
{
soundVolume = value;
soundEngine.SoundVolume = value;
}
} }
public static void SetMusicVolume(float vol) public static float MusicVolume
{ {
musicVolume = vol; get { return musicVolume; }
set {
musicVolume = value;
if (music != null) if (music != null)
music.Volume = vol; music.Volume = value;
}
} }
public static void SeekMusic(uint delta) public static void SeekMusic(uint delta)