Skip to content
Browse files

画像ファイル名を定数として定義

  • Loading branch information...
1 parent ab57784 commit 20586415ff2806dabc9455fbd48b1e3cbedc748e @hirekoke committed Dec 22, 2011
View
9 src/PitchPitch/Constants.cs
@@ -16,6 +16,15 @@ class Constants
public const string Dirname_Sound = "se";
#endregion
+ #region 画像ファイル名
+ public const string Filename_LifeImage = "life.png";
+ public const string Filename_CursorImage = "cursor.png";
+ public const string Filename_ExplosionImage = "explosion.png";
+ public const string Filename_GameoverImage = "gameover.png";
+ public const string Filename_TitleLogoImage = "logo.png";
+ public const string Filename_PlayerImage = "player-{0}.png";
+ #endregion
+
#region 色
public static readonly Color Color_Transition = Color.Black;
public static readonly Color Color_Foreground = Color.Black;
View
54 src/PitchPitch/Properties/Resources.Designer.cs
@@ -133,6 +133,24 @@ internal class Resources {
}
/// <summary>
+ /// music.png に類似しているローカライズされた文字列を検索します。
+ /// </summary>
+ internal static string Filename_MusicLogImage {
+ get {
+ return ResourceManager.GetString("Filename_MusicLogImage", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// music.txt に類似しているローカライズされた文字列を検索します。
+ /// </summary>
+ internal static string Filename_MusicLogText {
+ get {
+ return ResourceManager.GetString("Filename_MusicLogText", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// mplus-2c-black.ttf に類似しているローカライズされた文字列を検索します。
/// </summary>
internal static string Font_DefaultP {
@@ -358,6 +376,24 @@ internal class Resources {
}
/// <summary>
+ /// ↓ に類似しているローカライズされた文字列を検索します。
+ /// </summary>
+ internal static string Str_DownArrow {
+ get {
+ return ResourceManager.GetString("Str_DownArrow", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// ← に類似しているローカライズされた文字列を検索します。
+ /// </summary>
+ internal static string Str_LeftArrow {
+ get {
+ return ResourceManager.GetString("Str_LeftArrow", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// HP に類似しているローカライズされた文字列を検索します。
/// </summary>
internal static string Str_Life {
@@ -430,6 +466,15 @@ internal class Resources {
}
/// <summary>
+ /// → に類似しているローカライズされた文字列を検索します。
+ /// </summary>
+ internal static string Str_RightArrow {
+ get {
+ return ResourceManager.GetString("Str_RightArrow", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// : に類似しているローカライズされた文字列を検索します。
/// </summary>
internal static string Str_Separator {
@@ -439,6 +484,15 @@ internal class Resources {
}
/// <summary>
+ /// ↑ に類似しているローカライズされた文字列を検索します。
+ /// </summary>
+ internal static string Str_UpArrow {
+ get {
+ return ResourceManager.GetString("Str_UpArrow", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Pitch Pitch に類似しているローカライズされた文字列を検索します。
/// </summary>
internal static string WindowTitle {
View
24 src/PitchPitch/Properties/Resources.resx
@@ -149,6 +149,14 @@
<value>注意: このゲームでは酸欠・喉の痛み・頭痛が発生することがあります</value>
<comment>説明文字列</comment>
</data>
+ <data name="Filename_MusicLogImage" xml:space="preserve">
+ <value>music.png</value>
+ <comment>ファイル名</comment>
+ </data>
+ <data name="Filename_MusicLogText" xml:space="preserve">
+ <value>music.txt</value>
+ <comment>ファイル名</comment>
+ </data>
<data name="Font_DefaultP" xml:space="preserve">
<value>mplus-2c-black.ttf</value>
<comment>フォント-デフォルトプロフォーショナル</comment>
@@ -249,6 +257,14 @@
<value>距離</value>
<comment>文字列</comment>
</data>
+ <data name="Str_DownArrow" xml:space="preserve">
+ <value>↓</value>
+ <comment>文字列</comment>
+ </data>
+ <data name="Str_LeftArrow" xml:space="preserve">
+ <value>←</value>
+ <comment>文字列</comment>
+ </data>
<data name="Str_Life" xml:space="preserve">
<value>HP</value>
<comment>文字列</comment>
@@ -281,10 +297,18 @@
<value>高さ</value>
<comment>文字列</comment>
</data>
+ <data name="Str_RightArrow" xml:space="preserve">
+ <value>→</value>
+ <comment>文字列</comment>
+ </data>
<data name="Str_Separator" xml:space="preserve">
<value>: </value>
<comment>文字列</comment>
</data>
+ <data name="Str_UpArrow" xml:space="preserve">
+ <value>↑</value>
+ <comment>文字列</comment>
+ </data>
<data name="WindowTitle" xml:space="preserve">
<value>Pitch Pitch</value>
<comment>表示するウィンドウのタイトル</comment>
View
2 src/PitchPitch/ResourceManager.cs
@@ -184,7 +184,7 @@ public static AnimatedSprite CursorGraphic
{
if (_cursorGraphic == null)
{
- SurfaceCollection tmp = LoadSurfaces("cursor.png", new Size(24, 28));
+ SurfaceCollection tmp = LoadSurfaces(Constants.Filename_CursorImage, new Size(24, 28));
AnimationCollection anim = new AnimationCollection();
anim.Add(tmp, 100, true);
anim.AlphaBlending = true;
View
4 src/PitchPitch/gameobj/Player.cs
@@ -222,10 +222,10 @@ protected virtual void loadImages()
System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
int[] tmp = { 0, 1, 2 };
- _playerSurfaces = ResourceManager.LoadSurfaces(Array.ConvertAll<int, string>(tmp, (i) => { return string.Format("player-{0}.png", i); }));
+ _playerSurfaces = ResourceManager.LoadSurfaces(Array.ConvertAll<int, string>(tmp, (i) => { return string.Format(Constants.Filename_PlayerImage, i); }));
_playerSurfaces.Add(_playerSurfaces[1]);
- _explosionSurfaces = ResourceManager.LoadSurfaces("explosion.png", new Size(24, 24));
+ _explosionSurfaces = ResourceManager.LoadSurfaces(Constants.Filename_ExplosionImage, new Size(24, 24));
}
public bool Hit(map.Chip chip, PointD pointInView, int chipWidth, int chipHeight)
View
4 src/PitchPitch/map/MapLoader.cs
@@ -402,9 +402,9 @@ private Map loadUserMap(MapInfo info)
{
string dirPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
dirPath = Path.Combine(dirPath, Properties.Resources.Dirname_Config);
- string fpath = Path.Combine(dirPath, "music.png");
+ string fpath = Path.Combine(dirPath, Properties.Resources.Filename_MusicLogImage);
srcBmp.Save(fpath);
- fpath = Path.Combine(dirPath, "music.txt");
+ fpath = Path.Combine(dirPath, Properties.Resources.Filename_MusicLogText);
using (StreamWriter writer = new StreamWriter(fpath, false, Encoding.UTF8))
{
writer.WriteLine("max pitch: {0}", info.MaxPitch);
View
2 src/PitchPitch/scene/SceneGameOver.cs
@@ -44,7 +44,7 @@ public SceneGameOver()
_cursor = ResourceManager.GetColoredCursorGraphic(_foreColor);
- _overImgSurface = ResourceManager.LoadSurface("gameover.png");
+ _overImgSurface = ResourceManager.LoadSurface(Constants.Filename_GameoverImage);
ImageUtil.SetColor(_overImgSurface, _foreColor);
_menuSurfaces = new SurfaceCollection();
View
5 src/PitchPitch/scene/SceneGameStage.cs
@@ -173,9 +173,8 @@ public SceneGameStage(map.Map map)
Key.Escape, Key.R, Key.M, Key.T
};
- #region 画像読み込み
- _lifeSurfaces = ResourceManager.LoadSurfaces("life.png", new Size(30, 32));
- #endregion
+ // 画像読み込み
+ _lifeSurfaces = ResourceManager.LoadSurfaces(Constants.Filename_LifeImage, new Size(30, 32));
#region 配置
_viewRect = new Rectangle(
View
4 src/PitchPitch/scene/SceneMapSelect.cs
@@ -582,8 +582,8 @@ private void drawOctaveSelecting(SdlDotNet.Graphics.Surface s)
_octaveSelectingSurface.Update();
}
- _octaveUpSurface = ResourceManager.SmallPFont.Render("", Constants.Color_Background);
- _octaveDownSurface = ResourceManager.SmallPFont.Render("", Constants.Color_Background);
+ _octaveUpSurface = ResourceManager.SmallPFont.Render(Properties.Resources.Str_UpArrow, Constants.Color_Background);
+ _octaveDownSurface = ResourceManager.SmallPFont.Render(Properties.Resources.Str_DownArrow, Constants.Color_Background);
}
s.Blit(_octaveSelectingSurface, new Point(
View
2 src/PitchPitch/scene/SceneTitle.cs
@@ -110,7 +110,7 @@ protected override void draw(Surface s)
s.Fill(Constants.Color_Background);
if(_titleSurface == null)
- _titleSurface = ResourceManager.LoadSurface("logo.png");
+ _titleSurface = ResourceManager.LoadSurface(Constants.Filename_TitleLogoImage);
s.Blit(_coloredTitleSurface == null ? _titleSurface : _coloredTitleSurface,
new Point((int)(s.Width / 2.0 - _titleSurface.Width / 2.0), 50));

0 comments on commit 2058641

Please sign in to comment.
Something went wrong with that request. Please try again.