Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/dominik #35

Merged
merged 8 commits into from
Oct 31, 2023
Merged

Dev/dominik #35

merged 8 commits into from
Oct 31, 2023

Conversation

Wit111
Copy link
Collaborator

@Wit111 Wit111 commented Oct 27, 2023

switched movement to use cyberith virtualizer

@damian-tomczak
Copy link
Owner

damian-tomczak commented Oct 27, 2023

I'm waiting for the green light to review this, as I assume isn't ready, am I correct?
You can create pr in draft or convert it to draft - fancy feature, good to know 😄

@damian-tomczak
Copy link
Owner

is it ready? @Wit111

if (wcstombs_s(&virtualizerNameLen, nullptr, 0, virtualizerName, 0) == 0)
{
char* mbstr = new char[virtualizerNameLen];
wcstombs_s(&virtualizerNameLen, mbstr, virtualizerNameLen, virtualizerName, virtualizerNameLen);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We try to deliver multiplatform code, thus we shouldn't use _s functions

delete[] mbstr;
LOGGER_LOG(("Device found "s + virtualizerConvertedName + "Firmware Version: " + std::to_string(info.MajorVersion) + "." + std::to_string(info.MinorVersion)).c_str());
}
else
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imo this if condition is redundant

{
char* mbstr = new char[virtualizerNameLen];
wcstombs_s(&virtualizerNameLen, mbstr, virtualizerNameLen, virtualizerName, virtualizerNameLen);
std::string virtualizerConvertedName(mbstr);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this solution is overcomplicated and in c style
you can just calculate productName c string size then create std::string with the previously gained size to finally use wcstombs and print the filled std string

@@ -181,6 +216,28 @@ int run(Engine* const engine) try
isRenderingStarted = true;
}
#endif

#ifdef CYBSDK_FOUND
float ring_height = device->GetPlayerHeight();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const auto, please use camelCase


const auto info = device->GetDeviceInfo();

const wchar_t* virtName = info.ProductName;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be also const auto

std::vector<char> virtBuf(virtNameLen);
wcstombs(virtBuf.data(), virtName, virtNameLen);
std::string virtConvertedName(virtBuf.begin(), virtBuf.end());
LOGGER_LOG(std::format("Device found {} Firmware Version: {}.{}", virtConvertedName, std::to_string(static_cast<int>(info.MajorVersion)), std::to_string(static_cast<int>(info.MinorVersion))).c_str());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without to_string doesn't work?

if (movement_speed > 0.f)
{
ring_angle *= 2 * std::numbers::pi_v<float>;
float offsetX = std::sin(ring_angle) * movement_speed * flySpeedMultiplier * deltaTime;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const auto

@Wit111 Wit111 merged commit 79c735c into master Oct 31, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants