This repository has been archived by the owner on Sep 21, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.modio | ||
*.dll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
´´´ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |