mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Fixed some Win7 compat issues
This commit is contained in:
parent
54d5884213
commit
ad1ba70fdd
5 changed files with 31 additions and 17 deletions
|
@ -358,6 +358,8 @@ namespace Beefy.gfx
|
|||
float usePointSize = pointSize;
|
||||
mPath = new String();
|
||||
GetFontPath(fontName, mPath);
|
||||
if (mPath.IsEmpty)
|
||||
return false;
|
||||
|
||||
String fontPath = scope String(mPath);
|
||||
if (pointSize == -1)
|
||||
|
@ -380,7 +382,10 @@ namespace Beefy.gfx
|
|||
|
||||
Font font = new Font();
|
||||
if (!font.Load(path, pointSize))
|
||||
{
|
||||
delete font;
|
||||
return .Err; //TODO: Make proper error
|
||||
}
|
||||
return font;
|
||||
}
|
||||
|
||||
|
|
|
@ -359,20 +359,20 @@ namespace Beefy.theme.dark
|
|||
mHeaderFont.Load("Segoe UI", 11.7f * sScale); //8.8
|
||||
mHeaderFont.AddAlternate("Segoe UI Symbol", 11.7f * sScale);
|
||||
mHeaderFont.AddAlternate("Segoe UI Historic", 11.7f * sScale);
|
||||
mHeaderFont.AddAlternate("Segoe UI Emoji", 11.7f * sScale);
|
||||
mHeaderFont.AddAlternate("Segoe UI Emoji", 11.7f * sScale).IgnoreError();
|
||||
|
||||
mSmallFont.Dispose(true);
|
||||
mSmallFont.Load("Segoe UI", 12.8f * sScale); // 10.0
|
||||
mSmallFont.AddAlternate("Segoe UI Symbol", 12.8f * sScale);
|
||||
mSmallFont.AddAlternate("Segoe UI Historic", 12.8f * sScale);
|
||||
mSmallFont.AddAlternate("Segoe UI Emoji", 12.8f * sScale);
|
||||
mSmallFont.AddAlternate("Segoe UI Emoji", 12.8f * sScale).IgnoreError();
|
||||
|
||||
mSmallBoldFont.Dispose(true);
|
||||
mSmallBoldFont.Dispose(true);
|
||||
mSmallBoldFont.Load("Segoe UI Bold", 12.8f * sScale); // 10.0
|
||||
mSmallBoldFont.AddAlternate("Segoe UI Symbol", 12.8f * sScale);
|
||||
mSmallBoldFont.AddAlternate("Segoe UI Historic", 12.8f * sScale);
|
||||
mSmallBoldFont.AddAlternate("Segoe UI Emoji", 12.8f * sScale);
|
||||
mSmallBoldFont.AddAlternate("Segoe UI Emoji", 12.8f * sScale).IgnoreError();
|
||||
/*mSmallBoldFont.Load(StringAppend!(tempStr, BFApp.sApp.mInstallDir, "fonts/segoeuib.ttf"), 12.8f * sScale); // 10.0
|
||||
mSmallBoldFont.AddAlternate(scope String(BFApp.sApp.mInstallDir, "fonts/segoeui.ttf"), 12.8f * sScale);
|
||||
mSmallBoldFont.AddAlternate(scope String(BFApp.sApp.mInstallDir, "fonts/seguisym.ttf"), 12.8f * sScale);
|
||||
|
|
|
@ -163,7 +163,7 @@ bool FTFont::Load(const StringImpl& fileName, float pointSize)
|
|||
mFaceSize = new FTFontManager::FaceSize();
|
||||
*faceSizePtr = mFaceSize;
|
||||
|
||||
FT_Size ftSize;
|
||||
FT_Size ftSize = NULL;
|
||||
FT_New_Size(mFace->mFTFace, &ftSize);
|
||||
FT_Activate_Size(ftSize);
|
||||
auto error = FT_Set_Char_Size(mFace->mFTFace, 0, (int)(pointSize * 64), 72, 72);
|
||||
|
|
|
@ -31,13 +31,8 @@ USING_NS_BF;
|
|||
|
||||
///
|
||||
|
||||
static void GfxFailed(HRESULT result)
|
||||
{
|
||||
BF_FATAL(StrFormat("DirectX call failed with result %d", result).c_str());
|
||||
}
|
||||
|
||||
#define DXFAILED(check) ((hr = (check)) != 0)
|
||||
#define DXCHECK(check) if ((check) != 0) GfxFailed(check)
|
||||
#define DXCHECK(check) if ((check) != 0) BF_FATAL(StrFormat("DirectX call failed with result 0x%X", check).c_str());
|
||||
|
||||
DXShaderParam::DXShaderParam()
|
||||
{
|
||||
|
@ -1277,10 +1272,21 @@ bool DXRenderDevice::Init(BFApp* app)
|
|||
|
||||
WinBFApp* winApp = (WinBFApp*) app;
|
||||
|
||||
//D3D_FEATURE_LEVEL d3dFeatureLevel;
|
||||
D3D_FEATURE_LEVEL featureLevelArr[] =
|
||||
{
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
D3D_FEATURE_LEVEL_10_1,
|
||||
D3D_FEATURE_LEVEL_10_0,
|
||||
D3D_FEATURE_LEVEL_9_3,
|
||||
D3D_FEATURE_LEVEL_9_2,
|
||||
D3D_FEATURE_LEVEL_9_1,
|
||||
};;
|
||||
|
||||
D3D_FEATURE_LEVEL d3dFeatureLevel = (D3D_FEATURE_LEVEL)0;
|
||||
int flags = 0;
|
||||
//flags = D3D11_CREATE_DEVICE_DEBUG;
|
||||
DXCHECK(D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, flags, NULL, 0, D3D11_SDK_VERSION, &mD3DDevice, NULL, &mD3DDeviceContext));
|
||||
DXCHECK(D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, flags, featureLevelArr, 6, D3D11_SDK_VERSION, &mD3DDevice, &d3dFeatureLevel, &mD3DDeviceContext));
|
||||
OutputDebugStrF("D3D Feature Level: %X\n", d3dFeatureLevel);
|
||||
|
||||
IDXGIDevice* pDXGIDevice = NULL;
|
||||
DXCHECK(mD3DDevice->QueryInterface(__uuidof(IDXGIDevice), reinterpret_cast<void**>(&pDXGIDevice)));
|
||||
|
@ -1482,9 +1488,11 @@ Texture* DXRenderDevice::LoadTexture(ImageData* imageData, int flags)
|
|||
desc.SampleDesc.Count = 1;
|
||||
//desc.Usage = D3D11_USAGE_DYNAMIC;
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
//desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||
|
||||
OutputDebugStrF("Creating texture\n");
|
||||
|
||||
ID3D11Texture2D* d3DTexture = NULL;
|
||||
DXCHECK(mD3DDevice->CreateTexture2D(&desc, &resData, &d3DTexture));
|
||||
|
||||
|
@ -1527,6 +1535,7 @@ Texture* DXRenderDevice::CreateDynTexture(int width, int height)
|
|||
desc.ArraySize = 1;
|
||||
desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
desc.SampleDesc.Count = 1;
|
||||
desc.SampleDesc.Quality = 0;
|
||||
//desc.Usage = D3D11_USAGE_DYNAMIC;
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
|
|
|
@ -10069,8 +10069,8 @@ namespace IDE
|
|||
}
|
||||
else
|
||||
{
|
||||
mTinyCodeFont.AddAlternate(fontName, tinyFontSize);
|
||||
mCodeFont.AddAlternate(fontName, fontSize);
|
||||
mTinyCodeFont.AddAlternate(fontName, tinyFontSize).IgnoreError();
|
||||
mCodeFont.AddAlternate(fontName, fontSize).IgnoreError();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10086,12 +10086,12 @@ namespace IDE
|
|||
mCodeFont.AddAlternate("Segoe UI", fontSize);
|
||||
mCodeFont.AddAlternate("Segoe UI Symbol", fontSize);
|
||||
mCodeFont.AddAlternate("Segoe UI Historic", fontSize);
|
||||
mCodeFont.AddAlternate("Segoe UI Emoji", fontSize);
|
||||
mCodeFont.AddAlternate("Segoe UI Emoji", fontSize).IgnoreError();
|
||||
|
||||
mTinyCodeFont.AddAlternate("Segoe UI", tinyFontSize);
|
||||
mTinyCodeFont.AddAlternate("Segoe UI Symbol", tinyFontSize);
|
||||
mTinyCodeFont.AddAlternate("Segoe UI Historic", tinyFontSize);
|
||||
mTinyCodeFont.AddAlternate("Segoe UI Emoji", tinyFontSize);
|
||||
mTinyCodeFont.AddAlternate("Segoe UI Emoji", tinyFontSize).IgnoreError();
|
||||
|
||||
/*mCodeFont.AddAlternate(new String("fonts/segoeui.ttf"), fontSize);
|
||||
mCodeFont.AddAlternate(new String("fonts/seguisym.ttf"), fontSize);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue