mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-03 23:41:56 +00:00
parent
93fff6a738
commit
0c9fb6b22b
@ -29,13 +29,12 @@ because they don't depend on any other component.
|
|||||||
* [gen](gen/) (base): Helper utility to generate C++ files from different XMLs.
|
* [gen](gen/) (base): Helper utility to generate C++ files from different XMLs.
|
||||||
* [gfx](gfx/) (fixmath): Abstract graphics structures like point, size, rectangle, region, color, etc.
|
* [gfx](gfx/) (fixmath): Abstract graphics structures like point, size, rectangle, region, color, etc.
|
||||||
* [net](net/) (base): Networking library to send HTTP requests.
|
* [net](net/) (base): Networking library to send HTTP requests.
|
||||||
* [pen](pen/) (base, wacom): Library to handle graphics tablet input.
|
|
||||||
* [webserver](webserver/) (base): HTTP web server
|
* [webserver](webserver/) (base): HTTP web server
|
||||||
|
|
||||||
## Level 2
|
## Level 2
|
||||||
|
|
||||||
* [doc](doc/) (base, fixmath, gfx): Document model library.
|
* [doc](doc/) (base, fixmath, gfx): Document model library.
|
||||||
* [she](she/) (allegro, base, gfx): A wrapper for the Allegro library.
|
* [she](she/) (allegro, base, gfx, wacom): A wrapper for the Allegro library.
|
||||||
|
|
||||||
## Level 3
|
## Level 3
|
||||||
|
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
# Aseprite Pen Library
|
|
||||||
# Copyright (C) 2016 David Capello
|
|
||||||
|
|
||||||
add_library(pen-lib
|
|
||||||
pen.cpp)
|
|
||||||
|
|
||||||
target_link_libraries(pen-lib
|
|
||||||
base-lib)
|
|
@ -1,31 +0,0 @@
|
|||||||
// Aseprite Pen Library
|
|
||||||
// Copyright (c) 2016 David Capello
|
|
||||||
//
|
|
||||||
// This file is released under the terms of the MIT license.
|
|
||||||
// Read LICENSE.txt for more information.
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "pen/pen.h"
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include "pen/pen_win.h"
|
|
||||||
#else
|
|
||||||
#include "pen/pen_none.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace pen {
|
|
||||||
|
|
||||||
PenAPI::PenAPI(void* nativeDisplayHandle)
|
|
||||||
: m_impl(new Impl(nativeDisplayHandle))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
PenAPI::~PenAPI()
|
|
||||||
{
|
|
||||||
delete m_impl;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace pen
|
|
@ -1,25 +0,0 @@
|
|||||||
// Aseprite Pen Library
|
|
||||||
// Copyright (c) 2016 David Capello
|
|
||||||
//
|
|
||||||
// This file is released under the terms of the MIT license.
|
|
||||||
// Read LICENSE.txt for more information.
|
|
||||||
|
|
||||||
#ifndef PEN_PEN_H_INCLUDED
|
|
||||||
#define PEN_PEN_H_INCLUDED
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
namespace pen {
|
|
||||||
|
|
||||||
class PenAPI {
|
|
||||||
public:
|
|
||||||
PenAPI(void* nativeDisplayHandle);
|
|
||||||
~PenAPI();
|
|
||||||
|
|
||||||
private:
|
|
||||||
class Impl;
|
|
||||||
Impl* m_impl;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace pen
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,15 +0,0 @@
|
|||||||
// Aseprite Pen Library
|
|
||||||
// Copyright (c) 2016 David Capello
|
|
||||||
//
|
|
||||||
// This file is released under the terms of the MIT license.
|
|
||||||
// Read LICENSE.txt for more information.
|
|
||||||
|
|
||||||
namespace pen {
|
|
||||||
|
|
||||||
class PenAPI::Impl {
|
|
||||||
public:
|
|
||||||
Impl(void*) { }
|
|
||||||
~Impl() { }
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace pen
|
|
@ -1,68 +0,0 @@
|
|||||||
// Aseprite Pen Library
|
|
||||||
// Copyright (c) 2016 David Capello
|
|
||||||
//
|
|
||||||
// This file is released under the terms of the MIT license.
|
|
||||||
// Read LICENSE.txt for more information.
|
|
||||||
|
|
||||||
#include "base/debug.h"
|
|
||||||
#include "base/dll.h"
|
|
||||||
#include "base/fs.h"
|
|
||||||
#include "base/log.h"
|
|
||||||
#include "base/path.h"
|
|
||||||
#include "base/string.h"
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
#include "wacom/wintab.h"
|
|
||||||
|
|
||||||
typedef UINT (API* WTInfoW_Func)(UINT, UINT, LPVOID);
|
|
||||||
typedef HCTX (API* WTOpenW_Func)(HWND, LPLOGCONTEXTW, BOOL);
|
|
||||||
typedef BOOL (API* WTClose_Func)(HCTX);
|
|
||||||
|
|
||||||
class pen::PenAPI::Impl {
|
|
||||||
public:
|
|
||||||
Impl(void* nativeDisplayHandle) : m_ctx(nullptr) {
|
|
||||||
m_wintabLib = base::load_dll("wintab32.dll");
|
|
||||||
if (!m_wintabLib)
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto WTInfoW = base::get_dll_proc<WTInfoW_Func>(m_wintabLib, "WTInfoW");
|
|
||||||
auto WTOpenW = base::get_dll_proc<WTOpenW_Func>(m_wintabLib, "WTOpenW");
|
|
||||||
if (!WTInfoW || !WTOpenW)
|
|
||||||
return;
|
|
||||||
|
|
||||||
LOGCONTEXTW logctx;
|
|
||||||
memset(&logctx, 0, sizeof(LOGCONTEXTW));
|
|
||||||
logctx.lcOptions |= CXO_SYSTEM;
|
|
||||||
UINT infoRes = WTInfoW(WTI_DEFSYSCTX, 0, &logctx);
|
|
||||||
ASSERT(infoRes == sizeof(LOGCONTEXTW));
|
|
||||||
ASSERT(logctx.lcOptions & CXO_SYSTEM);
|
|
||||||
|
|
||||||
logctx.lcOptions |= CXO_SYSTEM;
|
|
||||||
m_ctx = WTOpenW((HWND)nativeDisplayHandle, &logctx, TRUE);
|
|
||||||
if (!m_ctx) {
|
|
||||||
LOG("Pen library is not initialized...\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG("Pen initialized...\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
~Impl() {
|
|
||||||
if (!m_wintabLib)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (m_ctx) {
|
|
||||||
auto WTClose = base::get_dll_proc<WTClose_Func>(m_wintabLib, "WTClose");
|
|
||||||
if (WTClose) {
|
|
||||||
LOG("Pen shutdown...\n");
|
|
||||||
WTClose(m_ctx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
base::unload_dll(m_wintabLib);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
base::dll m_wintabLib;
|
|
||||||
HCTX m_ctx;
|
|
||||||
};
|
|
Loading…
Reference in New Issue
Block a user