1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-06-25 22:09:35 +00:00

Debugger: implement search for polygons, which use selected texture.

This commit is contained in:
Sergey Lipskiy 2018-01-21 14:05:39 +07:00
parent ef0b8264a3
commit 6498795b6d
3 changed files with 38 additions and 11 deletions

View File

@ -163,17 +163,41 @@ void Debugger::checkDebugState()
void Debugger::_debugKeys()
{
if (isKeyPressed(G64_VK_RIGHT, 0x0001)) {
if (std::next(m_triSel) != m_triangles.end())
if (std::next(m_triSel) != m_triangles.cend())
++m_triSel;
else
m_triSel = m_triangles.begin();
m_triSel = m_triangles.cbegin();
}
if (isKeyPressed(G64_VK_LEFT, 0x0001)) {
if (m_triSel != m_triangles.begin())
if (m_triSel != m_triangles.cbegin())
--m_triSel;
else
m_triSel = std::prev(m_triangles.end());
m_triSel = std::prev(m_triangles.cend());
}
if (isKeyPressed(G64_VK_F, 0x0001)) {
if (m_pCurTexInfo != nullptr) {
auto curTexName = m_pCurTexInfo->texture->name;
auto beginItr =
(std::next(m_triSel) != m_triangles.cend() &&
(m_triSel->tex_info[0]->texture->name == curTexName ||
m_triSel->tex_info[1]->texture->name == curTexName)) ?
std::next(m_triSel) :
m_triangles.cbegin();
auto predicate = [curTexName](const Triangles::value_type & val) {
if (val.tex_info[0].operator bool() && val.tex_info[0]->texture->name == curTexName)
return true;
if (val.tex_info[1].operator bool() && val.tex_info[1]->texture->name == curTexName)
return true;
return false;
};
auto iter = std::find_if(beginItr, m_triangles.cend(), predicate);
if (iter == m_triangles.cend() && beginItr != m_triangles.cbegin())
iter = std::find_if(m_triangles.cbegin(), beginItr, predicate);
if (iter != m_triangles.cend())
m_triSel = iter;
}
}
if (isKeyPressed(G64_VK_B, 0x0001)) {

View File

@ -76,6 +76,7 @@ m_keys[G64_VK_0] = 0x30;
m_keys[G64_VK_A] = 0x41;
m_keys[G64_VK_B] = 0x42;
m_keys[G64_VK_D] = 0x44;
m_keys[G64_VK_F] = 0x46;
m_keys[G64_VK_G] = 0x47;
m_keys[G64_VK_Q] = 0x51;
m_keys[G64_VK_R] = 0x52;
@ -107,6 +108,7 @@ m_keys[G64_VK_0] = 48;
m_keys[G64_VK_A] = 97;
m_keys[G64_VK_B] = 98;
m_keys[G64_VK_D] = 100;
m_keys[G64_VK_F] = 102;
m_keys[G64_VK_G] = 103;
m_keys[G64_VK_Q] = 113;
m_keys[G64_VK_R] = 114;

View File

@ -70,14 +70,15 @@
#define G64_VK_A 21
#define G64_VK_B 22
#define G64_VK_D 23
#define G64_VK_G 24
#define G64_VK_Q 25
#define G64_VK_R 26
#define G64_VK_S 27
#define G64_VK_V 28
#define G64_VK_W 29
#define G64_VK_F 24
#define G64_VK_G 25
#define G64_VK_Q 26
#define G64_VK_R 27
#define G64_VK_S 28
#define G64_VK_V 29
#define G64_VK_W 30
#define G64_NUM_KEYS 30
#define G64_NUM_KEYS 31
class Glide64Keys
{