Permalink
Browse files

mingw sample

  • Loading branch information...
Turupawn committed Apr 23, 2018
1 parent c791188 commit 1ee455c8d71c462d2b59a9858d3240214d489ec5
View
@@ -22,7 +22,13 @@ IF (UNIX AND NOT APPLE)
ENDIF ()
IF (MINGW)
target_link_libraries(modio ${CMAKE_SOURCE_DIR}/lib/MinGW/libcurl.a ${CMAKE_SOURCE_DIR}/lib/MinGW/libz.a wldap32 ws2_32 ssl eay32 crypto)
target_link_libraries(modio
${CMAKE_SOURCE_DIR}/lib/MinGW/libcurl.a
${CMAKE_SOURCE_DIR}/lib/MinGW/libz.a
${CMAKE_SOURCE_DIR}/lib/MinGW/libcrypto.dll.a
${CMAKE_SOURCE_DIR}/lib/MinGW/libeay32.dll
${CMAKE_SOURCE_DIR}/lib/MinGW/libssl.dll.a
wldap32 ws2_32)
ENDIF()
IF (MSVC)
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
@@ -0,0 +1,2 @@
.modio
*.dll
@@ -0,0 +1,5 @@
CC=g++
CFLAGS=-Wall -std=c++11
all: main.cpp
$(CC) $(CFLAGS) main.cpp -o example -I ../../include ../../build/libmodio.dll.a
@@ -0,0 +1,20 @@
# Setup
1. Install the MinGW compiler provided by the [MinGW Installer](https://sourceforge.net/projects/mingw/files/)
2. Download the ´mingw32-gcc-c++´ package
3. Add your MinGW binary folder to the path environment variable. By default it's `C:\MinGW\bin`.
# Compile
Open a command prompt and run:
´´´bash
mingw32-make
´´´
# Run
´´´bash
example.exe
´´´
@@ -0,0 +1,59 @@
#include "modio.h"
int main(void)
{
modio::Instance modio_instance(MODIO_ENVIRONMENT_TEST, 7, "e91c01b8882f4affeddd56c96111977b");
volatile static bool finished = false;
auto wait = [&]()
{
while (!finished)
{
modio_instance.sleep(10);
modioProcess();
}
};
auto finish = [&]()
{
finished = true;
};
// Before requesting mods, let's define the query filters
modio::FilterCreator filter;
filter.setLimit(7);
filter.setCacheMaxAgeSeconds(100);
std::cout <<"Getting mods..." << std::endl;
// Now we finished setting up the filters we are ready to request the mods
modio_instance.getMods(filter, [&](const modio::Response& response, const std::vector<modio::Mod> & mods)
{
std::cout << "On mod get response: " << response.code << std::endl;
if(response.code == 200)
{
std::cout << "Listing mods" << std::endl;
std::cout << "============" << std::endl;
for(auto& mod : mods)
{
std::cout << "Id: \t" << mod.id << std::endl;
std::cout << "Name:\t" << mod.name << std::endl;
}
// Additionally, we can access pagination data to ease future browsing queries
std::cout << std::endl;
std::cout << "Cursor data:" << std::endl;
std::cout << "Result count: " << response.result_count << std::endl;
std::cout << "Result limit: " << response.result_limit << std::endl;
std::cout << "Result offset: " << response.result_offset << std::endl;
}
finish();
});
wait();
std::cout << "Process finished" << std::endl;
return 0;
}

0 comments on commit 1ee455c

Please sign in to comment.