Code: Select all
//container for Scaling and Shifting functions between screen and Mandelbrot values
struct ScreenScaler {
float xScale;
float yScale;
float xPos;
float yPos;
float xMin, xMax;
float yMin, yMax;
void initSpace (ScreenScaler &space) {
double zoomingBar = SendMessage(hSlider2, TBM_GETPOS, 0, 0);
float Zoom = (zoomingBar / 5);
float SlideX = SendMessage(hSlider3, TBM_GETPOS, 0, 0);
float SlideY = SendMessage(hSlider4, TBM_GETPOS, 0, 0);
space.xScale = 1 + Zoom;
space.yScale = 1 + Zoom;
space.xPos = 0; //(SlideX / 10) - 4;
space.yPos = (SlideY / 10) - 4;
space.xMin = ((-2) / space.xScale) + space.xPos;
space.xMax = ((2) / space.xScale) + space.xPos;
space.yMin = ((-2) / yScale) + space.yPos;
space.yMax = ((2) / yScale) + space.yPos;
}
void left(ScreenScaler *lscale, bool movleft) {
if (movleft) {
lscale->xPos -= 1.0; // I am passing these members by reference/pointer hoping to change their values directly. with the trackbars this works great, but buttons and keys stubbornly refuse to increment..
}
}
void right(ScreenScaler *rscale) {
rscale->xPos += 1.0;
}
};
{
bool movleft = false; //so I am getting here for sure, if I uncomment the messagebeep, it sounds when its button is pressed.
//bool right = false; //id like this to be a continuous shifting while the button is held (the sound of the messagebeep implies this is already happening), as I am trying to move left and right/up and down//
if (LOWORD(wParam) == VK_LEFT)
/*case VK_LEFT:*/ {
movleft = true;
scale.left(&scale, movleft);
scale.xPos = scale.xPos -= 1;
//MessageBeep(MB_OK);
break;
}
if (LOWORD(wParam) == VK_RIGHT)
/*case VK_RIGHT: */{
scale.right(&scale);
scale.xPos = scale.xPos += 1;
//MessageBeep(MB_COMPOSITE);
break;
}
// }
return 0;
}
< /code>
(um zu beantworten, warum es einen Bool auf dem einen gibt, und nicht das andere, ist es natürlich ein weiterer Versuch, die Struktur zu erkennen. Ich ändere sie //ScreenScaler scale declared earlier
float cx = std::lerp(scale.xMin, scale.xMax, j);
float cy = std::lerp(scale.yMin, scale.yMax, i);
< /code>
Ich habe versucht, Wm_Command oder Wm_notify zu fangen, ich habe versucht, Schaltflächen zu bauen (obwohl ich nicht versucht habe, in dem entsprechenden Fall zu subklassigen, und ja mit bs_notify). Ich habe versucht, direkt aus dem Fall zu inkrementieren, und ich habe in der Struktur versucht, diese Voidplops in verschiedenen Permutationen zu rufen. Einmal funktionieren die Trackbars kontinuierlich, und das Beste daran ist, dass es in seiner endgültigen Form keine Tasten geben wird, es werden Spannungen auf Stiften sein. Es ist Spannung).
Als endgültiger Erklärer/Haftungsausschluss habe ich dies auch speziell getan, ohne zu suchen>