Skip to content

Commit

Permalink
new buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
duchuule committed Jul 9, 2015
1 parent 3f40740 commit 9121659
Show file tree
Hide file tree
Showing 40 changed files with 237 additions and 123 deletions.
Binary file added Assets/Direct3D/divider.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_a_button.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_a_button_color.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_a_button_gbasp.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_b_button.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_b_button_color.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_b_button_gbasp.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_combo_button.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_combo_button_color.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_combo_button_gbasp.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_cross.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_cross_color.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_cross_gbasp.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_l_button.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_l_button_color.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_l_button_gbasp.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_r_button.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_r_button_color.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_r_button_gbasp.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_select.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_select_color.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_select_gbasp.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_start.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_start_color.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_start_gbasp.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_turbo_button.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_turbo_button_color.dds
Binary file not shown.
Binary file added Assets/Direct3D/pad_turbo_button_gbasp.dds
Binary file not shown.
Binary file added Assets/Direct3D/resumetext.dds
Binary file not shown.
Binary file added Assets/Direct3D/thumbstick.dds
Binary file not shown.
Binary file added Assets/Direct3D/thumbstick_color.dds
Binary file not shown.
Binary file added Assets/Direct3D/thumbstick_gbasp.dds
Binary file not shown.
Binary file added Assets/Direct3D/thumbstickcenter.dds
Binary file not shown.
99 changes: 73 additions & 26 deletions EmulatorRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,36 @@
#include "TextureLoader.h"


#define CROSS_TEXTURE_FILE_NAME L"Assets/pad_cross.dds"
#define BUTTONS_TEXTURE_FILE_NAME L"Assets/pad_buttons.dds"
#define SS_TEXTURE_FILE_NAME L"Assets/pad_start_select.dds"
#define L_TEXTURE_FILE_NAME L"Assets/pad_l_button.dds"
#define R_TEXTURE_FILE_NAME L"Assets/pad_r_button.dds"
#define STICK_TEXTURE_FILE_NAME L"Assets/ThumbStick.dds"
#define STICK_CENTER_TEXTURE_FILE_NAME L"Assets/ThumbStickCenter.dds"
#define CROSS_TEXTURE_FILE_NAME L"Assets/Direct3D/pad_cross.dds"
#define START_TEXTURE_FILE_NAME L"Assets/Direct3D/pad_start.dds"
#define SELECT_TEXTURE_FILE_NAME L"Assets/Direct3D/pad_select.dds"
#define A_TEXTURE_FILE_NAME L"Assets/Direct3D/pad_a_button.dds"
#define B_TEXTURE_FILE_NAME L"Assets/Direct3D/pad_b_button.dds"
#define L_TEXTURE_FILE_NAME L"Assets/Direct3D/pad_l_button.dds"
#define R_TEXTURE_FILE_NAME L"Assets/Direct3D/pad_r_button.dds"
#define STICK_TEXTURE_FILE_NAME L"Assets/Direct3D/thumbstick.dds"
#define STICK_CENTER_TEXTURE_FILE_NAME L"Assets/Direct3D/thumbstickcenter.dds"

#define CROSS_COLOR_TEXTURE_FILE_NAME L"Assets/Direct3D/pad_cross_color.dds"
#define START_COLOR_TEXTURE_FILE_NAME L"Assets/Direct3D/pad_start_color.dds"
#define SELECT_COLOR_TEXTURE_FILE_NAME L"Assets/Direct3D/pad_select_color.dds"
#define A_COLOR_TEXTURE_FILE_NAME L"Assets/Direct3D/pad_a_button_color.dds"
#define B_COLOR_TEXTURE_FILE_NAME L"Assets/Direct3D/pad_b_button_color.dds"
#define L_COLOR_TEXTURE_FILE_NAME L"Assets/Direct3D/pad_l_button_color.dds"
#define R_COLOR_TEXTURE_FILE_NAME L"Assets/Direct3D/pad_r_button_color.dds"
#define STICK_COLOR_TEXTURE_FILE_NAME L"Assets/Direct3D/thumbstick_color.dds"

