Fix few bugs from last commit

This commit is contained in:
UnknownShadow200 2018-06-01 19:45:49 +10:00
parent ca5d0899fd
commit 4618df5331
3 changed files with 4 additions and 6 deletions

View File

@ -96,7 +96,7 @@ namespace ClassicalSharp {
public Texture MakeTextTexture(ref DrawTextArgs args, int windowX, int windowY) { public Texture MakeTextTexture(ref DrawTextArgs args, int windowX, int windowY) {
Size size = MeasureSize(ref args); Size size = MeasureSize(ref args);
if (size == Size.Empty) if (size == Size.Empty)
return new Texture(-1, windowX, windowY, 0, 0, 1, 1); return new Texture(0, windowX, windowY, 0, 0, 1, 1);
using (Bitmap bmp = CreatePow2Bitmap(size)) { using (Bitmap bmp = CreatePow2Bitmap(size)) {
SetBitmap(bmp); SetBitmap(bmp);

View File

@ -56,7 +56,6 @@
<DefineConstants>DEBUG;TRACE;USE_DX;</DefineConstants> <DefineConstants>DEBUG;TRACE;USE_DX;</DefineConstants>
<StartAction>Project</StartAction> <StartAction>Project</StartAction>
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath> <BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
<StartArguments>unk aa 127.0.0.1 25566</StartArguments>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release_D3D' "> <PropertyGroup Condition=" '$(Configuration)' == 'Release_D3D' ">
<OutputPath>..\output\release\</OutputPath> <OutputPath>..\output\release\</OutputPath>

View File

@ -23,14 +23,13 @@ namespace ClassicalSharp.Textures {
} }
public static int LoadTile(int texLoc) { public static int LoadTile(int texLoc) {
int size = TileSize; int size = TileSize, x = texLoc % TilesPerRow, y = texLoc / TilesPerRow;
if (y >= RowsCount) return 0;
using (FastBitmap atlas = new FastBitmap(Atlas, true, true)) using (FastBitmap atlas = new FastBitmap(Atlas, true, true))
using (Bitmap bmp = Platform.CreateBmp(size, size)) using (Bitmap bmp = Platform.CreateBmp(size, size))
using (FastBitmap dst = new FastBitmap(bmp, true, false)) using (FastBitmap dst = new FastBitmap(bmp, true, false))
{ {
int x = texLoc % TilesPerRow, y = texLoc / TilesPerRow;
y %= RowsCount;
FastBitmap.MovePortion(x * size, y * size, 0, 0, atlas, dst, size); FastBitmap.MovePortion(x * size, y * size, 0, 0, atlas, dst, size);
return game.Graphics.CreateTexture(dst, false, game.Graphics.Mipmaps); return game.Graphics.CreateTexture(dst, false, game.Graphics.Mipmaps);
} }