license message box on Windows

This commit is contained in:
2018-08-24 06:58:09 +02:00
parent a37ea5309b
commit 1c3e1b7e55
3 changed files with 22 additions and 6 deletions

View File

@@ -168,11 +168,21 @@ bool App::check_license()
CURL *curl = curl_easy_init();
if (curl)
{
std::string url = "http://omigamedev.com/panopainter/79516B99-8E67-40AD-B12F-149A5A9C2E15";
//std::string url = "http://omigamedev.com/panopainter/79516B99-8E67-40AD-B12F-149A5A9C2E15";
std::string url = "https://panopainter.com/license/E8EDC2FE-E1BD-4AB1-91BD-FCCD926739BD.php";
std::string ret;
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ret);
//curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_data_handler);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 2L);
auto err = curl_easy_perform(curl);
curl_easy_cleanup(curl);
LOG("License check: %s", ret.c_str());
if (err == CURLcode::CURLE_OK)
return true;
}

View File

@@ -293,12 +293,16 @@ int main(int argc, char** argv)
WNDCLASS wc;
PIXELFORMATDESCRIPTOR pfd;
if (!App::I.check_license())
return -1;
if (argc == 1)
App::I.initLog();
if (!App::I.check_license())
{
MessageBoxA(NULL, "Unable to verify this demo license, please make sure you are connected to Internet.",
"PanoPainter - License Error", MB_ICONERROR | MB_OK);
return -1;
}
SetupExceptionHandler();
BT_SetTerminate();

View File

@@ -30,9 +30,11 @@ public:
void draw_stroke() const;
void destroy()
{
glDeleteBuffers(2, buffers);
if (buffers[0] || buffers[1])
glDeleteBuffers(2, buffers);
#if USE_VBO
glDeleteVertexArrays(2, arrays);
if (arrays[0] || arrays[1])
glDeleteVertexArrays(2, arrays);
#endif // USE_VBO
buffers[0] = buffers[1] = 0;
arrays[0] = arrays[1] = 0;