mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-10-01 15:46:17 -04:00
Fixed project settings. Started adding ui button logic
This commit is contained in:
parent
ca79787832
commit
b693f799ed
@ -24,8 +24,12 @@ namespace OpenDiablo2.Common
|
||||
// --- Fonts ---
|
||||
public static string Font8 = "data\\local\\font\\latin\\font8";
|
||||
public static string Font16 = "data\\local\\font\\latin\\font16";
|
||||
public static string Font24 = "data\\local\\font\\latin\\font24";
|
||||
public static string FontFormal12 = "data\\local\\font\\latin\\fontformal12";
|
||||
public static string FontFormal10 = "data\\local\\font\\latin\\fontformal10";
|
||||
|
||||
// --- UI ---
|
||||
public static string WideButtonBlank = "data\\global\\ui\\FrontEnd\\WideButtonBlank.dc6";
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Autofac;
|
||||
using OpenDiablo2.Common.Interfaces;
|
||||
using OpenDiablo2.Core.UI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -18,6 +19,8 @@ namespace OpenDiablo2.Core
|
||||
|
||||
builder.RegisterType<GameEngine>().AsImplementedInterfaces().SingleInstance();
|
||||
builder.RegisterType<MPQProvider>().As<IMPQProvider>().SingleInstance();
|
||||
|
||||
builder.RegisterType<WideButton>().AsSelf().InstancePerRequest();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -76,6 +76,7 @@
|
||||
<Compile Include="GameEngine.cs" />
|
||||
<Compile Include="MPQProvider.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="UI\WideButton.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OpenDiablo2.Common\OpenDiablo2.Common.csproj">
|
||||
|
60
OpenDiablo2.Core/UI/WideButton.cs
Normal file
60
OpenDiablo2.Core/UI/WideButton.cs
Normal file
@ -0,0 +1,60 @@
|
||||
using OpenDiablo2.Common;
|
||||
using OpenDiablo2.Common.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OpenDiablo2.Core.UI
|
||||
{
|
||||
public sealed class WideButton
|
||||
{
|
||||
private readonly IMouseInfoProvider mouseInfoProvider;
|
||||
private readonly IRenderWindow renderWindow;
|
||||
|
||||
public delegate void OnActivateDelegate();
|
||||
public OnActivateDelegate OnActivate { get; set; }
|
||||
public Point Position { get; set; } = new Point();
|
||||
|
||||
ISprite sprite;
|
||||
IFont font;
|
||||
ILabel label;
|
||||
|
||||
private string text;
|
||||
public string Text
|
||||
{
|
||||
get => text;
|
||||
set
|
||||
{
|
||||
text = value;
|
||||
UpdateText();
|
||||
}
|
||||
}
|
||||
|
||||
public WideButton(IRenderWindow renderWindow, IMouseInfoProvider mouseInfoProvider)
|
||||
{
|
||||
this.renderWindow = renderWindow;
|
||||
this.mouseInfoProvider = mouseInfoProvider;
|
||||
|
||||
sprite = renderWindow.LoadSprite(ResourcePaths.WideButtonBlank, Palettes.Act1);
|
||||
font = renderWindow.LoadFont(ResourcePaths.Font24, Palettes.Static);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void UpdateText()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -24,7 +24,7 @@ namespace OpenDiablo2.Scenes
|
||||
private readonly IMusicProvider musicProvider;
|
||||
|
||||
private float logoFrame;
|
||||
private ISprite backgroundSprite, diabloLogoLeft, diabloLogoRight, diabloLogoLeftBlack, diabloLogoRightBlack, wideButton;
|
||||
private ISprite backgroundSprite, diabloLogoLeft, diabloLogoRight, diabloLogoLeftBlack, diabloLogoRightBlack;
|
||||
private IFont labelFont;
|
||||
private ILabel versionLabel, urlLabel;
|
||||
|
||||
@ -47,7 +47,7 @@ namespace OpenDiablo2.Scenes
|
||||
diabloLogoLeftBlack = renderWindow.LoadSprite(ResourcePaths.Diablo2LogoBlackLeft, Palettes.Units, new Point(400, 120));
|
||||
diabloLogoRightBlack = renderWindow.LoadSprite(ResourcePaths.Diablo2LogoBlackRight, Palettes.Units, new Point(400, 120));
|
||||
|
||||
wideButton = renderWindow.LoadSprite("data\\global\\ui\\FrontEnd\\WideButtonBlank.dc6", "ACT1");
|
||||
|
||||
|
||||
labelFont = renderWindow.LoadFont(ResourcePaths.Font16, Palettes.Static);
|
||||
versionLabel = renderWindow.CreateLabel(labelFont, new Point(50, 555), "v0.01 Pre-Alpha");
|
||||
@ -83,18 +83,18 @@ namespace OpenDiablo2.Scenes
|
||||
renderWindow.Draw(backgroundSprite, 4, 3, 0);
|
||||
|
||||
// Render the flaming diablo 2 logo
|
||||
renderWindow.Draw(diabloLogoLeftBlack, (int)((float)diabloLogoLeftBlack.TotalFrames * logoFrame));
|
||||
renderWindow.Draw(diabloLogoRightBlack, (int)((float)diabloLogoRightBlack.TotalFrames * logoFrame));
|
||||
renderWindow.Draw(diabloLogoLeft, (int)((float)diabloLogoLeft.TotalFrames * logoFrame));
|
||||
renderWindow.Draw(diabloLogoRight, (int)((float)diabloLogoRight.TotalFrames * logoFrame));
|
||||
renderWindow.Draw(diabloLogoLeftBlack, (int)(diabloLogoLeftBlack.TotalFrames * logoFrame));
|
||||
renderWindow.Draw(diabloLogoRightBlack, (int)(diabloLogoRightBlack.TotalFrames * logoFrame));
|
||||
renderWindow.Draw(diabloLogoLeft, (int)(diabloLogoLeft.TotalFrames * logoFrame));
|
||||
renderWindow.Draw(diabloLogoRight, (int)(diabloLogoRight.TotalFrames * logoFrame));
|
||||
|
||||
// Render the text
|
||||
renderWindow.Draw(versionLabel);
|
||||
renderWindow.Draw(urlLabel);
|
||||
|
||||
// Render the UI buttons
|
||||
wideButton.Location = new Point(264, 290);
|
||||
renderWindow.Draw(wideButton, 2, 1, 0);
|
||||
//wideButton.Location = new Point(264, 290);
|
||||
//renderWindow.Draw(wideButton, 2, 1, 0);
|
||||
}
|
||||
|
||||
public void Update(long ms)
|
||||
|
@ -30,6 +30,24 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=4.8.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.4.8.1\lib\net45\Autofac.dll</HintPath>
|
||||
|
@ -15,50 +15,28 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenDiablo2.Scenes", "OpenD
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2B0CF1AC-06DD-4322-AE8B-FF8A8C70A3CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2B0CF1AC-06DD-4322-AE8B-FF8A8C70A3CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2B0CF1AC-06DD-4322-AE8B-FF8A8C70A3CD}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{2B0CF1AC-06DD-4322-AE8B-FF8A8C70A3CD}.Debug|x64.Build.0 = Debug|x64
|
||||
{2B0CF1AC-06DD-4322-AE8B-FF8A8C70A3CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2B0CF1AC-06DD-4322-AE8B-FF8A8C70A3CD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2B0CF1AC-06DD-4322-AE8B-FF8A8C70A3CD}.Release|x64.ActiveCfg = Release|x64
|
||||
{2B0CF1AC-06DD-4322-AE8B-FF8A8C70A3CD}.Release|x64.Build.0 = Release|x64
|
||||
{B743160E-A0BB-45DC-9998-967A85E50562}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B743160E-A0BB-45DC-9998-967A85E50562}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B743160E-A0BB-45DC-9998-967A85E50562}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B743160E-A0BB-45DC-9998-967A85E50562}.Debug|x64.Build.0 = Debug|x64
|
||||
{B743160E-A0BB-45DC-9998-967A85E50562}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B743160E-A0BB-45DC-9998-967A85E50562}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B743160E-A0BB-45DC-9998-967A85E50562}.Release|x64.ActiveCfg = Release|x64
|
||||
{B743160E-A0BB-45DC-9998-967A85E50562}.Release|x64.Build.0 = Release|x64
|
||||
{8FC6BF7D-835A-47C1-A6B2-125495FA0900}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8FC6BF7D-835A-47C1-A6B2-125495FA0900}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8FC6BF7D-835A-47C1-A6B2-125495FA0900}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{8FC6BF7D-835A-47C1-A6B2-125495FA0900}.Debug|x64.Build.0 = Debug|x64
|
||||
{8FC6BF7D-835A-47C1-A6B2-125495FA0900}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8FC6BF7D-835A-47C1-A6B2-125495FA0900}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8FC6BF7D-835A-47C1-A6B2-125495FA0900}.Release|x64.ActiveCfg = Release|x64
|
||||
{8FC6BF7D-835A-47C1-A6B2-125495FA0900}.Release|x64.Build.0 = Release|x64
|
||||
{1F8731D5-393B-4561-9CEA-887A2F466576}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1F8731D5-393B-4561-9CEA-887A2F466576}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1F8731D5-393B-4561-9CEA-887A2F466576}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{1F8731D5-393B-4561-9CEA-887A2F466576}.Debug|x64.Build.0 = Debug|x64
|
||||
{1F8731D5-393B-4561-9CEA-887A2F466576}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1F8731D5-393B-4561-9CEA-887A2F466576}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1F8731D5-393B-4561-9CEA-887A2F466576}.Release|x64.ActiveCfg = Release|x64
|
||||
{1F8731D5-393B-4561-9CEA-887A2F466576}.Release|x64.Build.0 = Release|x64
|
||||
{05224FE7-293F-4184-B1D6-89F5171B60E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{05224FE7-293F-4184-B1D6-89F5171B60E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{05224FE7-293F-4184-B1D6-89F5171B60E0}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{05224FE7-293F-4184-B1D6-89F5171B60E0}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{05224FE7-293F-4184-B1D6-89F5171B60E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{05224FE7-293F-4184-B1D6-89F5171B60E0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{05224FE7-293F-4184-B1D6-89F5171B60E0}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{05224FE7-293F-4184-B1D6-89F5171B60E0}.Debug|x64.Build.0 = Debug|x64
|
||||
{05224FE7-293F-4184-B1D6-89F5171B60E0}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{05224FE7-293F-4184-B1D6-89F5171B60E0}.Release|x64.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
|
Loading…
Reference in New Issue
Block a user