Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario1159 committed Jun 18, 2022
2 parents 32e0a0a + 3fb97e8 commit 7fc3f3f
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# build version format
version: "{build}"

os: Visual Studio 2017
os: Visual Studio 2019

platform:
- x64
Expand Down
9 changes: 3 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

[![cmake-img]][cmake-url]
[![License][license-img]][license-url]
[![Travis Tests][travis-img]][travis-url]
[![Appveyor Tests][appveyor-img]][appveyor-url]
[![Coverage Tests][codecov-img]][codecov-url]

Expand Down Expand Up @@ -180,9 +179,9 @@ void xmain(int argc, const char** argv)
{
const xwin::Event& event = eventQueue.front();

if (event.type == xwin::EventType::MouseMove)
if (event.type == xwin::EventType::MouseInput)
{
const xwin::MouseData mouse = event.data.mouse;
const xwin::MouseInputData mouse = event.data.mouseInput;
}
if (event.type == xwin::EventType::Close)
{
Expand All @@ -208,7 +207,7 @@ Be sure to have [CMake](https://cmake.org) Installed.
| `XWIN_API` | The OS API to use for window generation, defaults to `AUTO`, can be can be `NOOP`, `WIN32`<!--, `UWP`-->, `COCOA`, `UIKIT`, `XCB` <!--`XLIB`, `MIR`, `WAYLAND`-->, `ANDROID`, or `WASM`. |
| `XWIN_OS` | **Optional** - What Operating System to build for, functions as a quicker way of setting target platforms. Defaults to `AUTO`, can be `NOOP`, `WINDOWS`, `MACOS`, `LINUX`, `ANDROID`, `IOS`, `WASM`. If your platform supports multiple apis, the final api will be automatically set to CrossWindow defaults ( `WIN32` on Windows, `XCB` on Linux ). If `XWIN_API` is set this option is ignored. |
First install [Git](https://git-scm.com/downloads), then open any terminal such as [Hyper](https://hyper.is/) in any folder and type:
First install [Git](https://git-scm.com/downloads), then open any terminal in any folder and type:
```bash
# 🐑 Clone the repo
Expand Down Expand Up @@ -254,8 +253,6 @@ CrossWindow is licensed as either **MIT** or **Apache-2.0**, whichever you would
[cmake-url]: https://cmake.org/
[license-img]: https://img.shields.io/:license-mit-blue.svg?style=flat-square
[license-url]: https://opensource.org/licenses/MIT
[travis-img]: https://img.shields.io/travis/com/alaingalvan/crosswindow?style=flat-square
[travis-url]: https://app.travis-ci.com/github/alaingalvan/CrossWindow
[appveyor-img]: https://img.shields.io/appveyor/ci/alaingalvan/CrossWindow.svg?style=flat-square&logo=windows
[appveyor-url]: https://ci.appveyor.com/project/alaingalvan/crosswindow
[circleci-img]: https://img.shields.io/circleci/project/github/alaingalvan/CrossWindow.svg?style=flat-square&logo=appveyor
Expand Down
4 changes: 2 additions & 2 deletions src/CrossWindow/Common/Event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ ResizeData::ResizeData(unsigned width, unsigned height, bool resizing)
* (Mac OS, iOS, WebAssembly) we should opt to use those functions.
*/
static KeyToCharMap sKeyToCharMap = {
"\e", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "\b",
"\x1B", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "\b",
"\t", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "[", "]", "\r",
"", "A", "S", "D", "F", "G", "H", "J", "K", "L", ";", ":", "'", "\"",
"`", "", "\\", "Z", "X", "C", "V", "B", "N", "M", ",", ".", "/", "",
Expand All @@ -89,7 +89,7 @@ static KeyToCharMap sKeyToCharMap = {
"", "", "", "", "", "", "", ""};

static std::unordered_map<const char*, Key> sCharToKeyMap = {
{"\e", Key::Escape},
{"\x1B", Key::Escape},
{"1", Key::Num1},
{"2", Key::Num2},
{"3", Key::Num3},
Expand Down
19 changes: 7 additions & 12 deletions src/CrossWindow/Noop/NoopWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,18 @@ namespace xwin
{
Window::~Window() { close(); }

bool Window::create(WindowDesc& desc, EventQueue& eventQueue) { return false; }
bool Window::create(const WindowDesc& desc, EventQueue& eventQueue)
{
mDesc = desc;
return false;
}

void Window::close() {}

const WindowDesc Window::getDesc() { return WindowDesc(); }

void Window::updateDesc(WindowDesc& desc) {}

bool create(WindowDesc& desc, EventQueue& eventQueue) { return true; }

const WindowDesc getDesc()
{
WindowDesc wd;
return wd;
}
const WindowDesc Window::getDesc() { return mDesc; }

void updateDesc(WindowDesc& desc) {}
void Window::updateDesc(WindowDesc& desc) {}

void Window::setTitle(std::string title) {}

Expand Down
3 changes: 3 additions & 0 deletions src/CrossWindow/Noop/NoopWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,8 @@ class Window

// returns the current top left corner this window is located in
UVec2 getCurrentDisplayPosition();

protected:
WindowDesc mDesc;
};
}
9 changes: 4 additions & 5 deletions src/CrossWindow/Win32/Win32EventQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,11 +786,10 @@ LRESULT EventQueue::pushEvent(MSG msg, Window* window)

// Some events may require resizing the current window,
// such as DPI events.
if (
!(currentWindowRect.right == currentWindowRect.left &&
currentWindowRect.right == currentWindowRect.top &&
currentWindowRect.right == currentWindowRect.bottom &&
currentWindowRect.right == -1))
if (!(currentWindowRect.right == currentWindowRect.left &&
currentWindowRect.right == currentWindowRect.top &&
currentWindowRect.right == currentWindowRect.bottom &&
currentWindowRect.right == -1))
{
RECT* const prcNewWindow = (RECT*)msg.lParam;
SetWindowPos(window->hwnd, NULL, currentWindowRect.left,
Expand Down

0 comments on commit 7fc3f3f

Please sign in to comment.