130 и 320 это самое начало и самый конец дуги.
Вот так у меня выглядит формула для направленяи стрелки.
pi/2 - speed*pi*5/6 / 200
std::wstring s2ws(const std::string& str)
{
using convert_typeX = std::codecvt_utf8<wchar_t>;
std::wstring_convert<convert_typeX, wchar_t> converterX;
return converterX.from_bytes(str);
}
HBITMAP LoadHbitmapFromFile(const std::string& filename)
{
Gdiplus::Bitmap* bitmap = Gdiplus::Bitmap::FromFile(s2ws(filename).c_str(), false);
HBITMAP result = NULL;
std::cout << "Loading file " << filename << "\n";
if (bitmap)
{
bitmap->GetHBITMAP(Gdiplus::Color(255, 255, 255), &result);
delete bitmap;
}
return result;
}
void SaveHbitmapToFile(HBITMAP img, const std::string& filename)
{
Gdiplus::Bitmap bmp(img, (HPALETTE)0);
SavebitmapToFile(bmp, filename);
}
void SavebitmapToFile(Gdiplus::Bitmap &bmp, const std::string& filename)
{
CLSID pngClsid;
if (CLSIDFromString(L"{557CF406-1A04-11D3-9A73-0000F81EF32E}", &pngClsid) != NOERROR) {
std::cout << "Can't get CLSID for png encoder\n";
exit(1);
}
std::wstring wname = s2ws(filename);
auto res = bmp.Save(wname.c_str(), &pngClsid, NULL);
if (res != 0) {
std::cout << "Can't save to file with error " << res << "\n";
std::cout << "Filename: " << ws2s(wname) << "\n";
}
}