Skip to content

Commit

Permalink
fixes or windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-dez committed May 5, 2020
1 parent a263c69 commit 2b7f209
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 19 deletions.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ if(UNIX AND NOT APPLE) # Linux
set(LINUX TRUE)
endif()

if(WIN32)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:msvcrt.lib")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDebugDLL$<$<CONFIG:Debug>:Debug>")
endif()

###########################
# We will be using hidapi #
###########################
Expand All @@ -26,6 +31,12 @@ target_include_directories(hidapi PRIVATE
hidapi/hidapi
)

if(WIN32)
target_link_libraries(hidapi
setupapi
)
endif()

add_compile_options(
-D__jctool_cpp_API__
)
Expand Down
2 changes: 1 addition & 1 deletion hidapi
2 changes: 1 addition & 1 deletion jctool/IRSensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class IRSensor {

bool capture_in_progress{};
IRCaptureMode capture_mode{};
IRCaptureStatus capture_status{};
IRCaptureStatus capture_status;

int res_idx_selected{}; /** The index number of the resolution selected.
* See ir_sensor.h.
Expand Down
2 changes: 1 addition & 1 deletion jctool/jctool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
#include <iomanip>
#include <sstream>
// #define NOMINMAX
#include <chrono>
#ifdef WIN32
#include <cstdio>
#include <Windows.h>
#else
#include <chrono>
#include <stdio.h>
#include <unistd.h>
inline int Sleep(uint64_t ms){
Expand Down
18 changes: 9 additions & 9 deletions jctool/jctool_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,15 @@ enum IRCaptureMode : u8 {
};

struct IRCaptureStatus {
float fps;
int frame_counter;
int last_frag_no;
float duration;
float noise_level;
int avg_intensity_percent;
int white_pixels_percent;
u16 exfilter;
u8 exf_int;
float fps{};
int frame_counter{};
int last_frag_no{};
float duration{};
float noise_level{};
int avg_intensity_percent{};
int white_pixels_percent{};
u16 exfilter{};
u8 exf_int{};
std::stringstream message_stream;
};

Expand Down
12 changes: 6 additions & 6 deletions jctool/jctool_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ SOFTWARE.

namespace JCToolkit {
namespace Assets {
ImageResource battery_indicators[] = {
static ImageResource battery_indicators[] = {
{IMAGE_RES_PATH "batt_0" IMAGE_RES_EXT, false},
{IMAGE_RES_PATH "batt_0_chr" IMAGE_RES_EXT, false},
{IMAGE_RES_PATH "batt_25" IMAGE_RES_EXT, false},
Expand All @@ -80,17 +80,17 @@ namespace JCToolkit {
{IMAGE_RES_PATH "batt_100" IMAGE_RES_EXT, false},
{IMAGE_RES_PATH "batt_100_chr" IMAGE_RES_EXT, false}
};
ImageResource left_joycon[] = {
static ImageResource left_joycon[] = {
{IMAGE_RES_PATH "l_joy_body" IMAGE_RES_EXT, false},
{IMAGE_RES_PATH "l_joy_buttons" IMAGE_RES_EXT, false},
{IMAGE_RES_PATH "l_joy_lines" IMAGE_RES_EXT, false},
};
ImageResource right_joycon[] = {
static ImageResource right_joycon[] = {
{IMAGE_RES_PATH "r_joy_body" IMAGE_RES_EXT, false},
{IMAGE_RES_PATH "r_joy_buttons" IMAGE_RES_EXT, false},
{IMAGE_RES_PATH "r_joy_lines" IMAGE_RES_EXT, false},
};
ImageResource pro_controller[] = {
static ImageResource pro_controller[] = {
{IMAGE_RES_PATH "pro_body" IMAGE_RES_EXT, false},
{IMAGE_RES_PATH "pro_buttons" IMAGE_RES_EXT, false},
{IMAGE_RES_PATH "pro_grips_l" IMAGE_RES_EXT, false},
Expand Down Expand Up @@ -232,7 +232,7 @@ namespace JCToolkit {
ImGui::SetCursorPos(con_start);
ImGui::ImageAutoFit(
(ImTextureID)con_images[i].getRID(),
{con_images[i].getWidth(), con_images[i].getHeight()},
{(float)con_images[i].getWidth(), (float)con_images[i].getHeight()},
{0,0}, {1,1},
ImGui::ColorConvertU32ToFloat4(IM_COL32(col.r,col.g,col.b,255))
);
Expand Down Expand Up @@ -607,7 +607,7 @@ namespace JCToolkit {

void showIRCameraFeed(IRSensor& ir_sensor){
auto& size = std::get<2>(ir_resolutions[ir_sensor.res_idx_selected]);
ImGui::ImageAutoFit((ImTextureID)ir_sensor.getCaptureTexID(), {size.x, size.y});
ImGui::ImageAutoFit((ImTextureID)ir_sensor.getCaptureTexID(), {(float)size.x, (float)size.y});
}

enum class IRFeedControl {
Expand Down
2 changes: 1 addition & 1 deletion jctool/session/controller_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ ConSess::Status ConSess::checkConnectionStatus(StatusDelay status_delay){
return this->getStatus(status_delay);
}

#define CON_JOB(lbda_captures...) [lbda_captures](controller_hid_handle_t handle, u8& timming_byte)
#define CON_JOB(...) [__VA_ARGS__](controller_hid_handle_t handle, u8& timming_byte)

void ConSess::testSetLedBusy(){
ConSessManager::add_job(*this->con,
Expand Down
1 change: 1 addition & 0 deletions stb
Submodule stb added at f54acd
1 change: 1 addition & 0 deletions ui/ImGui/imgui
Submodule imgui added at 6a9624

0 comments on commit 2b7f209

Please sign in to comment.