#define CROSS_GBASP_TEXTURE_FILE_NAME L"Assets/Direct3D/pad_cross_gbasp.dds"
#define START_GBASP_TEXTURE_FILE_NAME L"Assets/Direct3D/pad_start_gbasp.dds"
#define SELECT_GBASP_TEXTURE_FILE_NAME L"Assets/Direct3D/pad_select_gbasp.dds"
#define A_GBASP_TEXTURE_FILE_NAME L"Assets/Direct3D/pad_a_button_gbasp.dds"
#define B_GBASP_TEXTURE_FILE_NAME L"Assets/Direct3D/pad_b_button_gbasp.dds"
#define L_GBASP_TEXTURE_FILE_NAME L"Assets/Direct3D/pad_l_button_gbasp.dds"
#define R_GBASP_TEXTURE_FILE_NAME L"Assets/Direct3D/pad_r_button_gbasp.dds"
#define STICK_GBASP_TEXTURE_FILE_NAME L"Assets/Direct3D/thumbstick_gbasp.dds"

#define DIVIDER_TEXTURE_FILE_NAME L"Assets/Direct3D/divider.dds"


#define AUTOSAVE_INTERVAL 10.0f

Expand Down Expand Up @@ -145,7 +168,7 @@ namespace VBA10

LoadTextureFromFile(
m_deviceResources->GetD3DDevice(),
STICK_TEXTURE_FILE_NAME,
STICK_GBASP_TEXTURE_FILE_NAME,
this->stickResource.GetAddressOf(),
this->stickSRV.GetAddressOf()
);
Expand All @@ -159,24 +182,39 @@ namespace VBA10

LoadTextureFromFile(
m_deviceResources->GetD3DDevice(),
CROSS_TEXTURE_FILE_NAME,
CROSS_GBASP_TEXTURE_FILE_NAME,
this->crossResource.GetAddressOf(),
this->crossSRV.GetAddressOf()
);

LoadTextureFromFile(
m_deviceResources->GetD3DDevice(),
BUTTONS_TEXTURE_FILE_NAME,
this->buttonsResource.GetAddressOf(),
this->buttonsSRV.GetAddressOf()
A_GBASP_TEXTURE_FILE_NAME,
this->aResource.GetAddressOf(),
this->aSRV.GetAddressOf()
);

LoadTextureFromFile(
m_deviceResources->GetD3DDevice(),
B_GBASP_TEXTURE_FILE_NAME,
this->bResource.GetAddressOf(),
this->bSRV.GetAddressOf()
);

LoadTextureFromFile(
m_deviceResources->GetD3DDevice(),
SS_TEXTURE_FILE_NAME,
this->startSelectResource.GetAddressOf(),
this->startSelectSRV.GetAddressOf()
START_GBASP_TEXTURE_FILE_NAME,
this->startResource.GetAddressOf(),
this->startSRV.GetAddressOf()
);

LoadTextureFromFile(
m_deviceResources->GetD3DDevice(),
SELECT_GBASP_TEXTURE_FILE_NAME,
this->selectResource.GetAddressOf(),
this->selectSRV.GetAddressOf()
);


LoadTextureFromFile(
m_deviceResources->GetD3DDevice(),
Expand Down Expand Up @@ -587,9 +625,11 @@ namespace VBA10
source.bottom = 144;
}

this->controller->GetButtonsRectangle(&buttonsRectangle);
this->controller->GetARectangle(&aRectangle);
this->controller->GetBRectangle(&bRectangle);
this->controller->GetCrossRectangle(&crossRectangle);
this->controller->GetStartSelectRectangle(&startSelectRectangle);
this->controller->GetStartRectangle(&startRectangle);
this->controller->GetSelectRectangle(&selectRectangle);
this->controller->GetLRectangle(&lRectangle);
this->controller->GetRRectangle(&rRectangle);

Expand All @@ -614,11 +654,15 @@ namespace VBA10

if(TouchControlsEnabled())
{
Engine::Rectangle buttonsRect (this->buttonsRectangle.left, this->buttonsRectangle.top, this->buttonsRectangle.right - this->buttonsRectangle.left, this->buttonsRectangle.bottom - this->buttonsRectangle.top);

Engine::Rectangle aRect (this->aRectangle.left, this->aRectangle.top, this->aRectangle.right - this->aRectangle.left, this->aRectangle.bottom - this->aRectangle.top);
ComPtr<ID3D11Texture2D> tex;
this->buttonsResource.As(&tex);
this->dxSpriteBatch->Draw(buttonsRect, this->buttonsSRV.Get(), tex.Get(), color);
this->aResource.As(&tex);
this->dxSpriteBatch->Draw(aRect, this->aSRV.Get(), tex.Get(), color);

Engine::Rectangle bRect(this->bRectangle.left, this->bRectangle.top, this->bRectangle.right - this->bRectangle.left, this->bRectangle.bottom - this->bRectangle.top);
ComPtr<ID3D11Texture2D> tex2;
this->bResource.As(&tex2);
this->dxSpriteBatch->Draw(bRect, this->bSRV.Get(), tex2.Get(), color);

int dpad = EmulatorSettings::Current->DPadStyle;
if(dpad == 0)
Expand Down Expand Up @@ -647,12 +691,15 @@ namespace VBA10
this->dxSpriteBatch->Draw(stickRectE, this->stickSRV.Get(), tex.Get(), color);
}

Engine::Rectangle startSelectRectE (startSelectRectangle.left, startSelectRectangle.top, startSelectRectangle.right - startSelectRectangle.left, startSelectRectangle.bottom - startSelectRectangle.top);

ComPtr<ID3D11Texture2D> texSS;
this->startSelectResource.As(&texSS);
Engine::Rectangle startRectE (startRectangle.left, startRectangle.top, startRectangle.right - startRectangle.left, startRectangle.bottom - startRectangle.top);
ComPtr<ID3D11Texture2D> texStart;
this->startResource.As(&texStart);
this->dxSpriteBatch->Draw(startRectE, this->startSRV.Get(), texStart.Get(), color);

this->dxSpriteBatch->Draw(startSelectRectE, this->startSelectSRV.Get(), texSS.Get(), color);
Engine::Rectangle selectRectE(selectRectangle.left, selectRectangle.top, selectRectangle.right - selectRectangle.left, selectRectangle.bottom - selectRectangle.top);
ComPtr<ID3D11Texture2D> texSelect;
this->selectResource.As(&texSelect);
this->dxSpriteBatch->Draw(selectRectE, this->selectSRV.Get(), texSelect.Get(), color);

