reorganized file structure; texture and fonts now have appropriate folder resolver;

This commit is contained in:
2018-09-16 01:37:48 -05:00
parent 7735445888
commit 539a39e51f
18 changed files with 279 additions and 18 deletions

View File

@@ -0,0 +1,24 @@
using RhythmBullet.Zer01HD.Utilities.ContentSystem;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RhythmBullet.Zer01HD.Game.ContentResolvers
{
class FontContentResolver : IContentResolver
{
readonly ResolutionContentResolver rcr;
public FontContentResolver(ResolutionContentResolver rcr)
{
this.rcr = rcr;
}
public string Load(string assetName)
{
return rcr.Load("fonts/" + assetName);
}
}
}

View File

@@ -0,0 +1,109 @@
using RhythmBullet.Zer01HD.Game.Preferences;
using RhythmBullet.Zer01HD.Utilities;
using RhythmBullet.Zer01HD.Utilities.ContentSystem;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RhythmBullet.Zer01HD.Game.ContentResolvers
{
class ResolutionContentResolver : IContentResolver
{
int width, height;
bool updated;
Resolution bestResolution;
public int Width
{
get
{
return width;
}
set
{
updated = true;
width = value;
}
}
public int Height
{
get
{
return height;
}
set
{
updated = true;
height = value;
}
}
Resolution[] resolutions = {
new Resolution(1920, 1080),
new Resolution(2560, 1440),
new Resolution(3840, 2160)
};
Resolution ChooseRounded()
{
updated = false;
Resolution best = resolutions[0];
int leastDifference = -1;
int w = Width, h = Height;
if (w > h)
{
for (int i = 0; i < resolutions.Length; i++)
{
int currentDiff = h - resolutions[i].Height;
if (currentDiff < 0)
{
currentDiff = currentDiff * -1;
}
if ((currentDiff < leastDifference) || leastDifference == -1)
{
best = resolutions[i];
leastDifference = currentDiff;
}
}
}
else
{
for (int i = 0; i < resolutions.Length; i++)
{
int currentDiff = w - resolutions[i].Width;
if (currentDiff < 0)
{
currentDiff = currentDiff * -1;
}
if (currentDiff < leastDifference || leastDifference == -1)
{
best = resolutions[i];
leastDifference = currentDiff;
}
}
}
return best;
}
public string Load(string path)
{
if (updated)
{
bestResolution = ChooseRounded();
}
return bestResolution + "/" + path;
}
}
}

View File

@@ -1,27 +0,0 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using RhythmBullet.Zer01HD.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RhythmBullet.Zer01HD.Game
{
class LoadingScreen : Screen
{
Texture2D recrown;
public LoadingScreen(Texture2D recrown)
{
this.recrown = recrown;
}
public override void Draw(SpriteBatch spriteBatch)
{
spriteBatch.Draw(recrown, recrown.Bounds, Color.White);
base.Draw(spriteBatch);
}
}
}

View File

@@ -1,5 +1,6 @@
using Microsoft.Xna.Framework.Graphics;
using RhythmBullet.Zer01HD.UI;
using RhythmBullet.Zer01HD.Utilities.UI;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RhythmBullet.Zer01HD.Game.Preferences
{
class Controls
{
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RhythmBullet.Zer01HD.Game.Preferences
{
class General
{
public Resolution Resolution;
public bool Fullscreen;
public float MusicVolume;
public float FXVolume;
}
}