Skip to content

Commit

Permalink
Windows compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
codecat committed Jul 22, 2017
1 parent 594096f commit ca595f3
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ build/
cmake-build-*/
.idea/
.DS_Store
/*.dir/
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ set(CMAKE_CXX_STANDARD 11)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "")
set(GLFW_BUILD_TESTS OFF CACHE BOOL "")
set(GLFW_BUILD_DOCS OFF CACHE BOOL "")
set(GLFW_INSTALL OFF CACHE BOOL "")

find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)
Expand Down Expand Up @@ -123,6 +124,11 @@ target_link_libraries(nimbleapp
${GLEW_LIBRARIES}
)

if(WIN32)
set(CMAKE_SUPPRESS_REGENERATION true)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()

if(NA_BUILD_EXAMPLE)
add_subdirectory(example)
endif()
2 changes: 1 addition & 1 deletion ext/scratch2
2 changes: 1 addition & 1 deletion include/nimble/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "widget.h"
#include "contentmanager.h"

class GLFWwindow;
struct GLFWwindow;
struct lay_context;
struct NVGcontext;

Expand Down
4 changes: 2 additions & 2 deletions src/nimble/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void na::Application::DoLayout()

lay_reset_context(m_layout);
lay_id root = lay_item(m_layout);
lay_set_size_xy(m_layout, root, m_bufferSize.x / pixelScale, m_bufferSize.y / pixelScale);
lay_set_size_xy(m_layout, root, (lay_scalar)(m_bufferSize.x / pixelScale), (lay_scalar)(m_bufferSize.y / pixelScale));

if (m_root != nullptr) {
m_root->DoLayout(m_layout, root);
Expand Down Expand Up @@ -187,7 +187,7 @@ void na::Application::SetWindowSize(const glm::ivec2 &size)

float na::Application::GetPixelScale()
{
return m_bufferSize.x / m_windowSize.x;
return m_bufferSize.x / (float)m_windowSize.x;
}

void na::Application::Selector(const s2::string &query, s2::list<Widget*> &out)
Expand Down
4 changes: 4 additions & 0 deletions src/nimble/ini.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ na::IniPair* na::Ini::Get(const char* section, const char* key)
void na::Ini::Load(const char* filename)
{
FILE* fh = fopen(filename, "rb");
if (fh == nullptr) {
printf("Couldn't load %s\n", filename);
return;
}

IniSection* currentSection = (IniSection*)this;

Expand Down
2 changes: 1 addition & 1 deletion src/nimble/widgetselector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void na::WidgetSelectorNode::Parse(s2::string query)
{
const char* p = query;

char* pnext = strchr(p, ' ');
char* pnext = const_cast<char*>(strchr(p, ' '));
if (pnext != nullptr) {
*pnext = '\0';
pnext++;
Expand Down

0 comments on commit ca595f3

Please sign in to comment.