if(gbaROMLoaded)
{
Expand Down
18 changes: 12 additions & 6 deletions EmulatorRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ namespace VBA10

GameTime ^gameTime;
VirtualControllerInput *controller;
RECT buttonsRectangle;
RECT aRectangle;
RECT bRectangle;
RECT crossRectangle;
RECT startSelectRectangle;
RECT startRectangle;
RECT selectRectangle;
RECT lRectangle;
RECT rRectangle;

Expand All @@ -75,10 +77,14 @@ namespace VBA10
ComPtr<ID3D11ShaderResourceView> stickSRV;
ComPtr<ID3D11Resource> crossResource;
ComPtr<ID3D11ShaderResourceView> crossSRV;
ComPtr<ID3D11Resource> buttonsResource;
ComPtr<ID3D11ShaderResourceView> buttonsSRV;
ComPtr<ID3D11Resource> startSelectResource;
ComPtr<ID3D11ShaderResourceView> startSelectSRV;
ComPtr<ID3D11Resource> aResource;
ComPtr<ID3D11ShaderResourceView> aSRV;
ComPtr<ID3D11Resource> bResource;
ComPtr<ID3D11ShaderResourceView> bSRV;
ComPtr<ID3D11Resource> startResource;
ComPtr<ID3D11ShaderResourceView> startSRV;
ComPtr<ID3D11Resource> selectResource;
ComPtr<ID3D11ShaderResourceView> selectSRV;
ComPtr<ID3D11Resource> lButtonResource;
ComPtr<ID3D11ShaderResourceView> lButtonSRV;
ComPtr<ID3D11Resource> rButtonResource;
Expand Down
2 changes: 1 addition & 1 deletion TextureLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using namespace Microsoft::WRL;
void LoadTextureFromFile(ID3D11Device1 *device, const wchar_t *filename, ID3D11Resource **texture, ID3D11ShaderResourceView **textureSRV)
{
FILE *file;
if(_wfopen_s(&file, filename, L"r") != 0)
if(_wfopen_s(&file, filename, L"rb") != 0)
{
return;
}
Expand Down
33 changes: 33 additions & 0 deletions VBA10.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,39 @@
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<Image Include="Assets\Direct3D\divider.dds" />
<Image Include="Assets\Direct3D\pad_a_button.dds" />
<Image Include="Assets\Direct3D\pad_a_button_color.dds" />
<Image Include="Assets\Direct3D\pad_a_button_gbasp.dds" />
<Image Include="Assets\Direct3D\pad_b_button.dds" />
<Image Include="Assets\Direct3D\pad_b_button_color.dds" />
<Image Include="Assets\Direct3D\pad_b_button_gbasp.dds" />
<Image Include="Assets\Direct3D\pad_combo_button.dds" />
<Image Include="Assets\Direct3D\pad_combo_button_color.dds" />
<Image Include="Assets\Direct3D\pad_combo_button_gbasp.dds" />
<Image Include="Assets\Direct3D\pad_cross.dds" />
<Image Include="Assets\Direct3D\pad_cross_color.dds" />
<Image Include="Assets\Direct3D\pad_cross_gbasp.dds" />
<Image Include="Assets\Direct3D\pad_l_button.dds" />
<Image Include="Assets\Direct3D\pad_l_button_color.dds" />
<Image Include="Assets\Direct3D\pad_l_button_gbasp.dds" />
<Image Include="Assets\Direct3D\pad_r_button.dds" />
<Image Include="Assets\Direct3D\pad_r_button_color.dds" />
<Image Include="Assets\Direct3D\pad_r_button_gbasp.dds" />
<Image Include="Assets\Direct3D\pad_select.dds" />
<Image Include="Assets\Direct3D\pad_select_color.dds" />
<Image Include="Assets\Direct3D\pad_select_gbasp.dds" />
<Image Include="Assets\Direct3D\pad_start.dds" />
<Image Include="Assets\Direct3D\pad_start_color.dds" />
<Image Include="Assets\Direct3D\pad_start_gbasp.dds" />
<Image Include="Assets\Direct3D\pad_turbo_button.dds" />
<Image Include="Assets\Direct3D\pad_turbo_button_color.dds" />
<Image Include="Assets\Direct3D\pad_turbo_button_gbasp.dds" />
<Image Include="Assets\Direct3D\resumetext.dds" />
<Image Include="Assets\Direct3D\thumbstick.dds" />
<Image Include="Assets\Direct3D\thumbstickcenter.dds" />
<Image Include="Assets\Direct3D\thumbstick_color.dds" />
<Image Include="Assets\Direct3D\thumbstick_gbasp.dds" />
<Image Include="Assets\Logo.scale-100.png" />
<Image Include="Assets\no_snapshot.png" />
<Image Include="Assets\pad_buttons.dds" />
Expand Down
102 changes: 102 additions & 0 deletions VBA10.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
<Filter Include="Database">
<UniqueIdentifier>{e127113f-af0f-4a5b-ba6a-b82e7a446ca4}</UniqueIdentifier>
</Filter>
<Filter Include="Assets\Direct3D">
<UniqueIdentifier>{5714a47e-204a-4cb0-b924-59d08eaefc07}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml" />
Expand Down Expand Up @@ -615,5 +618,104 @@
<Image Include="Assets\SmallTile.scale-100.png">
<Filter>Assets</Filter>
</Image>
<Image Include="Assets\Direct3D\divider.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_a_button.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_a_button_color.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_a_button_gbasp.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_b_button.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_b_button_color.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_b_button_gbasp.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_combo_button.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_combo_button_color.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_combo_button_gbasp.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_cross.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_cross_color.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_cross_gbasp.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_l_button.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_l_button_color.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_l_button_gbasp.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_r_button.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_r_button_color.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_r_button_gbasp.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_select.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_select_color.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_select_gbasp.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_start.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_start_color.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_start_gbasp.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_turbo_button.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_turbo_button_color.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\pad_turbo_button_gbasp.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\resumetext.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\thumbstick.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\thumbstick_color.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\thumbstick_gbasp.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
<Image Include="Assets\Direct3D\thumbstickcenter.dds">
<Filter>Assets\Direct3D</Filter>
</Image>
</ItemGroup>
</Project>
Loading

0 comments on commit 9121659

Please sign in to comment.