Compare commits
82 Commits
Author | SHA1 | Date |
---|---|---|
Martin Fouilleul | 82e4d0e08b | |
Martin Fouilleul | ef79405805 | |
Martin Fouilleul | a1b48b2b2f | |
Ilia Demianenko | 5e62a5d2e7 | |
Ilia Demianenko | c05223f91c | |
Reuben Dunnington | 6e4943c2fa | |
Martin Fouilleul | 90dd12a69f | |
Martin Fouilleul | 549e640102 | |
Martin Fouilleul | d5bd7ea2bb | |
Martin Fouilleul | c4a1ad52a0 | |
Reuben Dunnington | 9448104f41 | |
Reuben Dunnington | aac74b0533 | |
Ben Visness | 4f0738fe64 | |
Ben Visness | 1cc8778982 | |
Ben Visness | 75c4f6f94d | |
Martin Fouilleul | fb18d3240a | |
Martin Fouilleul | 388b059643 | |
Martin Fouilleul | b4aedb3ecc | |
Ben Visness | 34127134d5 | |
Ben Visness | 24d61aaeab | |
Reuben Dunnington | 37c00bd42f | |
Martin Fouilleul | 94ce88e272 | |
Martin Fouilleul | 647565e285 | |
Martin Fouilleul | ecf89fa6b2 | |
Martin Fouilleul | 715ab0f6e3 | |
Martin Fouilleul | 370482a3e0 | |
Martin Fouilleul | 827db17e14 | |
Martin Fouilleul | 01565324c5 | |
Reuben Dunnington | ea74114693 | |
Reuben Dunnington | 4b30bd70d0 | |
Ben Visness | 43273cc170 | |
Ben Visness | ab3280ed4e | |
Reuben Dunnington | 0d839a9767 | |
Martin Fouilleul | 762d2d9d10 | |
Martin Fouilleul | 34303edd4e | |
Reuben Dunnington | e85d774245 | |
Martin Fouilleul | 116e614ab6 | |
Reuben Dunnington | 44477782d8 | |
Ben Visness | d2e8430c49 | |
Ben Visness | 45c615bfa9 | |
Ben Visness | 17beaef0e0 | |
Reuben Dunnington | 37655abbf5 | |
Ben Visness | a77d6a07cd | |
Ben Visness | 0b273f1e43 | |
Ben Visness | bd780b20f3 | |
Reuben Dunnington | 5b7e27f9fd | |
Martin Fouilleul | 00555dc03f | |
martinfouilleul | 4865e2142d | |
Ben Visness | f05adac120 | |
Ben Visness | 29cb9f50e4 | |
Ben Visness | 731b1c7334 | |
Martin Fouilleul | 7d3f29e43b | |
Ilia Demianenko | 33078fd9dc | |
Martin Fouilleul | 300d5aeab4 | |
Martin Fouilleul | d58643eb52 | |
Ilia Demianenko | efeac65a96 | |
Martin Fouilleul | 7ca40f8cac | |
Martin Fouilleul | 09cf30cf45 | |
Martin Fouilleul | 47dc052508 | |
Martin Fouilleul | 0e680c989b | |
Ilia Demianenko | 73717b5dd8 | |
Ilia Demianenko | d44ac5a1fb | |
Ilia Demianenko | 82aefaf758 | |
Martin Fouilleul | 8cd571f923 | |
Martin Fouilleul | a0f9ab5f85 | |
Martin Fouilleul | 0f3f7b5052 | |
Ilia Demianenko | a5567da82c | |
Martin Fouilleul | 7026919b38 | |
Martin Fouilleul | a1ffcd3ddc | |
Martin Fouilleul | d53c688810 | |
Martin Fouilleul | db36158e7a | |
Martin Fouilleul | d90c11db58 | |
Martin Fouilleul | b9232b796c | |
Martin Fouilleul | ce752713f6 | |
Martin Fouilleul | 313f2e0ad4 | |
martinfouilleul | ab4abd28d7 | |
Martin Fouilleul | 3e2f550b68 | |
Martin Fouilleul | dc837a6a6d | |
Martin Fouilleul | 8d346eca90 | |
Ilia Demianenko | afbb4329f5 | |
Martin Fouilleul | 06a7642055 | |
Ilia Demianenko | bb39bc7a13 |
|
@ -24,7 +24,6 @@ BraceWrapping:
|
|||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterObjCDeclaration: true
|
||||
AfterStruct: true
|
||||
AfterObjCDeclaration: true
|
||||
AfterUnion: true
|
||||
|
|
|
@ -14,6 +14,7 @@ build
|
|||
*.wasm
|
||||
*.app
|
||||
*.dylib
|
||||
*.a
|
||||
|
||||
Debug/*
|
||||
|
||||
|
@ -35,6 +36,8 @@ src/graphics/orca_gl31.h
|
|||
__pycache__
|
||||
scripts/files
|
||||
|
||||
ext/angle
|
||||
# explicitly abandon old ext dir
|
||||
/ext
|
||||
src/ext/angle
|
||||
|
||||
sketches/*/bin
|
||||
sketches/*/bin
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
github: orca-app
|
||||
custom: "https://orca-app.dev/sponsor.html"
|
|
@ -0,0 +1,207 @@
|
|||
Orca
|
||||
|
||||
Copyright (C) 2023 Martin Fouilleul
|
||||
|
||||
Orca is distributed under the MIT license or the Apache License version 2.0,
|
||||
at your option.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
122
Readme.md
122
Readme.md
|
@ -1,122 +1,2 @@
|
|||
------
|
||||
**DISCLAIMER: This project is very much a Work In Progress. We are making it accessible in this very early state so that participants in the [2023 Wheel Reinvention Jam](https://handmade.network/jam/2023) can try it out and possibly use it as their jamming platform. Expect bugs, missing and/or incomplete features, unstable APIs, and sparse documentation. Some current issues might be a show stopper for you, so make sure you can build and run the sample apps before jumping in.**
|
||||
**This repository is not used anymore. Development of Orca was moved here: [https://github.com/orca-app/orca](https://github.com/orca-app/orca)**
|
||||
|
||||
**If you do choose to try out Orca anyway, thank you! We'll do our best to answer your questions, and we'd really appreciate your feedback!**
|
||||
|
||||
------
|
||||
|
||||
# Orca
|
||||
|
||||
Orca is a development platform and runtime environment for cross-platform, sandboxed graphical WebAssembly applications. In this early MVP you can:
|
||||
|
||||
- Receive mouse and keyboard input.
|
||||
- Draw paths, images and text using a 2D vector graphics API.
|
||||
- Draw 2D/3D graphics using OpenGL ES 3.1 (minus a few features)
|
||||
- Build user interfaces using our UI API and default widgets.
|
||||
- Read and write files using a capability-based API.
|
||||
|
||||
## Installing
|
||||
|
||||
The Orca command-line tools must be installed to your system in order to use them in your own projects.
|
||||
|
||||
**At this early stage, you must build Orca yourself - in the future, this installation process will be streamlined.**
|
||||
|
||||
### Requirements
|
||||
|
||||
- Windows or Mac (Linux is not yet supported)
|
||||
- [Python 3](https://www.python.org/) (for command line tools)
|
||||
- Clang
|
||||
- **Windows users:** `clang` can be installed via the Visual Studio installer. Search for "C++ Clang Compiler".
|
||||
- **Mac users:** Apple's built-in `clang` does not support WebAssembly. We recommend installing `clang` via [Homebrew](https://brew.sh/) with `brew install clang`.
|
||||
- MSVC (Visual Studio 2022 17.5 or newer) (Windows only)
|
||||
- This can be installed through the [Visual Studio Community](https://visualstudio.microsoft.com/) installer.
|
||||
- Please note the version requirement! Orca requires C11 atomics, which were only added to MSVC in late 2022.
|
||||
|
||||
### Installation instructions
|
||||
|
||||
Clone the repo, then `cd` into the `orca` directory:
|
||||
|
||||
```
|
||||
git clone git@git.handmade.network:hmn/orca.git
|
||||
cd orca
|
||||
```
|
||||
|
||||
Build the Orca runtime:
|
||||
|
||||
```
|
||||
./orca dev build-runtime
|
||||
```
|
||||
|
||||
Install the Orca dev tools. If on Windows, the tool can automatically add `orca` to your PATH. Otherwise, you must manually add the Orca install directory to your PATH, e.g. by updating `.zshrc` or `.bashrc`.
|
||||
|
||||
```
|
||||
./orca dev install
|
||||
```
|
||||
|
||||
Finally, verify that Orca is successfully installed by running the `orca version` command. Note the lack of `./`!
|
||||
|
||||
```
|
||||
orca version
|
||||
```
|
||||
|
||||
If you encounter any errors, see the FAQ below.
|
||||
|
||||
Once the `orca` tools are installed, you can use them from anywhere to
|
||||
|
||||
### Building the sample Orca apps
|
||||
|
||||
The `samples` directory contains several sample apps that demonstrate various Orca features. To build one, `cd` to a sample project's directory and run its build script. For example, for the `breakout` sample:
|
||||
|
||||
```
|
||||
cd samples/breakout
|
||||
# Windows
|
||||
build.bat
|
||||
# Mac
|
||||
./build.sh
|
||||
```
|
||||
|
||||
On Windows this creates a `Breakout` directory in `samples/breakout`. You can launch the app by running `Breakout/bin/Breakout.exe`. On macOS this creates a `Breakout.app` bundle in `samples/breakout` that you can double-click to run.
|
||||
|
||||
## Writing an Orca app
|
||||
|
||||
Orca apps are WebAssembly modules that use the Orca APIs. The process for creating an Orca application is:
|
||||
|
||||
1. Compile a WebAssembly module using your language and toolchain of choice.
|
||||
2. Bundle the WebAssembly module into a native executable using the Orca command-line tools.
|
||||
|
||||
For a more thorough overview, please read the [Quick Start Guide](./doc/QuickStart.md), which will walk you through building a simple application.
|
||||
|
||||
The following additional resources may also help you familiarize yourself with Orca and its APIs:
|
||||
|
||||
- The [samples folder](./samples) contains sample applications that show various aspects of the Orca API and support library:
|
||||
- [`breakout`](./samples/breakout) is a small breakout game making use of the vector graphics API.
|
||||
- [`clock`](./samples/clock) is a simple clock showcasing vector graphics and the time API.
|
||||
- [`triangle`](./samples/triangle) shows how to draw a spinning triangle using the GLES API.
|
||||
- [`fluid`](./samples/fluid) is a fluid simulation using a more complex GLES setup.
|
||||
- [`ui`](./samples/ui) showcases the UI API and Orca's default UI widgets.
|
||||
- The [API Cheatsheets](./doc/cheatsheets) provide a list of Orca API functions, grouped by topic.
|
||||
|
||||
## FAQ
|
||||
|
||||
**What languages can I use with Orca?**
|
||||
|
||||
In principle, you can use any language and toolchain that can produce an Orca-compatible WebAssembly module. However, several important parts of Orca, such as the UI, are provided as part of the support library, which is written in C. Therefore, at this early stage, it may be difficult to use any language other than C.
|
||||
|
||||
We look forward to expanding the number of officially-supported languages in the future.
|
||||
|
||||
**I am getting errors about atomics when building the runtime on Windows.**
|
||||
|
||||
Please ensure that you have the latest version of Visual Studio and MSVC installed. The Orca runtime requires the use of C11 atomics, which were not added to MSVC until late 2022.
|
||||
|
||||
**I am getting errors saying that `orca` is not found.**
|
||||
|
||||
Please ensure that you have installed Orca to your system per the installation instructions above. Please also ensure that the Orca install directory is on your PATH. The installation path is printed when running `./orca dev install`.
|
||||
|
||||
## License
|
||||
|
||||
Orca is distributed under the terms of the GNU Affero General Public License version 3, with additional terms in accordance with section 7 of AGPLv3. These additional terms ensure that:
|
||||
|
||||
- Modified versions of Orca must reasonably inform users that they are modified.
|
||||
- You can distribute your application's WebAssembly modules under the terms of your choice, and are not required to license them under the terms of the AGPLv3.
|
||||
|
||||
Copyright and License details can be found in [LICENSE.txt](./LICENSE.txt)
|
||||
|
|
|
@ -6,51 +6,86 @@
|
|||
--------
|
||||
|
||||
# Orca Quick Start Guide
|
||||
---
|
||||
|
||||
This is a short introduction to developping an application that can be run by the Orca runtime. We'll present the basic structure of an Orca application, and walk through a simple example in C.
|
||||
This is a short introduction to developing an application that can be run by the Orca runtime. We'll present the basic structure of an Orca application, and walk through a simple example in C.
|
||||
|
||||
## What is an Orca app?
|
||||
|
||||
An Orca app is a WebAssembly module designed for the Orca runtime. Your app interacts with the Orca runtime via WebAssembly imports and exports. For example, you can import functions from the Orca runtime to get user input, and export functions to the Orca runtime to draw to the screen.
|
||||
|
||||
Orca also ships with a core library, written in C, which facilitates interaction with the Orca runtime and provides features like UI. This library should be compiled along with your app as part of producing your WebAssembly module.
|
||||
|
||||
You can, in principle, write an Orca app in any programming language that supports WebAssembly. However, at this early stage, C is the only officially supported language.
|
||||
|
||||
![Basic structure of a C app](images/app_c.png)
|
||||
|
||||
Once you have compiled your WebAssembly module, you can bundle this module into an executable using the `orca bundle` command. The application bundle can include images, fonts, or any other private data that the app needs in order to function. These files can be read or written from the app without asking the user for permission. The resulting Orca executables are therefore self-contained.
|
||||
|
||||
![Example Orca application bundle](images/app_bundle.png)
|
||||
|
||||
## Basic structure
|
||||
|
||||
Orca exposes a number of types and functions to applications. In order to use them the first thing to do is to include `orca.h`.
|
||||
|
||||
```
|
||||
```c
|
||||
#include<orca.h>
|
||||
```
|
||||
|
||||
The Orca runtime manages the application's window and event loop. In order to receive a specific kind of event, you can define an associated _event handler_ and export it to the runtime. For instance, to be notified when your application's window is resized, you should define the `oc_on_resize()` handler:
|
||||
|
||||
```
|
||||
```c
|
||||
ORCA_EXPORT void oc_on_resize(u32 width, u32 height)
|
||||
{
|
||||
// handle the window resize event
|
||||
}
|
||||
```
|
||||
|
||||
The `ORCA_EXPORT` macro makes the handler visible to the orca runtime, which automatically binds it to the window resize event.
|
||||
The `ORCA_EXPORT` macro makes the handler visible to the Orca runtime, which automatically binds it to the window resize event.
|
||||
|
||||
Handlers are optional. If you don't care about an event, you can just omit the associated handler. You probably want to define at least two important handlers:
|
||||
Handlers are optional. If you don't care about an event, you can just omit the associated handler. However, you will almost certainly want to define at least two important handlers:
|
||||
|
||||
- `oc_on_init()` is called once when your application starts and can be use to initialize your application's resources
|
||||
- `oc_on_init()` is called once when your application starts and can be use to initialize your application's resources.
|
||||
- `oc_on_frame_refresh()` is called when your application needs to render a new frame, typically tied to the refresh rate of the monitor.
|
||||
|
||||
For a list of available handlers and their signatures, see the [app cheatsheet](../doc/cheatsheets/cheatsheet_app.h).
|
||||
|
||||
|
||||
## Clock Example
|
||||
## Clock example
|
||||
|
||||
Let's look at the [clock example](../samples/clock). This is a simple app that shows an analog clock and showcases a couple of interesting Orca APIs.
|
||||
|
||||
Open [`main.c`](../samples/clock/src/main.c) and look at the definition of `oc_on_init()`. This handler is called when the applications starts, right after the application window has been created.
|
||||
Open [`main.c`](../samples/clock/src/main.c) and look at the definition of `oc_on_init()`. This handler is called when the application starts, right after the application window has been created.
|
||||
|
||||
The first thing we do here is set the title and dimensions of the window. We then create the graphics resources that we'll use to draw the clock onto the window.
|
||||
|
||||
```c
|
||||
ORCA_EXPORT void oc_on_init(void)
|
||||
{
|
||||
oc_window_set_title(OC_STR8("clock"));
|
||||
oc_window_set_size((oc_vec2){ .x = 400, .y = 400 });
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
### Graphics surfaces
|
||||
|
||||
The next line of `oc_init()` creates a _graphics surface_. A surface represents a destination you can draw into using a specific API. In this sample, we're going to use a canvas surface, which allows drawing with a 2D vector graphics API. Other samples use a GLES surface to draw with the OpenGL ES API.
|
||||
The next line of `oc_on_init()` creates a _graphics surface_. A surface represents a destination you can draw into using a specific API. In this sample, we're going to use a canvas surface, which allows drawing with a 2D vector graphics API. Other samples use a GLES surface to draw with the OpenGL ES API.
|
||||
|
||||
Before drawing into it, the surface must be selected as the current surface by calling `oc_surface_select()`. Once all drawing is done you can display the result by calling `oc_surface_present()`.
|
||||
|
||||
```c
|
||||
oc_surface surface = { 0 };
|
||||
oc_canvas canvas = { 0 };
|
||||
|
||||
ORCA_EXPORT void oc_on_init(void)
|
||||
{
|
||||
// ...
|
||||
surface = oc_surface_canvas();
|
||||
canvas = oc_canvas_create();
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
### Canvas
|
||||
|
||||
After creating the surface, we create a _canvas_. A canvas holds some context for drawing commands, like the current color or stroke width, as well as a command buffer that records all drawing commands. All canvas drawing functions use an implicit _current canvas_. You can select a canvas to be the current canvas by calling `oc_canvas_select()`, as seen at the begining of `oc_on_frame_refresh()`.
|
||||
|
@ -59,14 +94,17 @@ Canvas drawing functions like `oc_fill()` or `oc_stroke` merely add to the curre
|
|||
|
||||
To summarize, the general structure of canvas drawing code is like the following:
|
||||
|
||||
```
|
||||
oc_canvas_select(canvas); // make the canvas current
|
||||
```c
|
||||
ORCA_EXPORT void oc_on_frame_refresh(void)
|
||||
{
|
||||
oc_canvas_select(canvas); // make the canvas current
|
||||
|
||||
//... add commands to the canvas command buffer using drawing functions
|
||||
//... add commands to the canvas command buffer using drawing functions
|
||||
|
||||
oc_surface_select(surface); // select the canvas surface
|
||||
oc_render(canvas); // render the canvas commands into it
|
||||
oc_surface_present(surface); // display the result
|
||||
oc_surface_select(surface); // select the canvas surface
|
||||
oc_render(canvas); // render the canvas commands into it
|
||||
oc_surface_present(surface); // display the result
|
||||
}
|
||||
```
|
||||
|
||||
### Drawing
|
||||
|
@ -74,56 +112,55 @@ oc_surface_present(surface); // display the result
|
|||
Canvas drawing functions can be roughly divided into three groups:
|
||||
|
||||
- Path functions like `oc_line_to()` or `oc_cubic_to()` are used to specify paths using lines and curves.
|
||||
- Attributes setup functions like `oc_set_color()` or `oc_set_width()` are used to set attributes used by subsequent commands.
|
||||
- Attribute setup functions like `oc_set_color()` or `oc_set_width()` are used to set attributes used by subsequent commands.
|
||||
- Command functions like `oc_stroke()` and `oc_fill()` encode commands into the canvas command buffer using the current path and attributes.
|
||||
|
||||
Some helpers combine a path specification and a command, like `oc_circle_fill()`.
|
||||
|
||||
As an example, the back of the clock is drawn using these two calls:
|
||||
|
||||
```
|
||||
// clock backing
|
||||
oc_set_color_rgba(1, 1, 1, 1);
|
||||
oc_circle_fill(centerX, centerY, clockRadius);
|
||||
```c
|
||||
oc_set_color_rgba(1, 1, 1, 1);
|
||||
oc_circle_fill(centerX, centerY, clockRadius);
|
||||
```
|
||||
|
||||
For a list of canvas drawing functions, see the [graphics API cheatsheet](../doc/cheatsheets/cheatsheet_graphics.h).
|
||||
|
||||
#### Transforms
|
||||
|
||||
A special case of attribute setting function is the pair `oc_matrix_push()` and `oc_matrix_pop()`, which are used to manipulate a stack of transform matrices:
|
||||
A special case of attribute setting function is the pair `oc_matrix_multiply_push()` and `oc_matrix_pop()`, which are used to manipulate a stack of transform matrices:
|
||||
|
||||
- `oc_matrix_push()` multiplies the matrix currently on top of the stack with its argument, and pushes the result on the stack.
|
||||
- `oc_matrix_multiply_push()` multiplies the matrix currently on top of the stack with its argument, and pushes the result on the stack.
|
||||
- `oc_matrix_pop()` pops a matrix from the stack.
|
||||
|
||||
The matrix on the top of the stack at the time a command is encoded is used to transform the path of that command.
|
||||
|
||||
You can see an example of using transform matrices when drawing the clock's hands:
|
||||
|
||||
```
|
||||
// hours hand
|
||||
oc_matrix_push(mat_transform(centerX, centerY, hoursRotation));
|
||||
{
|
||||
oc_set_color_rgba(.2, 0.2, 0.2, 1);
|
||||
oc_rounded_rectangle_fill(0, -7.5 * uiScale, clockRadius * 0.5f, 15 * uiScale, 5 * uiScale);
|
||||
}
|
||||
oc_matrix_pop();
|
||||
```c
|
||||
// hour hand
|
||||
oc_matrix_multiply_push(mat_transform(centerX, centerY, hoursRotation));
|
||||
{
|
||||
oc_set_color_rgba(.2, 0.2, 0.2, 1);
|
||||
oc_rounded_rectangle_fill(0, -7.5 * uiScale, clockRadius * 0.5f, 15 * uiScale, 5 * uiScale);
|
||||
}
|
||||
oc_matrix_pop();
|
||||
```
|
||||
|
||||
### Fonts and text
|
||||
|
||||
Going back to `oc_init()`, after creating a surface and a canvas, we create a font that we will use to draw the numbers on the clock's face:
|
||||
|
||||
```
|
||||
oc_unicode_range ranges[5] = {
|
||||
OC_UNICODE_BASIC_LATIN,
|
||||
OC_UNICODE_C1_CONTROLS_AND_LATIN_1_SUPPLEMENT,
|
||||
OC_UNICODE_LATIN_EXTENDED_A,
|
||||
OC_UNICODE_LATIN_EXTENDED_B,
|
||||
OC_UNICODE_SPECIALS
|
||||
};
|
||||
```c
|
||||
oc_unicode_range ranges[5] = {
|
||||
OC_UNICODE_BASIC_LATIN,
|
||||
OC_UNICODE_C1_CONTROLS_AND_LATIN_1_SUPPLEMENT,
|
||||
OC_UNICODE_LATIN_EXTENDED_A,
|
||||
OC_UNICODE_LATIN_EXTENDED_B,
|
||||
OC_UNICODE_SPECIALS
|
||||
};
|
||||
|
||||
font = oc_font_create_from_path(OC_STR8("/segoeui.ttf"), 5, ranges);
|
||||
font = oc_font_create_from_path(OC_STR8("/segoeui.ttf"), 5, ranges);
|
||||
```
|
||||
|
||||
The font is loaded from a font file located in a data folder inside the app bundle. By default, Orca apps use this data folder as their "root" for file operations.
|
||||
|
@ -132,35 +169,37 @@ Along with the path of the font file, we pass to the creation function the unico
|
|||
|
||||
We then use the font to draw the clock's face:
|
||||
|
||||
```
|
||||
// clock face
|
||||
for(int i = 0; i < oc_array_size(clockNumberStrings); ++i)
|
||||
{
|
||||
oc_rect textRect = oc_text_bounding_box(font, fontSize, clockNumberStrings[i]);
|
||||
textRect.h -= 10 * uiScale; // oc_text_bounding_box height doesn't seem to be a tight fit around the glyph
|
||||
```c
|
||||
// clock face
|
||||
for(int i = 0; i < oc_array_size(clockNumberStrings); ++i)
|
||||
{
|
||||
oc_rect textRect = oc_font_text_metrics(font, fontSize, clockNumberStrings[i]).ink;
|
||||
|
||||
const f32 angle = i * ((M_PI * 2) / 12.0f) - (M_PI / 2);
|
||||
oc_mat2x3 transform = mat_transform(centerX - (textRect.w / 2), centerY + (textRect.h / 2), angle);
|
||||
oc_vec2 pos = oc_mat2x3_mul(transform, (oc_vec2){ clockRadius * 0.8f, 0 });
|
||||
const f32 angle = i * ((M_PI * 2) / 12.0f) - (M_PI / 2);
|
||||
oc_mat2x3 transform = mat_transform(centerX - (textRect.w / 2) - textRect.x,
|
||||
centerY - (textRect.h / 2) - textRect.y,
|
||||
angle);
|
||||
|
||||
oc_set_color_rgba(0.2, 0.2, 0.2, 1);
|
||||
oc_text_fill(pos.x, pos.y, clockNumberStrings[i]);
|
||||
}
|
||||
oc_vec2 pos = oc_mat2x3_mul(transform, (oc_vec2){ clockRadius * 0.8f, 0 });
|
||||
|
||||
oc_set_color_rgba(0.2, 0.2, 0.2, 1);
|
||||
oc_text_fill(pos.x, pos.y, clockNumberStrings[i]);
|
||||
}
|
||||
```
|
||||
|
||||
### Logging and asserts
|
||||
|
||||
The runtime has a console overlay whose visiblity can be toggled on and off with `Shift + Cmd + D` on macOS, or `Shift + Ctrl + D` on Windows. Your application can log messages, warnings or errors to that console using the following functions:
|
||||
The runtime has a console overlay whose visiblity can be toggled on and off with `⌘ + Shift + D` on macOS, or `Ctrl + Shift + D` on Windows. Your application can log messages, warnings, or errors to that console using the following functions:
|
||||
|
||||
```
|
||||
```c
|
||||
void oc_log_info(const char* fmt, ...); // informational messages
|
||||
void oc_log_warning(const char* fmt, ...); // warnings, displayed in orange.
|
||||
void oc_log_error(const char* fmt, ...); // errors, displayed in red.
|
||||
void oc_log_error(const char* fmt, ...); // errors, displayed in red.
|
||||
```
|
||||
|
||||
If you started the application from a terminal, the log entries are also duplicated there.
|
||||
|
||||
You can assert on a condition using `OC_ASSERT(test, fmt, ...)`. If the test fails, the runtime displays a message box including your message, and terminates the application.
|
||||
You can assert on a condition using `OC_ASSERT(test, fmt, ...)`. If the test fails, the runtime displays a message box and terminates the application.
|
||||
|
||||
You can unconditionally abort the application with a message box using `OC_ABORT(fmt, ...)`.
|
||||
|
||||
|
@ -168,10 +207,10 @@ You can unconditionally abort the application with a message box using `OC_ABORT
|
|||
|
||||
For more examples of how to use Orca APIs, you can look at the other [sample apps](../samples):
|
||||
|
||||
- [breakout](./samples/breakout) is a mini breakout game making use of the vector graphics API. It demonstrates using input and drawing images.
|
||||
- [triangle](./samples/triangle) shows how to draw a spining triangle using the GLES API.
|
||||
- [fluid](./samples/fluid) is a fluid simulation using a more complex GLES setup.
|
||||
- [ui](./samples/ui) showcases the UI API and Orca's default UI widgets.
|
||||
- [breakout](../samples/breakout) is a mini breakout game making use of the vector graphics API. It demonstrates using input and drawing images.
|
||||
- [triangle](../samples/triangle) shows how to draw a spining triangle using the GLES API.
|
||||
- [fluid](../samples/fluid) is a fluid simulation using a more complex GLES setup.
|
||||
- [ui](../samples/ui) showcases the UI API and Orca's default UI widgets.
|
||||
|
||||
For a list of Orca APIs, you can look at the [API cheatsheets](../doc/cheatsheets).
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# UI Colors
|
||||
|
||||
## Dark (default theme)
|
||||
![Dark theme colors](images/UIDarkPalette.svg)
|
||||
|
||||
## Light
|
||||
![Light theme colors](images/UILightPalette.svg)
|
|
@ -16,8 +16,8 @@ void oc_on_mouse_enter(void);
|
|||
void oc_on_mouse_leave(void);
|
||||
void oc_on_mouse_move(f32 x, f32 y, f32 deltaX, f32 deltaY);
|
||||
void oc_on_mouse_wheel(f32 deltaX, f32 deltaY);
|
||||
void oc_on_key_down(oc_key_code key);
|
||||
void oc_on_key_up(oc_key_code key);
|
||||
void oc_on_key_down(oc_scan_code scan, oc_key_code key);
|
||||
void oc_on_key_up(oc_scan_code scan, oc_key_code key);
|
||||
void oc_on_frame_refresh(void);
|
||||
void oc_on_resize(f32 width, f32 height);
|
||||
void oc_on_raw_event(oc_event* event);
|
||||
|
|
|
@ -39,6 +39,7 @@ void oc_render(oc_canvas canvas);
|
|||
//------------------------------------------------------------------------------------------
|
||||
|
||||
void oc_matrix_push(oc_mat2x3 matrix);
|
||||
void oc_matrix_multiply_push(oc_mat2x3 matrix);
|
||||
void oc_matrix_pop(void);
|
||||
oc_mat2x3 oc_matrix_top();
|
||||
|
||||
|
@ -116,21 +117,21 @@ oc_font oc_font_nil(void);
|
|||
bool oc_font_is_nil(oc_font font);
|
||||
|
||||
oc_font oc_font_create_from_memory(oc_str8 mem, u32 rangeCount, oc_unicode_range* ranges);
|
||||
oc_font oc_font_create_from_file(oc_file file, u32 rangeCount, oc_unicode_range* ranges);
|
||||
oc_font oc_font_create_from_path(oc_str8 path, u32 rangeCount, oc_unicode_range* ranges);
|
||||
|
||||
void oc_font_destroy(oc_font font);
|
||||
|
||||
oc_font_extents oc_font_get_extents(oc_font font);
|
||||
oc_font_extents oc_font_get_scaled_extents(oc_font font, f32 emSize);
|
||||
oc_str32 oc_font_get_glyph_indices(oc_font font, oc_str32 codePoints, oc_str32 backing);
|
||||
oc_str32 oc_font_push_glyph_indices(oc_arena* arena, oc_font font, oc_str32 codePoints);
|
||||
u32 oc_font_get_glyph_index(oc_font font, oc_utf32 codePoint);
|
||||
|
||||
oc_font_metrics oc_font_get_metrics(oc_font font, f32 emSize);
|
||||
oc_font_metrics oc_font_get_metrics_unscaled(oc_font font);
|
||||
f32 oc_font_get_scale_for_em_pixels(oc_font font, f32 emSize);
|
||||
|
||||
u32 oc_font_get_glyph_index(oc_font font, oc_utf32 codePoint);
|
||||
oc_str32 oc_font_get_glyph_indices(oc_font font, oc_str32 codePoints, oc_str32 backing);
|
||||
oc_str32 oc_font_push_glyph_indices(oc_font font, oc_arena* arena, oc_str32 codePoints);
|
||||
|
||||
int oc_font_get_codepoint_extents(oc_font font, oc_utf32 codePoint, oc_text_extents* outExtents);
|
||||
int oc_font_get_glyph_extents(oc_font font, oc_str32 glyphIndices, oc_text_extents* outExtents);
|
||||
|
||||
oc_rect oc_text_bounding_box_utf32(oc_font font, f32 fontSize, oc_str32 text);
|
||||
oc_rect oc_text_bounding_box(oc_font font, f32 fontSize, oc_str8 text);
|
||||
oc_text_metrics oc_font_text_metrics_utf32(oc_font font, f32 fontSize, oc_str32 codepoints);
|
||||
oc_text_metrics oc_font_text_metrics(oc_font font, f32 fontSize, oc_str8 text);
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
// images
|
||||
|
@ -141,7 +142,8 @@ bool oc_image_is_nil(oc_image a);
|
|||
oc_image oc_image_create(oc_surface surface, u32 width, u32 height);
|
||||
oc_image oc_image_create_from_rgba8(oc_surface surface, u32 width, u32 height, u8* pixels);
|
||||
oc_image oc_image_create_from_memory(oc_surface surface, oc_str8 mem, bool flip);
|
||||
oc_image oc_image_create_from_file(oc_surface surface, oc_str8 path, bool flip);
|
||||
oc_image oc_image_create_from_file(oc_surface surface, oc_file file, bool flip);
|
||||
oc_image oc_image_create_from_path(oc_surface surface, oc_str8 path, bool flip);
|
||||
|
||||
void oc_image_destroy(oc_image image);
|
||||
|
||||
|
@ -157,6 +159,8 @@ oc_rect oc_rect_atlas_alloc(oc_rect_atlas* atlas, i32 width, i32 height);
|
|||
void oc_rect_atlas_recycle(oc_rect_atlas* atlas, oc_rect rect);
|
||||
|
||||
oc_image_region oc_image_atlas_alloc_from_rgba8(oc_rect_atlas* atlas, oc_image backingImage, u32 width, u32 height, u8* pixels);
|
||||
oc_image_region oc_image_atlas_alloc_from_data(oc_rect_atlas* atlas, oc_image backingImage, oc_str8 data, bool flip);
|
||||
oc_image_region oc_image_atlas_alloc_from_file(oc_rect_atlas* atlas, oc_image backingImage, oc_str8 path, bool flip);
|
||||
oc_image_region oc_image_atlas_alloc_from_memory(oc_rect_atlas* atlas, oc_image backingImage, oc_str8 mem, bool flip);
|
||||
oc_image_region oc_image_atlas_alloc_from_file(oc_rect_atlas* atlas, oc_image backingImage, oc_file file, bool flip);
|
||||
oc_image_region oc_image_atlas_alloc_from_path(oc_rect_atlas* atlas, oc_image backingImage, oc_str8 path, bool flip);
|
||||
|
||||
void oc_image_atlas_recycle(oc_rect_atlas* atlas, oc_image_region imageRgn);
|
||||
|
|
|
@ -0,0 +1,500 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- Generated by SVGo -->
|
||||
<svg width="1200" height="1050"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<style type="text/css">
|
||||
<![CDATA[
|
||||
|
||||
text {
|
||||
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"
|
||||
}
|
||||
]]>
|
||||
</style>
|
||||
<rect x="0" y="0" width="150" height="50" style="fill: #6C090B" />
|
||||
<text x="5" y="29" style="font-size: 16px; fill: #fff3ef" >red0</text>
|
||||
<text x="5" y="45" style="font-size: 12px; fill: #fff3ef" >#6C090B</text>
|
||||
<rect x="0" y="50" width="150" height="50" style="fill: #901110" />
|
||||
<text x="5" y="79" style="font-size: 16px; fill: #fff3ef" >red1</text>
|
||||
<text x="5" y="95" style="font-size: 12px; fill: #fff3ef" >#901110</text>
|
||||
<rect x="0" y="100" width="150" height="50" style="fill: #B42019" />
|
||||
<text x="5" y="129" style="font-size: 16px; fill: #fff3ef" >red2</text>
|
||||
<text x="5" y="145" style="font-size: 12px; fill: #fff3ef" >#B42019</text>
|
||||
<rect x="0" y="150" width="150" height="50" style="fill: #D73324" />
|
||||
<text x="5" y="179" style="font-size: 16px; fill: #fff3ef" >red3</text>
|
||||
<text x="5" y="195" style="font-size: 12px; fill: #fff3ef" >#D73324</text>
|
||||
<rect x="0" y="200" width="150" height="50" style="fill: #FB4932" />
|
||||
<text x="5" y="229" style="font-size: 16px; fill: #fff3ef" >red4</text>
|
||||
<text x="5" y="245" style="font-size: 12px; fill: #fff3ef" >#FB4932</text>
|
||||
<rect x="0" y="250" width="150" height="50" style="fill: #FC725A" />
|
||||
<text x="5" y="279" style="font-size: 16px; fill: #6c090b" >red5</text>
|
||||
<text x="5" y="295" style="font-size: 12px; fill: #6c090b" >#FC725A</text>
|
||||
<rect x="0" y="300" width="150" height="50" style="fill: #FD9983" />
|
||||
<text x="5" y="329" style="font-size: 16px; fill: #6c090b" >red6</text>
|
||||
<text x="5" y="345" style="font-size: 12px; fill: #6c090b" >#FD9983</text>
|
||||
<rect x="0" y="350" width="150" height="50" style="fill: #FDBEAC" />
|
||||
<text x="5" y="379" style="font-size: 16px; fill: #6c090b" >red7</text>
|
||||
<text x="5" y="395" style="font-size: 12px; fill: #6c090b" >#FDBEAC</text>
|
||||
<rect x="0" y="400" width="150" height="50" style="fill: #FEE0D5" />
|
||||
<text x="5" y="429" style="font-size: 16px; fill: #6c090b" >red8</text>
|
||||
<text x="5" y="445" style="font-size: 12px; fill: #6c090b" >#FEE0D5</text>
|
||||
<rect x="0" y="450" width="150" height="50" style="fill: #FFF3EF" />
|
||||
<text x="5" y="479" style="font-size: 16px; fill: #6c090b" >red9</text>
|
||||
<text x="5" y="495" style="font-size: 12px; fill: #6c090b" >#FFF3EF</text>
|
||||
<rect x="150" y="0" width="150" height="50" style="fill: #551F03" />
|
||||
<text x="155" y="29" style="font-size: 16px; fill: #fff9ed" >orange0</text>
|
||||
<text x="155" y="45" style="font-size: 12px; fill: #fff9ed" >#551F03</text>
|
||||
<rect x="150" y="50" width="150" height="50" style="fill: #803506" />
|
||||
<text x="155" y="79" style="font-size: 16px; fill: #fff9ed" >orange1</text>
|
||||
<text x="155" y="95" style="font-size: 12px; fill: #fff9ed" >#803506</text>
|
||||
<rect x="150" y="100" width="150" height="50" style="fill: #AA500A" />
|
||||
<text x="155" y="129" style="font-size: 16px; fill: #fff9ed" >orange2</text>
|
||||
<text x="155" y="145" style="font-size: 12px; fill: #fff9ed" >#AA500A</text>
|
||||
<rect x="150" y="150" width="150" height="50" style="fill: #D56F0F" />
|
||||
<text x="155" y="179" style="font-size: 16px; fill: #fff9ed" >orange3</text>
|
||||
<text x="155" y="195" style="font-size: 12px; fill: #fff9ed" >#D56F0F</text>
|
||||
<rect x="150" y="200" width="150" height="50" style="fill: #FF9214" />
|
||||
<text x="155" y="229" style="font-size: 16px; fill: #fff9ed" >orange4</text>
|
||||
<text x="155" y="245" style="font-size: 12px; fill: #fff9ed" >#FF9214</text>
|
||||
<rect x="150" y="250" width="150" height="50" style="fill: #FFAE43" />
|
||||
<text x="155" y="279" style="font-size: 16px; fill: #551f03" >orange5</text>
|
||||
<text x="155" y="295" style="font-size: 12px; fill: #551f03" >#FFAE43</text>
|
||||
<rect x="150" y="300" width="150" height="50" style="fill: #FFC772" />
|
||||
<text x="155" y="329" style="font-size: 16px; fill: #551f03" >orange6</text>
|
||||
<text x="155" y="345" style="font-size: 12px; fill: #551f03" >#FFC772</text>
|
||||
<rect x="150" y="350" width="150" height="50" style="fill: #FFDDA1" />
|
||||
<text x="155" y="379" style="font-size: 16px; fill: #551f03" >orange7</text>
|
||||
<text x="155" y="395" style="font-size: 12px; fill: #551f03" >#FFDDA1</text>
|
||||
<rect x="150" y="400" width="150" height="50" style="fill: #FFEFD0" />
|
||||
<text x="155" y="429" style="font-size: 16px; fill: #551f03" >orange8</text>
|
||||
<text x="155" y="445" style="font-size: 12px; fill: #551f03" >#FFEFD0</text>
|
||||
<rect x="150" y="450" width="150" height="50" style="fill: #FFF9ED" />
|
||||
<text x="155" y="479" style="font-size: 16px; fill: #551f03" >orange9</text>
|
||||
<text x="155" y="495" style="font-size: 12px; fill: #551f03" >#FFF9ED</text>
|
||||
<rect x="300" y="0" width="150" height="50" style="fill: #512E09" />
|
||||
<text x="305" y="29" style="font-size: 16px; fill: #fefbed" >amber0</text>
|
||||
<text x="305" y="45" style="font-size: 12px; fill: #fefbed" >#512E09</text>
|
||||
<rect x="300" y="50" width="150" height="50" style="fill: #794B0F" />
|
||||
<text x="305" y="79" style="font-size: 16px; fill: #fefbed" >amber1</text>
|
||||
<text x="305" y="95" style="font-size: 12px; fill: #fefbed" >#794B0F</text>
|
||||
<rect x="300" y="100" width="150" height="50" style="fill: #A16B16" />
|
||||
<text x="305" y="129" style="font-size: 16px; fill: #fefbed" >amber2</text>
|
||||
<text x="305" y="145" style="font-size: 12px; fill: #fefbed" >#A16B16</text>
|
||||
<rect x="300" y="150" width="150" height="50" style="fill: #CA8F1E" />
|
||||
<text x="305" y="179" style="font-size: 16px; fill: #fefbed" >amber3</text>
|
||||
<text x="305" y="195" style="font-size: 12px; fill: #fefbed" >#CA8F1E</text>
|
||||
<rect x="300" y="200" width="150" height="50" style="fill: #F2B726" />
|
||||
<text x="305" y="229" style="font-size: 16px; fill: #fefbed" >amber4</text>
|
||||
<text x="305" y="245" style="font-size: 12px; fill: #fefbed" >#F2B726</text>
|
||||
<rect x="300" y="250" width="150" height="50" style="fill: #F5CA50" />
|
||||
<text x="305" y="279" style="font-size: 16px; fill: #512e09" >amber5</text>
|
||||
<text x="305" y="295" style="font-size: 12px; fill: #512e09" >#F5CA50</text>
|
||||
<rect x="300" y="300" width="150" height="50" style="fill: #F7DB7A" />
|
||||
<text x="305" y="329" style="font-size: 16px; fill: #512e09" >amber6</text>
|
||||
<text x="305" y="345" style="font-size: 12px; fill: #512e09" >#F7DB7A</text>
|
||||
<rect x="300" y="350" width="150" height="50" style="fill: #FAEAA6" />
|
||||
<text x="305" y="379" style="font-size: 16px; fill: #512e09" >amber7</text>
|
||||
<text x="305" y="395" style="font-size: 12px; fill: #512e09" >#FAEAA6</text>
|
||||
<rect x="300" y="400" width="150" height="50" style="fill: #FCF6D2" />
|
||||
<text x="305" y="429" style="font-size: 16px; fill: #512e09" >amber8</text>
|
||||
<text x="305" y="445" style="font-size: 12px; fill: #512e09" >#FCF6D2</text>
|
||||
<rect x="300" y="450" width="150" height="50" style="fill: #FEFBED" />
|
||||
<text x="305" y="479" style="font-size: 16px; fill: #512e09" >amber9</text>
|
||||
<text x="305" y="495" style="font-size: 12px; fill: #512e09" >#FEFBED</text>
|
||||
<rect x="450" y="0" width="150" height="50" style="fill: #544903" />
|
||||
<text x="455" y="29" style="font-size: 16px; fill: #fffeec" >yellow0</text>
|
||||
<text x="455" y="45" style="font-size: 12px; fill: #fffeec" >#544903</text>
|
||||
<rect x="450" y="50" width="150" height="50" style="fill: #7E6C06" />
|
||||
<text x="455" y="79" style="font-size: 16px; fill: #fffeec" >yellow1</text>
|
||||
<text x="455" y="95" style="font-size: 12px; fill: #fffeec" >#7E6C06</text>
|
||||
<rect x="450" y="100" width="150" height="50" style="fill: #A88E0A" />
|
||||
<text x="455" y="129" style="font-size: 16px; fill: #fffeec" >yellow2</text>
|
||||
<text x="455" y="145" style="font-size: 12px; fill: #fffeec" >#A88E0A</text>
|
||||
<rect x="450" y="150" width="150" height="50" style="fill: #D2AF0F" />
|
||||
<text x="455" y="179" style="font-size: 16px; fill: #fffeec" >yellow3</text>
|
||||
<text x="455" y="195" style="font-size: 12px; fill: #fffeec" >#D2AF0F</text>
|
||||
<rect x="450" y="200" width="150" height="50" style="fill: #FCCE14" />
|
||||
<text x="455" y="229" style="font-size: 16px; fill: #fffeec" >yellow4</text>
|
||||
<text x="455" y="245" style="font-size: 12px; fill: #fffeec" >#FCCE14</text>
|
||||
<rect x="450" y="250" width="150" height="50" style="fill: #FDDE43" />
|
||||
<text x="455" y="279" style="font-size: 16px; fill: #544903" >yellow5</text>
|
||||
<text x="455" y="295" style="font-size: 12px; fill: #544903" >#FDDE43</text>
|
||||
<rect x="450" y="300" width="150" height="50" style="fill: #FDEB71" />
|
||||
<text x="455" y="329" style="font-size: 16px; fill: #544903" >yellow6</text>
|
||||
<text x="455" y="345" style="font-size: 12px; fill: #544903" >#FDEB71</text>
|
||||
<rect x="450" y="350" width="150" height="50" style="fill: #FEF5A0" />
|
||||
<text x="455" y="379" style="font-size: 16px; fill: #544903" >yellow7</text>
|
||||
<text x="455" y="395" style="font-size: 12px; fill: #544903" >#FEF5A0</text>
|
||||
<rect x="450" y="400" width="150" height="50" style="fill: #FEFBD0" />
|
||||
<text x="455" y="429" style="font-size: 16px; fill: #544903" >yellow8</text>
|
||||
<text x="455" y="445" style="font-size: 12px; fill: #544903" >#FEFBD0</text>
|
||||
<rect x="450" y="450" width="150" height="50" style="fill: #FFFEEC" />
|
||||
<text x="455" y="479" style="font-size: 16px; fill: #544903" >yellow9</text>
|
||||
<text x="455" y="495" style="font-size: 12px; fill: #544903" >#FFFEEC</text>
|
||||
<rect x="600" y="0" width="150" height="50" style="fill: #314603" />
|
||||
<text x="605" y="29" style="font-size: 16px; fill: #f3fbe9" >lime0</text>
|
||||
<text x="605" y="45" style="font-size: 12px; fill: #f3fbe9" >#314603</text>
|
||||
<rect x="600" y="50" width="150" height="50" style="fill: #4B6905" />
|
||||
<text x="605" y="79" style="font-size: 16px; fill: #f3fbe9" >lime1</text>
|
||||
<text x="605" y="95" style="font-size: 12px; fill: #f3fbe9" >#4B6905</text>
|
||||
<rect x="600" y="100" width="150" height="50" style="fill: #678D09" />
|
||||
<text x="605" y="129" style="font-size: 16px; fill: #f3fbe9" >lime2</text>
|
||||
<text x="605" y="145" style="font-size: 12px; fill: #f3fbe9" >#678D09</text>
|
||||
<rect x="600" y="150" width="150" height="50" style="fill: #84B00C" />
|
||||
<text x="605" y="179" style="font-size: 16px; fill: #f3fbe9" >lime3</text>
|
||||
<text x="605" y="195" style="font-size: 12px; fill: #f3fbe9" >#84B00C</text>
|
||||
<rect x="600" y="200" width="150" height="50" style="fill: #A2D311" />
|
||||
<text x="605" y="229" style="font-size: 16px; fill: #f3fbe9" >lime4</text>
|
||||
<text x="605" y="245" style="font-size: 12px; fill: #f3fbe9" >#A2D311</text>
|
||||
<rect x="600" y="250" width="150" height="50" style="fill: #AEDC3A" />
|
||||
<text x="605" y="279" style="font-size: 16px; fill: #314603" >lime5</text>
|
||||
<text x="605" y="295" style="font-size: 12px; fill: #314603" >#AEDC3A</text>
|
||||
<rect x="600" y="300" width="150" height="50" style="fill: #BDE566" />
|
||||
<text x="605" y="329" style="font-size: 16px; fill: #314603" >lime6</text>
|
||||
<text x="605" y="345" style="font-size: 12px; fill: #314603" >#BDE566</text>
|
||||
<rect x="600" y="350" width="150" height="50" style="fill: #CFED96" />
|
||||
<text x="605" y="379" style="font-size: 16px; fill: #314603" >lime7</text>
|
||||
<text x="605" y="395" style="font-size: 12px; fill: #314603" >#CFED96</text>
|
||||
<rect x="600" y="400" width="150" height="50" style="fill: #E5F6C9" />
|
||||
<text x="605" y="429" style="font-size: 16px; fill: #314603" >lime8</text>
|
||||
<text x="605" y="445" style="font-size: 12px; fill: #314603" >#E5F6C9</text>
|
||||
<rect x="600" y="450" width="150" height="50" style="fill: #F3FBE9" />
|
||||
<text x="605" y="479" style="font-size: 16px; fill: #314603" >lime9</text>
|
||||
<text x="605" y="495" style="font-size: 12px; fill: #314603" >#F3FBE9</text>
|
||||
<rect x="750" y="0" width="150" height="50" style="fill: #263D13" />
|
||||
<text x="755" y="29" style="font-size: 16px; fill: #f3f8ed" >lightGreen0</text>
|
||||
<text x="755" y="45" style="font-size: 12px; fill: #f3f8ed" >#263D13</text>
|
||||
<rect x="750" y="50" width="150" height="50" style="fill: #3B5C1D" />
|
||||
<text x="755" y="79" style="font-size: 16px; fill: #f3f8ed" >lightGreen1</text>
|
||||
<text x="755" y="95" style="font-size: 12px; fill: #f3f8ed" >#3B5C1D</text>
|
||||
<rect x="750" y="100" width="150" height="50" style="fill: #517B28" />
|
||||
<text x="755" y="129" style="font-size: 16px; fill: #f3f8ed" >lightGreen2</text>
|
||||
<text x="755" y="145" style="font-size: 12px; fill: #f3f8ed" >#517B28</text>
|
||||
<rect x="750" y="150" width="150" height="50" style="fill: #679934" />
|
||||
<text x="755" y="179" style="font-size: 16px; fill: #f3f8ed" >lightGreen3</text>
|
||||
<text x="755" y="195" style="font-size: 12px; fill: #f3f8ed" >#679934</text>
|
||||
<rect x="750" y="200" width="150" height="50" style="fill: #7FB840" />
|
||||
<text x="755" y="229" style="font-size: 16px; fill: #f3f8ed" >lightGreen4</text>
|
||||
<text x="755" y="245" style="font-size: 12px; fill: #f3f8ed" >#7FB840</text>
|
||||
<rect x="750" y="250" width="150" height="50" style="fill: #97C65F" />
|
||||
<text x="755" y="279" style="font-size: 16px; fill: #263d13" >lightGreen5</text>
|
||||
<text x="755" y="295" style="font-size: 12px; fill: #263d13" >#97C65F</text>
|
||||
<rect x="750" y="300" width="150" height="50" style="fill: #B0D481" />
|
||||
<text x="755" y="329" style="font-size: 16px; fill: #263d13" >lightGreen6</text>
|
||||
<text x="755" y="345" style="font-size: 12px; fill: #263d13" >#B0D481</text>
|
||||
<rect x="750" y="350" width="150" height="50" style="fill: #C9E3A7" />
|
||||
<text x="755" y="379" style="font-size: 16px; fill: #263d13" >lightGreen7</text>
|
||||
<text x="755" y="395" style="font-size: 12px; fill: #263d13" >#C9E3A7</text>
|
||||
<rect x="750" y="400" width="150" height="50" style="fill: #E4F1D1" />
|
||||
<text x="755" y="429" style="font-size: 16px; fill: #263d13" >lightGreen8</text>
|
||||
<text x="755" y="445" style="font-size: 12px; fill: #263d13" >#E4F1D1</text>
|
||||
<rect x="750" y="450" width="150" height="50" style="fill: #F3F8ED" />
|
||||
<text x="755" y="479" style="font-size: 16px; fill: #263d13" >lightGreen9</text>
|
||||
<text x="755" y="495" style="font-size: 12px; fill: #263d13" >#F3F8ED</text>
|
||||
<rect x="900" y="0" width="150" height="50" style="fill: #123C19" />
|
||||
<text x="905" y="29" style="font-size: 16px; fill: #ecf7ec" >green0</text>
|
||||
<text x="905" y="45" style="font-size: 12px; fill: #ecf7ec" >#123C19</text>
|
||||
<rect x="900" y="50" width="150" height="50" style="fill: #1C5A25" />
|
||||
<text x="905" y="79" style="font-size: 16px; fill: #ecf7ec" >green1</text>
|
||||
<text x="905" y="95" style="font-size: 12px; fill: #ecf7ec" >#1C5A25</text>
|
||||
<rect x="900" y="100" width="150" height="50" style="fill: #277731" />
|
||||
<text x="905" y="129" style="font-size: 16px; fill: #ecf7ec" >green2</text>
|
||||
<text x="905" y="145" style="font-size: 12px; fill: #ecf7ec" >#277731</text>
|
||||
<rect x="900" y="150" width="150" height="50" style="fill: #32953D" />
|
||||
<text x="905" y="179" style="font-size: 16px; fill: #ecf7ec" >green3</text>
|
||||
<text x="905" y="195" style="font-size: 12px; fill: #ecf7ec" >#32953D</text>
|
||||
<rect x="900" y="200" width="150" height="50" style="fill: #3EB349" />
|
||||
<text x="905" y="229" style="font-size: 16px; fill: #ecf7ec" >green4</text>
|
||||
<text x="905" y="245" style="font-size: 12px; fill: #ecf7ec" >#3EB349</text>
|
||||
<rect x="900" y="250" width="150" height="50" style="fill: #5DC264" />
|
||||
<text x="905" y="279" style="font-size: 16px; fill: #123c19" >green5</text>
|
||||
<text x="905" y="295" style="font-size: 12px; fill: #123c19" >#5DC264</text>
|
||||
<rect x="900" y="300" width="150" height="50" style="fill: #7FD184" />
|
||||
<text x="905" y="329" style="font-size: 16px; fill: #123c19" >green6</text>
|
||||
<text x="905" y="345" style="font-size: 12px; fill: #123c19" >#7FD184</text>
|
||||
<rect x="900" y="350" width="150" height="50" style="fill: #A6E1A8" />
|
||||
<text x="905" y="379" style="font-size: 16px; fill: #123c19" >green7</text>
|
||||
<text x="905" y="395" style="font-size: 12px; fill: #123c19" >#A6E1A8</text>
|
||||
<rect x="900" y="400" width="150" height="50" style="fill: #D0F0D1" />
|
||||
<text x="905" y="429" style="font-size: 16px; fill: #123c19" >green8</text>
|
||||
<text x="905" y="445" style="font-size: 12px; fill: #123c19" >#D0F0D1</text>
|
||||
<rect x="900" y="450" width="150" height="50" style="fill: #ECF7EC" />
|
||||
<text x="905" y="479" style="font-size: 16px; fill: #123c19" >green9</text>
|
||||
<text x="905" y="495" style="font-size: 12px; fill: #123c19" >#ECF7EC</text>
|
||||
<rect x="1050" y="0" width="150" height="50" style="fill: #023C39" />
|
||||
<text x="1055" y="29" style="font-size: 16px; fill: #e6f7f4" >teal0</text>
|
||||
<text x="1055" y="45" style="font-size: 12px; fill: #e6f7f4" >#023C39</text>
|
||||
<rect x="1050" y="50" width="150" height="50" style="fill: #045A55" />
|
||||
<text x="1055" y="79" style="font-size: 16px; fill: #e6f7f4" >teal1</text>
|
||||
<text x="1055" y="95" style="font-size: 12px; fill: #e6f7f4" >#045A55</text>
|
||||
<rect x="1050" y="100" width="150" height="50" style="fill: #07776F" />
|
||||
<text x="1055" y="129" style="font-size: 16px; fill: #e6f7f4" >teal2</text>
|
||||
<text x="1055" y="145" style="font-size: 12px; fill: #e6f7f4" >#07776F</text>
|
||||
<rect x="1050" y="150" width="150" height="50" style="fill: #0A9588" />
|
||||
<text x="1055" y="179" style="font-size: 16px; fill: #e6f7f4" >teal3</text>
|
||||
<text x="1055" y="195" style="font-size: 12px; fill: #e6f7f4" >#0A9588</text>
|
||||
<rect x="1050" y="200" width="150" height="50" style="fill: #0EB3A1" />
|
||||
<text x="1055" y="229" style="font-size: 16px; fill: #e6f7f4" >teal4</text>
|
||||
<text x="1055" y="245" style="font-size: 12px; fill: #e6f7f4" >#0EB3A1</text>
|
||||
<rect x="1050" y="250" width="150" height="50" style="fill: #33C2B0" />
|
||||
<text x="1055" y="279" style="font-size: 16px; fill: #023c39" >teal5</text>
|
||||
<text x="1055" y="295" style="font-size: 12px; fill: #023c39" >#33C2B0</text>
|
||||
<rect x="1050" y="300" width="150" height="50" style="fill: #5ED1C1" />
|
||||
<text x="1055" y="329" style="font-size: 16px; fill: #023c39" >teal6</text>
|
||||
<text x="1055" y="345" style="font-size: 12px; fill: #023c39" >#5ED1C1</text>
|
||||
<rect x="1050" y="350" width="150" height="50" style="fill: #8EE1D3" />
|
||||
<text x="1055" y="379" style="font-size: 16px; fill: #023c39" >teal7</text>
|
||||
<text x="1055" y="395" style="font-size: 12px; fill: #023c39" >#8EE1D3</text>
|
||||
<rect x="1050" y="400" width="150" height="50" style="fill: #C4F0E8" />
|
||||
<text x="1055" y="429" style="font-size: 16px; fill: #023c39" >teal8</text>
|
||||
<text x="1055" y="445" style="font-size: 12px; fill: #023c39" >#C4F0E8</text>
|
||||
<rect x="1050" y="450" width="150" height="50" style="fill: #E6F7F4" />
|
||||
<text x="1055" y="479" style="font-size: 16px; fill: #023c39" >teal9</text>
|
||||
<text x="1055" y="495" style="font-size: 12px; fill: #023c39" >#E6F7F4</text>
|
||||
<rect x="0" y="500" width="150" height="50" style="fill: #04343D" />
|
||||
<text x="5" y="529" style="font-size: 16px; fill: #e7f7f8" >cyan0</text>
|
||||
<text x="5" y="545" style="font-size: 12px; fill: #e7f7f8" >#04343D</text>
|
||||
<rect x="0" y="550" width="150" height="50" style="fill: #074F5C" />
|
||||
<text x="5" y="579" style="font-size: 16px; fill: #e7f7f8" >cyan1</text>
|
||||
<text x="5" y="595" style="font-size: 12px; fill: #e7f7f8" >#074F5C</text>
|
||||
<rect x="0" y="600" width="150" height="50" style="fill: #0A6C7B" />
|
||||
<text x="5" y="629" style="font-size: 16px; fill: #e7f7f8" >cyan2</text>
|
||||
<text x="5" y="645" style="font-size: 12px; fill: #e7f7f8" >#0A6C7B</text>
|
||||
<rect x="0" y="650" width="150" height="50" style="fill: #0E8999" />
|
||||
<text x="5" y="679" style="font-size: 16px; fill: #e7f7f8" >cyan3</text>
|
||||
<text x="5" y="695" style="font-size: 12px; fill: #e7f7f8" >#0E8999</text>
|
||||
<rect x="0" y="700" width="150" height="50" style="fill: #13A8B8" />
|
||||
<text x="5" y="729" style="font-size: 16px; fill: #e7f7f8" >cyan4</text>
|
||||
<text x="5" y="745" style="font-size: 12px; fill: #e7f7f8" >#13A8B8</text>
|
||||
<rect x="0" y="750" width="150" height="50" style="fill: #38BBC6" />
|
||||
<text x="5" y="779" style="font-size: 16px; fill: #04343d" >cyan5</text>
|
||||
<text x="5" y="795" style="font-size: 12px; fill: #04343d" >#38BBC6</text>
|
||||
<rect x="0" y="800" width="150" height="50" style="fill: #62CDD4" />
|
||||
<text x="5" y="829" style="font-size: 16px; fill: #04343d" >cyan6</text>
|
||||
<text x="5" y="845" style="font-size: 12px; fill: #04343d" >#62CDD4</text>
|
||||
<rect x="0" y="850" width="150" height="50" style="fill: #91DFE3" />
|
||||
<text x="5" y="879" style="font-size: 16px; fill: #04343d" >cyan7</text>
|
||||
<text x="5" y="895" style="font-size: 12px; fill: #04343d" >#91DFE3</text>
|
||||
<rect x="0" y="900" width="150" height="50" style="fill: #C6EFF1" />
|
||||
<text x="5" y="929" style="font-size: 16px; fill: #04343d" >cyan8</text>
|
||||
<text x="5" y="945" style="font-size: 12px; fill: #04343d" >#C6EFF1</text>
|
||||
<rect x="0" y="950" width="150" height="50" style="fill: #E7F7F8" />
|
||||
<text x="5" y="979" style="font-size: 16px; fill: #04343d" >cyan9</text>
|
||||
<text x="5" y="995" style="font-size: 12px; fill: #04343d" >#E7F7F8</text>
|
||||
<rect x="150" y="500" width="150" height="50" style="fill: #003761" />
|
||||
<text x="155" y="529" style="font-size: 16px; fill: #ebf8fe" >lightBlue0</text>
|
||||
<text x="155" y="545" style="font-size: 12px; fill: #ebf8fe" >#003761</text>
|
||||
<rect x="150" y="550" width="150" height="50" style="fill: #004D85" />
|
||||
<text x="155" y="579" style="font-size: 16px; fill: #ebf8fe" >lightBlue1</text>
|
||||
<text x="155" y="595" style="font-size: 12px; fill: #ebf8fe" >#004D85</text>
|
||||
<rect x="150" y="600" width="150" height="50" style="fill: #0366A9" />
|
||||
<text x="155" y="629" style="font-size: 16px; fill: #ebf8fe" >lightBlue2</text>
|
||||
<text x="155" y="645" style="font-size: 12px; fill: #ebf8fe" >#0366A9</text>
|
||||
<rect x="150" y="650" width="150" height="50" style="fill: #0A81CC" />
|
||||
<text x="155" y="679" style="font-size: 16px; fill: #ebf8fe" >lightBlue3</text>
|
||||
<text x="155" y="695" style="font-size: 12px; fill: #ebf8fe" >#0A81CC</text>
|
||||
<rect x="150" y="700" width="150" height="50" style="fill: #139FF0" />
|
||||
<text x="155" y="729" style="font-size: 16px; fill: #ebf8fe" >lightBlue4</text>
|
||||
<text x="155" y="745" style="font-size: 12px; fill: #ebf8fe" >#139FF0</text>
|
||||
<rect x="150" y="750" width="150" height="50" style="fill: #40B4F3" />
|
||||
<text x="155" y="779" style="font-size: 16px; fill: #003761" >lightBlue5</text>
|
||||
<text x="155" y="795" style="font-size: 12px; fill: #003761" >#40B4F3</text>
|
||||
<rect x="150" y="800" width="150" height="50" style="fill: #6EC8F6" />
|
||||
<text x="155" y="829" style="font-size: 16px; fill: #003761" >lightBlue6</text>
|
||||
<text x="155" y="845" style="font-size: 12px; fill: #003761" >#6EC8F6</text>
|
||||
<rect x="150" y="850" width="150" height="50" style="fill: #9DDCF9" />
|
||||
<text x="155" y="879" style="font-size: 16px; fill: #003761" >lightBlue7</text>
|
||||
<text x="155" y="895" style="font-size: 12px; fill: #003761" >#9DDCF9</text>
|
||||
<rect x="150" y="900" width="150" height="50" style="fill: #CEEEFC" />
|
||||
<text x="155" y="929" style="font-size: 16px; fill: #003761" >lightBlue8</text>
|
||||
<text x="155" y="945" style="font-size: 12px; fill: #003761" >#CEEEFC</text>
|
||||
<rect x="150" y="950" width="150" height="50" style="fill: #EBF8FE" />
|
||||
<text x="155" y="979" style="font-size: 16px; fill: #003761" >lightBlue9</text>
|
||||
<text x="155" y="995" style="font-size: 12px; fill: #003761" >#EBF8FE</text>
|
||||
<rect x="300" y="500" width="150" height="50" style="fill: #053170" />
|
||||
<text x="305" y="529" style="font-size: 16px; fill: #eff8ff" >blue0</text>
|
||||
<text x="305" y="545" style="font-size: 12px; fill: #eff8ff" >#053170</text>
|
||||
<rect x="300" y="550" width="150" height="50" style="fill: #0A4694" />
|
||||
<text x="305" y="579" style="font-size: 16px; fill: #eff8ff" >blue1</text>
|
||||
<text x="305" y="595" style="font-size: 12px; fill: #eff8ff" >#0A4694</text>
|
||||
<rect x="300" y="600" width="150" height="50" style="fill: #135CB8" />
|
||||
<text x="305" y="629" style="font-size: 16px; fill: #eff8ff" >blue2</text>
|
||||
<text x="305" y="645" style="font-size: 12px; fill: #eff8ff" >#135CB8</text>
|
||||
<rect x="300" y="650" width="150" height="50" style="fill: #1D75DB" />
|
||||
<text x="305" y="679" style="font-size: 16px; fill: #eff8ff" >blue3</text>
|
||||
<text x="305" y="695" style="font-size: 12px; fill: #eff8ff" >#1D75DB</text>
|
||||
<rect x="300" y="700" width="150" height="50" style="fill: #2990FF" />
|
||||
<text x="305" y="729" style="font-size: 16px; fill: #eff8ff" >blue4</text>
|
||||
<text x="305" y="745" style="font-size: 12px; fill: #eff8ff" >#2990FF</text>
|
||||
<rect x="300" y="750" width="150" height="50" style="fill: #54A9FF" />
|
||||
<text x="305" y="779" style="font-size: 16px; fill: #053170" >blue5</text>
|
||||
<text x="305" y="795" style="font-size: 12px; fill: #053170" >#54A9FF</text>
|
||||
<rect x="300" y="800" width="150" height="50" style="fill: #7FC1FF" />
|
||||
<text x="305" y="829" style="font-size: 16px; fill: #053170" >blue6</text>
|
||||
<text x="305" y="845" style="font-size: 12px; fill: #053170" >#7FC1FF</text>
|
||||
<rect x="300" y="850" width="150" height="50" style="fill: #A9D7FF" />
|
||||
<text x="305" y="879" style="font-size: 16px; fill: #053170" >blue7</text>
|
||||
<text x="305" y="895" style="font-size: 12px; fill: #053170" >#A9D7FF</text>
|
||||
<rect x="300" y="900" width="150" height="50" style="fill: #D4ECFF" />
|
||||
<text x="305" y="929" style="font-size: 16px; fill: #053170" >blue8</text>
|
||||
<text x="305" y="945" style="font-size: 12px; fill: #053170" >#D4ECFF</text>
|
||||
<rect x="300" y="950" width="150" height="50" style="fill: #EFF8FF" />
|
||||
<text x="305" y="979" style="font-size: 16px; fill: #053170" >blue9</text>
|
||||
<text x="305" y="995" style="font-size: 12px; fill: #053170" >#EFF8FF</text>
|
||||
<rect x="450" y="500" width="150" height="50" style="fill: #171E65" />
|
||||
<text x="455" y="529" style="font-size: 16px; fill: #edeff8" >indigo0</text>
|
||||
<text x="455" y="545" style="font-size: 12px; fill: #edeff8" >#171E65</text>
|
||||
<rect x="450" y="550" width="150" height="50" style="fill: #20297A" />
|
||||
<text x="455" y="579" style="font-size: 16px; fill: #edeff8" >indigo1</text>
|
||||
<text x="455" y="595" style="font-size: 12px; fill: #edeff8" >#20297A</text>
|
||||
<rect x="450" y="600" width="150" height="50" style="fill: #29368E" />
|
||||
<text x="455" y="629" style="font-size: 16px; fill: #edeff8" >indigo2</text>
|
||||
<text x="455" y="645" style="font-size: 12px; fill: #edeff8" >#29368E</text>
|
||||
<rect x="450" y="650" width="150" height="50" style="fill: #3444A3" />
|
||||
<text x="455" y="679" style="font-size: 16px; fill: #edeff8" >indigo3</text>
|
||||
<text x="455" y="695" style="font-size: 12px; fill: #edeff8" >#3444A3</text>
|
||||
<rect x="450" y="700" width="150" height="50" style="fill: #4053B7" />
|
||||
<text x="455" y="729" style="font-size: 16px; fill: #edeff8" >indigo4</text>
|
||||
<text x="455" y="745" style="font-size: 12px; fill: #edeff8" >#4053B7</text>
|
||||
<rect x="450" y="750" width="150" height="50" style="fill: #5F71C5" />
|
||||
<text x="455" y="779" style="font-size: 16px; fill: #171e65" >indigo5</text>
|
||||
<text x="455" y="795" style="font-size: 12px; fill: #171e65" >#5F71C5</text>
|
||||
<rect x="450" y="800" width="150" height="50" style="fill: #8191D4" />
|
||||
<text x="455" y="829" style="font-size: 16px; fill: #171e65" >indigo6</text>
|
||||
<text x="455" y="845" style="font-size: 12px; fill: #171e65" >#8191D4</text>
|
||||
<rect x="450" y="850" width="150" height="50" style="fill: #A7B4E2" />
|
||||
<text x="455" y="879" style="font-size: 16px; fill: #171e65" >indigo7</text>
|
||||
<text x="455" y="895" style="font-size: 12px; fill: #171e65" >#A7B4E2</text>
|
||||
<rect x="450" y="900" width="150" height="50" style="fill: #D1D8F1" />
|
||||
<text x="455" y="929" style="font-size: 16px; fill: #171e65" >indigo8</text>
|
||||
<text x="455" y="945" style="font-size: 12px; fill: #171e65" >#D1D8F1</text>
|
||||
<rect x="450" y="950" width="150" height="50" style="fill: #EDEFF8" />
|
||||
<text x="455" y="979" style="font-size: 16px; fill: #171e65" >indigo9</text>
|
||||
<text x="455" y="995" style="font-size: 12px; fill: #171e65" >#EDEFF8</text>
|
||||
<rect x="600" y="500" width="150" height="50" style="fill: #401B77" />
|
||||
<text x="605" y="529" style="font-size: 16px; fill: #f1eefa" >violet0</text>
|
||||
<text x="605" y="545" style="font-size: 12px; fill: #f1eefa" >#401B77</text>
|
||||
<rect x="600" y="550" width="150" height="50" style="fill: #4C248C" />
|
||||
<text x="605" y="579" style="font-size: 16px; fill: #f1eefa" >violet1</text>
|
||||
<text x="605" y="595" style="font-size: 12px; fill: #f1eefa" >#4C248C</text>
|
||||
<rect x="600" y="600" width="150" height="50" style="fill: #582EA0" />
|
||||
<text x="605" y="629" style="font-size: 16px; fill: #f1eefa" >violet2</text>
|
||||
<text x="605" y="645" style="font-size: 12px; fill: #f1eefa" >#582EA0</text>
|
||||
<rect x="600" y="650" width="150" height="50" style="fill: #6439B5" />
|
||||
<text x="605" y="679" style="font-size: 16px; fill: #f1eefa" >violet3</text>
|
||||
<text x="605" y="695" style="font-size: 12px; fill: #f1eefa" >#6439B5</text>
|
||||
<rect x="600" y="700" width="150" height="50" style="fill: #7246C9" />
|
||||
<text x="605" y="729" style="font-size: 16px; fill: #f1eefa" >violet4</text>
|
||||
<text x="605" y="745" style="font-size: 12px; fill: #f1eefa" >#7246C9</text>
|
||||
<rect x="600" y="750" width="150" height="50" style="fill: #8865D4" />
|
||||
<text x="605" y="779" style="font-size: 16px; fill: #401b77" >violet5</text>
|
||||
<text x="605" y="795" style="font-size: 12px; fill: #401b77" >#8865D4</text>
|
||||
<rect x="600" y="800" width="150" height="50" style="fill: #A288DF" />
|
||||
<text x="605" y="829" style="font-size: 16px; fill: #401b77" >violet6</text>
|
||||
<text x="605" y="845" style="font-size: 12px; fill: #401b77" >#A288DF</text>
|
||||
<rect x="600" y="850" width="150" height="50" style="fill: #BEADE9" />
|
||||
<text x="605" y="879" style="font-size: 16px; fill: #401b77" >violet7</text>
|
||||
<text x="605" y="895" style="font-size: 12px; fill: #401b77" >#BEADE9</text>
|
||||
<rect x="600" y="900" width="150" height="50" style="fill: #DDD4F4" />
|
||||
<text x="605" y="929" style="font-size: 16px; fill: #401b77" >violet8</text>
|
||||
<text x="605" y="945" style="font-size: 12px; fill: #401b77" >#DDD4F4</text>
|
||||
<rect x="600" y="950" width="150" height="50" style="fill: #F1EEFA" />
|
||||
<text x="605" y="979" style="font-size: 16px; fill: #401b77" >violet9</text>
|
||||
<text x="605" y="995" style="font-size: 12px; fill: #401b77" >#F1EEFA</text>
|
||||
<rect x="750" y="500" width="150" height="50" style="fill: #4A1061" />
|
||||
<text x="755" y="529" style="font-size: 16px; fill: #f7ebf7" >purple0</text>
|
||||
<text x="755" y="545" style="font-size: 12px; fill: #f7ebf7" >#4A1061</text>
|
||||
<rect x="750" y="550" width="150" height="50" style="fill: #5E1776" />
|
||||
<text x="755" y="579" style="font-size: 16px; fill: #f7ebf7" >purple1</text>
|
||||
<text x="755" y="595" style="font-size: 12px; fill: #f7ebf7" >#5E1776</text>
|
||||
<rect x="750" y="600" width="150" height="50" style="fill: #731F8A" />
|
||||
<text x="755" y="629" style="font-size: 16px; fill: #f7ebf7" >purple2</text>
|
||||
<text x="755" y="645" style="font-size: 12px; fill: #f7ebf7" >#731F8A</text>
|
||||
<rect x="750" y="650" width="150" height="50" style="fill: #89289F" />
|
||||
<text x="755" y="679" style="font-size: 16px; fill: #f7ebf7" >purple3</text>
|
||||
<text x="755" y="695" style="font-size: 12px; fill: #f7ebf7" >#89289F</text>
|
||||
<rect x="750" y="700" width="150" height="50" style="fill: #A033B3" />
|
||||
<text x="755" y="729" style="font-size: 16px; fill: #f7ebf7" >purple4</text>
|
||||
<text x="755" y="745" style="font-size: 12px; fill: #f7ebf7" >#A033B3</text>
|
||||
<rect x="750" y="750" width="150" height="50" style="fill: #B553C2" />
|
||||
<text x="755" y="779" style="font-size: 16px; fill: #4a1061" >purple5</text>
|
||||
<text x="755" y="795" style="font-size: 12px; fill: #4a1061" >#B553C2</text>
|
||||
<rect x="750" y="800" width="150" height="50" style="fill: #CA78D1" />
|
||||
<text x="755" y="829" style="font-size: 16px; fill: #4a1061" >purple6</text>
|
||||
<text x="755" y="845" style="font-size: 12px; fill: #4a1061" >#CA78D1</text>
|
||||
<rect x="750" y="850" width="150" height="50" style="fill: #DDA0E1" />
|
||||
<text x="755" y="879" style="font-size: 16px; fill: #4a1061" >purple7</text>
|
||||
<text x="755" y="895" style="font-size: 12px; fill: #4a1061" >#DDA0E1</text>
|
||||
<rect x="750" y="900" width="150" height="50" style="fill: #EFCEF0" />
|
||||
<text x="755" y="929" style="font-size: 16px; fill: #4a1061" >purple8</text>
|
||||
<text x="755" y="945" style="font-size: 12px; fill: #4a1061" >#EFCEF0</text>
|
||||
<rect x="750" y="950" width="150" height="50" style="fill: #F7EBF7" />
|
||||
<text x="755" y="979" style="font-size: 16px; fill: #4a1061" >purple9</text>
|
||||
<text x="755" y="995" style="font-size: 12px; fill: #4a1061" >#F7EBF7</text>
|
||||
<rect x="900" y="500" width="150" height="50" style="fill: #5C0730" />
|
||||
<text x="905" y="529" style="font-size: 16px; fill: #fdeef1" >pink0</text>
|
||||
<text x="905" y="545" style="font-size: 12px; fill: #fdeef1" >#5C0730</text>
|
||||
<rect x="900" y="550" width="150" height="50" style="fill: #800E41" />
|
||||
<text x="905" y="579" style="font-size: 16px; fill: #fdeef1" >pink1</text>
|
||||
<text x="905" y="595" style="font-size: 12px; fill: #fdeef1" >#800E41</text>
|
||||
<rect x="900" y="600" width="150" height="50" style="fill: #A41751" />
|
||||
<text x="905" y="629" style="font-size: 16px; fill: #fdeef1" >pink2</text>
|
||||
<text x="905" y="645" style="font-size: 12px; fill: #fdeef1" >#A41751</text>
|
||||
<rect x="900" y="650" width="150" height="50" style="fill: #C72261" />
|
||||
<text x="905" y="679" style="font-size: 16px; fill: #fdeef1" >pink3</text>
|
||||
<text x="905" y="695" style="font-size: 12px; fill: #fdeef1" >#C72261</text>
|
||||
<rect x="900" y="700" width="150" height="50" style="fill: #EB2F71" />
|
||||
<text x="905" y="729" style="font-size: 16px; fill: #fdeef1" >pink4</text>
|
||||
<text x="905" y="745" style="font-size: 12px; fill: #fdeef1" >#EB2F71</text>
|
||||
<rect x="900" y="750" width="150" height="50" style="fill: #EF5686" />
|
||||
<text x="905" y="779" style="font-size: 16px; fill: #5c0730" >pink5</text>
|
||||
<text x="905" y="795" style="font-size: 12px; fill: #5c0730" >#EF5686</text>
|
||||
<rect x="900" y="800" width="150" height="50" style="fill: #F37E9F" />
|
||||
<text x="905" y="829" style="font-size: 16px; fill: #5c0730" >pink6</text>
|
||||
<text x="905" y="845" style="font-size: 12px; fill: #5c0730" >#F37E9F</text>
|
||||
<rect x="900" y="850" width="150" height="50" style="fill: #F7A8BC" />
|
||||
<text x="905" y="879" style="font-size: 16px; fill: #5c0730" >pink7</text>
|
||||
<text x="905" y="895" style="font-size: 12px; fill: #5c0730" >#F7A8BC</text>
|
||||
<rect x="900" y="900" width="150" height="50" style="fill: #FBD3DC" />
|
||||
<text x="905" y="929" style="font-size: 16px; fill: #5c0730" >pink8</text>
|
||||
<text x="905" y="945" style="font-size: 12px; fill: #5c0730" >#FBD3DC</text>
|
||||
<rect x="900" y="950" width="150" height="50" style="fill: #FDEEF1" />
|
||||
<text x="905" y="979" style="font-size: 16px; fill: #5c0730" >pink9</text>
|
||||
<text x="905" y="995" style="font-size: 12px; fill: #5c0730" >#FDEEF1</text>
|
||||
<rect x="1050" y="500" width="150" height="50" style="fill: #1C1F23" />
|
||||
<text x="1055" y="529" style="font-size: 16px; fill: #f9f9f9" >grey0</text>
|
||||
<text x="1055" y="545" style="font-size: 12px; fill: #f9f9f9" >#1C1F23</text>
|
||||
<rect x="1050" y="550" width="150" height="50" style="fill: #2E3238" />
|
||||
<text x="1055" y="579" style="font-size: 16px; fill: #f9f9f9" >grey1</text>
|
||||
<text x="1055" y="595" style="font-size: 12px; fill: #f9f9f9" >#2E3238</text>
|
||||
<rect x="1050" y="600" width="150" height="50" style="fill: #41464C" />
|
||||
<text x="1055" y="629" style="font-size: 16px; fill: #f9f9f9" >grey2</text>
|
||||
<text x="1055" y="645" style="font-size: 12px; fill: #f9f9f9" >#41464C</text>
|
||||
<rect x="1050" y="650" width="150" height="50" style="fill: #555B61" />
|
||||
<text x="1055" y="679" style="font-size: 16px; fill: #f9f9f9" >grey3</text>
|
||||
<text x="1055" y="695" style="font-size: 12px; fill: #f9f9f9" >#555B61</text>
|
||||
<rect x="1050" y="700" width="150" height="50" style="fill: #6B7075" />
|
||||
<text x="1055" y="729" style="font-size: 16px; fill: #f9f9f9" >grey4</text>
|
||||
<text x="1055" y="745" style="font-size: 12px; fill: #f9f9f9" >#6B7075</text>
|
||||
<rect x="1050" y="750" width="150" height="50" style="fill: #888D92" />
|
||||
<text x="1055" y="779" style="font-size: 16px; fill: #1c1f23" >grey5</text>
|
||||
<text x="1055" y="795" style="font-size: 12px; fill: #1c1f23" >#888D92</text>
|
||||
<rect x="1050" y="800" width="150" height="50" style="fill: #A7ABB0" />
|
||||
<text x="1055" y="829" style="font-size: 16px; fill: #1c1f23" >grey6</text>
|
||||
<text x="1055" y="845" style="font-size: 12px; fill: #1c1f23" >#A7ABB0</text>
|
||||
<rect x="1050" y="850" width="150" height="50" style="fill: #C6CACD" />
|
||||
<text x="1055" y="879" style="font-size: 16px; fill: #1c1f23" >grey7</text>
|
||||
<text x="1055" y="895" style="font-size: 12px; fill: #1c1f23" >#C6CACD</text>
|
||||
<rect x="1050" y="900" width="150" height="50" style="fill: #E6E8EA" />
|
||||
<text x="1055" y="929" style="font-size: 16px; fill: #1c1f23" >grey8</text>
|
||||
<text x="1055" y="945" style="font-size: 12px; fill: #1c1f23" >#E6E8EA</text>
|
||||
<rect x="1050" y="950" width="150" height="50" style="fill: #F9F9F9" />
|
||||
<text x="1055" y="979" style="font-size: 16px; fill: #1c1f23" >grey9</text>
|
||||
<text x="1055" y="995" style="font-size: 12px; fill: #1c1f23" >#F9F9F9</text>
|
||||
<rect x="0" y="1000" width="600" height="50" style="fill: #FFFFFF" />
|
||||
<text x="5" y="1029" style="font-size: 16px; fill: #808080" >white</text>
|
||||
<text x="5" y="1045" style="font-size: 12px; fill: #808080" >#FFFFFF</text>
|
||||
<rect x="600" y="1000" width="600" height="50" style="fill: #000000" />
|
||||
<text x="605" y="1029" style="font-size: 16px; fill: #808080" >black</text>
|
||||
<text x="605" y="1045" style="font-size: 12px; fill: #808080" >#000000</text>
|
||||
</svg>
|
After Width: | Height: | Size: 36 KiB |
|
@ -0,0 +1,500 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- Generated by SVGo -->
|
||||
<svg width="1200" height="1050"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<style type="text/css">
|
||||
<![CDATA[
|
||||
|
||||
text {
|
||||
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"
|
||||
}
|
||||
]]>
|
||||
</style>
|
||||
<rect x="0" y="0" width="150" height="50" style="fill: #FEF2ED" />
|
||||
<text x="5" y="29" style="font-size: 16px; fill: #6a0103" >red0</text>
|
||||
<text x="5" y="45" style="font-size: 12px; fill: #6a0103" >#FEF2ED</text>
|
||||
<rect x="0" y="50" width="150" height="50" style="fill: #FEDDD2" />
|
||||
<text x="5" y="79" style="font-size: 16px; fill: #6a0103" >red1</text>
|
||||
<text x="5" y="95" style="font-size: 12px; fill: #6a0103" >#FEDDD2</text>
|
||||
<rect x="0" y="100" width="150" height="50" style="fill: #FDB7A5" />
|
||||
<text x="5" y="129" style="font-size: 16px; fill: #6a0103" >red2</text>
|
||||
<text x="5" y="145" style="font-size: 12px; fill: #6a0103" >#FDB7A5</text>
|
||||
<rect x="0" y="150" width="150" height="50" style="fill: #FB9078" />
|
||||
<text x="5" y="179" style="font-size: 16px; fill: #6a0103" >red3</text>
|
||||
<text x="5" y="195" style="font-size: 12px; fill: #6a0103" >#FB9078</text>
|
||||
<rect x="0" y="200" width="150" height="50" style="fill: #FA664C" />
|
||||
<text x="5" y="229" style="font-size: 16px; fill: #6a0103" >red4</text>
|
||||
<text x="5" y="245" style="font-size: 12px; fill: #6a0103" >#FA664C</text>
|
||||
<rect x="0" y="250" width="150" height="50" style="fill: #F93920" />
|
||||
<text x="5" y="279" style="font-size: 16px; fill: #fef2ed" >red5</text>
|
||||
<text x="5" y="295" style="font-size: 12px; fill: #fef2ed" >#F93920</text>
|
||||
<rect x="0" y="300" width="150" height="50" style="fill: #D52515" />
|
||||
<text x="5" y="329" style="font-size: 16px; fill: #fef2ed" >red6</text>
|
||||
<text x="5" y="345" style="font-size: 12px; fill: #fef2ed" >#D52515</text>
|
||||
<rect x="0" y="350" width="150" height="50" style="fill: #B2140C" />
|
||||
<text x="5" y="379" style="font-size: 16px; fill: #fef2ed" >red7</text>
|
||||
<text x="5" y="395" style="font-size: 12px; fill: #fef2ed" >#B2140C</text>
|
||||
<rect x="0" y="400" width="150" height="50" style="fill: #8E0805" />
|
||||
<text x="5" y="429" style="font-size: 16px; fill: #fef2ed" >red8</text>
|
||||
<text x="5" y="445" style="font-size: 12px; fill: #fef2ed" >#8E0805</text>
|
||||
<rect x="0" y="450" width="150" height="50" style="fill: #6A0103" />
|
||||
<text x="5" y="479" style="font-size: 16px; fill: #fef2ed" >red9</text>
|
||||
<text x="5" y="495" style="font-size: 12px; fill: #fef2ed" >#6A0103</text>
|
||||
<rect x="150" y="0" width="150" height="50" style="fill: #FFF8EA" />
|
||||
<text x="155" y="29" style="font-size: 16px; fill: #541d00" >orange0</text>
|
||||
<text x="155" y="45" style="font-size: 12px; fill: #541d00" >#FFF8EA</text>
|
||||
<rect x="150" y="50" width="150" height="50" style="fill: #FEEECC" />
|
||||
<text x="155" y="79" style="font-size: 16px; fill: #541d00" >orange1</text>
|
||||
<text x="155" y="95" style="font-size: 12px; fill: #541d00" >#FEEECC</text>
|
||||
<rect x="150" y="100" width="150" height="50" style="fill: #FED998" />
|
||||
<text x="155" y="129" style="font-size: 16px; fill: #541d00" >orange2</text>
|
||||
<text x="155" y="145" style="font-size: 12px; fill: #541d00" >#FED998</text>
|
||||
<rect x="150" y="150" width="150" height="50" style="fill: #FDC165" />
|
||||
<text x="155" y="179" style="font-size: 16px; fill: #541d00" >orange3</text>
|
||||
<text x="155" y="195" style="font-size: 12px; fill: #541d00" >#FDC165</text>
|
||||
<rect x="150" y="200" width="150" height="50" style="fill: #FDA633" />
|
||||
<text x="155" y="229" style="font-size: 16px; fill: #541d00" >orange4</text>
|
||||
<text x="155" y="245" style="font-size: 12px; fill: #541d00" >#FDA633</text>
|
||||
<rect x="150" y="250" width="150" height="50" style="fill: #FC8800" />
|
||||
<text x="155" y="279" style="font-size: 16px; fill: #fff8ea" >orange5</text>
|
||||
<text x="155" y="295" style="font-size: 12px; fill: #fff8ea" >#FC8800</text>
|
||||
<rect x="150" y="300" width="150" height="50" style="fill: #D26700" />
|
||||
<text x="155" y="329" style="font-size: 16px; fill: #fff8ea" >orange6</text>
|
||||
<text x="155" y="345" style="font-size: 12px; fill: #fff8ea" >#D26700</text>
|
||||
<rect x="150" y="350" width="150" height="50" style="fill: #A84A00" />
|
||||
<text x="155" y="379" style="font-size: 16px; fill: #fff8ea" >orange7</text>
|
||||
<text x="155" y="395" style="font-size: 12px; fill: #fff8ea" >#A84A00</text>
|
||||
<rect x="150" y="400" width="150" height="50" style="fill: #7E3100" />
|
||||
<text x="155" y="429" style="font-size: 16px; fill: #fff8ea" >orange8</text>
|
||||
<text x="155" y="445" style="font-size: 12px; fill: #fff8ea" >#7E3100</text>
|
||||
<rect x="150" y="450" width="150" height="50" style="fill: #541D00" />
|
||||
<text x="155" y="479" style="font-size: 16px; fill: #fff8ea" >orange9</text>
|
||||
<text x="155" y="495" style="font-size: 12px; fill: #fff8ea" >#541D00</text>
|
||||
<rect x="300" y="0" width="150" height="50" style="fill: #FEFBEB" />
|
||||
<text x="305" y="29" style="font-size: 16px; fill: #502b03" >amber0</text>
|
||||
<text x="305" y="45" style="font-size: 12px; fill: #502b03" >#FEFBEB</text>
|
||||
<rect x="300" y="50" width="150" height="50" style="fill: #FCF5CE" />
|
||||
<text x="305" y="79" style="font-size: 16px; fill: #502b03" >amber1</text>
|
||||
<text x="305" y="95" style="font-size: 12px; fill: #502b03" >#FCF5CE</text>
|
||||
<rect x="300" y="100" width="150" height="50" style="fill: #F9E89E" />
|
||||
<text x="305" y="129" style="font-size: 16px; fill: #502b03" >amber2</text>
|
||||
<text x="305" y="145" style="font-size: 12px; fill: #502b03" >#F9E89E</text>
|
||||
<rect x="300" y="150" width="150" height="50" style="fill: #F6D86F" />
|
||||
<text x="305" y="179" style="font-size: 16px; fill: #502b03" >amber3</text>
|
||||
<text x="305" y="195" style="font-size: 12px; fill: #502b03" >#F6D86F</text>
|
||||
<rect x="300" y="200" width="150" height="50" style="fill: #F3C641" />
|
||||
<text x="305" y="229" style="font-size: 16px; fill: #502b03" >amber4</text>
|
||||
<text x="305" y="245" style="font-size: 12px; fill: #502b03" >#F3C641</text>
|
||||
<rect x="300" y="250" width="150" height="50" style="fill: #F0B114" />
|
||||
<text x="305" y="279" style="font-size: 16px; fill: #fefbeb" >amber5</text>
|
||||
<text x="305" y="295" style="font-size: 12px; fill: #fefbeb" >#F0B114</text>
|
||||
<rect x="300" y="300" width="150" height="50" style="fill: #C88A0F" />
|
||||
<text x="305" y="329" style="font-size: 16px; fill: #fefbeb" >amber6</text>
|
||||
<text x="305" y="345" style="font-size: 12px; fill: #fefbeb" >#C88A0F</text>
|
||||
<rect x="300" y="350" width="150" height="50" style="fill: #A0660A" />
|
||||
<text x="305" y="379" style="font-size: 16px; fill: #fefbeb" >amber7</text>
|
||||
<text x="305" y="395" style="font-size: 12px; fill: #fefbeb" >#A0660A</text>
|
||||
<rect x="300" y="400" width="150" height="50" style="fill: #784606" />
|
||||
<text x="305" y="429" style="font-size: 16px; fill: #fefbeb" >amber8</text>
|
||||
<text x="305" y="445" style="font-size: 12px; fill: #fefbeb" >#784606</text>
|
||||
<rect x="300" y="450" width="150" height="50" style="fill: #502B03" />
|
||||
<text x="305" y="479" style="font-size: 16px; fill: #fefbeb" >amber9</text>
|
||||
<text x="305" y="495" style="font-size: 12px; fill: #fefbeb" >#502B03</text>
|
||||
<rect x="450" y="0" width="150" height="50" style="fill: #FFFDEA" />
|
||||
<text x="455" y="29" style="font-size: 16px; fill: #534800" >yellow0</text>
|
||||
<text x="455" y="45" style="font-size: 12px; fill: #534800" >#FFFDEA</text>
|
||||
<rect x="450" y="50" width="150" height="50" style="fill: #FEFBCB" />
|
||||
<text x="455" y="79" style="font-size: 16px; fill: #534800" >yellow1</text>
|
||||
<text x="455" y="95" style="font-size: 12px; fill: #534800" >#FEFBCB</text>
|
||||
<rect x="450" y="100" width="150" height="50" style="fill: #FDF398" />
|
||||
<text x="455" y="129" style="font-size: 16px; fill: #534800" >yellow2</text>
|
||||
<text x="455" y="145" style="font-size: 12px; fill: #534800" >#FDF398</text>
|
||||
<rect x="450" y="150" width="150" height="50" style="fill: #FCE865" />
|
||||
<text x="455" y="179" style="font-size: 16px; fill: #534800" >yellow3</text>
|
||||
<text x="455" y="195" style="font-size: 12px; fill: #534800" >#FCE865</text>
|
||||
<rect x="450" y="200" width="150" height="50" style="fill: #FBDA32" />
|
||||
<text x="455" y="229" style="font-size: 16px; fill: #534800" >yellow4</text>
|
||||
<text x="455" y="245" style="font-size: 12px; fill: #534800" >#FBDA32</text>
|
||||
<rect x="450" y="250" width="150" height="50" style="fill: #FAC800" />
|
||||
<text x="455" y="279" style="font-size: 16px; fill: #fffdea" >yellow5</text>
|
||||
<text x="455" y="295" style="font-size: 12px; fill: #fffdea" >#FAC800</text>
|
||||
<rect x="450" y="300" width="150" height="50" style="fill: #D0AA00" />
|
||||
<text x="455" y="329" style="font-size: 16px; fill: #fffdea" >yellow6</text>
|
||||
<text x="455" y="345" style="font-size: 12px; fill: #fffdea" >#D0AA00</text>
|
||||
<rect x="450" y="350" width="150" height="50" style="fill: #A78B00" />
|
||||
<text x="455" y="379" style="font-size: 16px; fill: #fffdea" >yellow7</text>
|
||||
<text x="455" y="395" style="font-size: 12px; fill: #fffdea" >#A78B00</text>
|
||||
<rect x="450" y="400" width="150" height="50" style="fill: #7D6A00" />
|
||||
<text x="455" y="429" style="font-size: 16px; fill: #fffdea" >yellow8</text>
|
||||
<text x="455" y="445" style="font-size: 12px; fill: #fffdea" >#7D6A00</text>
|
||||
<rect x="450" y="450" width="150" height="50" style="fill: #534800" />
|
||||
<text x="455" y="479" style="font-size: 16px; fill: #fffdea" >yellow9</text>
|
||||
<text x="455" y="495" style="font-size: 12px; fill: #fffdea" >#534800</text>
|
||||
<rect x="600" y="0" width="150" height="50" style="fill: #F2FAE6" />
|
||||
<text x="605" y="29" style="font-size: 16px; fill: #2f4600" >lime0</text>
|
||||
<text x="605" y="45" style="font-size: 12px; fill: #2f4600" >#F2FAE6</text>
|
||||
<rect x="600" y="50" width="150" height="50" style="fill: #E3F6C5" />
|
||||
<text x="605" y="79" style="font-size: 16px; fill: #2f4600" >lime1</text>
|
||||
<text x="605" y="95" style="font-size: 12px; fill: #2f4600" >#E3F6C5</text>
|
||||
<rect x="600" y="100" width="150" height="50" style="fill: #CBED8E" />
|
||||
<text x="605" y="129" style="font-size: 16px; fill: #2f4600" >lime2</text>
|
||||
<text x="605" y="145" style="font-size: 12px; fill: #2f4600" >#CBED8E</text>
|
||||
<rect x="600" y="150" width="150" height="50" style="fill: #B7E35B" />
|
||||
<text x="605" y="179" style="font-size: 16px; fill: #2f4600" >lime3</text>
|
||||
<text x="605" y="195" style="font-size: 12px; fill: #2f4600" >#B7E35B</text>
|
||||
<rect x="600" y="200" width="150" height="50" style="fill: #A7DA2C" />
|
||||
<text x="605" y="229" style="font-size: 16px; fill: #2f4600" >lime4</text>
|
||||
<text x="605" y="245" style="font-size: 12px; fill: #2f4600" >#A7DA2C</text>
|
||||
<rect x="600" y="250" width="150" height="50" style="fill: #9BD100" />
|
||||
<text x="605" y="279" style="font-size: 16px; fill: #f2fae6" >lime5</text>
|
||||
<text x="605" y="295" style="font-size: 12px; fill: #f2fae6" >#9BD100</text>
|
||||
<rect x="600" y="300" width="150" height="50" style="fill: #7EAE00" />
|
||||
<text x="605" y="329" style="font-size: 16px; fill: #f2fae6" >lime6</text>
|
||||
<text x="605" y="345" style="font-size: 12px; fill: #f2fae6" >#7EAE00</text>
|
||||
<rect x="600" y="350" width="150" height="50" style="fill: #638B00" />
|
||||
<text x="605" y="379" style="font-size: 16px; fill: #f2fae6" >lime7</text>
|
||||
<text x="605" y="395" style="font-size: 12px; fill: #f2fae6" >#638B00</text>
|
||||
<rect x="600" y="400" width="150" height="50" style="fill: #486800" />
|
||||
<text x="605" y="429" style="font-size: 16px; fill: #f2fae6" >lime8</text>
|
||||
<text x="605" y="445" style="font-size: 12px; fill: #f2fae6" >#486800</text>
|
||||
<rect x="600" y="450" width="150" height="50" style="fill: #2F4600" />
|
||||
<text x="605" y="479" style="font-size: 16px; fill: #f2fae6" >lime9</text>
|
||||
<text x="605" y="495" style="font-size: 12px; fill: #f2fae6" >#2F4600</text>
|
||||
<rect x="750" y="0" width="150" height="50" style="fill: #F3F8EC" />
|
||||
<text x="755" y="29" style="font-size: 16px; fill: #253d12" >lightGreen0</text>
|
||||
<text x="755" y="45" style="font-size: 12px; fill: #253d12" >#F3F8EC</text>
|
||||
<rect x="750" y="50" width="150" height="50" style="fill: #E3F0D0" />
|
||||
<text x="755" y="79" style="font-size: 16px; fill: #253d12" >lightGreen1</text>
|
||||
<text x="755" y="95" style="font-size: 12px; fill: #253d12" >#E3F0D0</text>
|
||||
<rect x="750" y="100" width="150" height="50" style="fill: #C8E2A5" />
|
||||
<text x="755" y="129" style="font-size: 16px; fill: #253d12" >lightGreen2</text>
|
||||
<text x="755" y="145" style="font-size: 12px; fill: #253d12" >#C8E2A5</text>
|
||||
<rect x="750" y="150" width="150" height="50" style="fill: #ADD37E" />
|
||||
<text x="755" y="179" style="font-size: 16px; fill: #253d12" >lightGreen3</text>
|
||||
<text x="755" y="195" style="font-size: 12px; fill: #253d12" >#ADD37E</text>
|
||||
<rect x="750" y="200" width="150" height="50" style="fill: #93C55B" />
|
||||
<text x="755" y="229" style="font-size: 16px; fill: #253d12" >lightGreen4</text>
|
||||
<text x="755" y="245" style="font-size: 12px; fill: #253d12" >#93C55B</text>
|
||||
<rect x="750" y="250" width="150" height="50" style="fill: #7BB63C" />
|
||||
<text x="755" y="279" style="font-size: 16px; fill: #f3f8ec" >lightGreen5</text>
|
||||
<text x="755" y="295" style="font-size: 12px; fill: #f3f8ec" >#7BB63C</text>
|
||||
<rect x="750" y="300" width="150" height="50" style="fill: #649830" />
|
||||
<text x="755" y="329" style="font-size: 16px; fill: #f3f8ec" >lightGreen6</text>
|
||||
<text x="755" y="345" style="font-size: 12px; fill: #f3f8ec" >#649830</text>
|
||||
<rect x="750" y="350" width="150" height="50" style="fill: #4E7926" />
|
||||
<text x="755" y="379" style="font-size: 16px; fill: #f3f8ec" >lightGreen7</text>
|
||||
<text x="755" y="395" style="font-size: 12px; fill: #f3f8ec" >#4E7926</text>
|
||||
<rect x="750" y="400" width="150" height="50" style="fill: #395B1B" />
|
||||
<text x="755" y="429" style="font-size: 16px; fill: #f3f8ec" >lightGreen8</text>
|
||||
<text x="755" y="445" style="font-size: 12px; fill: #f3f8ec" >#395B1B</text>
|
||||
<rect x="750" y="450" width="150" height="50" style="fill: #253D12" />
|
||||
<text x="755" y="479" style="font-size: 16px; fill: #f3f8ec" >lightGreen9</text>
|
||||
<text x="755" y="495" style="font-size: 12px; fill: #f3f8ec" >#253D12</text>
|
||||
<rect x="900" y="0" width="150" height="50" style="fill: #ECF7EC" />
|
||||
<text x="905" y="29" style="font-size: 16px; fill: #113c18" >green0</text>
|
||||
<text x="905" y="45" style="font-size: 12px; fill: #113c18" >#ECF7EC</text>
|
||||
<rect x="900" y="50" width="150" height="50" style="fill: #D0F0D1" />
|
||||
<text x="905" y="79" style="font-size: 16px; fill: #113c18" >green1</text>
|
||||
<text x="905" y="95" style="font-size: 12px; fill: #113c18" >#D0F0D1</text>
|
||||
<rect x="900" y="100" width="150" height="50" style="fill: #A4E0A7" />
|
||||
<text x="905" y="129" style="font-size: 16px; fill: #113c18" >green2</text>
|
||||
<text x="905" y="145" style="font-size: 12px; fill: #113c18" >#A4E0A7</text>
|
||||
<rect x="900" y="150" width="150" height="50" style="fill: #7DD182" />
|
||||
<text x="905" y="179" style="font-size: 16px; fill: #113c18" >green3</text>
|
||||
<text x="905" y="195" style="font-size: 12px; fill: #113c18" >#7DD182</text>
|
||||
<rect x="900" y="200" width="150" height="50" style="fill: #5AC262" />
|
||||
<text x="905" y="229" style="font-size: 16px; fill: #113c18" >green4</text>
|
||||
<text x="905" y="245" style="font-size: 12px; fill: #113c18" >#5AC262</text>
|
||||
<rect x="900" y="250" width="150" height="50" style="fill: #3BB346" />
|
||||
<text x="905" y="279" style="font-size: 16px; fill: #ecf7ec" >green5</text>
|
||||
<text x="905" y="295" style="font-size: 12px; fill: #ecf7ec" >#3BB346</text>
|
||||
<rect x="900" y="300" width="150" height="50" style="fill: #30953B" />
|
||||
<text x="905" y="329" style="font-size: 16px; fill: #ecf7ec" >green6</text>
|
||||
<text x="905" y="345" style="font-size: 12px; fill: #ecf7ec" >#30953B</text>
|
||||
<rect x="900" y="350" width="150" height="50" style="fill: #25772F" />
|
||||
<text x="905" y="379" style="font-size: 16px; fill: #ecf7ec" >green7</text>
|
||||
<text x="905" y="395" style="font-size: 12px; fill: #ecf7ec" >#25772F</text>
|
||||
<rect x="900" y="400" width="150" height="50" style="fill: #1B5924" />
|
||||
<text x="905" y="429" style="font-size: 16px; fill: #ecf7ec" >green8</text>
|
||||
<text x="905" y="445" style="font-size: 12px; fill: #ecf7ec" >#1B5924</text>
|
||||
<rect x="900" y="450" width="150" height="50" style="fill: #113C18" />
|
||||
<text x="905" y="479" style="font-size: 16px; fill: #ecf7ec" >green9</text>
|
||||
<text x="905" y="495" style="font-size: 12px; fill: #ecf7ec" >#113C18</text>
|
||||
<rect x="1050" y="0" width="150" height="50" style="fill: #E4F7F4" />
|
||||
<text x="1055" y="29" style="font-size: 16px; fill: #003c3a" >teal0</text>
|
||||
<text x="1055" y="45" style="font-size: 12px; fill: #003c3a" >#E4F7F4</text>
|
||||
<rect x="1050" y="50" width="150" height="50" style="fill: #C0F0E8" />
|
||||
<text x="1055" y="79" style="font-size: 16px; fill: #003c3a" >teal1</text>
|
||||
<text x="1055" y="95" style="font-size: 12px; fill: #003c3a" >#C0F0E8</text>
|
||||
<rect x="1050" y="100" width="150" height="50" style="fill: #87E0D3" />
|
||||
<text x="1055" y="129" style="font-size: 16px; fill: #003c3a" >teal2</text>
|
||||
<text x="1055" y="145" style="font-size: 12px; fill: #003c3a" >#87E0D3</text>
|
||||
<rect x="1050" y="150" width="150" height="50" style="fill: #54D1C1" />
|
||||
<text x="1055" y="179" style="font-size: 16px; fill: #003c3a" >teal3</text>
|
||||
<text x="1055" y="195" style="font-size: 12px; fill: #003c3a" >#54D1C1</text>
|
||||
<rect x="1050" y="200" width="150" height="50" style="fill: #27C2B0" />
|
||||
<text x="1055" y="229" style="font-size: 16px; fill: #003c3a" >teal4</text>
|
||||
<text x="1055" y="245" style="font-size: 12px; fill: #003c3a" >#27C2B0</text>
|
||||
<rect x="1050" y="250" width="150" height="50" style="fill: #00B3A1" />
|
||||
<text x="1055" y="279" style="font-size: 16px; fill: #e4f7f4" >teal5</text>
|
||||
<text x="1055" y="295" style="font-size: 12px; fill: #e4f7f4" >#00B3A1</text>
|
||||
<rect x="1050" y="300" width="150" height="50" style="fill: #009589" />
|
||||
<text x="1055" y="329" style="font-size: 16px; fill: #e4f7f4" >teal6</text>
|
||||
<text x="1055" y="345" style="font-size: 12px; fill: #e4f7f4" >#009589</text>
|
||||
<rect x="1050" y="350" width="150" height="50" style="fill: #00776F" />
|
||||
<text x="1055" y="379" style="font-size: 16px; fill: #e4f7f4" >teal7</text>
|
||||
<text x="1055" y="395" style="font-size: 12px; fill: #e4f7f4" >#00776F</text>
|
||||
<rect x="1050" y="400" width="150" height="50" style="fill: #005955" />
|
||||
<text x="1055" y="429" style="font-size: 16px; fill: #e4f7f4" >teal8</text>
|
||||
<text x="1055" y="445" style="font-size: 12px; fill: #e4f7f4" >#005955</text>
|
||||
<rect x="1050" y="450" width="150" height="50" style="fill: #003C3A" />
|
||||
<text x="1055" y="479" style="font-size: 16px; fill: #e4f7f4" >teal9</text>
|
||||
<text x="1055" y="495" style="font-size: 12px; fill: #e4f7f4" >#003C3A</text>
|
||||
<rect x="0" y="500" width="150" height="50" style="fill: #E5F7F8" />
|
||||
<text x="5" y="529" style="font-size: 16px; fill: #00323d" >cyan0</text>
|
||||
<text x="5" y="545" style="font-size: 12px; fill: #00323d" >#E5F7F8</text>
|
||||
<rect x="0" y="550" width="150" height="50" style="fill: #C2EFF0" />
|
||||
<text x="5" y="579" style="font-size: 16px; fill: #00323d" >cyan1</text>
|
||||
<text x="5" y="595" style="font-size: 12px; fill: #00323d" >#C2EFF0</text>
|
||||
<rect x="0" y="600" width="150" height="50" style="fill: #8ADDE2" />
|
||||
<text x="5" y="629" style="font-size: 16px; fill: #00323d" >cyan2</text>
|
||||
<text x="5" y="645" style="font-size: 12px; fill: #00323d" >#8ADDE2</text>
|
||||
<rect x="0" y="650" width="150" height="50" style="fill: #58CBD3" />
|
||||
<text x="5" y="679" style="font-size: 16px; fill: #00323d" >cyan3</text>
|
||||
<text x="5" y="695" style="font-size: 12px; fill: #00323d" >#58CBD3</text>
|
||||
<rect x="0" y="700" width="150" height="50" style="fill: #2CB8C5" />
|
||||
<text x="5" y="729" style="font-size: 16px; fill: #00323d" >cyan4</text>
|
||||
<text x="5" y="745" style="font-size: 12px; fill: #00323d" >#2CB8C5</text>
|
||||
<rect x="0" y="750" width="150" height="50" style="fill: #05A4B6" />
|
||||
<text x="5" y="779" style="font-size: 16px; fill: #e5f7f8" >cyan5</text>
|
||||
<text x="5" y="795" style="font-size: 12px; fill: #e5f7f8" >#05A4B6</text>
|
||||
<rect x="0" y="800" width="150" height="50" style="fill: #038698" />
|
||||
<text x="5" y="829" style="font-size: 16px; fill: #e5f7f8" >cyan6</text>
|
||||
<text x="5" y="845" style="font-size: 12px; fill: #e5f7f8" >#038698</text>
|
||||
<rect x="0" y="850" width="150" height="50" style="fill: #016979" />
|
||||
<text x="5" y="879" style="font-size: 16px; fill: #e5f7f8" >cyan7</text>
|
||||
<text x="5" y="895" style="font-size: 12px; fill: #e5f7f8" >#016979</text>
|
||||
<rect x="0" y="900" width="150" height="50" style="fill: #004D5B" />
|
||||
<text x="5" y="929" style="font-size: 16px; fill: #e5f7f8" >cyan8</text>
|
||||
<text x="5" y="945" style="font-size: 12px; fill: #e5f7f8" >#004D5B</text>
|
||||
<rect x="0" y="950" width="150" height="50" style="fill: #00323D" />
|
||||
<text x="5" y="979" style="font-size: 16px; fill: #e5f7f8" >cyan9</text>
|
||||
<text x="5" y="995" style="font-size: 12px; fill: #e5f7f8" >#00323D</text>
|
||||
<rect x="150" y="500" width="150" height="50" style="fill: #E9F7FD" />
|
||||
<text x="155" y="529" style="font-size: 16px; fill: #00355f" >lightBlue0</text>
|
||||
<text x="155" y="545" style="font-size: 12px; fill: #00355f" >#E9F7FD</text>
|
||||
<rect x="150" y="550" width="150" height="50" style="fill: #C9ECFC" />
|
||||
<text x="155" y="579" style="font-size: 16px; fill: #00355f" >lightBlue1</text>
|
||||
<text x="155" y="595" style="font-size: 12px; fill: #00355f" >#C9ECFC</text>
|
||||
<rect x="150" y="600" width="150" height="50" style="fill: #95D8F8" />
|
||||
<text x="155" y="629" style="font-size: 16px; fill: #00355f" >lightBlue2</text>
|
||||
<text x="155" y="645" style="font-size: 12px; fill: #00355f" >#95D8F8</text>
|
||||
<rect x="150" y="650" width="150" height="50" style="fill: #62C3F5" />
|
||||
<text x="155" y="679" style="font-size: 16px; fill: #00355f" >lightBlue3</text>
|
||||
<text x="155" y="695" style="font-size: 12px; fill: #00355f" >#62C3F5</text>
|
||||
<rect x="150" y="700" width="150" height="50" style="fill: #30ACF1" />
|
||||
<text x="155" y="729" style="font-size: 16px; fill: #00355f" >lightBlue4</text>
|
||||
<text x="155" y="745" style="font-size: 12px; fill: #00355f" >#30ACF1</text>
|
||||
<rect x="150" y="750" width="150" height="50" style="fill: #0095EE" />
|
||||
<text x="155" y="779" style="font-size: 16px; fill: #e9f7fd" >lightBlue5</text>
|
||||
<text x="155" y="795" style="font-size: 12px; fill: #e9f7fd" >#0095EE</text>
|
||||
<rect x="150" y="800" width="150" height="50" style="fill: #007BCA" />
|
||||
<text x="155" y="829" style="font-size: 16px; fill: #e9f7fd" >lightBlue6</text>
|
||||
<text x="155" y="845" style="font-size: 12px; fill: #e9f7fd" >#007BCA</text>
|
||||
<rect x="150" y="850" width="150" height="50" style="fill: #0063A7" />
|
||||
<text x="155" y="879" style="font-size: 16px; fill: #e9f7fd" >lightBlue7</text>
|
||||
<text x="155" y="895" style="font-size: 12px; fill: #e9f7fd" >#0063A7</text>
|
||||
<rect x="150" y="900" width="150" height="50" style="fill: #004B83" />
|
||||
<text x="155" y="929" style="font-size: 16px; fill: #e9f7fd" >lightBlue8</text>
|
||||
<text x="155" y="945" style="font-size: 12px; fill: #e9f7fd" >#004B83</text>
|
||||
<rect x="150" y="950" width="150" height="50" style="fill: #00355F" />
|
||||
<text x="155" y="979" style="font-size: 16px; fill: #e9f7fd" >lightBlue9</text>
|
||||
<text x="155" y="995" style="font-size: 12px; fill: #e9f7fd" >#00355F</text>
|
||||
<rect x="300" y="500" width="150" height="50" style="fill: #EAF5FF" />
|
||||
<text x="305" y="529" style="font-size: 16px; fill: #002c6b" >blue0</text>
|
||||
<text x="305" y="545" style="font-size: 12px; fill: #002c6b" >#EAF5FF</text>
|
||||
<rect x="300" y="550" width="150" height="50" style="fill: #CBE7FE" />
|
||||
<text x="305" y="579" style="font-size: 16px; fill: #002c6b" >blue1</text>
|
||||
<text x="305" y="595" style="font-size: 12px; fill: #002c6b" >#CBE7FE</text>
|
||||
<rect x="300" y="600" width="150" height="50" style="fill: #98CDFD" />
|
||||
<text x="305" y="629" style="font-size: 16px; fill: #002c6b" >blue2</text>
|
||||
<text x="305" y="645" style="font-size: 12px; fill: #002c6b" >#98CDFD</text>
|
||||
<rect x="300" y="650" width="150" height="50" style="fill: #65B2FC" />
|
||||
<text x="305" y="679" style="font-size: 16px; fill: #002c6b" >blue3</text>
|
||||
<text x="305" y="695" style="font-size: 12px; fill: #002c6b" >#65B2FC</text>
|
||||
<rect x="300" y="700" width="150" height="50" style="fill: #3295FB" />
|
||||
<text x="305" y="729" style="font-size: 16px; fill: #002c6b" >blue4</text>
|
||||
<text x="305" y="745" style="font-size: 12px; fill: #002c6b" >#3295FB</text>
|
||||
<rect x="300" y="750" width="150" height="50" style="fill: #0064FA" />
|
||||
<text x="305" y="779" style="font-size: 16px; fill: #eaf5ff" >blue5</text>
|
||||
<text x="305" y="795" style="font-size: 12px; fill: #eaf5ff" >#0064FA</text>
|
||||
<rect x="300" y="800" width="150" height="50" style="fill: #0062D6" />
|
||||
<text x="305" y="829" style="font-size: 16px; fill: #eaf5ff" >blue6</text>
|
||||
<text x="305" y="845" style="font-size: 12px; fill: #eaf5ff" >#0062D6</text>
|
||||
<rect x="300" y="850" width="150" height="50" style="fill: #004FB3" />
|
||||
<text x="305" y="879" style="font-size: 16px; fill: #eaf5ff" >blue7</text>
|
||||
<text x="305" y="895" style="font-size: 12px; fill: #eaf5ff" >#004FB3</text>
|
||||
<rect x="300" y="900" width="150" height="50" style="fill: #003D8F" />
|
||||
<text x="305" y="929" style="font-size: 16px; fill: #eaf5ff" >blue8</text>
|
||||
<text x="305" y="945" style="font-size: 12px; fill: #eaf5ff" >#003D8F</text>
|
||||
<rect x="300" y="950" width="150" height="50" style="fill: #002C6B" />
|
||||
<text x="305" y="979" style="font-size: 16px; fill: #eaf5ff" >blue9</text>
|
||||
<text x="305" y="995" style="font-size: 12px; fill: #eaf5ff" >#002C6B</text>
|
||||
<rect x="450" y="500" width="150" height="50" style="fill: #ECEFF8" />
|
||||
<text x="455" y="529" style="font-size: 16px; fill: #171d63" >indigo0</text>
|
||||
<text x="455" y="545" style="font-size: 12px; fill: #171d63" >#ECEFF8</text>
|
||||
<rect x="450" y="550" width="150" height="50" style="fill: #D1D8F0" />
|
||||
<text x="455" y="579" style="font-size: 16px; fill: #171d63" >indigo1</text>
|
||||
<text x="455" y="595" style="font-size: 12px; fill: #171d63" >#D1D8F0</text>
|
||||
<rect x="450" y="600" width="150" height="50" style="fill: #A7B3E1" />
|
||||
<text x="455" y="629" style="font-size: 16px; fill: #171d63" >indigo2</text>
|
||||
<text x="455" y="645" style="font-size: 12px; fill: #171d63" >#A7B3E1</text>
|
||||
<rect x="450" y="650" width="150" height="50" style="fill: #8090D3" />
|
||||
<text x="455" y="679" style="font-size: 16px; fill: #171d63" >indigo3</text>
|
||||
<text x="455" y="695" style="font-size: 12px; fill: #171d63" >#8090D3</text>
|
||||
<rect x="450" y="700" width="150" height="50" style="fill: #5E6FC4" />
|
||||
<text x="455" y="729" style="font-size: 16px; fill: #171d63" >indigo4</text>
|
||||
<text x="455" y="745" style="font-size: 12px; fill: #171d63" >#5E6FC4</text>
|
||||
<rect x="450" y="750" width="150" height="50" style="fill: #3F51B5" />
|
||||
<text x="455" y="779" style="font-size: 16px; fill: #eceff8" >indigo5</text>
|
||||
<text x="455" y="795" style="font-size: 12px; fill: #eceff8" >#3F51B5</text>
|
||||
<rect x="450" y="800" width="150" height="50" style="fill: #3342A1" />
|
||||
<text x="455" y="829" style="font-size: 16px; fill: #eceff8" >indigo6</text>
|
||||
<text x="455" y="845" style="font-size: 12px; fill: #eceff8" >#3342A1</text>
|
||||
<rect x="450" y="850" width="150" height="50" style="fill: #28348C" />
|
||||
<text x="455" y="879" style="font-size: 16px; fill: #eceff8" >indigo7</text>
|
||||
<text x="455" y="895" style="font-size: 12px; fill: #eceff8" >#28348C</text>
|
||||
<rect x="450" y="900" width="150" height="50" style="fill: #1F2878" />
|
||||
<text x="455" y="929" style="font-size: 16px; fill: #eceff8" >indigo8</text>
|
||||
<text x="455" y="945" style="font-size: 12px; fill: #eceff8" >#1F2878</text>
|
||||
<rect x="450" y="950" width="150" height="50" style="fill: #171D63" />
|
||||
<text x="455" y="979" style="font-size: 16px; fill: #eceff8" >indigo9</text>
|
||||
<text x="455" y="995" style="font-size: 12px; fill: #eceff8" >#171D63</text>
|
||||
<rect x="600" y="500" width="150" height="50" style="fill: #F3EDF9" />
|
||||
<text x="605" y="529" style="font-size: 16px; fill: #281475" >violet0</text>
|
||||
<text x="605" y="545" style="font-size: 12px; fill: #281475" >#F3EDF9</text>
|
||||
<rect x="600" y="550" width="150" height="50" style="fill: #E2D1F4" />
|
||||
<text x="605" y="579" style="font-size: 16px; fill: #281475" >violet1</text>
|
||||
<text x="605" y="595" style="font-size: 12px; fill: #281475" >#E2D1F4</text>
|
||||
<rect x="600" y="600" width="150" height="50" style="fill: #C4A7E9" />
|
||||
<text x="605" y="629" style="font-size: 16px; fill: #281475" >violet2</text>
|
||||
<text x="605" y="645" style="font-size: 12px; fill: #281475" >#C4A7E9</text>
|
||||
<rect x="600" y="650" width="150" height="50" style="fill: #A67FDD" />
|
||||
<text x="605" y="679" style="font-size: 16px; fill: #281475" >violet3</text>
|
||||
<text x="605" y="695" style="font-size: 12px; fill: #281475" >#A67FDD</text>
|
||||
<rect x="600" y="700" width="150" height="50" style="fill: #885BD2" />
|
||||
<text x="605" y="729" style="font-size: 16px; fill: #281475" >violet4</text>
|
||||
<text x="605" y="745" style="font-size: 12px; fill: #281475" >#885BD2</text>
|
||||
<rect x="600" y="750" width="150" height="50" style="fill: #6A3AC7" />
|
||||
<text x="605" y="779" style="font-size: 16px; fill: #f3edf9" >violet5</text>
|
||||
<text x="605" y="795" style="font-size: 12px; fill: #f3edf9" >#6A3AC7</text>
|
||||
<rect x="600" y="800" width="150" height="50" style="fill: #572FB3" />
|
||||
<text x="605" y="829" style="font-size: 16px; fill: #f3edf9" >violet6</text>
|
||||
<text x="605" y="845" style="font-size: 12px; fill: #f3edf9" >#572FB3</text>
|
||||
<rect x="600" y="850" width="150" height="50" style="fill: #46259E" />
|
||||
<text x="605" y="879" style="font-size: 16px; fill: #f3edf9" >violet7</text>
|
||||
<text x="605" y="895" style="font-size: 12px; fill: #f3edf9" >#46259E</text>
|
||||
<rect x="600" y="900" width="150" height="50" style="fill: #361C8A" />
|
||||
<text x="605" y="929" style="font-size: 16px; fill: #f3edf9" >violet8</text>
|
||||
<text x="605" y="945" style="font-size: 12px; fill: #f3edf9" >#361C8A</text>
|
||||
<rect x="600" y="950" width="150" height="50" style="fill: #281475" />
|
||||
<text x="605" y="979" style="font-size: 16px; fill: #f3edf9" >violet9</text>
|
||||
<text x="605" y="995" style="font-size: 12px; fill: #f3edf9" >#281475</text>
|
||||
<rect x="750" y="500" width="150" height="50" style="fill: #F7E9F7" />
|
||||
<text x="755" y="529" style="font-size: 16px; fill: #490a61" >purple0</text>
|
||||
<text x="755" y="545" style="font-size: 12px; fill: #490a61" >#F7E9F7</text>
|
||||
<rect x="750" y="550" width="150" height="50" style="fill: #EFCAF0" />
|
||||
<text x="755" y="579" style="font-size: 16px; fill: #490a61" >purple1</text>
|
||||
<text x="755" y="595" style="font-size: 12px; fill: #490a61" >#EFCAF0</text>
|
||||
<rect x="750" y="600" width="150" height="50" style="fill: #DD9BE0" />
|
||||
<text x="755" y="629" style="font-size: 16px; fill: #490a61" >purple2</text>
|
||||
<text x="755" y="645" style="font-size: 12px; fill: #490a61" >#DD9BE0</text>
|
||||
<rect x="750" y="650" width="150" height="50" style="fill: #C96FD1" />
|
||||
<text x="755" y="679" style="font-size: 16px; fill: #490a61" >purple3</text>
|
||||
<text x="755" y="695" style="font-size: 12px; fill: #490a61" >#C96FD1</text>
|
||||
<rect x="750" y="700" width="150" height="50" style="fill: #B449C2" />
|
||||
<text x="755" y="729" style="font-size: 16px; fill: #490a61" >purple4</text>
|
||||
<text x="755" y="745" style="font-size: 12px; fill: #490a61" >#B449C2</text>
|
||||
<rect x="750" y="750" width="150" height="50" style="fill: #9E28B3" />
|
||||
<text x="755" y="779" style="font-size: 16px; fill: #f7e9f7" >purple5</text>
|
||||
<text x="755" y="795" style="font-size: 12px; fill: #f7e9f7" >#9E28B3</text>
|
||||
<rect x="750" y="800" width="150" height="50" style="fill: #871E9E" />
|
||||
<text x="755" y="829" style="font-size: 16px; fill: #f7e9f7" >purple6</text>
|
||||
<text x="755" y="845" style="font-size: 12px; fill: #f7e9f7" >#871E9E</text>
|
||||
<rect x="750" y="850" width="150" height="50" style="fill: #71168A" />
|
||||
<text x="755" y="879" style="font-size: 16px; fill: #f7e9f7" >purple7</text>
|
||||
<text x="755" y="895" style="font-size: 12px; fill: #f7e9f7" >#71168A</text>
|
||||
<rect x="750" y="900" width="150" height="50" style="fill: #5C0F75" />
|
||||
<text x="755" y="929" style="font-size: 16px; fill: #f7e9f7" >purple8</text>
|
||||
<text x="755" y="945" style="font-size: 12px; fill: #f7e9f7" >#5C0F75</text>
|
||||
<rect x="750" y="950" width="150" height="50" style="fill: #490A61" />
|
||||
<text x="755" y="979" style="font-size: 16px; fill: #f7e9f7" >purple9</text>
|
||||
<text x="755" y="995" style="font-size: 12px; fill: #f7e9f7" >#490A61</text>
|
||||
<rect x="900" y="500" width="150" height="50" style="fill: #FDECEF" />
|
||||
<text x="905" y="529" style="font-size: 16px; fill: #5a012b" >pink0</text>
|
||||
<text x="905" y="545" style="font-size: 12px; fill: #5a012b" >#FDECEF</text>
|
||||
<rect x="900" y="550" width="150" height="50" style="fill: #FBCFD8" />
|
||||
<text x="905" y="579" style="font-size: 16px; fill: #5a012b" >pink1</text>
|
||||
<text x="905" y="595" style="font-size: 12px; fill: #5a012b" >#FBCFD8</text>
|
||||
<rect x="900" y="600" width="150" height="50" style="fill: #F6A0B5" />
|
||||
<text x="905" y="629" style="font-size: 16px; fill: #5a012b" >pink2</text>
|
||||
<text x="905" y="645" style="font-size: 12px; fill: #5a012b" >#F6A0B5</text>
|
||||
<rect x="900" y="650" width="150" height="50" style="fill: #F27396" />
|
||||
<text x="905" y="679" style="font-size: 16px; fill: #5a012b" >pink3</text>
|
||||
<text x="905" y="695" style="font-size: 12px; fill: #5a012b" >#F27396</text>
|
||||
<rect x="900" y="700" width="150" height="50" style="fill: #ED487B" />
|
||||
<text x="905" y="729" style="font-size: 16px; fill: #5a012b" >pink4</text>
|
||||
<text x="905" y="745" style="font-size: 12px; fill: #5a012b" >#ED487B</text>
|
||||
<rect x="900" y="750" width="150" height="50" style="fill: #E91E63" />
|
||||
<text x="905" y="779" style="font-size: 16px; fill: #fdecef" >pink5</text>
|
||||
<text x="905" y="795" style="font-size: 12px; fill: #fdecef" >#E91E63</text>
|
||||
<rect x="900" y="800" width="150" height="50" style="fill: #C51356" />
|
||||
<text x="905" y="829" style="font-size: 16px; fill: #fdecef" >pink6</text>
|
||||
<text x="905" y="845" style="font-size: 12px; fill: #fdecef" >#C51356</text>
|
||||
<rect x="900" y="850" width="150" height="50" style="fill: #A20B48" />
|
||||
<text x="905" y="879" style="font-size: 16px; fill: #fdecef" >pink7</text>
|
||||
<text x="905" y="895" style="font-size: 12px; fill: #fdecef" >#A20B48</text>
|
||||
<rect x="900" y="900" width="150" height="50" style="fill: #7E053A" />
|
||||
<text x="905" y="929" style="font-size: 16px; fill: #fdecef" >pink8</text>
|
||||
<text x="905" y="945" style="font-size: 12px; fill: #fdecef" >#7E053A</text>
|
||||
<rect x="900" y="950" width="150" height="50" style="fill: #5A012B" />
|
||||
<text x="905" y="979" style="font-size: 16px; fill: #fdecef" >pink9</text>
|
||||
<text x="905" y="995" style="font-size: 12px; fill: #fdecef" >#5A012B</text>
|
||||
<rect x="1050" y="500" width="150" height="50" style="fill: #F9F9F9" />
|
||||
<text x="1055" y="529" style="font-size: 16px; fill: #1c1f23" >grey0</text>
|
||||
<text x="1055" y="545" style="font-size: 12px; fill: #1c1f23" >#F9F9F9</text>
|
||||
<rect x="1050" y="550" width="150" height="50" style="fill: #E6E8EA" />
|
||||
<text x="1055" y="579" style="font-size: 16px; fill: #1c1f23" >grey1</text>
|
||||
<text x="1055" y="595" style="font-size: 12px; fill: #1c1f23" >#E6E8EA</text>
|
||||
<rect x="1050" y="600" width="150" height="50" style="fill: #C6CACD" />
|
||||
<text x="1055" y="629" style="font-size: 16px; fill: #1c1f23" >grey2</text>
|
||||
<text x="1055" y="645" style="font-size: 12px; fill: #1c1f23" >#C6CACD</text>
|
||||
<rect x="1050" y="650" width="150" height="50" style="fill: #A7ABB0" />
|
||||
<text x="1055" y="679" style="font-size: 16px; fill: #1c1f23" >grey3</text>
|
||||
<text x="1055" y="695" style="font-size: 12px; fill: #1c1f23" >#A7ABB0</text>
|
||||
<rect x="1050" y="700" width="150" height="50" style="fill: #888D92" />
|
||||
<text x="1055" y="729" style="font-size: 16px; fill: #1c1f23" >grey4</text>
|
||||
<text x="1055" y="745" style="font-size: 12px; fill: #1c1f23" >#888D92</text>
|
||||
<rect x="1050" y="750" width="150" height="50" style="fill: #6B7075" />
|
||||
<text x="1055" y="779" style="font-size: 16px; fill: #f9f9f9" >grey5</text>
|
||||
<text x="1055" y="795" style="font-size: 12px; fill: #f9f9f9" >#6B7075</text>
|
||||
<rect x="1050" y="800" width="150" height="50" style="fill: #555B61" />
|
||||
<text x="1055" y="829" style="font-size: 16px; fill: #f9f9f9" >grey6</text>
|
||||
<text x="1055" y="845" style="font-size: 12px; fill: #f9f9f9" >#555B61</text>
|
||||
<rect x="1050" y="850" width="150" height="50" style="fill: #41464C" />
|
||||
<text x="1055" y="879" style="font-size: 16px; fill: #f9f9f9" >grey7</text>
|
||||
<text x="1055" y="895" style="font-size: 12px; fill: #f9f9f9" >#41464C</text>
|
||||
<rect x="1050" y="900" width="150" height="50" style="fill: #2E3238" />
|
||||
<text x="1055" y="929" style="font-size: 16px; fill: #f9f9f9" >grey8</text>
|
||||
<text x="1055" y="945" style="font-size: 12px; fill: #f9f9f9" >#2E3238</text>
|
||||
<rect x="1050" y="950" width="150" height="50" style="fill: #1C1F23" />
|
||||
<text x="1055" y="979" style="font-size: 16px; fill: #f9f9f9" >grey9</text>
|
||||
<text x="1055" y="995" style="font-size: 12px; fill: #f9f9f9" >#1C1F23</text>
|
||||
<rect x="0" y="1000" width="600" height="50" style="fill: #FFFFFF" />
|
||||
<text x="5" y="1029" style="font-size: 16px; fill: #808080" >white</text>
|
||||
<text x="5" y="1045" style="font-size: 12px; fill: #808080" >#FFFFFF</text>
|
||||
<rect x="600" y="1000" width="600" height="50" style="fill: #000000" />
|
||||
<text x="605" y="1029" style="font-size: 16px; fill: #808080" >black</text>
|
||||
<text x="605" y="1045" style="font-size: 12px; fill: #808080" >#000000</text>
|
||||
</svg>
|
After Width: | Height: | Size: 36 KiB |
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
Binary file not shown.
After Width: | Height: | Size: 184 KiB |
|
@ -1,4 +0,0 @@
|
|||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
|
@ -1,15 +0,0 @@
|
|||
|
||||
M3_SRC_DIR := ../../../source
|
||||
|
||||
SOURCES := ../../app/main.c \
|
||||
$(shell find $(M3_SRC_DIR) -type f -name '*.c')
|
||||
|
||||
override CFLAGS += -std=c99 -O3 -flto -Dd_m3HasWASI -Wno-error=format-security -Wfatal-errors -I$(M3_SRC_DIR)
|
||||
|
||||
all: wasm3
|
||||
|
||||
wasm3: $(SOURCES)
|
||||
$(CC) $(CFLAGS) $(SOURCES) -o wasm3 -lm
|
||||
|
||||
clean:
|
||||
$(RM) wasm3
|
13
orca
13
orca
|
@ -7,10 +7,17 @@ import os
|
|||
import sys
|
||||
|
||||
|
||||
MAJOR, MINOR = 3, 8
|
||||
|
||||
if __name__ != "__main__":
|
||||
print("why are you importing the orca command-line tool as a Python module, you absolute goofball")
|
||||
exit(1)
|
||||
|
||||
if sys.version_info.major < MAJOR or sys.version_info.minor < MINOR:
|
||||
print("Your Python version is too old.")
|
||||
print("Orca requires version {}.{}, but you have version {}.{}.".format(MAJOR, MINOR, sys.version_info.major, sys.version_info.minor))
|
||||
exit(1)
|
||||
|
||||
|
||||
# If you modify this, be sure to modify the version in scripts/dev.py as well.
|
||||
def check_if_source():
|
||||
|
@ -41,9 +48,9 @@ if use_source:
|
|||
# Use the source checkout's scripts instead of the system-installed scripts.
|
||||
|
||||
if not is_source:
|
||||
print("The Orca tool is running from a local source checkout and will")
|
||||
print("use that instead of the system Orca installation.")
|
||||
print()
|
||||
print("The Orca tool is running from a local source checkout and will", file=sys.stderr)
|
||||
print("use that instead of the system Orca installation.", file=sys.stderr)
|
||||
print(file=sys.stderr)
|
||||
|
||||
sys.path.append(source_dir)
|
||||
import scripts.orca
|
||||
|
|
2
orca.bat
2
orca.bat
|
@ -3,5 +3,5 @@
|
|||
rem Get the directory of this batch script
|
||||
set "script_dir=%~dp0"
|
||||
|
||||
python3 "%script_dir%orca" %*
|
||||
python "%script_dir%orca" %*
|
||||
exit /b %errorlevel%
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
Pong
|
||||
Breakout
|
||||
profile.dtrace
|
||||
profile.spall
|
||||
|
|
|
@ -1,19 +1,39 @@
|
|||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
:: compile wasm module
|
||||
:: The following code checks if you have the necessary programs to compile the samples.
|
||||
:: This code exists to improve the experience of first-time Orca users and can
|
||||
:: be safely deleted in your own projects if you wish.
|
||||
if exist "..\..\scripts\sample_build_check.py" (
|
||||
python ..\..\scripts\sample_build_check.py
|
||||
if !ERRORLEVEL! neq 0 exit /b 1
|
||||
) else (
|
||||
echo Could not check if you have the necessary tools to build the Orca samples.
|
||||
echo If you have copied this script to your own project, you can delete this code.
|
||||
)
|
||||
|
||||
set ORCA_DIR=..\..
|
||||
set STDLIB_DIR=%ORCA_DIR%\src\libc-shim
|
||||
|
||||
:: common flags to build wasm modules
|
||||
set wasmFlags=--target=wasm32^
|
||||
--no-standard-libraries ^
|
||||
-fno-builtin ^
|
||||
-mbulk-memory ^
|
||||
-g -O2 ^
|
||||
-D__ORCA__ ^
|
||||
-Wl,--no-entry ^
|
||||
-Wl,--export-dynamic ^
|
||||
-g ^
|
||||
-O2 ^
|
||||
-mbulk-memory ^
|
||||
-D__ORCA__ ^
|
||||
-isystem ..\..\src\libc-shim\include ^
|
||||
-I..\..\ext -I ..\..\src
|
||||
-isystem %STDLIB_DIR%\include ^
|
||||
-I%ORCA_DIR%\src ^
|
||||
-I%ORCA_DIR%\src\ext
|
||||
|
||||
clang %wasmFlags% -o .\module.wasm ..\..\src\orca.c ..\..\src\libc-shim\src\*.c src\main.c
|
||||
:: build orca core as wasm module
|
||||
clang %wasmFlags% -Wl,--relocatable -o .\liborca.a %ORCA_DIR%\src\orca.c %ORCA_DIR%\src\libc-shim\src\*.c
|
||||
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
|
||||
|
||||
orca bundle --orca-dir ..\.. --name Breakout --icon icon.png --resource-dir data module.wasm
|
||||
:: build sample as wasm module and link it with the orca module
|
||||
clang %wasmFlags% -L . -lorca -o module.wasm src/main.c
|
||||
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
|
||||
|
||||
:: create app directory and copy files into it
|
||||
orca bundle --orca-dir %ORCA_DIR% --name Breakout --icon icon.png --resource-dir data module.wasm
|
||||
|
|
|
@ -2,31 +2,36 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
if [[ -x /usr/local/opt/llvm/bin/clang ]]; then
|
||||
CLANG=/usr/local/opt/llvm/bin/clang
|
||||
elif [[ -x /opt/homebrew/opt/llvm/bin/clang ]]; then
|
||||
CLANG=/opt/homebrew/opt/llvm/bin/clang
|
||||
# The following code checks if you have the necessary programs to compile the samples.
|
||||
# This code exists to improve the experience of first-time Orca users and can
|
||||
# be safely deleted in your own projects if you wish.
|
||||
if [ -f ../../scripts/sample_build_check.py ]; then
|
||||
python3 ../../scripts/sample_build_check.py
|
||||
else
|
||||
echo "Could not find Homebrew clang; this script will probably not work."
|
||||
CLANG=clang
|
||||
echo "Could not check if you have the necessary tools to build the Orca samples."
|
||||
echo "If you have copied this script to your own project, you can delete this code."
|
||||
fi
|
||||
|
||||
ORCA_DIR=../..
|
||||
STDLIB_DIR=../../src/libc-shim
|
||||
STDLIB_DIR=$ORCA_DIR/src/libc-shim
|
||||
|
||||
# common flags to build wasm modules
|
||||
wasmFlags="--target=wasm32 \
|
||||
--no-standard-libraries \
|
||||
-fno-builtin \
|
||||
-mbulk-memory \
|
||||
-g -O2 \
|
||||
-D__ORCA__ \
|
||||
-Wl,--no-entry \
|
||||
-Wl,--export-dynamic \
|
||||
-g \
|
||||
-O2 \
|
||||
-mbulk-memory \
|
||||
-D__ORCA__ \
|
||||
-I $STDLIB_DIR/include \
|
||||
-I $ORCA_DIR/ext \
|
||||
-I $ORCA_DIR/src"
|
||||
-isystem $STDLIB_DIR/include \
|
||||
-I $ORCA_DIR/src \
|
||||
-I $ORCA_DIR/src/ext"
|
||||
|
||||
$CLANG $wasmFlags -o ./module.wasm ../../src/orca.c $STDLIB_DIR/src/*.c src/main.c
|
||||
# build orca core as wasm module
|
||||
clang $wasmFlags -Wl,--relocatable -o ./liborca.a $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c
|
||||
|
||||
orca bundle --orca-dir ../.. --name Breakout --icon icon.png --resource-dir data module.wasm
|
||||
# build sample as wasm module and link it with the orca module
|
||||
clang $wasmFlags -L . -lorca -o module.wasm src/main.c
|
||||
|
||||
# create app directory and copy files into it
|
||||
orca bundle --orca-dir $ORCA_DIR --name Breakout --icon icon.png --resource-dir data module.wasm
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
**************************************************************************/
|
||||
#include <math.h>
|
||||
|
||||
#include <orca.h>
|
||||
|
@ -118,7 +125,7 @@ ORCA_EXPORT void oc_on_resize(u32 width, u32 height)
|
|||
frameSize.y = height;
|
||||
}
|
||||
|
||||
ORCA_EXPORT void oc_on_key_down(int key)
|
||||
ORCA_EXPORT void oc_on_key_down(oc_scan_code scan, oc_key_code key)
|
||||
{
|
||||
oc_log_info("key down: %i", key);
|
||||
if(key == OC_KEY_LEFT)
|
||||
|
@ -131,7 +138,7 @@ ORCA_EXPORT void oc_on_key_down(int key)
|
|||
}
|
||||
}
|
||||
|
||||
ORCA_EXPORT void oc_on_key_up(int key)
|
||||
ORCA_EXPORT void oc_on_key_up(oc_scan_code scan, oc_key_code key)
|
||||
{
|
||||
oc_log_info("key up: %i", key);
|
||||
if(key == OC_KEY_LEFT)
|
||||
|
@ -280,6 +287,7 @@ int check_collision(oc_rect block)
|
|||
|
||||
ORCA_EXPORT void oc_on_frame_refresh(void)
|
||||
{
|
||||
oc_arena_scope scratch = oc_scratch_begin();
|
||||
f32 aspect = frameSize.x / frameSize.y;
|
||||
|
||||
if(leftDown)
|
||||
|
@ -394,7 +402,7 @@ ORCA_EXPORT void oc_on_frame_refresh(void)
|
|||
0, -1, frameSize.y
|
||||
};
|
||||
|
||||
oc_matrix_push(yUp);
|
||||
oc_matrix_multiply_push(yUp);
|
||||
{
|
||||
for(int i = 0; i < NUM_BLOCKS; i++)
|
||||
{
|
||||
|
@ -415,7 +423,7 @@ ORCA_EXPORT void oc_on_frame_refresh(void)
|
|||
oc_rounded_rectangle_stroke(r.x, r.y, r.w, r.h, 4);
|
||||
|
||||
int fontSize = 18;
|
||||
oc_str8 text = oc_str8_pushf(oc_scratch(), "%d", blockHealth[i]);
|
||||
oc_str8 text = oc_str8_pushf(scratch.arena, "%d", blockHealth[i]);
|
||||
oc_rect textRect = oc_font_text_metrics(font, fontSize, text).ink;
|
||||
|
||||
oc_vec2 textPos = {
|
||||
|
@ -430,7 +438,7 @@ ORCA_EXPORT void oc_on_frame_refresh(void)
|
|||
oc_set_font(font);
|
||||
oc_set_font_size(18);
|
||||
oc_move_to(textPos.x, textPos.y);
|
||||
oc_matrix_push(flip_y_at(textPos));
|
||||
oc_matrix_multiply_push(flip_y_at(textPos));
|
||||
{
|
||||
oc_text_outlines(text);
|
||||
oc_fill();
|
||||
|
@ -441,7 +449,7 @@ ORCA_EXPORT void oc_on_frame_refresh(void)
|
|||
oc_set_color(paddleColor);
|
||||
oc_rounded_rectangle_fill(paddle.x, paddle.y, paddle.w, paddle.h, 4);
|
||||
|
||||
oc_matrix_push(flip_y(ball));
|
||||
oc_matrix_multiply_push(flip_y(ball));
|
||||
{
|
||||
oc_image_draw(ballImage, ball);
|
||||
}
|
||||
|
@ -450,9 +458,9 @@ ORCA_EXPORT void oc_on_frame_refresh(void)
|
|||
// draw score text
|
||||
{
|
||||
oc_move_to(20, 20);
|
||||
oc_str8 text = oc_str8_pushf(oc_scratch(), "Destroy all %d blocks to win! Current score: %d", NUM_BLOCKS_TO_WIN, score);
|
||||
oc_str8 text = oc_str8_pushf(scratch.arena, "Destroy all %d blocks to win! Current score: %d", NUM_BLOCKS_TO_WIN, score);
|
||||
oc_vec2 textPos = { 20, 20 };
|
||||
oc_matrix_push(flip_y_at(textPos));
|
||||
oc_matrix_multiply_push(flip_y_at(textPos));
|
||||
{
|
||||
oc_set_color_rgba(0.9, 0.9, 0.9, 1);
|
||||
oc_text_outlines(text);
|
||||
|
@ -467,5 +475,5 @@ ORCA_EXPORT void oc_on_frame_refresh(void)
|
|||
oc_render(canvas);
|
||||
oc_surface_present(surface);
|
||||
|
||||
oc_arena_clear(oc_scratch());
|
||||
oc_scratch_end(scratch);
|
||||
}
|
||||
|
|
|
@ -1,19 +1,39 @@
|
|||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
:: compile wasm module
|
||||
:: The following code checks if you have the necessary programs to compile the samples.
|
||||
:: This code exists to improve the experience of first-time Orca users and can
|
||||
:: be safely deleted in your own projects if you wish.
|
||||
if exist "..\..\scripts\sample_build_check.py" (
|
||||
python ..\..\scripts\sample_build_check.py
|
||||
if !ERRORLEVEL! neq 0 exit /b 1
|
||||
) else (
|
||||
echo Could not check if you have the necessary tools to build the Orca samples.
|
||||
echo If you have copied this script to your own project, you can delete this code.
|
||||
)
|
||||
|
||||
set ORCA_DIR=..\..
|
||||
set STDLIB_DIR=%ORCA_DIR%\src\libc-shim
|
||||
|
||||
:: common flags to build wasm modules
|
||||
set wasmFlags=--target=wasm32^
|
||||
--no-standard-libraries ^
|
||||
-fno-builtin ^
|
||||
-mbulk-memory ^
|
||||
-g -O2 ^
|
||||
-D__ORCA__ ^
|
||||
-Wl,--no-entry ^
|
||||
-Wl,--export-dynamic ^
|
||||
-g ^
|
||||
-O2 ^
|
||||
-mbulk-memory ^
|
||||
-D__ORCA__ ^
|
||||
-isystem ..\..\src\libc-shim\include ^
|
||||
-I..\..\ext -I ..\..\src
|
||||
-isystem %STDLIB_DIR%\include ^
|
||||
-I%ORCA_DIR%\src ^
|
||||
-I%ORCA_DIR%\src\ext
|
||||
|
||||
clang %wasmFlags% -o .\module.wasm ..\..\src\orca.c ..\..\src\libc-shim\src\*.c src\main.c
|
||||
:: build orca core as wasm module
|
||||
clang %wasmFlags% -Wl,--relocatable -o .\liborca.a %ORCA_DIR%\src\orca.c %ORCA_DIR%\src\libc-shim\src\*.c
|
||||
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
|
||||
|
||||
orca bundle --orca-dir ..\.. --name Clock --icon icon.png --resource-dir data module.wasm
|
||||
:: build sample as wasm module and link it with the orca module
|
||||
clang %wasmFlags% -L . -lorca -o module.wasm src/main.c
|
||||
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
|
||||
|
||||
:: create app directory and copy files into it
|
||||
orca bundle --orca-dir %ORCA_DIR% --name Clock --icon icon.png --resource-dir data module.wasm
|
||||
|
|
|
@ -2,31 +2,36 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
if [[ -x /usr/local/opt/llvm/bin/clang ]]; then
|
||||
CLANG=/usr/local/opt/llvm/bin/clang
|
||||
elif [[ -x /opt/homebrew/opt/llvm/bin/clang ]]; then
|
||||
CLANG=/opt/homebrew/opt/llvm/bin/clang
|
||||
# The following code checks if you have the necessary programs to compile the samples.
|
||||
# This code exists to improve the experience of first-time Orca users and can
|
||||
# be safely deleted in your own projects if you wish.
|
||||
if [ -f ../../scripts/sample_build_check.py ]; then
|
||||
python3 ../../scripts/sample_build_check.py
|
||||
else
|
||||
echo "Could not find Homebrew clang; this script will probably not work."
|
||||
CLANG=clang
|
||||
echo "Could not check if you have the necessary tools to build the Orca samples."
|
||||
echo "If you have copied this script to your own project, you can delete this code."
|
||||
fi
|
||||
|
||||
ORCA_DIR=../..
|
||||
STDLIB_DIR=../../src/libc-shim
|
||||
STDLIB_DIR=$ORCA_DIR/src/libc-shim
|
||||
|
||||
# common flags to build wasm modules
|
||||
wasmFlags="--target=wasm32 \
|
||||
--no-standard-libraries \
|
||||
-fno-builtin \
|
||||
-mbulk-memory \
|
||||
-g -O2 \
|
||||
-D__ORCA__ \
|
||||
-Wl,--no-entry \
|
||||
-Wl,--export-dynamic \
|
||||
-g \
|
||||
-O2 \
|
||||
-mbulk-memory \
|
||||
-D__ORCA__ \
|
||||
-I $STDLIB_DIR/include \
|
||||
-I $ORCA_DIR/ext \
|
||||
-I $ORCA_DIR/src"
|
||||
-isystem $STDLIB_DIR/include \
|
||||
-I $ORCA_DIR/src \
|
||||
-I $ORCA_DIR/src/ext"
|
||||
|
||||
$CLANG $wasmFlags -o ./module.wasm ../../src/orca.c $STDLIB_DIR/src/*.c src/main.c
|
||||
# build orca core as wasm module
|
||||
clang $wasmFlags -Wl,--relocatable -o ./liborca.a $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c
|
||||
|
||||
orca bundle --orca-dir ../.. --name Clock --icon icon.png --resource-dir data module.wasm
|
||||
# build sample as wasm module and link it with the orca module
|
||||
clang $wasmFlags -L . -lorca -o module.wasm src/main.c
|
||||
|
||||
# create app directory and copy files into it
|
||||
orca bundle --orca-dir $ORCA_DIR --name Clock --icon icon.png --resource-dir data module.wasm
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [[ -x /usr/local/opt/llvm/bin/clang ]]; then
|
||||
CLANG=/usr/local/opt/llvm/bin/clang
|
||||
elif [[ -x /opt/homebrew/opt/llvm/bin/clang ]]; then
|
||||
CLANG=/opt/homebrew/opt/llvm/bin/clang
|
||||
else
|
||||
echo "Could not find Homebrew clang; this script will probably not work."
|
||||
CLANG=clang
|
||||
fi
|
||||
|
||||
if [[ -x /usr/local/opt/llvm/bin/clang++ ]]; then
|
||||
CLANGPP=/usr/local/opt/llvm/bin/clang++
|
||||
elif [[ -x /opt/homebrew/opt/llvm/bin/clang++ ]]; then
|
||||
CLANGPP=/opt/homebrew/opt/llvm/bin/clang++
|
||||
else
|
||||
echo "Could not find Homebrew clang++; this script will probably not work."
|
||||
CLANGPP=clang++
|
||||
fi
|
||||
|
||||
ORCA_DIR=../..
|
||||
STDLIB_DIR=../../src/libc-shim
|
||||
|
||||
wasmObjFlags="--target=wasm32 \
|
||||
-g \
|
||||
-O2 \
|
||||
-mbulk-memory \
|
||||
-D__ORCA__ \
|
||||
-I $ORCA_DIR/ext \
|
||||
-I $STDLIB_DIR/include \
|
||||
-I $ORCA_DIR/ext \
|
||||
-I $ORCA_DIR/src"
|
||||
|
||||
wasmFlags="--target=wasm32 \
|
||||
--no-standard-libraries \
|
||||
-Wl,--no-entry \
|
||||
-Wl,--export-dynamic \
|
||||
-g \
|
||||
-O2 \
|
||||
-mbulk-memory \
|
||||
-D__ORCA__ \
|
||||
-I $ORCA_DIR/ext \
|
||||
-I $STDLIB_DIR/include \
|
||||
-I $ORCA_DIR/ext \
|
||||
-I $ORCA_DIR/src"
|
||||
|
||||
if [ ! -e build ] ; then
|
||||
mkdir build
|
||||
fi
|
||||
|
||||
$CLANG $wasmObjFlags -c -o ./build/orca.o ../../src/orca.c
|
||||
for file in $STDLIB_DIR/src/*.c ; do
|
||||
name=$(basename $file)
|
||||
name=${name%.c}
|
||||
$CLANG $wasmObjFlags -c -o ./build/$name.o $file
|
||||
done
|
||||
|
||||
$CLANGPP $wasmFlags -o ./module.wasm src/main.c ./build/*.o
|
||||
|
||||
orca bundle --orca-dir ../.. --name Clock --resource-dir data module.wasm
|
|
@ -1,3 +1,10 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
**************************************************************************/
|
||||
#include <math.h>
|
||||
#include <orca.h>
|
||||
|
||||
|
@ -108,7 +115,7 @@ ORCA_EXPORT void oc_on_frame_refresh(void)
|
|||
}
|
||||
|
||||
// hours hand
|
||||
oc_matrix_push(mat_transform(centerX, centerY, hoursRotation));
|
||||
oc_matrix_multiply_push(mat_transform(centerX, centerY, hoursRotation));
|
||||
{
|
||||
oc_set_color_rgba(.2, 0.2, 0.2, 1);
|
||||
oc_rounded_rectangle_fill(0, -7.5 * uiScale, clockRadius * 0.5f, 15 * uiScale, 5 * uiScale);
|
||||
|
@ -116,7 +123,7 @@ ORCA_EXPORT void oc_on_frame_refresh(void)
|
|||
oc_matrix_pop();
|
||||
|
||||
// minutes hand
|
||||
oc_matrix_push(mat_transform(centerX, centerY, minutesRotation));
|
||||
oc_matrix_multiply_push(mat_transform(centerX, centerY, minutesRotation));
|
||||
{
|
||||
oc_set_color_rgba(.2, 0.2, 0.2, 1);
|
||||
oc_rounded_rectangle_fill(0, -5 * uiScale, clockRadius * 0.7f, 10 * uiScale, 5 * uiScale);
|
||||
|
@ -124,7 +131,7 @@ ORCA_EXPORT void oc_on_frame_refresh(void)
|
|||
oc_matrix_pop();
|
||||
|
||||
// seconds hand
|
||||
oc_matrix_push(mat_transform(centerX, centerY, secondsRotation));
|
||||
oc_matrix_multiply_push(mat_transform(centerX, centerY, secondsRotation));
|
||||
{
|
||||
oc_set_color_rgba(1, 0.2, 0.2, 1);
|
||||
oc_rounded_rectangle_fill(0, -2.5 * uiScale, clockRadius * 0.8f, 5 * uiScale, 5 * uiScale);
|
||||
|
|
|
@ -1,17 +1,35 @@
|
|||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
:: compile wasm module
|
||||
:: The following code checks if you have the necessary programs to compile the samples.
|
||||
:: This code exists to improve the experience of first-time Orca users and can
|
||||
:: be safely deleted in your own projects if you wish.
|
||||
if exist "..\..\scripts\sample_build_check.py" (
|
||||
python ..\..\scripts\sample_build_check.py
|
||||
if !ERRORLEVEL! neq 0 exit /b 1
|
||||
) else (
|
||||
echo Could not check if you have the necessary tools to build the Orca samples.
|
||||
echo If you have copied this script to your own project, you can delete this code.
|
||||
)
|
||||
|
||||
set ORCA_DIR=..\..
|
||||
set STDLIB_DIR=%ORCA_DIR%\src\libc-shim
|
||||
|
||||
:: common flags to build wasm modules
|
||||
set wasmFlags=--target=wasm32^
|
||||
--no-standard-libraries ^
|
||||
-fno-builtin ^
|
||||
-mbulk-memory ^
|
||||
-g -O2 ^
|
||||
-D__ORCA__ ^
|
||||
-Wl,--no-entry ^
|
||||
-Wl,--export-dynamic ^
|
||||
-g ^
|
||||
-O2 ^
|
||||
-mbulk-memory ^
|
||||
-D__ORCA__ ^
|
||||
-isystem ..\..\src\libc-shim\include ^
|
||||
-I..\..\ext -I ..\..\src
|
||||
-isystem %STDLIB_DIR%\include ^
|
||||
-I%ORCA_DIR%\src ^
|
||||
-I%ORCA_DIR%\src\ext
|
||||
|
||||
:: build orca core as wasm module
|
||||
clang %wasmFlags% -Wl,--relocatable -o .\liborca.a %ORCA_DIR%\src\orca.c %ORCA_DIR%\src\libc-shim\src\*.c
|
||||
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
|
||||
|
||||
set shaders=src/shaders/advect.glsl^
|
||||
src/shaders/blit_div_fragment.glsl^
|
||||
|
@ -28,10 +46,12 @@ set shaders=src/shaders/advect.glsl^
|
|||
src/shaders/subtract_pressure.glsl
|
||||
|
||||
|
||||
call python3 ../../scripts/embed_text_files.py --prefix=glsl_ --output src/glsl_shaders.h %shaders%
|
||||
call python ../../scripts/embed_text_files.py --prefix=glsl_ --output src/glsl_shaders.h %shaders%
|
||||
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
|
||||
|
||||
:: build sample as wasm module and link it with the orca module
|
||||
clang %wasmFlags% -L . -lorca -o .\module.wasm src\main.c
|
||||
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
|
||||
|
||||
clang %wasmFlags% -o .\module.wasm ..\..\src\orca.c ..\..\src\libc-shim\src\*.c src\main.c
|
||||
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
|
||||
|
||||
orca bundle --orca-dir ..\.. --icon icon.png --name Fluid module.wasm
|
||||
:: create app directory and copy files into it
|
||||
orca bundle --orca-dir %ORCA_DIR% --name Fluid --icon icon.png module.wasm
|
||||
|
|
|
@ -2,33 +2,38 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
if [[ -x /usr/local/opt/llvm/bin/clang ]]; then
|
||||
CLANG=/usr/local/opt/llvm/bin/clang
|
||||
elif [[ -x /opt/homebrew/opt/llvm/bin/clang ]]; then
|
||||
CLANG=/opt/homebrew/opt/llvm/bin/clang
|
||||
# The following code checks if you have the necessary programs to compile the samples.
|
||||
# This code exists to improve the experience of first-time Orca users and can
|
||||
# be safely deleted in your own projects if you wish.
|
||||
if [ -f ../../scripts/sample_build_check.py ]; then
|
||||
python3 ../../scripts/sample_build_check.py
|
||||
else
|
||||
echo "Could not find Homebrew clang; this script will probably not work."
|
||||
CLANG=clang
|
||||
echo "Could not check if you have the necessary tools to build the Orca samples."
|
||||
echo "If you have copied this script to your own project, you can delete this code."
|
||||
fi
|
||||
|
||||
ORCA_DIR=../..
|
||||
STDLIB_DIR=../../src/libc-shim
|
||||
STDLIB_DIR=$ORCA_DIR/src/libc-shim
|
||||
|
||||
python3 ../../scripts/embed_text_files.py --prefix=glsl_ --output src/glsl_shaders.h src/shaders/*.glsl
|
||||
|
||||
# common flags to build wasm modules
|
||||
wasmFlags="--target=wasm32 \
|
||||
--no-standard-libraries \
|
||||
-fno-builtin \
|
||||
-mbulk-memory \
|
||||
-g -O2 \
|
||||
-D__ORCA__ \
|
||||
-Wl,--no-entry \
|
||||
-Wl,--export-dynamic \
|
||||
-g \
|
||||
-O2 \
|
||||
-mbulk-memory \
|
||||
-D__ORCA__ \
|
||||
-I $STDLIB_DIR/include \
|
||||
-I $ORCA_DIR/ext \
|
||||
-I $ORCA_DIR/src"
|
||||
-isystem $STDLIB_DIR/include \
|
||||
-I $ORCA_DIR/src \
|
||||
-I $ORCA_DIR/src/ext"
|
||||
|
||||
$CLANG $wasmFlags -o ./module.wasm ../../src/orca.c $STDLIB_DIR/src/*.c src/main.c
|
||||
# build orca core as wasm module
|
||||
clang $wasmFlags -Wl,--relocatable -o ./liborca.a $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c
|
||||
|
||||
orca bundle --orca-dir ../.. --icon icon.png --name Fluid module.wasm
|
||||
# build sample as wasm module and link it with the orca module
|
||||
clang $wasmFlags -L . -lorca -o module.wasm src/main.c
|
||||
|
||||
# create app directory and copy files into it
|
||||
orca bundle --orca-dir $ORCA_DIR --name Fluid --icon icon.png module.wasm
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
/************************************************************/ /**
|
||||
/*************************************************************************
|
||||
*
|
||||
* @file: main.cpp
|
||||
* @author: Martin Fouilleul
|
||||
* @date: 27/02/2022
|
||||
* @revision:
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
*****************************************************************/
|
||||
**************************************************************************/
|
||||
|
||||
#include "glsl_shaders.h"
|
||||
#include "math.h"
|
||||
|
@ -141,6 +140,7 @@ frame_buffer divBuffer[4];
|
|||
GLuint vertexBuffer;
|
||||
|
||||
oc_surface surface;
|
||||
f64 startTime;
|
||||
|
||||
//----------------------------------------------------------------
|
||||
//NOTE(martin): initialization
|
||||
|
@ -404,6 +404,7 @@ typedef struct mouse_input
|
|||
} mouse_input;
|
||||
|
||||
mouse_input mouseInput = { 0 };
|
||||
bool mouseWasDown = false;
|
||||
|
||||
int frameWidth = 800;
|
||||
int frameHeight = 600;
|
||||
|
@ -411,6 +412,7 @@ int frameHeight = 600;
|
|||
ORCA_EXPORT void oc_on_mouse_down(int button)
|
||||
{
|
||||
mouseInput.down = true;
|
||||
mouseWasDown = true;
|
||||
}
|
||||
|
||||
ORCA_EXPORT void oc_on_mouse_up(int button)
|
||||
|
@ -578,23 +580,56 @@ void multigrid_clear(frame_buffer* error)
|
|||
|
||||
void input_splat(float t)
|
||||
{
|
||||
//NOTE: apply force and dye
|
||||
if(mouseInput.down && (mouseInput.deltaX || mouseInput.deltaY))
|
||||
bool applySplat = false;
|
||||
float x, y, deltaX, deltaY;
|
||||
static f64 lastFrameTime = 0;
|
||||
if (lastFrameTime == 0)
|
||||
{
|
||||
lastFrameTime = startTime;
|
||||
}
|
||||
f64 now = oc_clock_time(OC_CLOCK_MONOTONIC);
|
||||
float frameDuration = now - lastFrameTime;
|
||||
lastFrameTime = now;
|
||||
|
||||
if (mouseInput.down && (mouseInput.deltaX || mouseInput.deltaY))
|
||||
{
|
||||
oc_vec2 scaling = oc_surface_contents_scaling(surface);
|
||||
applySplat = true;
|
||||
x = mouseInput.x * scaling.x / frameWidth;
|
||||
y = mouseInput.y * scaling.y / frameHeight;
|
||||
deltaX = 1. / 60 / frameDuration * mouseInput.deltaX * scaling.x / frameWidth;
|
||||
deltaY = 1. / 60 / frameDuration * mouseInput.deltaY * scaling.y / frameHeight;
|
||||
mouseInput.deltaX = 0;
|
||||
mouseInput.deltaY = 0;
|
||||
}
|
||||
|
||||
f64 timeSinceStart = now - startTime;
|
||||
if (!mouseWasDown && timeSinceStart < 1)
|
||||
{
|
||||
applySplat = true;
|
||||
float totalDeltaX = 0.5;
|
||||
x = 0.1 + totalDeltaX * timeSinceStart;
|
||||
y = 0.5;
|
||||
deltaX = totalDeltaX / 180;
|
||||
deltaY = 0;
|
||||
}
|
||||
|
||||
//NOTE: apply force and dye
|
||||
if(applySplat)
|
||||
{
|
||||
// account for margin
|
||||
float margin = 32;
|
||||
|
||||
float offset = margin / texWidth;
|
||||
float ratio = 1 - 2 * margin / texWidth;
|
||||
|
||||
float splatPosX = (mouseInput.x * scaling.x / frameWidth) * ratio + offset;
|
||||
float splatPosY = (1 - mouseInput.y * scaling.y / frameHeight) * ratio + offset;
|
||||
float splatPosX = x * ratio + offset;
|
||||
float splatPosY = (1 - y) * ratio + offset;
|
||||
|
||||
float splatVelX = (10000. * DELTA * mouseInput.deltaX * scaling.x / frameWidth) * ratio;
|
||||
float splatVelY = (-10000. * DELTA * mouseInput.deltaY * scaling.y / frameWidth) * ratio;
|
||||
float splatVelX = (10000. * DELTA * deltaX) * ratio;
|
||||
float splatVelY = (-10000. * DELTA * deltaY) * ratio;
|
||||
|
||||
float intensity = 100 * sqrtf(square(ratio * mouseInput.deltaX * scaling.x / frameWidth) + square(ratio * mouseInput.deltaY * scaling.y / frameHeight));
|
||||
float intensity = 100 * sqrtf(square(ratio * deltaX) + square(ratio * deltaY));
|
||||
|
||||
float r = intensity * (sinf(2 * M_PI * 0.1 * t) + 1);
|
||||
float g = 0.5 * intensity * (cosf(2 * M_PI * 0.1 / M_E * t + 654) + 1);
|
||||
|
@ -603,9 +638,6 @@ void input_splat(float t)
|
|||
float radius = 0.005;
|
||||
|
||||
apply_splat(splatPosX, splatPosY, radius, splatVelX, splatVelY, r, g, b, false);
|
||||
|
||||
mouseInput.deltaX = 0;
|
||||
mouseInput.deltaY = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -678,6 +710,8 @@ ORCA_EXPORT void oc_on_init()
|
|||
testDiv[i][j][0] = 0.5 + 0.5 * cosf(j / 100. * 3.14159 + i / 100. * 1.2139);
|
||||
}
|
||||
}
|
||||
|
||||
startTime = oc_clock_time(OC_CLOCK_MONOTONIC);
|
||||
}
|
||||
|
||||
ORCA_EXPORT void oc_on_resize(u32 width, u32 height)
|
||||
|
|
|
@ -1,19 +1,39 @@
|
|||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
:: compile wasm module
|
||||
:: The following code checks if you have the necessary programs to compile the samples.
|
||||
:: This code exists to improve the experience of first-time Orca users and can
|
||||
:: be safely deleted in your own projects if you wish.
|
||||
if exist "..\..\scripts\sample_build_check.py" (
|
||||
python ..\..\scripts\sample_build_check.py
|
||||
if !ERRORLEVEL! neq 0 exit /b 1
|
||||
) else (
|
||||
echo Could not check if you have the necessary tools to build the Orca samples.
|
||||
echo If you have copied this script to your own project, you can delete this code.
|
||||
)
|
||||
|
||||
set ORCA_DIR=..\..
|
||||
set STDLIB_DIR=%ORCA_DIR%\src\libc-shim
|
||||
|
||||
:: common flags to build wasm modules
|
||||
set wasmFlags=--target=wasm32^
|
||||
--no-standard-libraries ^
|
||||
-fno-builtin ^
|
||||
-mbulk-memory ^
|
||||
-g -O2 ^
|
||||
-D__ORCA__ ^
|
||||
-Wl,--no-entry ^
|
||||
-Wl,--export-dynamic ^
|
||||
-g ^
|
||||
-O2 ^
|
||||
-mbulk-memory ^
|
||||
-D__ORCA__ ^
|
||||
-isystem ..\..\src\libc-shim\include ^
|
||||
-I..\..\ext -I ..\..\src
|
||||
-isystem %STDLIB_DIR%\include ^
|
||||
-I%ORCA_DIR%\src ^
|
||||
-I%ORCA_DIR%\src\ext
|
||||
|
||||
clang %wasmFlags% -o .\module.wasm ..\..\src\orca.c ..\..\src\libc-shim\src\*.c src\main.c
|
||||
:: build orca core as wasm module
|
||||
clang %wasmFlags% -Wl,--relocatable -o .\liborca.a %ORCA_DIR%\src\orca.c %ORCA_DIR%\src\libc-shim\src\*.c
|
||||
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
|
||||
|
||||
orca bundle --orca-dir ..\.. --name Triangle module.wasm
|
||||
:: build sample as wasm module and link it with the orca module
|
||||
clang %wasmFlags% -L . -lorca -o module.wasm src/main.c
|
||||
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
|
||||
|
||||
:: create app directory and copy files into it
|
||||
orca bundle --orca-dir %ORCA_DIR% --name Triangle --icon icon.png module.wasm
|
||||
|
|
|
@ -2,31 +2,36 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
if [[ -x /usr/local/opt/llvm/bin/clang ]]; then
|
||||
CLANG=/usr/local/opt/llvm/bin/clang
|
||||
elif [[ -x /opt/homebrew/opt/llvm/bin/clang ]]; then
|
||||
CLANG=/opt/homebrew/opt/llvm/bin/clang
|
||||
# The following code checks if you have the necessary programs to compile the samples.
|
||||
# This code exists to improve the experience of first-time Orca users and can
|
||||
# be safely deleted in your own projects if you wish.
|
||||
if [ -f ../../scripts/sample_build_check.py ]; then
|
||||
python3 ../../scripts/sample_build_check.py
|
||||
else
|
||||
echo "Could not find Homebrew clang; this script will probably not work."
|
||||
CLANG=clang
|
||||
echo "Could not check if you have the necessary tools to build the Orca samples."
|
||||
echo "If you have copied this script to your own project, you can delete this code."
|
||||
fi
|
||||
|
||||
ORCA_DIR=../..
|
||||
STDLIB_DIR=../../src/libc-shim
|
||||
STDLIB_DIR=$ORCA_DIR/src/libc-shim
|
||||
|
||||
# common flags to build wasm modules
|
||||
wasmFlags="--target=wasm32 \
|
||||
--no-standard-libraries \
|
||||
-fno-builtin \
|
||||
-mbulk-memory \
|
||||
-g -O2 \
|
||||
-D__ORCA__ \
|
||||
-Wl,--no-entry \
|
||||
-Wl,--export-dynamic \
|
||||
-g \
|
||||
-O2 \
|
||||
-mbulk-memory \
|
||||
-D__ORCA__ \
|
||||
-I $STDLIB_DIR/include \
|
||||
-I $ORCA_DIR/ext \
|
||||
-I $ORCA_DIR/src"
|
||||
-isystem $STDLIB_DIR/include \
|
||||
-I $ORCA_DIR/src \
|
||||
-I $ORCA_DIR/src/ext"
|
||||
|
||||
$CLANG $wasmFlags -o ./module.wasm ../../src/orca.c ../../src/libc-shim/src/*.c src/main.c
|
||||
# build orca core as wasm module
|
||||
clang $wasmFlags -Wl,--relocatable -o ./liborca.a $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c
|
||||
|
||||
orca bundle --orca-dir ../.. --name Triangle module.wasm
|
||||
# build sample as wasm module and link it with the orca module
|
||||
clang $wasmFlags -L . -lorca -o module.wasm src/main.c
|
||||
|
||||
# create app directory and copy files into it
|
||||
orca bundle --orca-dir $ORCA_DIR --name Triangle module.wasm
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
**************************************************************************/
|
||||
#include <math.h>
|
||||
|
||||
#include <orca.h>
|
||||
|
|
|
@ -1,19 +1,39 @@
|
|||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
:: compile wasm module
|
||||
:: The following code checks if you have the necessary programs to compile the samples.
|
||||
:: This code exists to improve the experience of first-time Orca users and can
|
||||
:: be safely deleted in your own projects if you wish.
|
||||
if exist "..\..\scripts\sample_build_check.py" (
|
||||
python ..\..\scripts\sample_build_check.py
|
||||
if !ERRORLEVEL! neq 0 exit /b 1
|
||||
) else (
|
||||
echo Could not check if you have the necessary tools to build the Orca samples.
|
||||
echo If you have copied this script to your own project, you can delete this code.
|
||||
)
|
||||
|
||||
set ORCA_DIR=..\..
|
||||
set STDLIB_DIR=%ORCA_DIR%\src\libc-shim
|
||||
|
||||
:: common flags to build wasm modules
|
||||
set wasmFlags=--target=wasm32^
|
||||
--no-standard-libraries ^
|
||||
-fno-builtin ^
|
||||
-mbulk-memory ^
|
||||
-g -O2 ^
|
||||
-D__ORCA__ ^
|
||||
-Wl,--no-entry ^
|
||||
-Wl,--export-dynamic ^
|
||||
-g ^
|
||||
-O2 ^
|
||||
-mbulk-memory ^
|
||||
-D__ORCA__ ^
|
||||
-isystem ..\..\src\libc-shim\include ^
|
||||
-I..\..\ext -I ..\..\src
|
||||
-isystem %STDLIB_DIR%\include ^
|
||||
-I%ORCA_DIR%\src ^
|
||||
-I%ORCA_DIR%\src\ext
|
||||
|
||||
clang %wasmFlags% -o .\module.wasm ..\..\src\orca.c ..\..\src\libc-shim\src\*.c src\main.c
|
||||
:: build orca core as wasm module
|
||||
clang %wasmFlags% -Wl,--relocatable -o .\liborca.a %ORCA_DIR%\src\orca.c %ORCA_DIR%\src\libc-shim\src\*.c
|
||||
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
|
||||
|
||||
orca bundle --orca-dir ..\.. --name UI --resource-dir data module.wasm
|
||||
:: build sample as wasm module and link it with the orca module
|
||||
clang %wasmFlags% -L . -lorca -o .\module.wasm src\main.c
|
||||
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
|
||||
|
||||
:: create app directory and copy files into it
|
||||
orca bundle --orca-dir %ORCA_DIR% --name UI --resource-dir data module.wasm
|
||||
|
|
|
@ -2,31 +2,36 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
if [[ -x /usr/local/opt/llvm/bin/clang ]]; then
|
||||
CLANG=/usr/local/opt/llvm/bin/clang
|
||||
elif [[ -x /opt/homebrew/opt/llvm/bin/clang ]]; then
|
||||
CLANG=/opt/homebrew/opt/llvm/bin/clang
|
||||
# The following code checks if you have the necessary programs to compile the samples.
|
||||
# This code exists to improve the experience of first-time Orca users and can
|
||||
# be safely deleted in your own projects if you wish.
|
||||
if [ -f ../../scripts/sample_build_check.py ]; then
|
||||
python3 ../../scripts/sample_build_check.py
|
||||
else
|
||||
echo "Could not find Homebrew clang; this script will probably not work."
|
||||
CLANG=clang
|
||||
echo "Could not check if you have the necessary tools to build the Orca samples."
|
||||
echo "If you have copied this script to your own project, you can delete this code."
|
||||
fi
|
||||
|
||||
ORCA_DIR=../..
|
||||
STDLIB_DIR=../../src/libc-shim
|
||||
STDLIB_DIR=$ORCA_DIR/src/libc-shim
|
||||
|
||||
# common flags to build wasm modules
|
||||
wasmFlags="--target=wasm32 \
|
||||
--no-standard-libraries \
|
||||
-mbulk-memory \
|
||||
-g -O2 \
|
||||
-D__ORCA__ \
|
||||
-Wl,--no-entry \
|
||||
-Wl,--export-dynamic \
|
||||
-g \
|
||||
-O2 \
|
||||
-mbulk-memory \
|
||||
-D__ORCA__ \
|
||||
-I $ORCA_DIR/ext \
|
||||
-I $STDLIB_DIR/include \
|
||||
-I $ORCA_DIR/ext \
|
||||
-I $ORCA_DIR/src"
|
||||
-isystem $STDLIB_DIR/include \
|
||||
-I $ORCA_DIR/src \
|
||||
-I $ORCA_DIR/src/ext"
|
||||
|
||||
$CLANG $wasmFlags -o ./module.wasm ../../src/orca.c $STDLIB_DIR/src/*.c src/main.c
|
||||
# build orca core as wasm module
|
||||
clang $wasmFlags -Wl,--relocatable -o ./liborca.a $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c
|
||||
|
||||
orca bundle --orca-dir ../.. --name UI --resource-dir data module.wasm
|
||||
# build sample as wasm module and link it with the orca module
|
||||
clang $wasmFlags -L . -lorca -o module.wasm src/main.c
|
||||
|
||||
# create app directory and copy files into it
|
||||
orca bundle --orca-dir $ORCA_DIR --name UI --resource-dir data module.wasm
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -5,284 +5,298 @@ import json
|
|||
|
||||
|
||||
def needs_arg_ptr_stub(decl):
|
||||
res = (decl['ret']['tag'] == 'S')
|
||||
for arg in decl['args']:
|
||||
if arg['type']['tag'] == 'S':
|
||||
res = True
|
||||
return(res)
|
||||
res = (decl['ret']['tag'] == 'S')
|
||||
for arg in decl['args']:
|
||||
if arg['type']['tag'] == 'S':
|
||||
res = True
|
||||
return(res)
|
||||
|
||||
def printError(str):
|
||||
# This prints a string with a red foreground color.
|
||||
# See this link for an explanation of console escape codes: https://stackabuse.com/how-to-print-colored-text-in-python/
|
||||
print("\x1b[38;5;196m" + "error: " + str + "\033[0;0m")
|
||||
# This prints a string with a red foreground color.
|
||||
# See this link for an explanation of console escape codes: https://stackabuse.com/how-to-print-colored-text-in-python/
|
||||
print("\x1b[38;5;196m" + "error: " + str + "\033[0;0m")
|
||||
|
||||
|
||||
def bindgen(apiName, spec, **kwargs):
|
||||
guest_stubs_path = kwargs.get("guest_stubs")
|
||||
guest_include = kwargs.get("guest_include")
|
||||
wasm3_bindings_path = kwargs.get("wasm3_bindings")
|
||||
guest_stubs_path = kwargs.get("guest_stubs")
|
||||
guest_include = kwargs.get("guest_include")
|
||||
wasm3_bindings_path = kwargs.get("wasm3_bindings")
|
||||
|
||||
if guest_stubs_path == None:
|
||||
guest_stubs_path = 'bindgen_' + apiName + '_guest_stubs.c'
|
||||
if wasm3_bindings_path == None:
|
||||
wasm3_bindings_path = 'bindgen_' + apiName + '_wasm3_bindings.c'
|
||||
if guest_stubs_path == None:
|
||||
guest_stubs_path = 'bindgen_' + apiName + '_guest_stubs.c'
|
||||
if wasm3_bindings_path == None:
|
||||
wasm3_bindings_path = 'bindgen_' + apiName + '_wasm3_bindings.c'
|
||||
|
||||
host_bindings = open(wasm3_bindings_path, 'w')
|
||||
guest_bindings = None
|
||||
host_bindings = open(wasm3_bindings_path, 'w')
|
||||
guest_bindings = None
|
||||
|
||||
specFile = open(spec, 'r')
|
||||
data = json.load(specFile)
|
||||
specFile = open(spec, 'r')
|
||||
data = json.load(specFile)
|
||||
|
||||
for decl in data:
|
||||
if needs_arg_ptr_stub(decl):
|
||||
guest_bindings = open(guest_stubs_path, 'w')
|
||||
if guest_include != None:
|
||||
s = '#include"' + guest_include + '"\n\n'
|
||||
print(s, file=guest_bindings)
|
||||
break
|
||||
for decl in data:
|
||||
if needs_arg_ptr_stub(decl):
|
||||
guest_bindings = open(guest_stubs_path, 'w')
|
||||
if guest_include != None:
|
||||
s = '#include"' + guest_include + '"\n\n'
|
||||
print(s, file=guest_bindings)
|
||||
break
|
||||
|
||||
for decl in data:
|
||||
for decl in data:
|
||||
|
||||
name = decl['name']
|
||||
cname = decl.get('cname', name)
|
||||
name = decl['name']
|
||||
cname = decl.get('cname', name)
|
||||
|
||||
if needs_arg_ptr_stub(decl):
|
||||
argPtrStubName = name + '_argptr_stub'
|
||||
# pointer arg stub declaration
|
||||
s = ''
|
||||
if decl['ret']['tag'] == 'S':
|
||||
s += 'void'
|
||||
else:
|
||||
s += decl['ret']['name']
|
||||
if needs_arg_ptr_stub(decl):
|
||||
argPtrStubName = name + '_argptr_stub'
|
||||
# pointer arg stub declaration
|
||||
s = ''
|
||||
if decl['ret']['tag'] == 'S':
|
||||
s += 'void'
|
||||
else:
|
||||
s += decl['ret']['name']
|
||||
|
||||
s += ' ORCA_IMPORT(' + argPtrStubName + ') ('
|
||||
s += ' ORCA_IMPORT(' + argPtrStubName + ') ('
|
||||
|
||||
if decl['ret']['tag'] == 'S':
|
||||
s += decl['ret']['name'] + '* __retArg'
|
||||
if len(decl['args']) > 0:
|
||||
s += ', '
|
||||
if decl['ret']['tag'] == 'S':
|
||||
s += decl['ret']['name'] + '* __retArg'
|
||||
if len(decl['args']) > 0:
|
||||
s += ', '
|
||||
elif len(decl['args']) == 0:
|
||||
s += 'void'
|
||||
|
||||
for i, arg in enumerate(decl['args']):
|
||||
s += arg['type']['name']
|
||||
if arg['type']['tag'] == 'S':
|
||||
s += '*'
|
||||
s += ' ' + arg['name']
|
||||
if i+1 < len(decl['args']):
|
||||
s += ', '
|
||||
s += ');\n\n'
|
||||
for i, arg in enumerate(decl['args']):
|
||||
s += arg['type']['name']
|
||||
if arg['type']['tag'] == 'S':
|
||||
s += '*'
|
||||
s += ' ' + arg['name']
|
||||
if i+1 < len(decl['args']):
|
||||
s += ', '
|
||||
s += ');\n\n'
|
||||
|
||||
# forward function to pointer arg stub declaration
|
||||
s += decl['ret']['name'] + ' ' + name + '('
|
||||
for i, arg in enumerate(decl['args']):
|
||||
s += arg['type']['name'] + ' ' + arg['name']
|
||||
if i+1 < len(decl['args']):
|
||||
s += ', '
|
||||
s += ')\n'
|
||||
s += '{\n'
|
||||
s += '\t'
|
||||
if decl['ret']['tag'] == 'S':
|
||||
s += decl['ret']['name'] + ' __ret;\n\t'
|
||||
elif decl['ret']['tag'] != 'v':
|
||||
s += decl['ret']['name']
|
||||
s += ' __ret = '
|
||||
s += argPtrStubName + '('
|
||||
# forward function to pointer arg stub declaration
|
||||
s += decl['ret']['name'] + ' ' + name + '('
|
||||
|
||||
if decl['ret']['tag'] == 'S':
|
||||
s += '&__ret'
|
||||
if len(decl['args']) > 0:
|
||||
s += ', '
|
||||
if len(decl['args']) == 0:
|
||||
s += 'void'
|
||||
|
||||
for i, arg in enumerate(decl['args']):
|
||||
if arg['type']['tag'] == 'S':
|
||||
s += '&'
|
||||
for i, arg in enumerate(decl['args']):
|
||||
s += arg['type']['name'] + ' ' + arg['name']
|
||||
if i+1 < len(decl['args']):
|
||||
s += ', '
|
||||
s += ')\n'
|
||||
s += '{\n'
|
||||
s += '\t'
|
||||
if decl['ret']['tag'] == 'S':
|
||||
s += decl['ret']['name'] + ' __ret;\n\t'
|
||||
elif decl['ret']['tag'] != 'v':
|
||||
s += decl['ret']['name']
|
||||
s += ' __ret = '
|
||||
s += argPtrStubName + '('
|
||||
|
||||
s += arg['name']
|
||||
if i+1 < len(decl['args']):
|
||||
s += ', '
|
||||
s += ');\n'
|
||||
if decl['ret']['tag'] != 'v':
|
||||
s += '\treturn(__ret);\n'
|
||||
s += '}\n\n'
|
||||
if decl['ret']['tag'] == 'S':
|
||||
s += '&__ret'
|
||||
if len(decl['args']) > 0:
|
||||
s += ', '
|
||||
|
||||
print(s, file=guest_bindings)
|
||||
for i, arg in enumerate(decl['args']):
|
||||
if arg['type']['tag'] == 'S':
|
||||
s += '&'
|
||||
|
||||
# host-side stub
|
||||
s = 'const void* ' + cname + '_stub(IM3Runtime runtime, IM3ImportContext _ctx, uint64_t* _sp, void* _mem)'
|
||||
s += arg['name']
|
||||
if i+1 < len(decl['args']):
|
||||
s += ', '
|
||||
s += ');\n'
|
||||
if decl['ret']['tag'] != 'v':
|
||||
s += '\treturn(__ret);\n'
|
||||
s += '}\n\n'
|
||||
|
||||
gen_stub = decl.get('gen_stub', True)
|
||||
if gen_stub == False:
|
||||
s += ';\n\n'
|
||||
else:
|
||||
s += '\n{\n'
|
||||
print(s, file=guest_bindings)
|
||||
|
||||
# host-side stub
|
||||
s = 'const void* ' + cname + '_stub(IM3Runtime runtime, IM3ImportContext _ctx, uint64_t* _sp, void* _mem)'
|
||||
|
||||
gen_stub = decl.get('gen_stub', True)
|
||||
if gen_stub == False:
|
||||
s += ';\n\n'
|
||||
else:
|
||||
s += '\n{\n'
|
||||
|
||||
|
||||
# NOTE: check and cast arguments
|
||||
retTag = decl['ret']['tag']
|
||||
# NOTE: check and cast arguments
|
||||
retTag = decl['ret']['tag']
|
||||
|
||||
firstArgIndex = 0
|
||||
if retTag != 'v':
|
||||
firstArgIndex = 1
|
||||
firstArgIndex = 0
|
||||
if retTag != 'v':
|
||||
firstArgIndex = 1
|
||||
|
||||
for argIndex, arg in enumerate(decl['args']):
|
||||
if retTag == 'S':
|
||||
retTypeName = decl['ret']['name']
|
||||
retTypeCName = decl['ret'].get('cname', retTypeName)
|
||||
s += retTypeCName + '* __retPtr = (' + retTypeCName + '*)((char*)_mem + *(i32*)&_sp[0]);\n'
|
||||
|
||||
argName = arg['name']
|
||||
typeName = arg['type']['name']
|
||||
typeCName = arg['type'].get('cname', typeName)
|
||||
argTag = arg['type']['tag']
|
||||
s += '\t{\n'
|
||||
s += '\t\tOC_ASSERT(((char*)__retPtr >= (char*)_mem) && (((char*)__retPtr - (char*)_mem) < m3_GetMemorySize(runtime)), "return pointer is out of bounds");\n'
|
||||
s += '\t\tOC_ASSERT((char*)__retPtr + sizeof(' + retTypeCName + ') <= ((char*)_mem + m3_GetMemorySize(runtime)), "return pointer is out of bounds");\n'
|
||||
s += '\t}\n'
|
||||
|
||||
s += '\t'
|
||||
for argIndex, arg in enumerate(decl['args']):
|
||||
|
||||
if argTag == 'i':
|
||||
s += typeCName + ' ' + argName + ' = ('+typeCName+')*(i32*)&_sp[' + str(firstArgIndex + argIndex) + '];\n'
|
||||
elif argTag == 'I':
|
||||
s += typeCName + ' ' + argName + ' = ('+typeCName+')*(i64*)&_sp[' + str(firstArgIndex + argIndex) + '];\n'
|
||||
elif argTag == 'f':
|
||||
s += typeCName + ' ' + argName + ' = ('+typeCName+')*(f32*)&_sp[' + str(firstArgIndex + argIndex) + '];\n'
|
||||
elif argTag == 'F':
|
||||
s += typeCName + ' ' + argName + ' = ('+typeCName+')*(f64*)&_sp[' + str(firstArgIndex + argIndex) + '];\n'
|
||||
elif argTag == 'p':
|
||||
s += typeCName + ' ' + argName + ' = ('+ typeCName +')((char*)_mem + *(u32*)&_sp[' + str(firstArgIndex + argIndex) + ']);\n'
|
||||
elif argTag == 'S':
|
||||
s += typeCName + ' ' + argName + ' = *('+ typeCName +'*)((char*)_mem + *(u32*)&_sp[' + str(firstArgIndex + argIndex) + ']);\n'
|
||||
else:
|
||||
print('unrecognized type ' + c + ' in procedure signature\n')
|
||||
break
|
||||
argName = arg['name']
|
||||
typeName = arg['type']['name']
|
||||
typeCName = arg['type'].get('cname', typeName)
|
||||
argTag = arg['type']['tag']
|
||||
|
||||
# check pointer arg length
|
||||
for arg in decl['args']:
|
||||
s += '\t'
|
||||
|
||||
argName = arg['name']
|
||||
typeName = arg['type']['name']
|
||||
typeCName = arg['type'].get('cname', typeName)
|
||||
argTag = arg['type']['tag']
|
||||
argLen = arg.get('len')
|
||||
if argTag == 'i':
|
||||
s += typeCName + ' ' + argName + ' = ('+typeCName+')*(i32*)&_sp[' + str(firstArgIndex + argIndex) + '];\n'
|
||||
elif argTag == 'I':
|
||||
s += typeCName + ' ' + argName + ' = ('+typeCName+')*(i64*)&_sp[' + str(firstArgIndex + argIndex) + '];\n'
|
||||
elif argTag == 'f':
|
||||
s += typeCName + ' ' + argName + ' = ('+typeCName+')*(f32*)&_sp[' + str(firstArgIndex + argIndex) + '];\n'
|
||||
elif argTag == 'F':
|
||||
s += typeCName + ' ' + argName + ' = ('+typeCName+')*(f64*)&_sp[' + str(firstArgIndex + argIndex) + '];\n'
|
||||
elif argTag == 'p':
|
||||
s += typeCName + ' ' + argName + ' = ('+ typeCName +')((char*)_mem + *(u32*)&_sp[' + str(firstArgIndex + argIndex) + ']);\n'
|
||||
elif argTag == 'S':
|
||||
s += typeCName + ' ' + argName + ' = *('+ typeCName +'*)((char*)_mem + *(u32*)&_sp[' + str(firstArgIndex + argIndex) + ']);\n'
|
||||
else:
|
||||
print('unrecognized type ' + c + ' in procedure signature\n')
|
||||
break
|
||||
|
||||
if argTag == 'p':
|
||||
if argLen == None:
|
||||
printError("binding '" + name + "' missing pointer length decoration for param '" + argName + "'")
|
||||
else:
|
||||
s += '\t{\n'
|
||||
s += '\t\tOC_ASSERT(((char*)'+ argName + ' >= (char*)_mem) && (((char*)'+ argName +' - (char*)_mem) < m3_GetMemorySize(runtime)), "parameter \''+argName+'\' is out of bounds");\n'
|
||||
s += '\t\tOC_ASSERT((char*)' + argName + ' + '
|
||||
# check pointer arg length
|
||||
for arg in decl['args']:
|
||||
|
||||
proc = argLen.get('proc')
|
||||
if proc != None:
|
||||
s += proc + '(runtime, '
|
||||
lenProcArgs = argLen['args']
|
||||
for i, lenProcArg in enumerate(lenProcArgs):
|
||||
s += lenProcArg
|
||||
if i < len(lenProcArgs)-1:
|
||||
s += ', '
|
||||
s += ')'
|
||||
else:
|
||||
components = argLen.get('components')
|
||||
countArg = argLen.get('count')
|
||||
argName = arg['name']
|
||||
typeName = arg['type']['name']
|
||||
typeCName = arg['type'].get('cname', typeName)
|
||||
argTag = arg['type']['tag']
|
||||
argLen = arg.get('len')
|
||||
|
||||
if components != None:
|
||||
s += str(components)
|
||||
if countArg != None:
|
||||
s += '*'
|
||||
if countArg != None:
|
||||
s += countArg
|
||||
if argTag == 'p':
|
||||
if argLen == None:
|
||||
printError("binding '" + name + "' missing pointer length decoration for param '" + argName + "'")
|
||||
else:
|
||||
s += '\t{\n'
|
||||
s += '\t\tOC_ASSERT(((char*)'+ argName + ' >= (char*)_mem) && (((char*)'+ argName +' - (char*)_mem) < m3_GetMemorySize(runtime)), "parameter \''+argName+'\' is out of bounds");\n'
|
||||
s += '\t\tOC_ASSERT((char*)' + argName + ' + '
|
||||
|
||||
if typeCName.endswith('**') or (typeCName.startswith('void') == False and typeCName.startswith('const void') == False):
|
||||
s += '*sizeof('+typeCName[:-1]+')'
|
||||
proc = argLen.get('proc')
|
||||
if proc != None:
|
||||
s += proc + '(runtime, '
|
||||
lenProcArgs = argLen['args']
|
||||
for i, lenProcArg in enumerate(lenProcArgs):
|
||||
s += lenProcArg
|
||||
if i < len(lenProcArgs)-1:
|
||||
s += ', '
|
||||
s += ')'
|
||||
else:
|
||||
components = argLen.get('components')
|
||||
countArg = argLen.get('count')
|
||||
|
||||
s += ' <= ((char*)_mem + m3_GetMemorySize(runtime)), "parameter \''+argName+'\' overflows wasm memory");\n'
|
||||
s += '\t}\n'
|
||||
if components != None:
|
||||
s += str(components)
|
||||
if countArg != None:
|
||||
s += '*'
|
||||
if countArg != None:
|
||||
s += countArg
|
||||
|
||||
s += '\t'
|
||||
if typeCName.endswith('**') or (typeCName.startswith('void') == False and typeCName.startswith('const void') == False):
|
||||
s += '*sizeof('+typeCName[:-1]+')'
|
||||
|
||||
if retTag == 'i':
|
||||
s += '*((i32*)&_sp[0]) = (i32)'
|
||||
elif retTag == 'I':
|
||||
s += '*((i64*)&_sp[0]) = (i64)'
|
||||
elif retTag == 'f':
|
||||
s += '*((f32*)&_sp[0]) = (f32)'
|
||||
elif retTag == 'F':
|
||||
s += '*((f64*)&_sp[0]) = (f64)'
|
||||
elif retTag == 'S':
|
||||
retTypeName = decl['ret']['name']
|
||||
retTypeCName = decl['ret'].get('cname', retTypeName)
|
||||
s += '*(' + retTypeCName + '*)((char*)_mem + *(i32*)&_sp[0]) = '
|
||||
elif retTag == 'p':
|
||||
print("Warning: " + name + ": pointer return type not supported yet")
|
||||
s += ' <= ((char*)_mem + m3_GetMemorySize(runtime)), "parameter \''+argName+'\' is out of bounds");\n'
|
||||
s += '\t}\n'
|
||||
|
||||
s += cname + '('
|
||||
s += '\t'
|
||||
|
||||
for i, arg in enumerate(decl['args']):
|
||||
s += arg['name']
|
||||
if retTag == 'i':
|
||||
s += '*((i32*)&_sp[0]) = (i32)'
|
||||
elif retTag == 'I':
|
||||
s += '*((i64*)&_sp[0]) = (i64)'
|
||||
elif retTag == 'f':
|
||||
s += '*((f32*)&_sp[0]) = (f32)'
|
||||
elif retTag == 'F':
|
||||
s += '*((f64*)&_sp[0]) = (f64)'
|
||||
elif retTag == 'S':
|
||||
s += '*__retPtr = '
|
||||
elif retTag == 'p':
|
||||
print("Warning: " + name + ": pointer return type not supported yet")
|
||||
|
||||
if i+1 < len(decl['args']):
|
||||
s += ', '
|
||||
s += cname + '('
|
||||
|
||||
s += ');\n\treturn(0);\n}\n\n'
|
||||
for i, arg in enumerate(decl['args']):
|
||||
s += arg['name']
|
||||
|
||||
print(s, file=host_bindings)
|
||||
if i+1 < len(decl['args']):
|
||||
s += ', '
|
||||
|
||||
# link function
|
||||
s = 'int bindgen_link_' + apiName + '_api(IM3Module module)\n{\n'
|
||||
s += ' M3Result res;\n'
|
||||
s += ' int ret = 0;\n'
|
||||
s += ');\n\treturn(0);\n}\n\n'
|
||||
|
||||
for decl in data:
|
||||
name = decl['name']
|
||||
cname = decl.get('cname', name)
|
||||
print(s, file=host_bindings)
|
||||
|
||||
if needs_arg_ptr_stub(decl):
|
||||
name = name + '_argptr_stub'
|
||||
# link function
|
||||
s = 'int bindgen_link_' + apiName + '_api(IM3Module module)\n{\n'
|
||||
s += ' M3Result res;\n'
|
||||
s += ' int ret = 0;\n'
|
||||
|
||||
m3Sig = ''
|
||||
if decl['ret']['tag'] == 'S':
|
||||
m3Sig += 'v'
|
||||
else:
|
||||
m3Sig += decl['ret']['tag']
|
||||
for decl in data:
|
||||
name = decl['name']
|
||||
cname = decl.get('cname', name)
|
||||
|
||||
m3Sig += '('
|
||||
if decl['ret']['tag'] == 'S':
|
||||
m3Sig += 'i'
|
||||
for arg in decl['args']:
|
||||
tag = arg['type']['tag']
|
||||
if tag == 'p' or tag == 'S':
|
||||
tag = 'i'
|
||||
m3Sig += tag
|
||||
m3Sig += ')'
|
||||
if needs_arg_ptr_stub(decl):
|
||||
name = name + '_argptr_stub'
|
||||
|
||||
m3Sig = ''
|
||||
if decl['ret']['tag'] == 'S':
|
||||
m3Sig += 'v'
|
||||
else:
|
||||
m3Sig += decl['ret']['tag']
|
||||
|
||||
m3Sig += '('
|
||||
if decl['ret']['tag'] == 'S':
|
||||
m3Sig += 'i'
|
||||
for arg in decl['args']:
|
||||
tag = arg['type']['tag']
|
||||
if tag == 'p' or tag == 'S':
|
||||
tag = 'i'
|
||||
m3Sig += tag
|
||||
m3Sig += ')'
|
||||
|
||||
|
||||
s += ' res = m3_LinkRawFunction(module, "*", "' + name + '", "' + m3Sig + '", ' + cname + '_stub);\n'
|
||||
s += ' if(res != m3Err_none && res != m3Err_functionLookupFailed)\n'
|
||||
s += ' {\n'
|
||||
s += ' oc_log_error("Couldn\'t link function ' + name + ' (%s)\\n", res);\n'
|
||||
s += ' ret = -1;\n'
|
||||
s += ' }\n\n'
|
||||
s += ' res = m3_LinkRawFunction(module, "*", "' + name + '", "' + m3Sig + '", ' + cname + '_stub);\n'
|
||||
s += ' if(res != m3Err_none && res != m3Err_functionLookupFailed)\n'
|
||||
s += ' {\n'
|
||||
s += ' oc_log_error("Couldn\'t link function ' + name + ' (%s)\\n", res);\n'
|
||||
s += ' ret = -1;\n'
|
||||
s += ' }\n\n'
|
||||
|
||||
s += '\treturn(ret);\n}\n'
|
||||
s += '\treturn(ret);\n}\n'
|
||||
|
||||
print(s, file=host_bindings)
|
||||
print(s, file=host_bindings)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = ArgumentParser(prog='bindgen.py')
|
||||
parser.add_argument('api')
|
||||
parser.add_argument('spec')
|
||||
parser.add_argument('-g', '--guest-stubs')
|
||||
parser.add_argument('--guest-include')
|
||||
parser.add_argument('--wasm3-bindings')
|
||||
parser = ArgumentParser(prog='bindgen.py')
|
||||
parser.add_argument('api')
|
||||
parser.add_argument('spec')
|
||||
parser.add_argument('-g', '--guest-stubs')
|
||||
parser.add_argument('--guest-include')
|
||||
parser.add_argument('--wasm3-bindings')
|
||||
|
||||
args = parser.parse_args()
|
||||
args = parser.parse_args()
|
||||
|
||||
apiName = args.api
|
||||
spec = args.spec
|
||||
guest_stubs_path = args.guest_stubs
|
||||
if guest_stubs_path == None:
|
||||
guest_stubs_path = 'bindgen_' + apiName + '_guest_stubs.c'
|
||||
apiName = args.api
|
||||
spec = args.spec
|
||||
guest_stubs_path = args.guest_stubs
|
||||
if guest_stubs_path == None:
|
||||
guest_stubs_path = 'bindgen_' + apiName + '_guest_stubs.c'
|
||||
|
||||
wasm3_bindings_path = args.wasm3_bindings
|
||||
if wasm3_bindings_path == None:
|
||||
wasm3_bindings_path = 'bindgen_' + apiName + '_wasm3_bindings.c'
|
||||
wasm3_bindings_path = args.wasm3_bindings
|
||||
if wasm3_bindings_path == None:
|
||||
wasm3_bindings_path = 'bindgen_' + apiName + '_wasm3_bindings.c'
|
||||
|
||||
bindgen(apiName, spec,
|
||||
guest_stubs=guest_stubs_path,
|
||||
guest_include=args.guest_include,
|
||||
wasm3_bindings=wasm3_bindings_path,
|
||||
)
|
||||
bindgen(apiName, spec,
|
||||
guest_stubs=guest_stubs_path,
|
||||
guest_include=args.guest_include,
|
||||
wasm3_bindings=wasm3_bindings_path,
|
||||
)
|
||||
|
|
|
@ -70,8 +70,8 @@ def macos_make_app(args):
|
|||
#-----------------------------------------------------------
|
||||
orca_exe = os.path.join(args.orca_dir, 'build/bin/orca_runtime')
|
||||
orca_lib = os.path.join(args.orca_dir, 'build/bin/liborca.dylib')
|
||||
gles_lib = os.path.join(args.orca_dir, 'ext/angle/bin/libGLESv2.dylib')
|
||||
egl_lib = os.path.join(args.orca_dir, 'ext/angle/bin/libEGL.dylib')
|
||||
gles_lib = os.path.join(args.orca_dir, 'src/ext/angle/bin/libGLESv2.dylib')
|
||||
egl_lib = os.path.join(args.orca_dir, 'src/ext/angle/bin/libEGL.dylib')
|
||||
renderer_lib = os.path.join(args.orca_dir, 'build/bin/mtl_renderer.metallib')
|
||||
|
||||
shutil.copy(orca_exe, exe_dir)
|
||||
|
@ -211,8 +211,8 @@ def windows_make_app(args):
|
|||
#-----------------------------------------------------------
|
||||
orca_exe = os.path.join(args.orca_dir, 'build/bin/orca_runtime.exe')
|
||||
orca_lib = os.path.join(args.orca_dir, 'build/bin/orca.dll')
|
||||
gles_lib = os.path.join(args.orca_dir, 'ext/angle/bin/libGLESv2.dll')
|
||||
egl_lib = os.path.join(args.orca_dir, 'ext/angle/bin/libEGL.dll')
|
||||
gles_lib = os.path.join(args.orca_dir, 'src/ext/angle/bin/libGLESv2.dll')
|
||||
egl_lib = os.path.join(args.orca_dir, 'src/ext/angle/bin/libEGL.dll')
|
||||
|
||||
shutil.copy(orca_exe, os.path.join(exe_dir, app_name + '.exe'))
|
||||
shutil.copy(orca_lib, exe_dir)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import hashlib
|
||||
import json
|
||||
import os
|
||||
|
||||
from .log import *
|
||||
|
||||
|
@ -28,3 +29,80 @@ def checkfile(filepath):
|
|||
def filesum(filepath):
|
||||
with open(filepath, "rb") as file:
|
||||
return hashlib.sha256(file.read()).hexdigest()
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Directory-hashing implementation pulled from the checksumdir package on pypi.
|
||||
# Licensed under the MIT license.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
def dirsum(
|
||||
dirname,
|
||||
hash_func=hashlib.sha1,
|
||||
excluded_files=None,
|
||||
ignore_hidden=False,
|
||||
followlinks=False,
|
||||
excluded_extensions=None,
|
||||
include_paths=False
|
||||
):
|
||||
if not excluded_files:
|
||||
excluded_files = []
|
||||
|
||||
if not excluded_extensions:
|
||||
excluded_extensions = []
|
||||
|
||||
if not os.path.isdir(dirname):
|
||||
raise TypeError("{} is not a directory.".format(dirname))
|
||||
|
||||
hashvalues = []
|
||||
for root, dirs, files in os.walk(dirname, topdown=True, followlinks=followlinks):
|
||||
if ignore_hidden and re.search(r"/\.", root):
|
||||
continue
|
||||
|
||||
dirs.sort()
|
||||
files.sort()
|
||||
|
||||
for fname in files:
|
||||
if ignore_hidden and fname.startswith("."):
|
||||
continue
|
||||
|
||||
if fname.split(".")[-1:][0] in excluded_extensions:
|
||||
continue
|
||||
|
||||
if fname in excluded_files:
|
||||
continue
|
||||
|
||||
hashvalues.append(_filehash(os.path.join(root, fname), hash_func))
|
||||
|
||||
if include_paths:
|
||||
hasher = hash_func()
|
||||
# get the resulting relative path into array of elements
|
||||
path_list = os.path.relpath(os.path.join(root, fname)).split(os.sep)
|
||||
# compute the hash on joined list, removes all os specific separators
|
||||
hasher.update(''.join(path_list).encode('utf-8'))
|
||||
hashvalues.append(hasher.hexdigest())
|
||||
|
||||
return _reduce_hash(hashvalues, hash_func)
|
||||
|
||||
|
||||
def _filehash(filepath, hashfunc):
|
||||
hasher = hashfunc()
|
||||
blocksize = 64 * 1024
|
||||
|
||||
if not os.path.exists(filepath):
|
||||
return hasher.hexdigest()
|
||||
|
||||
with open(filepath, "rb") as fp:
|
||||
while True:
|
||||
data = fp.read(blocksize)
|
||||
if not data:
|
||||
break
|
||||
hasher.update(data)
|
||||
return hasher.hexdigest()
|
||||
|
||||
|
||||
def _reduce_hash(hashlist, hashfunc):
|
||||
hasher = hashfunc()
|
||||
for hashvalue in sorted(hashlist):
|
||||
hasher.update(hashvalue.encode("utf-8"))
|
||||
return hasher.hexdigest()
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"scripts/files/angle-windows-2019-2023-07-05.zip": "a333b5ccc8462151ee8df65c43cfacd70d9db2413f2e495da65670737b5b2d96",
|
||||
"scripts/files/angle-macos-jank-2023-07-05.zip": "c234b8db179a24757ab9f46610a032123718dd9bed967d2bf8e27d0d17eb0aff",
|
||||
"ext/angle/bin/libEGL.dll": "b7bf51f83e88129ddc20c0c2cb904ec04c89059a30a2cd29b9b1ea11c80388fb",
|
||||
"ext/angle/lib/libEGL.dll.lib": "4cec54c534136da413dea86bd271ccb9c5ae88e40aa91d1de7a01e701be8e1d7",
|
||||
"ext/angle/bin/libGLESv2.dll": "193b53b0a16b702eaa28a73e84527acf7aecfd665e3e3f54a8d9db9ae73111e1",
|
||||
"ext/angle/lib/libGLESv2.dll.lib": "ee87aac129efe8fe871825d181b85da1b1ea6626cb48be52c2e689f2804b953f",
|
||||
"ext/angle/bin/libEGL.dylib": "96baea4b1c8578d30738764784d07b509d1153df694c094faba2ee8ccbfde2a9",
|
||||
"ext/angle/bin/libGLESv2.dylib": "98ce9f6248a6447ba9199e96b8f6d87df9548d43ce583a2615717aab168ecb71"
|
||||
}
|
||||
"src/ext/angle/bin/libEGL.dll": "b7bf51f83e88129ddc20c0c2cb904ec04c89059a30a2cd29b9b1ea11c80388fb",
|
||||
"src/ext/angle/lib/libEGL.dll.lib": "4cec54c534136da413dea86bd271ccb9c5ae88e40aa91d1de7a01e701be8e1d7",
|
||||
"src/ext/angle/bin/libGLESv2.dll": "193b53b0a16b702eaa28a73e84527acf7aecfd665e3e3f54a8d9db9ae73111e1",
|
||||
"src/ext/angle/lib/libGLESv2.dll.lib": "ee87aac129efe8fe871825d181b85da1b1ea6626cb48be52c2e689f2804b953f",
|
||||
"src/ext/angle/bin/libEGL.dylib": "96baea4b1c8578d30738764784d07b509d1153df694c094faba2ee8ccbfde2a9",
|
||||
"src/ext/angle/bin/libGLESv2.dylib": "98ce9f6248a6447ba9199e96b8f6d87df9548d43ce583a2615717aab168ecb71"
|
||||
}
|
292
scripts/dev.py
292
scripts/dev.py
|
@ -1,7 +1,7 @@
|
|||
from datetime import datetime
|
||||
import glob
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import urllib.request
|
||||
import shutil
|
||||
import subprocess
|
||||
|
@ -9,16 +9,18 @@ from zipfile import ZipFile
|
|||
|
||||
from . import checksum
|
||||
from .bindgen import bindgen
|
||||
from .checksum import dirsum
|
||||
from .gles_gen import gles_gen
|
||||
from .log import *
|
||||
from .utils import pushd, removeall
|
||||
from .utils import pushd, removeall, yeetdir, yeetfile
|
||||
from .embed_text_files import *
|
||||
from .version import check_if_source, is_orca_source, orca_version
|
||||
|
||||
ANGLE_VERSION = "2023-07-05"
|
||||
|
||||
MAC_SDK_DIR = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
|
||||
|
||||
def attach_dev_commands(subparsers):
|
||||
dev_cmd = subparsers.add_parser("dev", help="Commands for building Orca itself. Must be run from the root of an Orca source checkout.")
|
||||
dev_cmd = subparsers.add_parser("dev", help="Commands for building Orca itself. Must be run from within an Orca source checkout.")
|
||||
dev_cmd.set_defaults(func=orca_source_only)
|
||||
|
||||
dev_sub = dev_cmd.add_subparsers(required=is_orca_source(), title='commands')
|
||||
|
@ -34,37 +36,8 @@ def attach_dev_commands(subparsers):
|
|||
install_cmd.add_argument("--no-confirm", action="store_true", help="don't ask the user for confirmation before installing")
|
||||
install_cmd.set_defaults(func=dev_shellish(install))
|
||||
|
||||
|
||||
# Checks if the Orca tool should use a source checkout of Orca instead of a system install.
|
||||
# This is copy-pasted to the command-line tool so it can work before loading anything.
|
||||
#
|
||||
# Returns: (use source, source directory, is actually the source's tool)
|
||||
def check_if_source():
|
||||
def path_is_in_orca_source(path):
|
||||
dir = path
|
||||
while True:
|
||||
try:
|
||||
os.stat(os.path.join(dir, ".orcaroot"))
|
||||
return (True, dir)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
newdir = os.path.dirname(dir)
|
||||
if newdir == dir: # TODO: Verify on Windows (it will probably not work)
|
||||
return (False, None)
|
||||
dir = newdir
|
||||
|
||||
in_source, current_source_dir = path_is_in_orca_source(os.getcwd())
|
||||
script_is_source, script_source_dir = path_is_in_orca_source(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
use_source = in_source or script_is_source
|
||||
source_dir = current_source_dir or script_source_dir
|
||||
return (use_source, source_dir, script_is_source)
|
||||
|
||||
|
||||
def is_orca_source():
|
||||
use_source, _, _ = check_if_source()
|
||||
return use_source
|
||||
uninstall_cmd = dev_sub.add_parser("uninstall", help="Uninstall the system installation of Orca.")
|
||||
uninstall_cmd.set_defaults(func=dev_shellish(uninstall))
|
||||
|
||||
|
||||
def orca_source_only(args):
|
||||
|
@ -94,12 +67,27 @@ def build_runtime(args):
|
|||
build_wasm3(args.release)
|
||||
build_orca(args.release)
|
||||
|
||||
with open("build/orcaruntime.sum", "w") as f:
|
||||
f.write(runtime_checksum())
|
||||
|
||||
|
||||
def runtime_checksum_last():
|
||||
try:
|
||||
with open("build/orcaruntime.sum", "r") as f:
|
||||
return f.read()
|
||||
except FileNotFoundError:
|
||||
return None
|
||||
|
||||
|
||||
def runtime_checksum():
|
||||
return dirsum("src")
|
||||
|
||||
|
||||
def clean(args):
|
||||
yeet("build")
|
||||
yeet("ext/angle")
|
||||
yeet("scripts/files")
|
||||
yeet("scripts/__pycache__")
|
||||
yeetdir("build")
|
||||
yeetdir("src/ext/angle")
|
||||
yeetdir("scripts/files")
|
||||
yeetdir("scripts/__pycache__")
|
||||
|
||||
|
||||
def build_platform_layer(target, release):
|
||||
|
@ -142,8 +130,8 @@ def build_platform_layer_lib_win(release):
|
|||
|
||||
includes = [
|
||||
"/I", "src",
|
||||
"/I", "ext",
|
||||
"/I", "ext/angle/include",
|
||||
"/I", "src/ext",
|
||||
"/I", "src/ext/angle/include",
|
||||
]
|
||||
libs = [
|
||||
"user32.lib",
|
||||
|
@ -158,7 +146,7 @@ def build_platform_layer_lib_win(release):
|
|||
"shlwapi.lib",
|
||||
"dxgi.lib",
|
||||
"dxguid.lib",
|
||||
"/LIBPATH:ext/angle/lib",
|
||||
"/LIBPATH:src/ext/angle/lib",
|
||||
"libEGL.dll.lib",
|
||||
"libGLESv2.dll.lib",
|
||||
"/DELAYLOAD:libEGL.dll",
|
||||
|
@ -180,13 +168,11 @@ def build_platform_layer_lib_win(release):
|
|||
], check=True)
|
||||
|
||||
def build_platform_layer_lib_mac(release):
|
||||
sdk_dir = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
|
||||
|
||||
flags = ["-mmacos-version-min=10.15.4", "-maes"]
|
||||
flags = ["-mmacos-version-min=10.15.4"]
|
||||
cflags = ["-std=c11"]
|
||||
debug_flags = ["-O3"] if release else ["-g", "-DOC_DEBUG", "-DOC_LOG_COMPILE_DEBUG"]
|
||||
ldflags = [f"-L{sdk_dir}/usr/lib", f"-F{sdk_dir}/System/Library/Frameworks/"]
|
||||
includes = ["-Isrc", "-Isrc/util", "-Isrc/platform", "-Iext", "-Iext/angle/include"]
|
||||
ldflags = [f"-L{MAC_SDK_DIR}/usr/lib", f"-F{MAC_SDK_DIR}/System/Library/Frameworks/"]
|
||||
includes = ["-Isrc", "-Isrc/util", "-Isrc/platform", "-Isrc/ext", "-Isrc/ext/angle/include"]
|
||||
|
||||
# compile metal shader
|
||||
subprocess.run([
|
||||
|
@ -225,7 +211,7 @@ def build_platform_layer_lib_mac(release):
|
|||
*ldflags, "-dylib",
|
||||
"-o", "build/bin/liborca.dylib",
|
||||
"build/orca_c.o", "build/orca_objc.o",
|
||||
"-Lext/angle/bin", "-lc",
|
||||
"-Lsrc/ext/angle/bin", "-lc",
|
||||
"-framework", "Carbon", "-framework", "Cocoa", "-framework", "Metal", "-framework", "QuartzCore",
|
||||
"-weak-lEGL", "-weak-lGLESv2",
|
||||
], check=True)
|
||||
|
@ -268,14 +254,14 @@ def build_wasm3(release):
|
|||
|
||||
|
||||
def build_wasm3_lib_win(release):
|
||||
for f in glob.iglob("./ext/wasm3/source/*.c"):
|
||||
for f in glob.iglob("./src/ext/wasm3/source/*.c"):
|
||||
name = os.path.splitext(os.path.basename(f))[0]
|
||||
subprocess.run([
|
||||
"cl", "/nologo",
|
||||
"/Zi", "/Zc:preprocessor", "/c",
|
||||
"/O2",
|
||||
f"/Fo:build/obj/{name}.obj",
|
||||
"/I", "./ext/wasm3/source",
|
||||
"/I", "./src/ext/wasm3/source",
|
||||
f,
|
||||
], check=True)
|
||||
subprocess.run([
|
||||
|
@ -285,23 +271,24 @@ def build_wasm3_lib_win(release):
|
|||
|
||||
|
||||
def build_wasm3_lib_mac(release):
|
||||
includes = ["-Iext/wasm3/source"]
|
||||
includes = ["-Isrc/ext/wasm3/source"]
|
||||
debug_flags = ["-g", "-O2"]
|
||||
flags = [
|
||||
*debug_flags,
|
||||
"-foptimize-sibling-calls",
|
||||
"-Wno-extern-initializer",
|
||||
"-Dd_m3VerboseErrorMessages",
|
||||
"-mmacos-version-min=10.15.4"
|
||||
]
|
||||
|
||||
for f in glob.iglob("ext/wasm3/source/*.c"):
|
||||
for f in glob.iglob("src/ext/wasm3/source/*.c"):
|
||||
name = os.path.splitext(os.path.basename(f))[0] + ".o"
|
||||
subprocess.run([
|
||||
"clang", "-c", *flags, *includes,
|
||||
"-o", f"build/obj/{name}",
|
||||
f,
|
||||
], check=True)
|
||||
subprocess.run(["ar", "-rcs", "build/lib/libwasm3.a", *glob.glob("build/obj/*.o")], check=True)
|
||||
subprocess.run(["libtool", "-static", "-o", "build/lib/libwasm3.a", "-no_warning_for_no_symbols", *glob.glob("build/obj/*.o")], check=True)
|
||||
subprocess.run(["rm", "-rf", "build/obj"], check=True)
|
||||
|
||||
|
||||
|
@ -327,9 +314,9 @@ def build_orca_win(release):
|
|||
# compile orca
|
||||
includes = [
|
||||
"/I", "src",
|
||||
"/I", "ext",
|
||||
"/I", "ext/angle/include",
|
||||
"/I", "ext/wasm3/source",
|
||||
"/I", "src/ext",
|
||||
"/I", "src/ext/angle/include",
|
||||
"/I", "src/ext/wasm3/source",
|
||||
]
|
||||
libs = [
|
||||
"/LIBPATH:build/bin",
|
||||
|
@ -352,17 +339,15 @@ def build_orca_mac(release):
|
|||
|
||||
includes = [
|
||||
"-Isrc",
|
||||
"-Iext",
|
||||
"-Iext/angle/include",
|
||||
"-Iext/wasm3/source"
|
||||
"-Isrc/ext",
|
||||
"-Isrc/ext/angle/include",
|
||||
"-Isrc/ext/wasm3/source"
|
||||
]
|
||||
libs = ["-Lbuild/bin", "-Lbuild/lib", "-lorca", "-lwasm3"]
|
||||
debug_flags = ["-O2"] if release else ["-g", "-DOC_DEBUG -DOC_LOG_COMPILE_DEBUG"]
|
||||
flags = [
|
||||
*debug_flags,
|
||||
"-mmacos-version-min=10.15.4",
|
||||
"-maes",
|
||||
]
|
||||
"-mmacos-version-min=10.15.4"]
|
||||
|
||||
gen_all_bindings()
|
||||
|
||||
|
@ -387,7 +372,7 @@ def build_orca_mac(release):
|
|||
|
||||
|
||||
def gen_all_bindings():
|
||||
gles_gen("ext/gl.xml",
|
||||
gles_gen("src/ext/gl.xml",
|
||||
"src/wasmbind/gles_api.json",
|
||||
"src/graphics/orca_gl31.h"
|
||||
)
|
||||
|
@ -419,28 +404,61 @@ def gen_all_bindings():
|
|||
|
||||
def ensure_programs():
|
||||
if platform.system() == "Windows":
|
||||
MSVC_MAJOR, MSVC_MINOR = 19, 35
|
||||
try:
|
||||
subprocess.run(["cl"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
cl_only = subprocess.run(["cl"], capture_output=True, text=True)
|
||||
desc = cl_only.stderr.splitlines()[0]
|
||||
|
||||
detect = subprocess.run(["cl", "/EP", "scripts\\msvc_version.txt"], capture_output=True, text=True)
|
||||
parts = [x for x in detect.stdout.splitlines() if x]
|
||||
version, arch = int(parts[0]), parts[1]
|
||||
major, minor = int(version / 100), version % 100
|
||||
|
||||
if arch != "x64":
|
||||
msg = log_error("MSVC is not running in 64-bit mode. Make sure you are running in")
|
||||
msg.more("an x64 Visual Studio command prompt, such as the \"x64 Native Tools")
|
||||
msg.more("Command Prompt\" from your Start Menu.")
|
||||
msg.more()
|
||||
msg.more("MSVC reported itself as:")
|
||||
msg.more(desc)
|
||||
exit(1)
|
||||
|
||||
if major < MSVC_MAJOR or minor < MSVC_MINOR:
|
||||
msg = log_error(f"Your version of MSVC is too old. You have version {major}.{minor},")
|
||||
msg.more(f"but version {MSVC_MAJOR}.{MSVC_MINOR} or greater is required.")
|
||||
msg.more()
|
||||
msg.more("MSVC reported itself as:")
|
||||
msg.more(desc)
|
||||
msg.more()
|
||||
msg.more("Please update Visual Studio to the latest version and try again.")
|
||||
exit(1)
|
||||
except FileNotFoundError:
|
||||
msg = log_error("MSVC was not found on your system.")
|
||||
msg.more("If you have already installed Visual Studio, make sure you are running in a")
|
||||
msg.more("Visual Studio command prompt or you have run vcvarsall.bat. Otherwise, download")
|
||||
msg.more("and install Visual Studio: https://visualstudio.microsoft.com/")
|
||||
msg.more("If you have already installed Visual Studio, make sure you are running in an")
|
||||
msg.more("x64 Visual Studio command prompt, such as the \"x64 Native Tools Command")
|
||||
msg.more("Prompt\" from your Start Menu. Otherwise, download and install Visual Studio,")
|
||||
msg.more("and ensure that your installation includes \"Desktop development with C++\"")
|
||||
msg.more("and \"C++ Clang Compiler\": https://visualstudio.microsoft.com/")
|
||||
exit(1)
|
||||
|
||||
try:
|
||||
subprocess.run(["clang", "-v"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
except FileNotFoundError:
|
||||
msg = log_error("clang was not found on your system.")
|
||||
if platform.system() == "Windows":
|
||||
msg.more("We recommend installing clang via the Visual Studio installer.")
|
||||
elif platform.system() == "Darwin":
|
||||
if platform.system() == "Darwin":
|
||||
try:
|
||||
subprocess.run(["clang", "-v"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
except FileNotFoundError:
|
||||
msg = log_error("clang was not found on your system.")
|
||||
msg.more("Run the following to install it:")
|
||||
msg.more()
|
||||
msg.more(" brew install llvm")
|
||||
msg.more()
|
||||
exit(1)
|
||||
# TODO(ben): Check for xcode command line tools
|
||||
exit(1)
|
||||
|
||||
if not os.path.exists(MAC_SDK_DIR):
|
||||
msg = log_error("The Xcode command-line tools are not installed.")
|
||||
msg.more("Run the following to install them:")
|
||||
msg.more()
|
||||
msg.more(" xcode-select --install")
|
||||
msg.more()
|
||||
exit(1)
|
||||
|
||||
|
||||
def ensure_angle():
|
||||
|
@ -456,15 +474,15 @@ def verify_angle():
|
|||
checkfiles = None
|
||||
if platform.system() == "Windows":
|
||||
checkfiles = [
|
||||
"ext/angle/bin/libEGL.dll",
|
||||
"ext/angle/lib/libEGL.dll.lib",
|
||||
"ext/angle/bin/libGLESv2.dll",
|
||||
"ext/angle/lib/libGLESv2.dll.lib",
|
||||
"src/ext/angle/bin/libEGL.dll",
|
||||
"src/ext/angle/lib/libEGL.dll.lib",
|
||||
"src/ext/angle/bin/libGLESv2.dll",
|
||||
"src/ext/angle/lib/libGLESv2.dll.lib",
|
||||
]
|
||||
elif platform.system() == "Darwin":
|
||||
checkfiles = [
|
||||
"ext/angle/bin/libEGL.dylib",
|
||||
"ext/angle/bin/libGLESv2.dylib",
|
||||
"src/ext/angle/bin/libEGL.dylib",
|
||||
"src/ext/angle/bin/libGLESv2.dylib",
|
||||
]
|
||||
|
||||
if checkfiles is None:
|
||||
|
@ -509,11 +527,7 @@ def download_angle():
|
|||
with ZipFile(filepath, "r") as anglezip:
|
||||
anglezip.extractall(path="scripts/files")
|
||||
|
||||
shutil.copytree(f"scripts/files/angle/", "ext/angle", dirs_exist_ok=True)
|
||||
|
||||
def yeet(path):
|
||||
os.makedirs(path, exist_ok=True)
|
||||
shutil.rmtree(path)
|
||||
shutil.copytree(f"scripts/files/angle/", "src/ext/angle", dirs_exist_ok=True)
|
||||
|
||||
|
||||
def prompt(msg):
|
||||
|
@ -526,22 +540,54 @@ def prompt(msg):
|
|||
else:
|
||||
print("Please enter \"yes\" or \"no\" and press return.")
|
||||
|
||||
def install_dir():
|
||||
if platform.system() == "Windows":
|
||||
return os.path.join(os.getenv("LOCALAPPDATA"), "orca")
|
||||
else:
|
||||
return os.path.expanduser(os.path.join("~", ".orca"))
|
||||
|
||||
|
||||
def install(args):
|
||||
if platform.system() == "Windows":
|
||||
dest = os.path.join(os.getenv("LOCALAPPDATA"), "orca")
|
||||
else:
|
||||
dest = os.path.expanduser(os.path.join("~", ".orca"))
|
||||
if runtime_checksum_last() is None:
|
||||
print("You must build the Orca runtime before you can install it to your")
|
||||
print("system. Please run the following command first:")
|
||||
print()
|
||||
print("orca dev build-runtime")
|
||||
exit(1)
|
||||
|
||||
if runtime_checksum() != runtime_checksum_last():
|
||||
print("Your build of the Orca runtime is out of date. We recommend that you")
|
||||
print("rebuild the runtime first with `orca dev build-runtime`.")
|
||||
if not prompt("Do you wish to install the runtime anyway?"):
|
||||
return
|
||||
print()
|
||||
|
||||
dest = install_dir()
|
||||
bin_dir = os.path.join(dest, "bin")
|
||||
src_dir = os.path.join(dest, "src")
|
||||
version_file = os.path.join(dest, ".orcaversion")
|
||||
|
||||
version = orca_version()
|
||||
existing_version = None
|
||||
try:
|
||||
with open(version_file, "r") as f:
|
||||
existing_version = f.read().strip()
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
if not args.no_confirm:
|
||||
print("The Orca command-line tools will be installed to:")
|
||||
print(f"The Orca command-line tools (version {version}) will be installed to:")
|
||||
print(dest)
|
||||
print()
|
||||
if existing_version is not None:
|
||||
print(f"This will overwrite version {existing_version}.")
|
||||
print()
|
||||
if not prompt("Proceed with the installation?"):
|
||||
return
|
||||
|
||||
bin_dir = os.path.join(dest, "bin")
|
||||
yeet(bin_dir)
|
||||
yeetdir(bin_dir)
|
||||
yeetdir(src_dir)
|
||||
yeetfile(version_file)
|
||||
|
||||
# The MS Store version of Python does some really stupid stuff with AppData:
|
||||
# https://git.handmade.network/hmn/orca/issues/32
|
||||
|
@ -552,14 +598,19 @@ def install(args):
|
|||
# paths we need, the following scripts work regardless of Python install.
|
||||
#
|
||||
# Also apparently you can't just do mkdir in a subprocess call here, hence the
|
||||
# trivial batch script.
|
||||
# trivial batch scripts.
|
||||
if platform.system() == "Windows":
|
||||
subprocess.run(["scripts\\mkdir.bat", bin_dir], check=True)
|
||||
subprocess.run(["scripts\\mkdir.bat", src_dir], check=True)
|
||||
subprocess.run(["scripts\\touch.bat", version_file], check=True)
|
||||
|
||||
shutil.copytree("scripts", os.path.join(bin_dir, "sys_scripts"))
|
||||
shutil.copy("orca", bin_dir)
|
||||
shutil.copytree("src", src_dir, dirs_exist_ok=True)
|
||||
if platform.system() == "Windows":
|
||||
shutil.copy("orca.bat", bin_dir)
|
||||
with open(version_file, "w") as f:
|
||||
f.write(version)
|
||||
|
||||
print()
|
||||
if platform.system() == "Windows":
|
||||
|
@ -568,14 +619,59 @@ def install(args):
|
|||
print()
|
||||
print("The tools will need to be on your PATH in order to actually use them.")
|
||||
if prompt("Would you like to automatically add Orca to your PATH?"):
|
||||
subprocess.run(["powershell", "scripts\\updatepath.ps1", bin_dir], check=True)
|
||||
print("Orca has been added to your PATH. Restart any open terminals to use it.")
|
||||
try:
|
||||
subprocess.run(["powershell", "-ExecutionPolicy", "Bypass", "scripts\\updatepath.ps1", f'"{bin_dir}"'], check=True)
|
||||
print("Orca has been added to your PATH. Restart any open terminals to use it.")
|
||||
except subprocess.CalledProcessError:
|
||||
msg = log_warning(f"Failed to automatically add Orca to your PATH.")
|
||||
msg.more("Please manually add the following directory to your PATH:")
|
||||
msg.more(bin_dir)
|
||||
else:
|
||||
print("No worries. You can manually add Orca to your PATH in the Windows settings")
|
||||
print("this in the Windows settings by searching for \"environment variables\".")
|
||||
print("by searching for \"environment variables\".")
|
||||
else:
|
||||
print("The Orca tools have been installed. Make sure the Orca tools are on your PATH by")
|
||||
print("adding the following to your shell config:")
|
||||
print()
|
||||
print(f"export PATH=\"{bin_dir}:$PATH\"")
|
||||
print()
|
||||
|
||||
def install_path():
|
||||
if platform.system() == "Windows":
|
||||
orca_dir = os.path.join(os.getenv("LOCALAPPDATA"), "orca")
|
||||
else:
|
||||
orca_dir = os.path.expanduser(os.path.join("~", ".orca"))
|
||||
|
||||
bin_dir = os.path.join(orca_dir, "bin")
|
||||
|
||||
return (orca_dir, bin_dir)
|
||||
|
||||
def yeet(path):
|
||||
os.makedirs(path, exist_ok=True)
|
||||
shutil.rmtree(path)
|
||||
|
||||
|
||||
def uninstall(args):
|
||||
orca_dir, bin_dir = install_path()
|
||||
|
||||
if not os.path.exists(orca_dir):
|
||||
print("Orca is not installed on your system.")
|
||||
exit()
|
||||
|
||||
print(f"Orca is currently installed at {orca_dir}.")
|
||||
if prompt("Are you sure you want to uninstall?"):
|
||||
yeet(orca_dir)
|
||||
|
||||
if platform.system() == "Windows":
|
||||
print("Orca has been uninstalled from your system.")
|
||||
print()
|
||||
if prompt("Would you like to automatically remove Orca from your PATH?"):
|
||||
try:
|
||||
subprocess.run(["powershell", "-ExecutionPolicy", "Bypass", "scripts\\updatepath.ps1", f'"{bin_dir}"', "-remove"], check=True)
|
||||
print("Orca has been removed from your PATH.")
|
||||
except subprocess.CalledProcessError:
|
||||
msg = log_warning(f"Failed to automatically remove Orca from your PATH.")
|
||||
msg.more("Please manually remove the following directory from your PATH:")
|
||||
msg.more(bin_dir)
|
||||
else:
|
||||
print("Orca has been uninstalled from your system. You may wish to remove it from your PATH.")
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
_MSC_VER
|
||||
|
||||
#if defined(__x86_64__) || defined(_M_X64)
|
||||
x64
|
||||
#elif defined(i386) || defined(__i386__) || defined(__i386) || defined(_M_IX86)
|
||||
x86
|
||||
#else
|
||||
unknown
|
||||
#endif
|
|
@ -1,15 +1,31 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
from .bundle import attach_bundle_commands
|
||||
from .source import attach_source_commands
|
||||
from .dev import attach_dev_commands
|
||||
from .version import attach_version_command
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-?", action="help", help=argparse.SUPPRESS)
|
||||
|
||||
subparsers = parser.add_subparsers(required=True, title='commands')
|
||||
subparsers = parser.add_subparsers(required=True, title="commands")
|
||||
attach_bundle_commands(subparsers)
|
||||
attach_source_commands(subparsers)
|
||||
attach_dev_commands(subparsers)
|
||||
attach_version_command(subparsers)
|
||||
|
||||
args = parser.parse_args()
|
||||
# Hack to run the actual version command if we pass -v or --version.
|
||||
# Using argparse action="version" requires us to pass a single string
|
||||
# and doesn't allow us to run our own custom version-printing function.
|
||||
argv = sys.argv[1:]
|
||||
|
||||
if len(argv) == 0:
|
||||
argv = ["-h"]
|
||||
elif argv[0] in ["-v", "--version"]:
|
||||
argv = ["version"]
|
||||
|
||||
args = parser.parse_args(argv)
|
||||
args.func(args)
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
import platform
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import textwrap
|
||||
|
||||
CLANG_MAJOR, CLANG_MINOR = 11, 0
|
||||
|
||||
def printw(str=""):
|
||||
print(textwrap.fill(str))
|
||||
|
||||
def print_clang_install_info(upgrade):
|
||||
if platform.system() == "Windows":
|
||||
printw(f"Please install Clang {CLANG_MAJOR}.{CLANG_MINOR} or newer. We recommend installing Clang via the Visual Studio installer. In the installer, search for \"C++ Clang Compiler\".")
|
||||
elif platform.system() == "Darwin":
|
||||
printw(f"Please install Clang {CLANG_MAJOR}.{CLANG_MINOR} or newer. We recommend installing Clang via Homebrew (https://brew.sh/):")
|
||||
printw()
|
||||
if upgrade:
|
||||
printw(" brew upgrade llvm")
|
||||
else:
|
||||
printw(" brew install llvm")
|
||||
printw()
|
||||
else:
|
||||
printw(f"Please install Clang {CLANG_MAJOR}.{CLANG_MINOR} or newer.")
|
||||
|
||||
try:
|
||||
out = subprocess.run(["clang", "--version"], capture_output=True, text=True, check=True)
|
||||
m = re.search(r"clang version (\d+)\.(\d+)\.(\d+)", out.stdout)
|
||||
major, minor, patch = int(m.group(1)), int(m.group(2)), int(m.group(3))
|
||||
if major < CLANG_MAJOR or minor < CLANG_MINOR:
|
||||
printw(f"ERROR: Your version of Clang is too old. You have version {major}.{minor}.{patch}, but version {CLANG_MAJOR}.{CLANG_MINOR} or greater is required.")
|
||||
printw()
|
||||
printw("This script is currently running the clang located at:")
|
||||
printw(shutil.which("clang"))
|
||||
printw()
|
||||
print_clang_install_info(True)
|
||||
exit(1)
|
||||
except FileNotFoundError:
|
||||
printw("ERROR: clang is not installed. The Orca samples require Clang in order to compile C programs to WebAssembly.")
|
||||
printw()
|
||||
print_clang_install_info(False)
|
||||
exit(1)
|
||||
except subprocess.CalledProcessError:
|
||||
printw("WARNING: Could not check Clang version. You may encounter build errors.")
|
||||
|
||||
try:
|
||||
subprocess.run(["wasm-ld", "--version"], capture_output=True, check=True)
|
||||
except FileNotFoundError:
|
||||
printw("ERROR: wasm-ld was not found on your system. This is a component of Clang that is required in order to produce WebAssembly modules. This likely means that an old or otherwise incompatible version of Clang is being used, such as Apple's version of Clang.")
|
||||
printw()
|
||||
print_clang_install_info(False)
|
||||
exit(1)
|
||||
|
||||
try:
|
||||
subprocess.run(["orca", "version"], capture_output=True, shell=True, check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
printw("ERROR: The Orca tooling has not been installed to your system or is not on your PATH. From the root of the Orca source code, please run the following commands:")
|
||||
printw()
|
||||
printw(" python orca dev build-runtime")
|
||||
printw(" python orca dev install")
|
||||
exit(1)
|
|
@ -0,0 +1,113 @@
|
|||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
|
||||
from .checksum import dirsum
|
||||
from .log import *
|
||||
from .utils import yeetdir
|
||||
from .version import src_dir, orca_version
|
||||
|
||||
|
||||
def attach_source_commands(subparsers):
|
||||
source_cmd = subparsers.add_parser("source", help="Commands for helping compile the Orca source code into your project.")
|
||||
source_sub = source_cmd.add_subparsers(required=True, title="commands")
|
||||
|
||||
cflags_cmd = source_sub.add_parser("cflags", help="Get help setting up a C or C++ compiler to compile the Orca source.")
|
||||
cflags_cmd.add_argument("srcdir", nargs="?", default=src_dir(), help="the directory containing the Orca source code (defaults to system installation)")
|
||||
cflags_cmd.set_defaults(func=shellish(cflags))
|
||||
|
||||
vendor_cmd = source_sub.add_parser("vendor", help="Copy the Orca source code into your project.")
|
||||
vendor_cmd.add_argument("dir", type=str, help="the directory into which the Orca source code will be copied")
|
||||
vendor_cmd.set_defaults(func=shellish(vendor))
|
||||
|
||||
|
||||
def vendor(args):
|
||||
# Verify that we are ok to vendor into the requested dir.
|
||||
if os.path.exists(args.dir):
|
||||
try:
|
||||
with open(vendor_file_path(args.dir), "r") as f:
|
||||
vendor_info = json.load(f)
|
||||
version = vendor_info["version"]
|
||||
print(f"Orca version {version} is currently installed in that directory.")
|
||||
|
||||
if vendor_checksum(args.dir) != vendor_info["checksum"]:
|
||||
log_error(f"The contents of your vendor directory have been modified. This command will exit to avoid overwriting any local changes. To proceed, manually delete {args.dir} and try again.")
|
||||
exit(1)
|
||||
except FileNotFoundError:
|
||||
if len(os.listdir(args.dir)) > 0:
|
||||
log_error(f"The requested directory already exists and does not appear to contain Orca source code. To avoid deleting anything important, please either provide the correct path or manually empty {args.dir} first.")
|
||||
exit(1)
|
||||
|
||||
yeetdir(args.dir)
|
||||
shutil.copytree(src_dir(), args.dir)
|
||||
with open(vendor_file_path(args.dir), "w") as f:
|
||||
json.dump({
|
||||
"version": orca_version(),
|
||||
"checksum": vendor_checksum(args.dir),
|
||||
}, f, indent=2)
|
||||
print(f"Version {orca_version()} of the Orca source code has been copied to {args.dir}.")
|
||||
|
||||
|
||||
def vendor_file_path(vendor_dir):
|
||||
return os.path.join(vendor_dir, ".orcavendor")
|
||||
|
||||
|
||||
def vendor_checksum(dir):
|
||||
return dirsum(dir, excluded_extensions=["orcavendor"])
|
||||
|
||||
|
||||
def cflags(args):
|
||||
if not os.path.exists(os.path.join(args.srcdir, "orca.h")):
|
||||
log_error(f"The provided path does not seem to contain the Orca source code: {args.srcdir}")
|
||||
exit(1)
|
||||
|
||||
def path_contains(a, b):
|
||||
a_abs = os.path.abspath(a)
|
||||
b_abs = os.path.abspath(b)
|
||||
return os.path.commonpath([a_abs, b_abs]) == a_abs
|
||||
|
||||
def nicepath(path):
|
||||
path_abs = os.path.abspath(path)
|
||||
if path_contains(os.getcwd(), path_abs):
|
||||
return os.path.relpath(path_abs)
|
||||
else:
|
||||
return path_abs
|
||||
|
||||
include = nicepath(args.srcdir)
|
||||
orcac = nicepath(os.path.join(args.srcdir, "orca.c"))
|
||||
extinclude = nicepath(os.path.join(args.srcdir, "ext"))
|
||||
sysinclude = nicepath(os.path.join(args.srcdir, "libc-shim/include"))
|
||||
libcsource = nicepath(os.path.join(args.srcdir, "libc-shim/src/*.c"))
|
||||
|
||||
print("To compile Orca as part of your C or C++ project, you must:")
|
||||
print(f"> Put the following directory on your SYSTEM include search path:")
|
||||
print(f" {sysinclude}")
|
||||
print(f"> Put the following directories on your include search path:")
|
||||
print(f" {include}")
|
||||
print(f" {extinclude}")
|
||||
print(f"> Compile the following file as a single translation unit:")
|
||||
print(f" {orcac}")
|
||||
print(f"> Compile the following files as separate translation units:")
|
||||
print(f" {libcsource}")
|
||||
print()
|
||||
print("The following clang flags are also required:")
|
||||
print("> --target=wasm32 (to compile to wasm)")
|
||||
print("> --no-standard-libraries (to use only our libc shim)")
|
||||
print("> -mbulk-memory (to enable memset/memcpy intrinsics, which are required)")
|
||||
print("> -D__ORCA__ (to signal that the Orca source code is being compiled to run on Orca itself)")
|
||||
print("> -Wl,--no-entry (to prevent wasm-ld from looking for a _start symbol)")
|
||||
print("> -Wl,--export-dynamic (to expose your module's functions to Orca)")
|
||||
print()
|
||||
print("And the following clang flags are recommended:")
|
||||
print("> -g -O2 (to compile with optimizations and debug info)")
|
||||
print()
|
||||
print("Complete clang example:")
|
||||
print()
|
||||
print(f"clang --target=wasm32 --no-standard-libraries -mbulk-memory -g -O2 -D__ORCA__ -Wl,--no-entry -Wl,--export-dynamic -isystem \"{sysinclude}\" -I \"{include}\" -I \"{extinclude}\" \"{orcac}\" \"{libcsource}\" your-main.c")
|
||||
print()
|
||||
if not path_contains(os.getcwd(), args.srcdir):
|
||||
print("If these paths look crazy to you, consider vendoring the source code into your")
|
||||
print("project using `orca source vendor`.")
|
||||
print()
|
|
@ -0,0 +1,3 @@
|
|||
@echo off
|
||||
type nul > %1
|
||||
exit /b %errorlevel%
|
|
@ -1,11 +1,16 @@
|
|||
param (
|
||||
[parameter(Mandatory=$true)]
|
||||
[string]$orcaPath
|
||||
[string]$orcaPath,
|
||||
|
||||
[switch]$remove
|
||||
)
|
||||
|
||||
$arrPath = [System.Environment]::GetEnvironmentVariable('PATH', 'User') -split ';'
|
||||
$arrPath = $arrPath | Where-Object { $_ -ne $orcaPath } | Where-Object { $_ -ne '' }
|
||||
$newPath = ($arrPath + $orcaPath) -join ';'
|
||||
if (-not $remove) {
|
||||
$arrPath += $orcaPath
|
||||
}
|
||||
|
||||
$newPath = $arrPath -join ';'
|
||||
|
||||
[System.Environment]::SetEnvironmentVariable('PATH', $newPath, 'User')
|
||||
# echo $newPath
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import glob
|
||||
import os
|
||||
import subprocess
|
||||
import traceback
|
||||
import shutil
|
||||
|
||||
from contextlib import contextmanager
|
||||
|
||||
|
@ -18,3 +17,13 @@ def pushd(new_dir):
|
|||
def removeall(dir):
|
||||
[os.remove(f) for f in glob.iglob("{}/*".format(dir), recursive=True)]
|
||||
os.removedirs(dir)
|
||||
|
||||
|
||||
def yeetdir(path):
|
||||
os.makedirs(path, exist_ok=True)
|
||||
shutil.rmtree(path)
|
||||
|
||||
|
||||
def yeetfile(path):
|
||||
if os.path.exists(path):
|
||||
os.remove(path)
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from .log import *
|
||||
from .utils import pushd
|
||||
|
||||
|
||||
# Checks if the Orca tool should use a source checkout of Orca instead of a system install.
|
||||
# This is copy-pasted to the command-line tool so it can work before loading anything.
|
||||
#
|
||||
# Returns: (use source, source directory, is actually the source's tool)
|
||||
def check_if_source():
|
||||
def path_is_in_orca_source(path):
|
||||
dir = path
|
||||
while True:
|
||||
try:
|
||||
os.stat(os.path.join(dir, ".orcaroot"))
|
||||
return (True, dir)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
newdir = os.path.dirname(dir)
|
||||
if newdir == dir:
|
||||
return (False, None)
|
||||
dir = newdir
|
||||
|
||||
in_source, current_source_dir = path_is_in_orca_source(os.getcwd())
|
||||
script_is_source, script_source_dir = path_is_in_orca_source(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
use_source = in_source or script_is_source
|
||||
source_dir = current_source_dir or script_source_dir
|
||||
return (use_source, source_dir, script_is_source)
|
||||
|
||||
|
||||
def is_orca_source():
|
||||
use_source, _, _ = check_if_source()
|
||||
return use_source
|
||||
|
||||
|
||||
def actual_install_dir():
|
||||
# The path adjustment in here is technically sort of fragile because it depends
|
||||
# on the current location of this actual file. But oh well.
|
||||
if is_orca_source():
|
||||
raise Exception("actual_install_dir should not be called when using the source version of the Orca tools")
|
||||
return os.path.normpath(os.path.join(os.path.abspath(__file__), "../../.."))
|
||||
|
||||
|
||||
def src_dir():
|
||||
# More fragile path adjustments! Yay!
|
||||
if is_orca_source():
|
||||
return os.path.normpath(os.path.join(os.path.abspath(__file__), "../../src"))
|
||||
else:
|
||||
return os.path.normpath(os.path.join(os.path.abspath(__file__), "../../../src"))
|
||||
|
||||
|
||||
def orca_version():
|
||||
is_source, source_dir, _ = check_if_source()
|
||||
if is_source:
|
||||
with pushd(source_dir):
|
||||
version = "unknown"
|
||||
if os.path.exists(".git"):
|
||||
try:
|
||||
res = subprocess.run(["git", "rev-parse", "--short", "HEAD"], check=True, capture_output=True, text=True)
|
||||
version = res.stdout.strip()
|
||||
except subprocess.CalledProcessError:
|
||||
log_warning("failed to look up current git hash for version number")
|
||||
return f"dev-{version}"
|
||||
else:
|
||||
try:
|
||||
with open(os.path.join(actual_install_dir(), ".orcaversion"), "r") as f:
|
||||
version = f.read().strip()
|
||||
return version
|
||||
except FileNotFoundError:
|
||||
return "dev-unknown"
|
||||
|
||||
|
||||
def attach_version_command(subparsers):
|
||||
version_cmd = subparsers.add_parser("version", help="Print the current Orca version.")
|
||||
version_cmd.set_defaults(func=print_orca_version)
|
||||
|
||||
|
||||
def print_orca_version(args):
|
||||
use_source, source_dir, _ = check_if_source()
|
||||
|
||||
# This function prints the bare version number to stdout and everything else
|
||||
# to stderr. This makes it easy to use the version number in shell pipelines
|
||||
# without requiring extra flags or parsing a weird output format.
|
||||
sys.stdout.write(orca_version() + "\n")
|
||||
if use_source:
|
||||
sys.stderr.write(f"Orca is running from a source checkout.\n")
|
||||
sys.stderr.write(f"Source dir: {source_dir}\n")
|
||||
else:
|
||||
sys.stderr.write(f"Orca is running from a system installation.\n")
|
||||
sys.stderr.write(f"Install dir: {actual_install_dir()}\n")
|
|
@ -1,11 +1,10 @@
|
|||
/************************************************************/ /**
|
||||
/*************************************************************************
|
||||
*
|
||||
* @file: main.cpp
|
||||
* @author: Martin Fouilleul
|
||||
* @date: 30/07/2022
|
||||
* @revision:
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
*****************************************************************/
|
||||
**************************************************************************/
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -42,14 +41,17 @@ int main()
|
|||
}
|
||||
|
||||
//NOTE: create atlas
|
||||
|
||||
oc_arena_scope scratch = oc_scratch_begin();
|
||||
|
||||
oc_arena permanentArena = { 0 };
|
||||
oc_arena_init(&permanentArena);
|
||||
|
||||
oc_rect_atlas* atlas = oc_rect_atlas_create(&permanentArena, 16000, 16000);
|
||||
oc_image atlasImage = oc_image_create(surface, 16000, 16000);
|
||||
|
||||
oc_str8 path1 = oc_path_executable_relative(oc_scratch(), OC_STR8("../../../sketches/resources/triceratops.png"));
|
||||
oc_str8 path2 = oc_path_executable_relative(oc_scratch(), OC_STR8("../../../sketches/resources/Top512.png"));
|
||||
oc_str8 path1 = oc_path_executable_relative(scratch.arena, OC_STR8("../../../sketches/resources/triceratops.png"));
|
||||
oc_str8 path2 = oc_path_executable_relative(scratch.arena, OC_STR8("../../../sketches/resources/Top512.png"));
|
||||
|
||||
oc_image_region image1 = oc_image_atlas_alloc_from_file(atlas, atlasImage, path1, false);
|
||||
oc_image_region image2 = oc_image_atlas_alloc_from_file(atlas, atlasImage, path2, false);
|
||||
|
@ -58,11 +60,14 @@ int main()
|
|||
oc_window_bring_to_front(window);
|
||||
oc_window_focus(window);
|
||||
|
||||
oc_scratch_end(scratch);
|
||||
|
||||
while(!oc_should_quit())
|
||||
{
|
||||
scratch = oc_scratch_begin();
|
||||
oc_pump_events(0);
|
||||
oc_event* event = 0;
|
||||
while((event = oc_next_event(oc_scratch())) != 0)
|
||||
while((event = oc_next_event(scratch.arena)) != 0)
|
||||
{
|
||||
switch(event->type)
|
||||
{
|
||||
|
@ -90,7 +95,7 @@ int main()
|
|||
oc_render(canvas);
|
||||
oc_surface_present(surface);
|
||||
|
||||
oc_arena_clear(oc_scratch());
|
||||
oc_scratch_end(scratch);
|
||||
}
|
||||
|
||||
oc_image_atlas_recycle(atlas, image1);
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
/************************************************************/ /**
|
||||
/*************************************************************************
|
||||
*
|
||||
* @file: main.cpp
|
||||
* @author: Martin Fouilleul
|
||||
* @date: 30/07/2022
|
||||
* @revision:
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
*****************************************************************/
|
||||
**************************************************************************/
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -52,10 +51,11 @@ int main()
|
|||
while(!oc_should_quit())
|
||||
{
|
||||
f64 startTime = oc_clock_time(OC_CLOCK_MONOTONIC);
|
||||
oc_arena_scope scratch = oc_scratch_begin();
|
||||
|
||||
oc_pump_events(0);
|
||||
oc_event* event = 0;
|
||||
while((event = oc_next_event(oc_scratch())) != 0)
|
||||
while((event = oc_next_event(scratch.arena)) != 0)
|
||||
{
|
||||
switch(event->type)
|
||||
{
|
||||
|
@ -69,19 +69,19 @@ int main()
|
|||
{
|
||||
if(event->key.action == OC_KEY_PRESS)
|
||||
{
|
||||
if(event->key.code == OC_KEY_LEFT)
|
||||
if(event->key.keyCode == OC_KEY_LEFT)
|
||||
{
|
||||
x -= 1;
|
||||
}
|
||||
if(event->key.code == OC_KEY_RIGHT)
|
||||
if(event->key.keyCode == OC_KEY_RIGHT)
|
||||
{
|
||||
x += 1;
|
||||
}
|
||||
if(event->key.code == OC_KEY_UP)
|
||||
if(event->key.keyCode == OC_KEY_UP)
|
||||
{
|
||||
y -= 1;
|
||||
}
|
||||
if(event->key.code == OC_KEY_DOWN)
|
||||
if(event->key.keyCode == OC_KEY_DOWN)
|
||||
{
|
||||
y += 1;
|
||||
}
|
||||
|
@ -183,7 +183,8 @@ int main()
|
|||
oc_render(canvas);
|
||||
oc_surface_present(surface);
|
||||
|
||||
oc_arena_clear(oc_scratch());
|
||||
oc_scratch_end(scratch);
|
||||
|
||||
frameTime = oc_clock_time(OC_CLOCK_MONOTONIC) - startTime;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
/************************************************************/ /**
|
||||
/*************************************************************************
|
||||
*
|
||||
* @file: main.cpp
|
||||
* @author: Martin Fouilleul
|
||||
* @date: 30/07/2022
|
||||
* @revision:
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
*****************************************************************/
|
||||
**************************************************************************/
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -43,23 +42,28 @@ int main()
|
|||
}
|
||||
|
||||
//NOTE: create image
|
||||
oc_str8 imagePath = oc_path_executable_relative(oc_scratch(), OC_STR8("../../resources/triceratops.png"));
|
||||
oc_arena_scope scratch = oc_scratch_begin();
|
||||
|
||||
oc_str8 imagePath = oc_path_executable_relative(scratch.arena, OC_STR8("../../resources/triceratops.png"));
|
||||
oc_image image = oc_image_create_from_file(surface, imagePath, false);
|
||||
oc_vec2 imageSize = oc_image_size(image);
|
||||
|
||||
oc_str8 imagePath2 = oc_path_executable_relative(oc_scratch(), OC_STR8("../../resources/Top512.png"));
|
||||
oc_str8 imagePath2 = oc_path_executable_relative(scratch.arena, OC_STR8("../../resources/Top512.png"));
|
||||
oc_image image2 = oc_image_create_from_file(surface, imagePath2, false);
|
||||
oc_vec2 imageSize2 = oc_image_size(image2);
|
||||
|
||||
oc_scratch_end(scratch);
|
||||
// start app
|
||||
oc_window_bring_to_front(window);
|
||||
oc_window_focus(window);
|
||||
|
||||
while(!oc_should_quit())
|
||||
{
|
||||
scratch = oc_scratch_begin();
|
||||
|
||||
oc_pump_events(0);
|
||||
oc_event* event = 0;
|
||||
while((event = oc_next_event(oc_scratch())) != 0)
|
||||
while((event = oc_next_event(scratch.arena)) != 0)
|
||||
{
|
||||
switch(event->type)
|
||||
{
|
||||
|
@ -81,7 +85,7 @@ int main()
|
|||
|
||||
oc_set_color_rgba(1, 1, 1, 1);
|
||||
/*
|
||||
oc_matrix_push((oc_mat2x3){0.707, -0.707, 200,
|
||||
oc_matrix_multiply_push((oc_mat2x3){0.707, -0.707, 200,
|
||||
0.707, 0.707, 100});
|
||||
oc_set_image(image);
|
||||
oc_set_image_source_region((oc_rect){500, 500, 2000, 1400});
|
||||
|
@ -105,7 +109,7 @@ int main()
|
|||
oc_render(canvas);
|
||||
oc_surface_present(surface);
|
||||
|
||||
oc_arena_clear(oc_scratch());
|
||||
oc_scratch_end(scratch);
|
||||
}
|
||||
|
||||
oc_image_destroy(image);
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
set INCLUDES=/I ..\..\src
|
||||
|
||||
if not exist "bin" mkdir bin
|
||||
|
||||
cl /we4013 /Zi /Zc:preprocessor /std:c11 /experimental:c11atomics %INCLUDES% main.c /link /LIBPATH:../../build/bin orca.dll.lib /out:bin/keyboard.exe
|
||||
copy ..\..\build\bin\orca.dll bin
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
BINDIR=bin
|
||||
LIBDIR=../../build/bin
|
||||
SRCDIR=../../src
|
||||
|
||||
INCLUDES="-I$SRCDIR"
|
||||
LIBS="-L$LIBDIR -lorca -framework Carbon -framework Cocoa -framework Metal -framework QuartzCore"
|
||||
FLAGS="-mmacos-version-min=10.15.4 -DOC_DEBUG -DLOG_COMPILE_DEBUG"
|
||||
|
||||
mkdir -p $BINDIR
|
||||
clang -g $FLAGS $LIBS $INCLUDES -o $BINDIR/keyboard main.c
|
||||
|
||||
cp $LIBDIR/liborca.dylib $BINDIR/
|
||||
|
||||
install_name_tool -add_rpath "@executable_path" $BINDIR/keyboard
|
|
@ -0,0 +1,68 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
**************************************************************************/
|
||||
#include "orca.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
oc_init();
|
||||
|
||||
oc_rect rect = { .x = 100, .y = 100, .w = 200, .h = 200 };
|
||||
oc_window window = oc_window_create(rect, OC_STR8("test"), 0);
|
||||
|
||||
oc_window_bring_to_front(window);
|
||||
oc_window_focus(window);
|
||||
|
||||
oc_window_center(window);
|
||||
|
||||
oc_log_info("keycode for enter = %i\n", OC_KEY_ENTER);
|
||||
|
||||
while(!oc_should_quit())
|
||||
{
|
||||
oc_arena_scope scratch = oc_scratch_begin();
|
||||
oc_pump_events(0);
|
||||
oc_event* event = 0;
|
||||
while((event = oc_next_event(scratch.arena)) != 0)
|
||||
{
|
||||
switch(event->type)
|
||||
{
|
||||
case OC_EVENT_WINDOW_CLOSE:
|
||||
{
|
||||
oc_request_quit();
|
||||
}
|
||||
break;
|
||||
|
||||
case OC_EVENT_KEYBOARD_KEY:
|
||||
{
|
||||
if(event->key.action == OC_KEY_PRESS)
|
||||
{
|
||||
if(event->key.keyCode < 128)
|
||||
{
|
||||
oc_log_info("Key:\n\tscanCode = %i\n\tkeyCode = %i (%c)\n",
|
||||
event->key.scanCode,
|
||||
event->key.keyCode,
|
||||
event->key.keyCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
oc_log_info("Key:\n\tscanCode = %i\n\tkeyCode = %i\n",
|
||||
event->key.scanCode,
|
||||
event->key.keyCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
oc_scratch_end(scratch);
|
||||
}
|
||||
oc_terminate();
|
||||
return (0);
|
||||
}
|
|
@ -1,3 +1,10 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -51,11 +58,12 @@ int main()
|
|||
|
||||
while(!oc_should_quit())
|
||||
{
|
||||
oc_arena_scope scratch = oc_scratch_begin();
|
||||
f64 startTime = oc_clock_time(OC_CLOCK_MONOTONIC);
|
||||
|
||||
oc_pump_events(0);
|
||||
oc_event* event = 0;
|
||||
while((event = oc_next_event(oc_scratch())) != 0)
|
||||
while((event = oc_next_event(scratch.arena)) != 0)
|
||||
{
|
||||
switch(event->type)
|
||||
{
|
||||
|
@ -113,7 +121,7 @@ int main()
|
|||
oc_surface_present(surface1);
|
||||
oc_surface_present(surface2);
|
||||
|
||||
oc_arena_clear(oc_scratch());
|
||||
oc_scratch_end(scratch);
|
||||
}
|
||||
|
||||
oc_canvas_destroy(canvas1);
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -57,13 +64,15 @@ static const char* TEST_STRING =
|
|||
oc_font create_font(const char* path)
|
||||
{
|
||||
//NOTE(martin): create font
|
||||
oc_str8 fontPath = oc_path_executable_relative(oc_scratch(), OC_STR8(path));
|
||||
char* fontPathCString = oc_str8_to_cstring(oc_scratch(), fontPath);
|
||||
oc_arena_scope scratch = oc_scratch_begin();
|
||||
oc_str8 fontPath = oc_path_executable_relative(scratch.arena, OC_STR8(path));
|
||||
char* fontPathCString = oc_str8_to_cstring(scratch.arena, fontPath);
|
||||
|
||||
FILE* fontFile = fopen(fontPathCString, "r");
|
||||
if(!fontFile)
|
||||
{
|
||||
oc_log_error("Could not load font file '%s'\n", fontPathCString);
|
||||
oc_scratch_end(scratch);
|
||||
return (oc_font_nil());
|
||||
}
|
||||
unsigned char* fontData = 0;
|
||||
|
@ -82,7 +91,7 @@ oc_font create_font(const char* path)
|
|||
|
||||
oc_font font = oc_font_create_from_memory(oc_str8_from_buffer(fontDataSize, (char*)fontData), 5, ranges);
|
||||
free(fontData);
|
||||
|
||||
oc_scratch_end(scratch);
|
||||
return (font);
|
||||
}
|
||||
|
||||
|
@ -160,12 +169,13 @@ int main()
|
|||
while(!oc_should_quit())
|
||||
{
|
||||
f64 startFrameTime = oc_clock_time(OC_CLOCK_MONOTONIC);
|
||||
oc_arena_scope scratch = oc_scratch_begin();
|
||||
|
||||
oc_pump_events(0);
|
||||
oc_event* event = 0;
|
||||
while((event = oc_next_event(oc_scratch())) != 0)
|
||||
while((event = oc_next_event(scratch.arena)) != 0)
|
||||
{
|
||||
oc_input_process_event(&inputState, event);
|
||||
oc_input_process_event(&inputState, scratch.arena, event);
|
||||
|
||||
switch(event->type)
|
||||
{
|
||||
|
@ -177,7 +187,7 @@ int main()
|
|||
|
||||
case OC_EVENT_MOUSE_BUTTON:
|
||||
{
|
||||
if(event->key.code == OC_MOUSE_LEFT)
|
||||
if(event->key.keyCode == OC_MOUSE_LEFT)
|
||||
{
|
||||
if(event->key.action == OC_KEY_PRESS)
|
||||
{
|
||||
|
@ -210,7 +220,7 @@ int main()
|
|||
|
||||
case OC_EVENT_KEYBOARD_KEY:
|
||||
{
|
||||
if(event->key.code == OC_KEY_SPACE && event->key.action == OC_KEY_PRESS)
|
||||
if(event->key.keyCode == OC_KEY_SPACE && event->key.action == OC_KEY_PRESS)
|
||||
{
|
||||
fontIndex = (fontIndex + 1) % FONT_COUNT;
|
||||
}
|
||||
|
@ -242,8 +252,8 @@ int main()
|
|||
}
|
||||
*/
|
||||
|
||||
oc_matrix_push((oc_mat2x3){ zoom, 0, 0,
|
||||
0, zoom, 0 });
|
||||
oc_matrix_multiply_push((oc_mat2x3){ zoom, 0, 0,
|
||||
0, zoom, 0 });
|
||||
|
||||
oc_set_color_rgba(1, 1, 1, 1);
|
||||
oc_clear();
|
||||
|
@ -287,7 +297,7 @@ int main()
|
|||
oc_set_font_size(14);
|
||||
oc_move_to(10, contentRect.h - 10 - lineHeights[fontIndex]);
|
||||
|
||||
oc_str8 text = oc_str8_pushf(oc_scratch(),
|
||||
oc_str8 text = oc_str8_pushf(scratch.arena,
|
||||
"Test program: %i glyphs, frame time = %fs, fps = %f",
|
||||
glyphCount,
|
||||
frameTime,
|
||||
|
@ -315,7 +325,7 @@ int main()
|
|||
(endFrameTime - startPresentTime) * 1000);
|
||||
|
||||
oc_input_next_frame(&inputState);
|
||||
oc_arena_clear(oc_scratch());
|
||||
oc_scratch_end(scratch);
|
||||
}
|
||||
|
||||
for(int i = 0; i < FONT_COUNT; i++)
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -11,8 +18,10 @@ i32 render_thread(void* user)
|
|||
{
|
||||
while(!oc_should_quit())
|
||||
{
|
||||
oc_arena_scope scratch = oc_scratch_begin();
|
||||
|
||||
oc_event* event = 0;
|
||||
while((event = oc_next_event(oc_scratch())) != 0)
|
||||
while((event = oc_next_event(scratch.arena)) != 0)
|
||||
{
|
||||
switch(event->type)
|
||||
{
|
||||
|
@ -40,7 +49,7 @@ i32 render_thread(void* user)
|
|||
|
||||
oc_surface_present(surface);
|
||||
|
||||
oc_arena_clear(oc_scratch());
|
||||
oc_scratch_end(scratch);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
/************************************************************/ /**
|
||||
/*************************************************************************
|
||||
*
|
||||
* @file: main.cpp
|
||||
* @author: Martin Fouilleul
|
||||
* @date: 30/07/2022
|
||||
* @revision:
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
*****************************************************************/
|
||||
**************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -26,9 +25,10 @@ int main()
|
|||
|
||||
while(!oc_should_quit())
|
||||
{
|
||||
oc_arena_scope scratch = oc_scratch_begin();
|
||||
oc_pump_events(0);
|
||||
oc_event* event = 0;
|
||||
while((event = oc_next_event(oc_scratch())) != 0)
|
||||
while((event = oc_next_event(scratch.arena)) != 0)
|
||||
{
|
||||
switch(event->type)
|
||||
{
|
||||
|
@ -122,7 +122,7 @@ int main()
|
|||
break;
|
||||
}
|
||||
}
|
||||
oc_arena_clear(oc_scratch());
|
||||
oc_scratch_end(scratch);
|
||||
}
|
||||
|
||||
oc_terminate();
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
/************************************************************/ /**
|
||||
/*************************************************************************
|
||||
*
|
||||
* @file: main.cpp
|
||||
* @author: Martin Fouilleul
|
||||
* @date: 30/07/2022
|
||||
* @revision:
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
*****************************************************************/
|
||||
**************************************************************************/
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -19,13 +18,15 @@
|
|||
oc_font create_font()
|
||||
{
|
||||
//NOTE(martin): create font
|
||||
oc_str8 fontPath = oc_path_executable_relative(oc_scratch(), OC_STR8("../../resources/OpenSansLatinSubset.ttf"));
|
||||
char* fontPathCString = oc_str8_to_cstring(oc_scratch(), fontPath);
|
||||
oc_arena_scope scratch = oc_scratch_begin();
|
||||
oc_str8 fontPath = oc_path_executable_relative(scratch.arena, OC_STR8("../../resources/OpenSansLatinSubset.ttf"));
|
||||
char* fontPathCString = oc_str8_to_cstring(scratch.arena, fontPath);
|
||||
|
||||
FILE* fontFile = fopen(fontPathCString, "r");
|
||||
if(!fontFile)
|
||||
{
|
||||
oc_log_error("Could not load font file '%s': %s\n", fontPathCString, strerror(errno));
|
||||
oc_scratch_end(scratch);
|
||||
return (oc_font_nil());
|
||||
}
|
||||
unsigned char* fontData = 0;
|
||||
|
@ -44,7 +45,7 @@ oc_font create_font()
|
|||
|
||||
oc_font font = oc_font_create_from_memory(oc_str8_from_buffer(fontDataSize, (char*)fontData), 5, ranges);
|
||||
free(fontData);
|
||||
|
||||
oc_scratch_end(scratch);
|
||||
return (font);
|
||||
}
|
||||
|
||||
|
@ -88,10 +89,11 @@ int main()
|
|||
while(!oc_should_quit())
|
||||
{
|
||||
f64 startTime = oc_clock_time(OC_CLOCK_MONOTONIC);
|
||||
oc_arena_scope scratch = oc_scratch_begin();
|
||||
|
||||
oc_pump_events(0);
|
||||
oc_event* event = 0;
|
||||
while((event = oc_next_event(oc_scratch())) != 0)
|
||||
while((event = oc_next_event(scratch.arena)) != 0)
|
||||
{
|
||||
switch(event->type)
|
||||
{
|
||||
|
@ -186,7 +188,7 @@ int main()
|
|||
oc_set_font_size(12);
|
||||
oc_move_to(50, 600 - 50);
|
||||
|
||||
oc_str8 text = oc_str8_pushf(oc_scratch(),
|
||||
oc_str8 text = oc_str8_pushf(scratch.arena,
|
||||
"Orca vector graphics test program (frame time = %fs, fps = %f)...",
|
||||
frameTime,
|
||||
1. / frameTime);
|
||||
|
@ -201,7 +203,7 @@ int main()
|
|||
oc_render(canvas);
|
||||
oc_surface_present(surface);
|
||||
|
||||
oc_arena_clear(oc_scratch());
|
||||
oc_scratch_end(scratch);
|
||||
frameTime = oc_clock_time(OC_CLOCK_MONOTONIC) - startTime;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
/************************************************************/ /**
|
||||
/*************************************************************************
|
||||
*
|
||||
* @file: main.cpp
|
||||
* @author: Martin Fouilleul
|
||||
* @date: 30/07/2022
|
||||
* @revision:
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
*****************************************************************/
|
||||
**************************************************************************/
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -121,8 +120,6 @@ void update_and_render(app_data* app)
|
|||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
|
||||
oc_surface_present(app->surface);
|
||||
|
||||
oc_arena_clear(oc_scratch());
|
||||
}
|
||||
|
||||
i32 render(void* user)
|
||||
|
@ -170,14 +167,16 @@ i32 render(void* user)
|
|||
|
||||
while(!oc_should_quit())
|
||||
{
|
||||
oc_arena_scope scratch = oc_scratch_begin();
|
||||
|
||||
oc_event* event = 0;
|
||||
|
||||
while((event = oc_next_event(oc_scratch())) != 0)
|
||||
while((event = oc_next_event(scratch.arena)) != 0)
|
||||
{
|
||||
process_event(app, *event);
|
||||
}
|
||||
update_and_render(app);
|
||||
oc_arena_clear(oc_scratch());
|
||||
oc_scratch_end(scratch);
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
/************************************************************/ /**
|
||||
/*************************************************************************
|
||||
*
|
||||
* @file: main.cpp
|
||||
* @author: Martin Fouilleul
|
||||
* @date: 30/07/2022
|
||||
* @revision:
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
*****************************************************************/
|
||||
**************************************************************************/
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -21,13 +20,15 @@
|
|||
oc_font create_font()
|
||||
{
|
||||
//NOTE(martin): create font
|
||||
oc_str8 fontPath = oc_path_executable_relative(oc_scratch(), OC_STR8("../../resources/OpenSansLatinSubset.ttf"));
|
||||
char* fontPathCString = oc_str8_to_cstring(oc_scratch(), fontPath);
|
||||
oc_arena_scope scratch = oc_scratch_begin();
|
||||
oc_str8 fontPath = oc_path_executable_relative(scratch.arena, OC_STR8("../../resources/OpenSansLatinSubset.ttf"));
|
||||
char* fontPathCString = oc_str8_to_cstring(scratch.arena, fontPath);
|
||||
|
||||
FILE* fontFile = fopen(fontPathCString, "r");
|
||||
if(!fontFile)
|
||||
{
|
||||
oc_log_error("Could not load font file '%s': %s\n", fontPathCString, strerror(errno));
|
||||
oc_scratch_end(scratch);
|
||||
return (oc_font_nil());
|
||||
}
|
||||
unsigned char* fontData = 0;
|
||||
|
@ -46,7 +47,7 @@ oc_font create_font()
|
|||
|
||||
oc_font font = oc_font_create_from_memory(oc_str8_from_buffer(fontDataSize, (char*)fontData), 5, ranges);
|
||||
free(fontData);
|
||||
|
||||
oc_scratch_end(scratch);
|
||||
return (font);
|
||||
}
|
||||
|
||||
|
@ -97,11 +98,12 @@ int main()
|
|||
|
||||
while(!oc_should_quit())
|
||||
{
|
||||
oc_arena_scope scratch = oc_scratch_begin();
|
||||
f64 startTime = oc_clock_time(OC_CLOCK_MONOTONIC);
|
||||
|
||||
oc_pump_events(0);
|
||||
oc_event* event = 0;
|
||||
while((event = oc_next_event(oc_scratch())) != 0)
|
||||
while((event = oc_next_event(scratch.arena)) != 0)
|
||||
{
|
||||
oc_input_process_event(&inputState, event);
|
||||
|
||||
|
@ -203,8 +205,8 @@ int main()
|
|||
oc_set_color_rgba(1, 0, 1, 1);
|
||||
oc_clear();
|
||||
|
||||
oc_matrix_push((oc_mat2x3){ zoom, 0, startX,
|
||||
0, zoom, startY });
|
||||
oc_matrix_multiply_push((oc_mat2x3){ zoom, 0, startX,
|
||||
0, zoom, startY });
|
||||
|
||||
draw_tiger(singlePath, singlePathIndex);
|
||||
|
||||
|
@ -222,7 +224,7 @@ int main()
|
|||
oc_set_font_size(12);
|
||||
oc_move_to(50, 600 - 50);
|
||||
|
||||
oc_str8 text = oc_str8_pushf(oc_scratch(),
|
||||
oc_str8 text = oc_str8_pushf(scratch.arena,
|
||||
"Orca vector graphics test program (frame time = %fs, fps = %f)...",
|
||||
frameTime,
|
||||
1. / frameTime);
|
||||
|
@ -237,7 +239,9 @@ int main()
|
|||
oc_surface_present(surface);
|
||||
|
||||
oc_input_next_frame(&inputState);
|
||||
oc_arena_clear(oc_scratch());
|
||||
|
||||
oc_scratch_end(scratch);
|
||||
|
||||
frameTime = oc_clock_time(OC_CLOCK_MONOTONIC) - startTime;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
**************************************************************************/
|
||||
void draw_tiger(bool singlePath, int singlePathIndex)
|
||||
{
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
/************************************************************/ /**
|
||||
/*************************************************************************
|
||||
*
|
||||
* @file: main.cpp
|
||||
* @author: Martin Fouilleul
|
||||
* @date: 30/07/2022
|
||||
* @revision:
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
*****************************************************************/
|
||||
**************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -121,9 +120,10 @@ int main()
|
|||
|
||||
while(!oc_should_quit())
|
||||
{
|
||||
oc_arena_scope scratch = oc_scratch_begin();
|
||||
oc_pump_events(0);
|
||||
oc_event* event = 0;
|
||||
while((event = oc_next_event(oc_scratch())) != 0)
|
||||
while((event = oc_next_event(scratch.arena)) != 0)
|
||||
{
|
||||
switch(event->type)
|
||||
{
|
||||
|
@ -164,7 +164,7 @@ int main()
|
|||
|
||||
oc_surface_present(surface);
|
||||
|
||||
oc_arena_clear(oc_scratch());
|
||||
oc_scratch_end(scratch);
|
||||
}
|
||||
|
||||
oc_terminate();
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
/************************************************************/ /**
|
||||
/*************************************************************************
|
||||
*
|
||||
* @file: main.cpp
|
||||
* @author: Martin Fouilleul
|
||||
* @date: 30/07/2022
|
||||
* @revision:
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
*****************************************************************/
|
||||
**************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -110,9 +109,10 @@ int main()
|
|||
|
||||
while(!oc_should_quit())
|
||||
{
|
||||
oc_arena_scope scratch = oc_scratch_begin();
|
||||
oc_pump_events(0);
|
||||
oc_event* event = 0;
|
||||
while((event = oc_next_event(oc_scratch())) != 0)
|
||||
while((event = oc_next_event(scratch.arena)) != 0)
|
||||
{
|
||||
switch(event->type)
|
||||
{
|
||||
|
@ -151,7 +151,7 @@ int main()
|
|||
|
||||
oc_surface_present(surface);
|
||||
|
||||
oc_arena_clear(oc_scratch());
|
||||
oc_scratch_end(scratch);
|
||||
}
|
||||
|
||||
oc_surface_destroy(surface);
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
/************************************************************/ /**
|
||||
/*************************************************************************
|
||||
*
|
||||
* @file: main.cpp
|
||||
* @author: Martin Fouilleul
|
||||
* @date: 30/07/2022
|
||||
* @revision:
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
*****************************************************************/
|
||||
**************************************************************************/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -37,8 +36,10 @@ int main()
|
|||
//NOTE(martin): load the library
|
||||
id<MTLDevice> device = MTLCreateSystemDefaultDevice();
|
||||
|
||||
oc_str8 shaderPath = oc_path_executable_relative(oc_scratch(), OC_STR8("triangle_shader.metallib"));
|
||||
const char* shaderPathCString = oc_str8_to_cstring(oc_scratch(), shaderPath);
|
||||
oc_arena_scope scratch = oc_scratch_begin();
|
||||
|
||||
oc_str8 shaderPath = oc_path_executable_relative(scratch.arena, OC_STR8("triangle_shader.metallib"));
|
||||
const char* shaderPathCString = oc_str8_to_cstring(scratch.arena, shaderPath);
|
||||
NSString* metalFileName = [[NSString alloc] initWithCString:shaderPathCString encoding:NSUTF8StringEncoding];
|
||||
NSError* err = 0;
|
||||
id<MTLLibrary> library = [device newLibraryWithFile:metalFileName error:&err];
|
||||
|
@ -68,6 +69,7 @@ int main()
|
|||
return (-1);
|
||||
}
|
||||
|
||||
oc_scratch_end(scrathc);
|
||||
// start app
|
||||
|
||||
oc_window_bring_to_front(window);
|
||||
|
@ -75,9 +77,10 @@ int main()
|
|||
|
||||
while(!oc_should_quit())
|
||||
{
|
||||
scratch = oc_scratch_begin();
|
||||
oc_pump_events(0);
|
||||
oc_event* event = 0;
|
||||
while((event = oc_next_event(oc_scratch())) != 0)
|
||||
while((event = oc_next_event(scratch.arena)) != 0)
|
||||
{
|
||||
switch(event->type)
|
||||
{
|
||||
|
@ -90,8 +93,6 @@ int main()
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
oc_arena_clear(oc_scratch());
|
||||
}
|
||||
|
||||
vector_uint2 viewportSize;
|
||||
|
@ -117,6 +118,8 @@ int main()
|
|||
[encoder endEncoding];
|
||||
|
||||
oc_surface_present(surface);
|
||||
|
||||
oc_scratch_end(scratch);
|
||||
}
|
||||
|
||||
oc_terminate();
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include<metal_stdlib>
|
||||
#include<simd/simd.h>
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef __VERTEX_H__
|
||||
#define __VERTEX_H__
|
||||
|
|
Binary file not shown.
Binary file not shown.
1203
sketches/ui/main.c
1203
sketches/ui/main.c
File diff suppressed because it is too large
Load Diff
|
@ -1,11 +1,10 @@
|
|||
/************************************************************/ /**
|
||||
/*************************************************************************
|
||||
*
|
||||
* @file: app.c
|
||||
* @author: Martin Fouilleul
|
||||
* @date: 23/12/2022
|
||||
* @revision:
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
*****************************************************************/
|
||||
**************************************************************************/
|
||||
#include "app_internal.h"
|
||||
#include "platform/platform_debug.h"
|
||||
|
||||
|
@ -110,7 +109,7 @@ void oc_queue_event(oc_event* event)
|
|||
|
||||
if(event->type == OC_EVENT_PATHDROP)
|
||||
{
|
||||
oc_list_for(&event->paths.list, elt, oc_str8_elt, listElt)
|
||||
oc_list_for(event->paths.list, elt, oc_str8_elt, listElt)
|
||||
{
|
||||
oc_str8* path = &elt->string;
|
||||
if(oc_ringbuffer_write_available(queue) < (sizeof(u64) + path->len))
|
||||
|
@ -180,6 +179,23 @@ oc_event* oc_next_event(oc_arena* arena)
|
|||
return (event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// key / scan codes
|
||||
//---------------------------------------------------------------
|
||||
|
||||
oc_key_code oc_scancode_to_keycode(oc_scan_code scanCode)
|
||||
{
|
||||
return (oc_appData.keyMap[scanCode]);
|
||||
}
|
||||
|
||||
#define OC_DEFAULT_KEYMAP_ENTRY(sc, sv, kc, ...) [(int) sc] = OC_VA_NOPT(sv, ##__VA_ARGS__) __VA_ARGS__,
|
||||
|
||||
oc_key_code oc_defaultKeyMap[OC_SCANCODE_COUNT] = {
|
||||
OC_KEY_TABLE(OC_DEFAULT_KEYMAP_ENTRY)
|
||||
};
|
||||
|
||||
#undef OC_DEFAULT_KEYMAP_ENTRY
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// window rects helpers
|
||||
//---------------------------------------------------------------
|
||||
|
|
309
src/app/app.h
309
src/app/app.h
|
@ -1,11 +1,10 @@
|
|||
/************************************************************/ /**
|
||||
/*************************************************************************
|
||||
*
|
||||
* @file: platform_app.h
|
||||
* @author: Martin Fouilleul
|
||||
* @date: 16/05/2020
|
||||
* @revision:
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
*****************************************************************/
|
||||
**************************************************************************/
|
||||
#ifndef __APP_H_
|
||||
#define __APP_H_
|
||||
|
||||
|
@ -13,6 +12,7 @@
|
|||
#include "util/memory.h"
|
||||
#include "util/typedefs.h"
|
||||
#include "util/utf8.h"
|
||||
#include "util/macros.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -37,15 +37,19 @@ typedef enum
|
|||
OC_MOUSE_CURSOR_TEXT
|
||||
} oc_mouse_cursor;
|
||||
|
||||
typedef i32 oc_window_style;
|
||||
static const oc_window_style OC_WINDOW_STYLE_NO_TITLE = 0x01 << 0,
|
||||
OC_WINDOW_STYLE_FIXED_SIZE = 0x01 << 1,
|
||||
OC_WINDOW_STYLE_NO_CLOSE = 0x01 << 2,
|
||||
OC_WINDOW_STYLE_NO_MINIFY = 0x01 << 3,
|
||||
OC_WINDOW_STYLE_NO_FOCUS = 0x01 << 4,
|
||||
OC_WINDOW_STYLE_FLOAT = 0x01 << 5,
|
||||
OC_WINDOW_STYLE_POPUPMENU = 0x01 << 6,
|
||||
OC_WINDOW_STYLE_NO_BUTTONS = 0x01 << 7;
|
||||
typedef u32 oc_window_style;
|
||||
|
||||
enum oc_window_style_enum
|
||||
{
|
||||
OC_WINDOW_STYLE_NO_TITLE = 0x01 << 0,
|
||||
OC_WINDOW_STYLE_FIXED_SIZE = 0x01 << 1,
|
||||
OC_WINDOW_STYLE_NO_CLOSE = 0x01 << 2,
|
||||
OC_WINDOW_STYLE_NO_MINIFY = 0x01 << 3,
|
||||
OC_WINDOW_STYLE_NO_FOCUS = 0x01 << 4,
|
||||
OC_WINDOW_STYLE_FLOAT = 0x01 << 5,
|
||||
OC_WINDOW_STYLE_POPUPMENU = 0x01 << 6,
|
||||
OC_WINDOW_STYLE_NO_BUTTONS = 0x01 << 7
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -58,6 +62,7 @@ typedef enum
|
|||
OC_EVENT_MOUSE_WHEEL,
|
||||
OC_EVENT_MOUSE_ENTER,
|
||||
OC_EVENT_MOUSE_LEAVE,
|
||||
OC_EVENT_CLIPBOARD_PASTE,
|
||||
OC_EVENT_WINDOW_RESIZE,
|
||||
OC_EVENT_WINDOW_MOVE,
|
||||
OC_EVENT_WINDOW_FOCUS,
|
||||
|
@ -78,132 +83,147 @@ typedef enum
|
|||
OC_KEY_REPEAT
|
||||
} oc_key_action;
|
||||
|
||||
#define OC_KEY_TABLE(X) \
|
||||
X(OC_SCANCODE_UNKNOWN, 0, OC_KEY_UNKNOWN, '\0') \
|
||||
X(OC_SCANCODE_SPACE, 32, OC_KEY_SPACE, ' ') \
|
||||
X(OC_SCANCODE_APOSTROPHE, 39, OC_KEY_APOSTROPHE, '\'') \
|
||||
X(OC_SCANCODE_COMMA, 44, OC_KEY_COMMA, ',') \
|
||||
X(OC_SCANCODE_MINUS, 45, OC_KEY_MINUS, '-') \
|
||||
X(OC_SCANCODE_PERIOD, 46, OC_KEY_PERIOD, '.') \
|
||||
X(OC_SCANCODE_SLASH, 47, OC_KEY_SLASH, '/') \
|
||||
X(OC_SCANCODE_0, 48, OC_KEY_0, '0') \
|
||||
X(OC_SCANCODE_1, 49, OC_KEY_1, '1') \
|
||||
X(OC_SCANCODE_2, 50, OC_KEY_2, '2') \
|
||||
X(OC_SCANCODE_3, 51, OC_KEY_3, '3') \
|
||||
X(OC_SCANCODE_4, 52, OC_KEY_4, '4') \
|
||||
X(OC_SCANCODE_5, 53, OC_KEY_5, '5') \
|
||||
X(OC_SCANCODE_6, 54, OC_KEY_6, '6') \
|
||||
X(OC_SCANCODE_7, 55, OC_KEY_7, '7') \
|
||||
X(OC_SCANCODE_8, 56, OC_KEY_8, '8') \
|
||||
X(OC_SCANCODE_9, 57, OC_KEY_9, '9') \
|
||||
X(OC_SCANCODE_SEMICOLON, 59, OC_KEY_SEMICOLON, ';') \
|
||||
X(OC_SCANCODE_EQUAL, 61, OC_KEY_EQUAL, '=') \
|
||||
X(OC_SCANCODE_LEFT_BRACKET, 91, OC_KEY_LEFT_BRACKET, '[') \
|
||||
X(OC_SCANCODE_BACKSLASH, 92, OC_KEY_BACKSLASH, '\\') \
|
||||
X(OC_SCANCODE_RIGHT_BRACKET, 93, OC_KEY_RIGHT_BRACKET, ']') \
|
||||
X(OC_SCANCODE_GRAVE_ACCENT, 96, OC_KEY_GRAVE_ACCENT, '`') \
|
||||
X(OC_SCANCODE_A, 97, OC_KEY_A, 'a') \
|
||||
X(OC_SCANCODE_B, 98, OC_KEY_B, 'b') \
|
||||
X(OC_SCANCODE_C, 99, OC_KEY_C, 'c') \
|
||||
X(OC_SCANCODE_D, 100, OC_KEY_D, 'd') \
|
||||
X(OC_SCANCODE_E, 101, OC_KEY_E, 'e') \
|
||||
X(OC_SCANCODE_F, 102, OC_KEY_F, 'f') \
|
||||
X(OC_SCANCODE_G, 103, OC_KEY_G, 'g') \
|
||||
X(OC_SCANCODE_H, 104, OC_KEY_H, 'h') \
|
||||
X(OC_SCANCODE_I, 105, OC_KEY_I, 'i') \
|
||||
X(OC_SCANCODE_J, 106, OC_KEY_J, 'j') \
|
||||
X(OC_SCANCODE_K, 107, OC_KEY_K, 'k') \
|
||||
X(OC_SCANCODE_L, 108, OC_KEY_L, 'l') \
|
||||
X(OC_SCANCODE_M, 109, OC_KEY_M, 'm') \
|
||||
X(OC_SCANCODE_N, 110, OC_KEY_N, 'n') \
|
||||
X(OC_SCANCODE_O, 111, OC_KEY_O, 'o') \
|
||||
X(OC_SCANCODE_P, 112, OC_KEY_P, 'p') \
|
||||
X(OC_SCANCODE_Q, 113, OC_KEY_Q, 'q') \
|
||||
X(OC_SCANCODE_R, 114, OC_KEY_R, 'r') \
|
||||
X(OC_SCANCODE_S, 115, OC_KEY_S, 's') \
|
||||
X(OC_SCANCODE_T, 116, OC_KEY_T, 't') \
|
||||
X(OC_SCANCODE_U, 117, OC_KEY_U, 'u') \
|
||||
X(OC_SCANCODE_V, 118, OC_KEY_V, 'v') \
|
||||
X(OC_SCANCODE_W, 119, OC_KEY_W, 'w') \
|
||||
X(OC_SCANCODE_X, 120, OC_KEY_X, 'x') \
|
||||
X(OC_SCANCODE_Y, 121, OC_KEY_Y, 'y') \
|
||||
X(OC_SCANCODE_Z, 122, OC_KEY_Z, 'z') \
|
||||
X(OC_SCANCODE_WORLD_1, 161, OC_KEY_WORLD_1) \
|
||||
X(OC_SCANCODE_WORLD_2, 162, OC_KEY_WORLD_2) \
|
||||
X(OC_SCANCODE_ESCAPE, 256, OC_KEY_ESCAPE) \
|
||||
X(OC_SCANCODE_ENTER, 257, OC_KEY_ENTER) \
|
||||
X(OC_SCANCODE_TAB, 258, OC_KEY_TAB) \
|
||||
X(OC_SCANCODE_BACKSPACE, 259, OC_KEY_BACKSPACE) \
|
||||
X(OC_SCANCODE_INSERT, 260, OC_KEY_INSERT) \
|
||||
X(OC_SCANCODE_DELETE, 261, OC_KEY_DELETE) \
|
||||
X(OC_SCANCODE_RIGHT, 262, OC_KEY_RIGHT) \
|
||||
X(OC_SCANCODE_LEFT, 263, OC_KEY_LEFT) \
|
||||
X(OC_SCANCODE_DOWN, 264, OC_KEY_DOWN) \
|
||||
X(OC_SCANCODE_UP, 265, OC_KEY_UP) \
|
||||
X(OC_SCANCODE_PAGE_UP, 266, OC_KEY_PAGE_UP) \
|
||||
X(OC_SCANCODE_PAGE_DOWN, 267, OC_KEY_PAGE_DOWN) \
|
||||
X(OC_SCANCODE_HOME, 268, OC_KEY_HOME) \
|
||||
X(OC_SCANCODE_END, 269, OC_KEY_END) \
|
||||
X(OC_SCANCODE_CAPS_LOCK, 280, OC_KEY_CAPS_LOCK) \
|
||||
X(OC_SCANCODE_SCROLL_LOCK, 281, OC_KEY_SCROLL_LOCK) \
|
||||
X(OC_SCANCODE_NUM_LOCK, 282, OC_KEY_NUM_LOCK) \
|
||||
X(OC_SCANCODE_PRINT_SCREEN, 283, OC_KEY_PRINT_SCREEN) \
|
||||
X(OC_SCANCODE_PAUSE, 284, OC_KEY_PAUSE) \
|
||||
X(OC_SCANCODE_F1, 290, OC_KEY_F1) \
|
||||
X(OC_SCANCODE_F2, 291, OC_KEY_F2) \
|
||||
X(OC_SCANCODE_F3, 292, OC_KEY_F3) \
|
||||
X(OC_SCANCODE_F4, 293, OC_KEY_F4) \
|
||||
X(OC_SCANCODE_F5, 294, OC_KEY_F5) \
|
||||
X(OC_SCANCODE_F6, 295, OC_KEY_F6) \
|
||||
X(OC_SCANCODE_F7, 296, OC_KEY_F7) \
|
||||
X(OC_SCANCODE_F8, 297, OC_KEY_F8) \
|
||||
X(OC_SCANCODE_F9, 298, OC_KEY_F9) \
|
||||
X(OC_SCANCODE_F10, 299, OC_KEY_F10) \
|
||||
X(OC_SCANCODE_F11, 300, OC_KEY_F11) \
|
||||
X(OC_SCANCODE_F12, 301, OC_KEY_F12) \
|
||||
X(OC_SCANCODE_F13, 302, OC_KEY_F13) \
|
||||
X(OC_SCANCODE_F14, 303, OC_KEY_F14) \
|
||||
X(OC_SCANCODE_F15, 304, OC_KEY_F15) \
|
||||
X(OC_SCANCODE_F16, 305, OC_KEY_F16) \
|
||||
X(OC_SCANCODE_F17, 306, OC_KEY_F17) \
|
||||
X(OC_SCANCODE_F18, 307, OC_KEY_F18) \
|
||||
X(OC_SCANCODE_F19, 308, OC_KEY_F19) \
|
||||
X(OC_SCANCODE_F20, 309, OC_KEY_F20) \
|
||||
X(OC_SCANCODE_F21, 310, OC_KEY_F21) \
|
||||
X(OC_SCANCODE_F22, 311, OC_KEY_F22) \
|
||||
X(OC_SCANCODE_F23, 312, OC_KEY_F23) \
|
||||
X(OC_SCANCODE_F24, 313, OC_KEY_F24) \
|
||||
X(OC_SCANCODE_F25, 314, OC_KEY_F25) \
|
||||
X(OC_SCANCODE_KP_0, 320, OC_KEY_KP_0) \
|
||||
X(OC_SCANCODE_KP_1, 321, OC_KEY_KP_1) \
|
||||
X(OC_SCANCODE_KP_2, 322, OC_KEY_KP_2) \
|
||||
X(OC_SCANCODE_KP_3, 323, OC_KEY_KP_3) \
|
||||
X(OC_SCANCODE_KP_4, 324, OC_KEY_KP_4) \
|
||||
X(OC_SCANCODE_KP_5, 325, OC_KEY_KP_5) \
|
||||
X(OC_SCANCODE_KP_6, 326, OC_KEY_KP_6) \
|
||||
X(OC_SCANCODE_KP_7, 327, OC_KEY_KP_7) \
|
||||
X(OC_SCANCODE_KP_8, 328, OC_KEY_KP_8) \
|
||||
X(OC_SCANCODE_KP_9, 329, OC_KEY_KP_9) \
|
||||
X(OC_SCANCODE_KP_DECIMAL, 330, OC_KEY_KP_DECIMAL) \
|
||||
X(OC_SCANCODE_KP_DIVIDE, 331, OC_KEY_KP_DIVIDE) \
|
||||
X(OC_SCANCODE_KP_MULTIPLY, 332, OC_KEY_KP_MULTIPLY) \
|
||||
X(OC_SCANCODE_KP_SUBTRACT, 333, OC_KEY_KP_SUBTRACT) \
|
||||
X(OC_SCANCODE_KP_ADD, 334, OC_KEY_KP_ADD) \
|
||||
X(OC_SCANCODE_KP_ENTER, 335, OC_KEY_KP_ENTER) \
|
||||
X(OC_SCANCODE_KP_EQUAL, 336, OC_KEY_KP_EQUAL) \
|
||||
X(OC_SCANCODE_LEFT_SHIFT, 340, OC_KEY_LEFT_SHIFT) \
|
||||
X(OC_SCANCODE_LEFT_CONTROL, 341, OC_KEY_LEFT_CONTROL) \
|
||||
X(OC_SCANCODE_LEFT_ALT, 342, OC_KEY_LEFT_ALT) \
|
||||
X(OC_SCANCODE_LEFT_SUPER, 343, OC_KEY_LEFT_SUPER) \
|
||||
X(OC_SCANCODE_RIGHT_SHIFT, 344, OC_KEY_RIGHT_SHIFT) \
|
||||
X(OC_SCANCODE_RIGHT_CONTROL, 345, OC_KEY_RIGHT_CONTROL) \
|
||||
X(OC_SCANCODE_RIGHT_ALT, 346, OC_KEY_RIGHT_ALT) \
|
||||
X(OC_SCANCODE_RIGHT_SUPER, 347, OC_KEY_RIGHT_SUPER) \
|
||||
X(OC_SCANCODE_MENU, 348, OC_KEY_MENU)
|
||||
|
||||
#define OC_SCANCODE_ENUM(sc, sv, ...) sc = sv,
|
||||
#define OC_KEYCODE_ENUM(sc, sv, kc, ...) kc = OC_VA_NOPT(sv, ##__VA_ARGS__) __VA_ARGS__,
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OC_KEY_UNKNOWN = 0,
|
||||
OC_KEY_SPACE = 32,
|
||||
OC_KEY_APOSTROPHE = 39, /* ' */
|
||||
OC_KEY_COMMA = 44, /* , */
|
||||
OC_KEY_MINUS = 45, // -
|
||||
OC_KEY_PERIOD = 46, // .
|
||||
OC_KEY_SLASH = 47, // /
|
||||
OC_KEY_0 = 48,
|
||||
OC_KEY_1 = 49,
|
||||
OC_KEY_2 = 50,
|
||||
OC_KEY_3 = 51,
|
||||
OC_KEY_4 = 52,
|
||||
OC_KEY_5 = 53,
|
||||
OC_KEY_6 = 54,
|
||||
OC_KEY_7 = 55,
|
||||
OC_KEY_8 = 56,
|
||||
OC_KEY_9 = 57,
|
||||
OC_KEY_SEMICOLON = 59, // ;
|
||||
OC_KEY_EQUAL = 61, // =
|
||||
OC_KEY_A = 65,
|
||||
OC_KEY_B = 66,
|
||||
OC_KEY_C = 67,
|
||||
OC_KEY_D = 68,
|
||||
OC_KEY_E = 69,
|
||||
OC_KEY_F = 70,
|
||||
OC_KEY_G = 71,
|
||||
OC_KEY_H = 72,
|
||||
OC_KEY_I = 73,
|
||||
OC_KEY_J = 74,
|
||||
OC_KEY_K = 75,
|
||||
OC_KEY_L = 76,
|
||||
OC_KEY_M = 77,
|
||||
OC_KEY_N = 78,
|
||||
OC_KEY_O = 79,
|
||||
OC_KEY_P = 80,
|
||||
OC_KEY_Q = 81,
|
||||
OC_KEY_R = 82,
|
||||
OC_KEY_S = 83,
|
||||
OC_KEY_T = 84,
|
||||
OC_KEY_U = 85,
|
||||
OC_KEY_V = 86,
|
||||
OC_KEY_W = 87,
|
||||
OC_KEY_X = 88,
|
||||
OC_KEY_Y = 89,
|
||||
OC_KEY_Z = 90,
|
||||
OC_KEY_LEFT_BRACKET = 91, // [
|
||||
OC_KEY_BACKSLASH = 92, // \ */
|
||||
OC_KEY_RIGHT_BRACKET = 93, // ]
|
||||
OC_KEY_GRAVE_ACCENT = 96, // `
|
||||
OC_KEY_WORLD_1 = 161, // non-US #1
|
||||
OC_KEY_WORLD_2 = 162, // non-US #2
|
||||
OC_KEY_ESCAPE = 256,
|
||||
OC_KEY_ENTER = 257,
|
||||
OC_KEY_TAB = 258,
|
||||
OC_KEY_BACKSPACE = 259,
|
||||
OC_KEY_INSERT = 260,
|
||||
OC_KEY_DELETE = 261,
|
||||
OC_KEY_RIGHT = 262,
|
||||
OC_KEY_LEFT = 263,
|
||||
OC_KEY_DOWN = 264,
|
||||
OC_KEY_UP = 265,
|
||||
OC_KEY_PAGE_UP = 266,
|
||||
OC_KEY_PAGE_DOWN = 267,
|
||||
OC_KEY_HOME = 268,
|
||||
OC_KEY_END = 269,
|
||||
OC_KEY_CAPS_LOCK = 280,
|
||||
OC_KEY_SCROLL_LOCK = 281,
|
||||
OC_KEY_NUM_LOCK = 282,
|
||||
OC_KEY_PRINT_SCREEN = 283,
|
||||
OC_KEY_PAUSE = 284,
|
||||
OC_KEY_F1 = 290,
|
||||
OC_KEY_F2 = 291,
|
||||
OC_KEY_F3 = 292,
|
||||
OC_KEY_F4 = 293,
|
||||
OC_KEY_F5 = 294,
|
||||
OC_KEY_F6 = 295,
|
||||
OC_KEY_F7 = 296,
|
||||
OC_KEY_F8 = 297,
|
||||
OC_KEY_F9 = 298,
|
||||
OC_KEY_F10 = 299,
|
||||
OC_KEY_F11 = 300,
|
||||
OC_KEY_F12 = 301,
|
||||
OC_KEY_F13 = 302,
|
||||
OC_KEY_F14 = 303,
|
||||
OC_KEY_F15 = 304,
|
||||
OC_KEY_F16 = 305,
|
||||
OC_KEY_F17 = 306,
|
||||
OC_KEY_F18 = 307,
|
||||
OC_KEY_F19 = 308,
|
||||
OC_KEY_F20 = 309,
|
||||
OC_KEY_F21 = 310,
|
||||
OC_KEY_F22 = 311,
|
||||
OC_KEY_F23 = 312,
|
||||
OC_KEY_F24 = 313,
|
||||
OC_KEY_F25 = 314,
|
||||
OC_KEY_KP_0 = 320,
|
||||
OC_KEY_KP_1 = 321,
|
||||
OC_KEY_KP_2 = 322,
|
||||
OC_KEY_KP_3 = 323,
|
||||
OC_KEY_KP_4 = 324,
|
||||
OC_KEY_KP_5 = 325,
|
||||
OC_KEY_KP_6 = 326,
|
||||
OC_KEY_KP_7 = 327,
|
||||
OC_KEY_KP_8 = 328,
|
||||
OC_KEY_KP_9 = 329,
|
||||
OC_KEY_KP_DECIMAL = 330,
|
||||
OC_KEY_KP_DIVIDE = 331,
|
||||
OC_KEY_KP_MULTIPLY = 332,
|
||||
OC_KEY_KP_SUBTRACT = 333,
|
||||
OC_KEY_KP_ADD = 334,
|
||||
OC_KEY_KP_ENTER = 335,
|
||||
OC_KEY_KP_EQUAL = 336,
|
||||
OC_KEY_LEFT_SHIFT = 340,
|
||||
OC_KEY_LEFT_CONTROL = 341,
|
||||
OC_KEY_LEFT_ALT = 342,
|
||||
OC_KEY_LEFT_SUPER = 343,
|
||||
OC_KEY_RIGHT_SHIFT = 344,
|
||||
OC_KEY_RIGHT_CONTROL = 345,
|
||||
OC_KEY_RIGHT_ALT = 346,
|
||||
OC_KEY_RIGHT_SUPER = 347,
|
||||
OC_KEY_MENU = 348,
|
||||
OC_KEY_COUNT
|
||||
OC_KEY_TABLE(OC_SCANCODE_ENUM)
|
||||
OC_SCANCODE_COUNT
|
||||
} oc_scan_code;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OC_KEY_TABLE(OC_KEYCODE_ENUM)
|
||||
OC_KEY_COUNT
|
||||
} oc_key_code;
|
||||
|
||||
#undef OC_SCANCODE_ENUM
|
||||
#undef OC_KEYCODE_ENUM
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OC_KEYMOD_NONE = 0x00,
|
||||
|
@ -227,11 +247,11 @@ typedef enum
|
|||
typedef struct oc_key_event // keyboard and mouse buttons input
|
||||
{
|
||||
oc_key_action action;
|
||||
i32 code;
|
||||
oc_scan_code scanCode;
|
||||
oc_key_code keyCode;
|
||||
oc_mouse_button button;
|
||||
oc_keymod_flags mods;
|
||||
char label[8];
|
||||
u8 labelLen;
|
||||
int clickCount;
|
||||
u8 clickCount;
|
||||
} oc_key_event;
|
||||
|
||||
typedef struct oc_char_event // character input
|
||||
|
@ -283,7 +303,6 @@ ORCA_API void oc_init(void);
|
|||
ORCA_API void oc_terminate(void);
|
||||
|
||||
ORCA_API bool oc_should_quit(void);
|
||||
ORCA_API void oc_cancel_quit(void);
|
||||
ORCA_API void oc_request_quit(void);
|
||||
|
||||
ORCA_API void oc_set_cursor(oc_mouse_cursor cursor);
|
||||
|
@ -301,8 +320,7 @@ ORCA_API void oc_set_cursor(oc_mouse_cursor cursor);
|
|||
ORCA_API void oc_pump_events(f64 timeout);
|
||||
ORCA_API oc_event* oc_next_event(oc_arena* arena);
|
||||
|
||||
typedef void (*oc_live_resize_callback)(oc_event event, void* data);
|
||||
ORCA_API void oc_set_live_resize_callback(oc_live_resize_callback callback, void* data);
|
||||
ORCA_API oc_key_code oc_scancode_to_keycode(oc_scan_code scanCode);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// window management
|
||||
|
@ -461,6 +479,9 @@ void oc_window_set_title(oc_str8 title);
|
|||
void oc_window_set_size(oc_vec2 size);
|
||||
|
||||
void ORCA_IMPORT(oc_request_quit)(void);
|
||||
oc_key_code ORCA_IMPORT(oc_scancode_to_keycode)(oc_scan_code scanCode);
|
||||
|
||||
void oc_clipboard_set_string(oc_str8 string);
|
||||
|
||||
#endif // !defined(OC_PLATFORM_ORCA) || !(OC_PLATFORM_ORCA)
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
/************************************************************/ /**
|
||||
/*************************************************************************
|
||||
*
|
||||
* @file: app_internal.h
|
||||
* @author: Martin Fouilleul
|
||||
* @date: 23/12/2022
|
||||
* @revision:
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
*****************************************************************/
|
||||
**************************************************************************/
|
||||
#ifndef __APP_INTERNAL_H_
|
||||
#define __APP_INTERNAL_H_
|
||||
|
||||
|
@ -53,12 +52,6 @@ typedef struct oc_window_data
|
|||
// Global App State
|
||||
//---------------------------------------------------------------
|
||||
|
||||
typedef struct oc_key_utf8
|
||||
{
|
||||
u8 labelLen;
|
||||
char label[8];
|
||||
} oc_key_utf8;
|
||||
|
||||
enum
|
||||
{
|
||||
OC_APP_MAX_WINDOWS = 128
|
||||
|
@ -80,14 +73,12 @@ typedef struct oc_app
|
|||
oc_window_data windowPool[OC_APP_MAX_WINDOWS];
|
||||
oc_list windowFreeList;
|
||||
|
||||
oc_live_resize_callback liveResizeCallback;
|
||||
void* liveResizeData;
|
||||
|
||||
oc_key_utf8 keyLabels[512];
|
||||
int keyCodes[512];
|
||||
int nativeKeys[OC_KEY_COUNT];
|
||||
oc_scan_code scanCodes[OC_SCANCODE_COUNT]; // native virtual key code to oc_scan_code
|
||||
oc_key_code keyMap[OC_SCANCODE_COUNT]; // oc_scan_code to oc_key_code, as per current keyboard layout
|
||||
|
||||
OC_PLATFORM_APP_DATA
|
||||
} oc_app;
|
||||
|
||||
extern oc_key_code oc_defaultKeyMap[OC_SCANCODE_COUNT];
|
||||
|
||||
#endif // __APP_INTERNAL_H_
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
/*************************************************************************
|
||||
*
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
**************************************************************************/
|
||||
#include "orca.h"
|
||||
|
||||
//This is used to pass raw events from the runtime
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
/************************************************************/ /**
|
||||
/*************************************************************************
|
||||
*
|
||||
* @file: osx_app.h
|
||||
* @author: Martin Fouilleul
|
||||
* @date: 12/02/2021
|
||||
* @revision:
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
*****************************************************************/
|
||||
**************************************************************************/
|
||||
#ifndef __OSX_APP_H_
|
||||
#define __OSX_APP_H_
|
||||
|
||||
|
@ -44,9 +43,6 @@ typedef struct oc_osx_app_data
|
|||
{
|
||||
NSTimer* frameTimer;
|
||||
NSCursor* cursor;
|
||||
|
||||
TISInputSourceRef kbLayoutInputSource;
|
||||
void* kbLayoutUnicodeData;
|
||||
id kbLayoutListener;
|
||||
|
||||
} oc_osx_app_data;
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
//*****************************************************************
|
||||
//
|
||||
// $file: osx_app.m $
|
||||
// $author: Martin Fouilleul $
|
||||
// $date: 16/05/2020 $
|
||||
// $revision: $
|
||||
// $note: (C) 2020 by Martin Fouilleul - all rights reserved $
|
||||
//
|
||||
//*****************************************************************
|
||||
/*************************************************************************
|
||||
*
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#import <QuartzCore/QuartzCore.h> //CATransaction
|
||||
|
||||
|
@ -57,143 +55,133 @@ static u32 oc_osx_get_window_style_mask(oc_window_style style)
|
|||
|
||||
static void oc_init_osx_keys()
|
||||
{
|
||||
memset(oc_appData.keyCodes, OC_KEY_UNKNOWN, 256 * sizeof(int));
|
||||
memset(oc_appData.scanCodes, OC_SCANCODE_UNKNOWN, 256 * sizeof(int));
|
||||
|
||||
oc_appData.keyCodes[0x1D] = OC_KEY_0;
|
||||
oc_appData.keyCodes[0x12] = OC_KEY_1;
|
||||
oc_appData.keyCodes[0x13] = OC_KEY_2;
|
||||
oc_appData.keyCodes[0x14] = OC_KEY_3;
|
||||
oc_appData.keyCodes[0x15] = OC_KEY_4;
|
||||
oc_appData.keyCodes[0x17] = OC_KEY_5;
|
||||
oc_appData.keyCodes[0x16] = OC_KEY_6;
|
||||
oc_appData.keyCodes[0x1A] = OC_KEY_7;
|
||||
oc_appData.keyCodes[0x1C] = OC_KEY_8;
|
||||
oc_appData.keyCodes[0x19] = OC_KEY_9;
|
||||
oc_appData.keyCodes[0x00] = OC_KEY_A;
|
||||
oc_appData.keyCodes[0x0B] = OC_KEY_B;
|
||||
oc_appData.keyCodes[0x08] = OC_KEY_C;
|
||||
oc_appData.keyCodes[0x02] = OC_KEY_D;
|
||||
oc_appData.keyCodes[0x0E] = OC_KEY_E;
|
||||
oc_appData.keyCodes[0x03] = OC_KEY_F;
|
||||
oc_appData.keyCodes[0x05] = OC_KEY_G;
|
||||
oc_appData.keyCodes[0x04] = OC_KEY_H;
|
||||
oc_appData.keyCodes[0x22] = OC_KEY_I;
|
||||
oc_appData.keyCodes[0x26] = OC_KEY_J;
|
||||
oc_appData.keyCodes[0x28] = OC_KEY_K;
|
||||
oc_appData.keyCodes[0x25] = OC_KEY_L;
|
||||
oc_appData.keyCodes[0x2E] = OC_KEY_M;
|
||||
oc_appData.keyCodes[0x2D] = OC_KEY_N;
|
||||
oc_appData.keyCodes[0x1F] = OC_KEY_O;
|
||||
oc_appData.keyCodes[0x23] = OC_KEY_P;
|
||||
oc_appData.keyCodes[0x0C] = OC_KEY_Q;
|
||||
oc_appData.keyCodes[0x0F] = OC_KEY_R;
|
||||
oc_appData.keyCodes[0x01] = OC_KEY_S;
|
||||
oc_appData.keyCodes[0x11] = OC_KEY_T;
|
||||
oc_appData.keyCodes[0x20] = OC_KEY_U;
|
||||
oc_appData.keyCodes[0x09] = OC_KEY_V;
|
||||
oc_appData.keyCodes[0x0D] = OC_KEY_W;
|
||||
oc_appData.keyCodes[0x07] = OC_KEY_X;
|
||||
oc_appData.keyCodes[0x10] = OC_KEY_Y;
|
||||
oc_appData.keyCodes[0x06] = OC_KEY_Z;
|
||||
oc_appData.scanCodes[0x1D] = OC_SCANCODE_0;
|
||||
oc_appData.scanCodes[0x12] = OC_SCANCODE_1;
|
||||
oc_appData.scanCodes[0x13] = OC_SCANCODE_2;
|
||||
oc_appData.scanCodes[0x14] = OC_SCANCODE_3;
|
||||
oc_appData.scanCodes[0x15] = OC_SCANCODE_4;
|
||||
oc_appData.scanCodes[0x17] = OC_SCANCODE_5;
|
||||
oc_appData.scanCodes[0x16] = OC_SCANCODE_6;
|
||||
oc_appData.scanCodes[0x1A] = OC_SCANCODE_7;
|
||||
oc_appData.scanCodes[0x1C] = OC_SCANCODE_8;
|
||||
oc_appData.scanCodes[0x19] = OC_SCANCODE_9;
|
||||
oc_appData.scanCodes[0x00] = OC_SCANCODE_A;
|
||||
oc_appData.scanCodes[0x0B] = OC_SCANCODE_B;
|
||||
oc_appData.scanCodes[0x08] = OC_SCANCODE_C;
|
||||
oc_appData.scanCodes[0x02] = OC_SCANCODE_D;
|
||||
oc_appData.scanCodes[0x0E] = OC_SCANCODE_E;
|
||||
oc_appData.scanCodes[0x03] = OC_SCANCODE_F;
|
||||
oc_appData.scanCodes[0x05] = OC_SCANCODE_G;
|
||||
oc_appData.scanCodes[0x04] = OC_SCANCODE_H;
|
||||
oc_appData.scanCodes[0x22] = OC_SCANCODE_I;
|
||||
oc_appData.scanCodes[0x26] = OC_SCANCODE_J;
|
||||
oc_appData.scanCodes[0x28] = OC_SCANCODE_K;
|
||||
oc_appData.scanCodes[0x25] = OC_SCANCODE_L;
|
||||
oc_appData.scanCodes[0x2E] = OC_SCANCODE_M;
|
||||
oc_appData.scanCodes[0x2D] = OC_SCANCODE_N;
|
||||
oc_appData.scanCodes[0x1F] = OC_SCANCODE_O;
|
||||
oc_appData.scanCodes[0x23] = OC_SCANCODE_P;
|
||||
oc_appData.scanCodes[0x0C] = OC_SCANCODE_Q;
|
||||
oc_appData.scanCodes[0x0F] = OC_SCANCODE_R;
|
||||
oc_appData.scanCodes[0x01] = OC_SCANCODE_S;
|
||||
oc_appData.scanCodes[0x11] = OC_SCANCODE_T;
|
||||
oc_appData.scanCodes[0x20] = OC_SCANCODE_U;
|
||||
oc_appData.scanCodes[0x09] = OC_SCANCODE_V;
|
||||
oc_appData.scanCodes[0x0D] = OC_SCANCODE_W;
|
||||
oc_appData.scanCodes[0x07] = OC_SCANCODE_X;
|
||||
oc_appData.scanCodes[0x10] = OC_SCANCODE_Y;
|
||||
oc_appData.scanCodes[0x06] = OC_SCANCODE_Z;
|
||||
|
||||
oc_appData.keyCodes[0x27] = OC_KEY_APOSTROPHE;
|
||||
oc_appData.keyCodes[0x2A] = OC_KEY_BACKSLASH;
|
||||
oc_appData.keyCodes[0x2B] = OC_KEY_COMMA;
|
||||
oc_appData.keyCodes[0x18] = OC_KEY_EQUAL;
|
||||
oc_appData.keyCodes[0x32] = OC_KEY_GRAVE_ACCENT;
|
||||
oc_appData.keyCodes[0x21] = OC_KEY_LEFT_BRACKET;
|
||||
oc_appData.keyCodes[0x1B] = OC_KEY_MINUS;
|
||||
oc_appData.keyCodes[0x2F] = OC_KEY_PERIOD;
|
||||
oc_appData.keyCodes[0x1E] = OC_KEY_RIGHT_BRACKET;
|
||||
oc_appData.keyCodes[0x29] = OC_KEY_SEMICOLON;
|
||||
oc_appData.keyCodes[0x2C] = OC_KEY_SLASH;
|
||||
oc_appData.keyCodes[0x0A] = OC_KEY_WORLD_1;
|
||||
oc_appData.scanCodes[0x27] = OC_SCANCODE_APOSTROPHE;
|
||||
oc_appData.scanCodes[0x2A] = OC_SCANCODE_BACKSLASH;
|
||||
oc_appData.scanCodes[0x2B] = OC_SCANCODE_COMMA;
|
||||
oc_appData.scanCodes[0x18] = OC_SCANCODE_EQUAL;
|
||||
oc_appData.scanCodes[0x32] = OC_SCANCODE_GRAVE_ACCENT;
|
||||
oc_appData.scanCodes[0x21] = OC_SCANCODE_LEFT_BRACKET;
|
||||
oc_appData.scanCodes[0x1B] = OC_SCANCODE_MINUS;
|
||||
oc_appData.scanCodes[0x2F] = OC_SCANCODE_PERIOD;
|
||||
oc_appData.scanCodes[0x1E] = OC_SCANCODE_RIGHT_BRACKET;
|
||||
oc_appData.scanCodes[0x29] = OC_SCANCODE_SEMICOLON;
|
||||
oc_appData.scanCodes[0x2C] = OC_SCANCODE_SLASH;
|
||||
oc_appData.scanCodes[0x0A] = OC_SCANCODE_WORLD_1;
|
||||
|
||||
oc_appData.keyCodes[0x33] = OC_KEY_BACKSPACE;
|
||||
oc_appData.keyCodes[0x39] = OC_KEY_CAPS_LOCK;
|
||||
oc_appData.keyCodes[0x75] = OC_KEY_DELETE;
|
||||
oc_appData.keyCodes[0x7D] = OC_KEY_DOWN;
|
||||
oc_appData.keyCodes[0x77] = OC_KEY_END;
|
||||
oc_appData.keyCodes[0x24] = OC_KEY_ENTER;
|
||||
oc_appData.keyCodes[0x35] = OC_KEY_ESCAPE;
|
||||
oc_appData.keyCodes[0x7A] = OC_KEY_F1;
|
||||
oc_appData.keyCodes[0x78] = OC_KEY_F2;
|
||||
oc_appData.keyCodes[0x63] = OC_KEY_F3;
|
||||
oc_appData.keyCodes[0x76] = OC_KEY_F4;
|
||||
oc_appData.keyCodes[0x60] = OC_KEY_F5;
|
||||
oc_appData.keyCodes[0x61] = OC_KEY_F6;
|
||||
oc_appData.keyCodes[0x62] = OC_KEY_F7;
|
||||
oc_appData.keyCodes[0x64] = OC_KEY_F8;
|
||||
oc_appData.keyCodes[0x65] = OC_KEY_F9;
|
||||
oc_appData.keyCodes[0x6D] = OC_KEY_F10;
|
||||
oc_appData.keyCodes[0x67] = OC_KEY_F11;
|
||||
oc_appData.keyCodes[0x6F] = OC_KEY_F12;
|
||||
oc_appData.keyCodes[0x69] = OC_KEY_F13;
|
||||
oc_appData.keyCodes[0x6B] = OC_KEY_F14;
|
||||
oc_appData.keyCodes[0x71] = OC_KEY_F15;
|
||||
oc_appData.keyCodes[0x6A] = OC_KEY_F16;
|
||||
oc_appData.keyCodes[0x40] = OC_KEY_F17;
|
||||
oc_appData.keyCodes[0x4F] = OC_KEY_F18;
|
||||
oc_appData.keyCodes[0x50] = OC_KEY_F19;
|
||||
oc_appData.keyCodes[0x5A] = OC_KEY_F20;
|
||||
oc_appData.keyCodes[0x73] = OC_KEY_HOME;
|
||||
oc_appData.keyCodes[0x72] = OC_KEY_INSERT;
|
||||
oc_appData.keyCodes[0x7B] = OC_KEY_LEFT;
|
||||
oc_appData.keyCodes[0x3A] = OC_KEY_LEFT_ALT;
|
||||
oc_appData.keyCodes[0x3B] = OC_KEY_LEFT_CONTROL;
|
||||
oc_appData.keyCodes[0x38] = OC_KEY_LEFT_SHIFT;
|
||||
oc_appData.keyCodes[0x37] = OC_KEY_LEFT_SUPER;
|
||||
oc_appData.keyCodes[0x6E] = OC_KEY_MENU;
|
||||
oc_appData.keyCodes[0x47] = OC_KEY_NUM_LOCK;
|
||||
oc_appData.keyCodes[0x79] = OC_KEY_PAGE_DOWN;
|
||||
oc_appData.keyCodes[0x74] = OC_KEY_PAGE_UP;
|
||||
oc_appData.keyCodes[0x7C] = OC_KEY_RIGHT;
|
||||
oc_appData.keyCodes[0x3D] = OC_KEY_RIGHT_ALT;
|
||||
oc_appData.keyCodes[0x3E] = OC_KEY_RIGHT_CONTROL;
|
||||
oc_appData.keyCodes[0x3C] = OC_KEY_RIGHT_SHIFT;
|
||||
oc_appData.keyCodes[0x36] = OC_KEY_RIGHT_SUPER;
|
||||
oc_appData.keyCodes[0x31] = OC_KEY_SPACE;
|
||||
oc_appData.keyCodes[0x30] = OC_KEY_TAB;
|
||||
oc_appData.keyCodes[0x7E] = OC_KEY_UP;
|
||||
oc_appData.scanCodes[0x33] = OC_SCANCODE_BACKSPACE;
|
||||
oc_appData.scanCodes[0x39] = OC_SCANCODE_CAPS_LOCK;
|
||||
oc_appData.scanCodes[0x75] = OC_SCANCODE_DELETE;
|
||||
oc_appData.scanCodes[0x7D] = OC_SCANCODE_DOWN;
|
||||
oc_appData.scanCodes[0x77] = OC_SCANCODE_END;
|
||||
oc_appData.scanCodes[0x24] = OC_SCANCODE_ENTER;
|
||||
oc_appData.scanCodes[0x35] = OC_SCANCODE_ESCAPE;
|
||||
oc_appData.scanCodes[0x7A] = OC_SCANCODE_F1;
|
||||
oc_appData.scanCodes[0x78] = OC_SCANCODE_F2;
|
||||
oc_appData.scanCodes[0x63] = OC_SCANCODE_F3;
|
||||
oc_appData.scanCodes[0x76] = OC_SCANCODE_F4;
|
||||
oc_appData.scanCodes[0x60] = OC_SCANCODE_F5;
|
||||
oc_appData.scanCodes[0x61] = OC_SCANCODE_F6;
|
||||
oc_appData.scanCodes[0x62] = OC_SCANCODE_F7;
|
||||
oc_appData.scanCodes[0x64] = OC_SCANCODE_F8;
|
||||
oc_appData.scanCodes[0x65] = OC_SCANCODE_F9;
|
||||
oc_appData.scanCodes[0x6D] = OC_SCANCODE_F10;
|
||||
oc_appData.scanCodes[0x67] = OC_SCANCODE_F11;
|
||||
oc_appData.scanCodes[0x6F] = OC_SCANCODE_F12;
|
||||
oc_appData.scanCodes[0x69] = OC_SCANCODE_F13;
|
||||
oc_appData.scanCodes[0x6B] = OC_SCANCODE_F14;
|
||||
oc_appData.scanCodes[0x71] = OC_SCANCODE_F15;
|
||||
oc_appData.scanCodes[0x6A] = OC_SCANCODE_F16;
|
||||
oc_appData.scanCodes[0x40] = OC_SCANCODE_F17;
|
||||
oc_appData.scanCodes[0x4F] = OC_SCANCODE_F18;
|
||||
oc_appData.scanCodes[0x50] = OC_SCANCODE_F19;
|
||||
oc_appData.scanCodes[0x5A] = OC_SCANCODE_F20;
|
||||
oc_appData.scanCodes[0x73] = OC_SCANCODE_HOME;
|
||||
oc_appData.scanCodes[0x72] = OC_SCANCODE_INSERT;
|
||||
oc_appData.scanCodes[0x7B] = OC_SCANCODE_LEFT;
|
||||
oc_appData.scanCodes[0x3A] = OC_SCANCODE_LEFT_ALT;
|
||||
oc_appData.scanCodes[0x3B] = OC_SCANCODE_LEFT_CONTROL;
|
||||
oc_appData.scanCodes[0x38] = OC_SCANCODE_LEFT_SHIFT;
|
||||
oc_appData.scanCodes[0x37] = OC_SCANCODE_LEFT_SUPER;
|
||||
oc_appData.scanCodes[0x6E] = OC_SCANCODE_MENU;
|
||||
oc_appData.scanCodes[0x47] = OC_SCANCODE_NUM_LOCK;
|
||||
oc_appData.scanCodes[0x79] = OC_SCANCODE_PAGE_DOWN;
|
||||
oc_appData.scanCodes[0x74] = OC_SCANCODE_PAGE_UP;
|
||||
oc_appData.scanCodes[0x7C] = OC_SCANCODE_RIGHT;
|
||||
oc_appData.scanCodes[0x3D] = OC_SCANCODE_RIGHT_ALT;
|
||||
oc_appData.scanCodes[0x3E] = OC_SCANCODE_RIGHT_CONTROL;
|
||||
oc_appData.scanCodes[0x3C] = OC_SCANCODE_RIGHT_SHIFT;
|
||||
oc_appData.scanCodes[0x36] = OC_SCANCODE_RIGHT_SUPER;
|
||||
oc_appData.scanCodes[0x31] = OC_SCANCODE_SPACE;
|
||||
oc_appData.scanCodes[0x30] = OC_SCANCODE_TAB;
|
||||
oc_appData.scanCodes[0x7E] = OC_SCANCODE_UP;
|
||||
|
||||
oc_appData.keyCodes[0x52] = OC_KEY_KP_0;
|
||||
oc_appData.keyCodes[0x53] = OC_KEY_KP_1;
|
||||
oc_appData.keyCodes[0x54] = OC_KEY_KP_2;
|
||||
oc_appData.keyCodes[0x55] = OC_KEY_KP_3;
|
||||
oc_appData.keyCodes[0x56] = OC_KEY_KP_4;
|
||||
oc_appData.keyCodes[0x57] = OC_KEY_KP_5;
|
||||
oc_appData.keyCodes[0x58] = OC_KEY_KP_6;
|
||||
oc_appData.keyCodes[0x59] = OC_KEY_KP_7;
|
||||
oc_appData.keyCodes[0x5B] = OC_KEY_KP_8;
|
||||
oc_appData.keyCodes[0x5C] = OC_KEY_KP_9;
|
||||
oc_appData.keyCodes[0x45] = OC_KEY_KP_ADD;
|
||||
oc_appData.keyCodes[0x41] = OC_KEY_KP_DECIMAL;
|
||||
oc_appData.keyCodes[0x4B] = OC_KEY_KP_DIVIDE;
|
||||
oc_appData.keyCodes[0x4C] = OC_KEY_KP_ENTER;
|
||||
oc_appData.keyCodes[0x51] = OC_KEY_KP_EQUAL;
|
||||
oc_appData.keyCodes[0x43] = OC_KEY_KP_MULTIPLY;
|
||||
oc_appData.keyCodes[0x4E] = OC_KEY_KP_SUBTRACT;
|
||||
|
||||
memset(oc_appData.nativeKeys, 0, sizeof(int) * OC_KEY_COUNT);
|
||||
for(int nativeKey = 0; nativeKey < 256; nativeKey++)
|
||||
{
|
||||
oc_key_code mpKey = oc_appData.keyCodes[nativeKey];
|
||||
if(mpKey)
|
||||
{
|
||||
oc_appData.nativeKeys[mpKey] = nativeKey;
|
||||
}
|
||||
}
|
||||
oc_appData.scanCodes[0x52] = OC_SCANCODE_KP_0;
|
||||
oc_appData.scanCodes[0x53] = OC_SCANCODE_KP_1;
|
||||
oc_appData.scanCodes[0x54] = OC_SCANCODE_KP_2;
|
||||
oc_appData.scanCodes[0x55] = OC_SCANCODE_KP_3;
|
||||
oc_appData.scanCodes[0x56] = OC_SCANCODE_KP_4;
|
||||
oc_appData.scanCodes[0x57] = OC_SCANCODE_KP_5;
|
||||
oc_appData.scanCodes[0x58] = OC_SCANCODE_KP_6;
|
||||
oc_appData.scanCodes[0x59] = OC_SCANCODE_KP_7;
|
||||
oc_appData.scanCodes[0x5B] = OC_SCANCODE_KP_8;
|
||||
oc_appData.scanCodes[0x5C] = OC_SCANCODE_KP_9;
|
||||
oc_appData.scanCodes[0x45] = OC_SCANCODE_KP_ADD;
|
||||
oc_appData.scanCodes[0x41] = OC_SCANCODE_KP_DECIMAL;
|
||||
oc_appData.scanCodes[0x4B] = OC_SCANCODE_KP_DIVIDE;
|
||||
oc_appData.scanCodes[0x4C] = OC_SCANCODE_KP_ENTER;
|
||||
oc_appData.scanCodes[0x51] = OC_SCANCODE_KP_EQUAL;
|
||||
oc_appData.scanCodes[0x43] = OC_SCANCODE_KP_MULTIPLY;
|
||||
oc_appData.scanCodes[0x4E] = OC_SCANCODE_KP_SUBTRACT;
|
||||
}
|
||||
|
||||
static int oc_convert_osx_key(unsigned short nsCode)
|
||||
{
|
||||
if(nsCode >= 265)
|
||||
if(nsCode >= OC_SCANCODE_COUNT)
|
||||
{
|
||||
return (OC_KEY_UNKNOWN);
|
||||
return (OC_SCANCODE_UNKNOWN);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (oc_appData.keyCodes[nsCode]);
|
||||
return (oc_appData.scanCodes[nsCode]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -220,64 +208,91 @@ static oc_keymod_flags oc_convert_osx_mods(NSUInteger nsFlags)
|
|||
return (mods);
|
||||
}
|
||||
|
||||
/////////////////////// WIP ////////////////////////////////////
|
||||
static void oc_update_keyboard_layout()
|
||||
{
|
||||
if(oc_appData.osx.kbLayoutInputSource)
|
||||
@autoreleasepool
|
||||
{
|
||||
CFRelease(oc_appData.osx.kbLayoutInputSource);
|
||||
oc_appData.osx.kbLayoutInputSource = 0;
|
||||
oc_appData.osx.kbLayoutUnicodeData = nil;
|
||||
}
|
||||
|
||||
oc_appData.osx.kbLayoutInputSource = TISCopyCurrentKeyboardLayoutInputSource();
|
||||
if(!oc_appData.osx.kbLayoutInputSource)
|
||||
{
|
||||
oc_log_error("Failed to load keyboard layout input source");
|
||||
}
|
||||
|
||||
oc_appData.osx.kbLayoutUnicodeData = TISGetInputSourceProperty(oc_appData.osx.kbLayoutInputSource,
|
||||
kTISPropertyUnicodeKeyLayoutData);
|
||||
if(!oc_appData.osx.kbLayoutUnicodeData)
|
||||
{
|
||||
oc_log_error("Failed to load keyboard layout unicode data");
|
||||
}
|
||||
|
||||
memset(oc_appData.keyLabels, 0, sizeof(oc_key_utf8) * OC_KEY_COUNT);
|
||||
|
||||
for(int key = 0; key < OC_KEY_COUNT; key++)
|
||||
{
|
||||
//TODO: check that the key is printable
|
||||
int nativeKey = oc_appData.nativeKeys[key];
|
||||
|
||||
UInt32 deadKeyState = 0;
|
||||
UniChar characters[4];
|
||||
UniCharCount characterCount = 0;
|
||||
|
||||
if(UCKeyTranslate((UCKeyboardLayout*)[(NSData*)oc_appData.osx.kbLayoutUnicodeData bytes],
|
||||
nativeKey,
|
||||
kUCKeyActionDisplay,
|
||||
0,
|
||||
LMGetKbdType(),
|
||||
kUCKeyTranslateNoDeadKeysBit,
|
||||
&deadKeyState,
|
||||
sizeof(characters) / sizeof(UniChar),
|
||||
&characterCount,
|
||||
characters)
|
||||
!= noErr)
|
||||
TISInputSourceRef kbLayoutInputSource = TISCopyCurrentKeyboardLayoutInputSource();
|
||||
if(!kbLayoutInputSource)
|
||||
{
|
||||
oc_appData.keyLabels[key].labelLen = 0;
|
||||
oc_log_error("Failed to load keyboard layout\n");
|
||||
goto end;
|
||||
}
|
||||
else
|
||||
|
||||
CFDataRef kbLayoutUnicodeData = TISGetInputSourceProperty(kbLayoutInputSource,
|
||||
kTISPropertyUnicodeKeyLayoutData);
|
||||
if(!kbLayoutUnicodeData)
|
||||
{
|
||||
NSString* nsString = [[NSString alloc] initWithCharacters:characters length:characterCount];
|
||||
const char* cstring = [nsString UTF8String];
|
||||
u32 len = strlen(cstring);
|
||||
oc_appData.keyLabels[key].labelLen = oc_min(len, 8);
|
||||
memcpy(oc_appData.keyLabels[key].label, cstring, oc_appData.keyLabels[key].labelLen);
|
||||
oc_log_error("Failed to load keyboard layout\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
UCKeyboardLayout* kbdLayout = (UCKeyboardLayout*)[(NSData*)kbLayoutUnicodeData bytes];
|
||||
UInt32 kbdType = LMGetKbdType();
|
||||
|
||||
//NOTE: default US layout
|
||||
memcpy(oc_appData.keyMap, oc_defaultKeyMap, sizeof(oc_key_code) * OC_SCANCODE_COUNT);
|
||||
|
||||
for(int osxCode = 0; osxCode < OC_SCANCODE_COUNT; osxCode++)
|
||||
{
|
||||
oc_key_code keyCode = OC_KEY_UNKNOWN;
|
||||
oc_scan_code scanCode = oc_appData.scanCodes[osxCode];
|
||||
|
||||
if(scanCode == OC_SCANCODE_ENTER)
|
||||
{
|
||||
oc_log_info("scan code enter\n");
|
||||
}
|
||||
|
||||
if(scanCode != OC_SCANCODE_UNKNOWN && scanCode < 256)
|
||||
{
|
||||
UInt32 deadKeyState = 0;
|
||||
UniChar characters[8];
|
||||
UniCharCount characterCount = 0;
|
||||
|
||||
OSStatus status = UCKeyTranslate(kbdLayout,
|
||||
osxCode,
|
||||
kUCKeyActionDown,
|
||||
0,
|
||||
kbdType,
|
||||
kUCKeyTranslateNoDeadKeysBit,
|
||||
&deadKeyState,
|
||||
sizeof(characters) / sizeof(UniChar),
|
||||
&characterCount,
|
||||
characters);
|
||||
|
||||
if(status == noErr)
|
||||
{
|
||||
oc_appData.keyMap[scanCode] = characters[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//NOTE fix digit row for azerty keyboards
|
||||
bool azerty = true;
|
||||
for(int scanCode = OC_SCANCODE_0; scanCode <= OC_SCANCODE_9; scanCode++)
|
||||
{
|
||||
if(oc_appData.keyMap[scanCode] >= OC_KEY_0 && oc_appData.keyMap[scanCode] <= OC_KEY_9)
|
||||
{
|
||||
azerty = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(azerty)
|
||||
{
|
||||
for(int scanCode = OC_SCANCODE_0; scanCode <= OC_SCANCODE_9; scanCode++)
|
||||
{
|
||||
oc_appData.keyMap[scanCode] = OC_KEY_0 + (scanCode - OC_SCANCODE_0);
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
kbLayoutUnicodeData = nil;
|
||||
CFRelease(kbLayoutInputSource);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
oc_str8 oc_key_to_label(oc_key_code key)
|
||||
{
|
||||
oc_key_utf8* keyInfo = &(oc_appData.keyLabels[key]);
|
||||
|
@ -300,7 +315,7 @@ oc_key_code oc_label_to_key(oc_str8 label)
|
|||
}
|
||||
return (res);
|
||||
}
|
||||
|
||||
*/
|
||||
@interface OCWindow : NSWindow
|
||||
{
|
||||
oc_window_data* mpWindow;
|
||||
|
@ -378,11 +393,9 @@ void oc_install_keyboard_layout_listener()
|
|||
{
|
||||
//NOTE: We set shouldQuit to true and send a Quit event
|
||||
// We then return a value to cancel the direct termination because we still
|
||||
// want to execte the code after oc_event_loop(). If the user didn't set shouldQuit to
|
||||
// false, oc_event_loop() will exit, and the user can execute any cleanup needed and
|
||||
// exit the program.
|
||||
// want to execute cleanup code. Use can then call oc_request_quit() to exit
|
||||
// the main runloop
|
||||
|
||||
oc_appData.shouldQuit = true;
|
||||
oc_event event = {};
|
||||
event.type = OC_EVENT_QUIT;
|
||||
oc_queue_event(&event);
|
||||
|
@ -674,11 +687,6 @@ void oc_install_keyboard_layout_listener()
|
|||
event.move.content.w = contentRect.size.width;
|
||||
event.move.content.h = contentRect.size.height;
|
||||
|
||||
if(oc_appData.liveResizeCallback)
|
||||
{
|
||||
oc_appData.liveResizeCallback(event, oc_appData.liveResizeData);
|
||||
}
|
||||
|
||||
//TODO: also ensure we don't overflow the queue during live resize...
|
||||
oc_queue_event(&event);
|
||||
}
|
||||
|
@ -810,7 +818,7 @@ static void oc_process_mouse_button(NSEvent* nsEvent, oc_window_data* window, oc
|
|||
event.window = oc_window_handle_from_ptr(window);
|
||||
event.type = OC_EVENT_MOUSE_BUTTON;
|
||||
event.key.action = action;
|
||||
event.key.code = button;
|
||||
event.key.button = button;
|
||||
event.key.mods = oc_convert_osx_mods([nsEvent modifierFlags]);
|
||||
event.key.clickCount = [nsEvent clickCount];
|
||||
|
||||
|
@ -910,12 +918,13 @@ static void oc_process_mouse_button(NSEvent* nsEvent, oc_window_data* window, oc
|
|||
event.window = oc_window_handle_from_ptr(window);
|
||||
event.type = OC_EVENT_KEYBOARD_KEY;
|
||||
event.key.action = action;
|
||||
event.key.code = oc_convert_osx_key([nsEvent keyCode]);
|
||||
event.key.scanCode = oc_convert_osx_key([nsEvent keyCode]);
|
||||
event.key.keyCode = oc_scancode_to_keycode(event.key.scanCode);
|
||||
event.key.mods = oc_convert_osx_mods([nsEvent modifierFlags]);
|
||||
|
||||
oc_str8 label = oc_key_to_label(event.key.code);
|
||||
event.key.labelLen = label.len;
|
||||
memcpy(event.key.label, label.ptr, label.len);
|
||||
// oc_str8 label = oc_key_to_label(event.key.code);
|
||||
// event.key.labelLen = label.len;
|
||||
// memcpy(event.key.label, label.ptr, label.len);
|
||||
|
||||
oc_queue_event(&event);
|
||||
|
||||
|
@ -928,7 +937,8 @@ static void oc_process_mouse_button(NSEvent* nsEvent, oc_window_data* window, oc
|
|||
event.window = oc_window_handle_from_ptr(window);
|
||||
event.type = OC_EVENT_KEYBOARD_KEY;
|
||||
event.key.action = OC_KEY_RELEASE;
|
||||
event.key.code = oc_convert_osx_key([nsEvent keyCode]);
|
||||
event.key.scanCode = oc_convert_osx_key([nsEvent keyCode]);
|
||||
event.key.keyCode = oc_scancode_to_keycode(event.key.scanCode);
|
||||
event.key.mods = oc_convert_osx_mods([nsEvent modifierFlags]);
|
||||
|
||||
oc_queue_event(&event);
|
||||
|
@ -955,8 +965,6 @@ static void oc_process_mouse_button(NSEvent* nsEvent, oc_window_data* window, oc
|
|||
}
|
||||
else if([nsEvent charactersIgnoringModifiers] == [NSString stringWithUTF8String:"q"])
|
||||
{
|
||||
oc_appData.shouldQuit = true;
|
||||
|
||||
oc_event event = {};
|
||||
event.type = OC_EVENT_QUIT;
|
||||
|
||||
|
@ -1151,11 +1159,6 @@ bool oc_should_quit()
|
|||
return (oc_appData.shouldQuit);
|
||||
}
|
||||
|
||||
void oc_do_quit()
|
||||
{
|
||||
oc_appData.shouldQuit = true;
|
||||
}
|
||||
|
||||
void oc_cancel_quit()
|
||||
{
|
||||
oc_appData.shouldQuit = false;
|
||||
|
@ -1164,9 +1167,21 @@ void oc_cancel_quit()
|
|||
void oc_request_quit()
|
||||
{
|
||||
oc_appData.shouldQuit = true;
|
||||
oc_event event = {};
|
||||
event.type = OC_EVENT_QUIT;
|
||||
oc_queue_event(&event);
|
||||
|
||||
@autoreleasepool
|
||||
{
|
||||
NSEvent* event = [NSEvent otherEventWithType:NSEventTypeApplicationDefined
|
||||
location:NSMakePoint(0, 0)
|
||||
modifierFlags:0
|
||||
timestamp:0.0
|
||||
windowNumber:0
|
||||
context:nil
|
||||
subtype:0
|
||||
data1:0
|
||||
data2:0];
|
||||
|
||||
[NSApp postEvent:event atStart:NO];
|
||||
}
|
||||
}
|
||||
|
||||
void oc_set_cursor(oc_mouse_cursor cursor)
|
||||
|
@ -1223,6 +1238,7 @@ void oc_clipboard_set_string(oc_str8 string)
|
|||
|
||||
NSString* nsString = [[NSString alloc] initWithBytes:string.ptr length:string.len encoding:NSUTF8StringEncoding];
|
||||
NSPasteboard* pb = [NSPasteboard generalPasteboard];
|
||||
[pb clearContents];
|
||||
[pb writeObjects:[[NSArray alloc] initWithObjects:nsString, nil]];
|
||||
}
|
||||
}
|
||||
|
@ -1746,7 +1762,7 @@ void oc_osx_update_layers(oc_window_data* window)
|
|||
@autoreleasepool
|
||||
{
|
||||
int z = 0;
|
||||
oc_list_for(&window->osx.layers, layer, oc_layer, listElt)
|
||||
oc_list_for(window->osx.layers, layer, oc_layer, listElt)
|
||||
{
|
||||
layer->caLayer.zPosition = (CGFloat)z;
|
||||
z++;
|
||||
|
@ -1853,12 +1869,6 @@ void oc_surface_init_for_window(oc_surface_data* surface, oc_window_data* window
|
|||
// Events handling
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
void oc_set_live_resize_callback(oc_live_resize_callback callback, void* data)
|
||||
{
|
||||
oc_appData.liveResizeCallback = callback;
|
||||
oc_appData.liveResizeData = data;
|
||||
}
|
||||
|
||||
void oc_pump_events(f64 timeout)
|
||||
{
|
||||
@autoreleasepool
|
||||
|
@ -1952,7 +1962,7 @@ oc_str8 oc_open_dialog(oc_arena* arena,
|
|||
{
|
||||
NSMutableArray* fileTypesArray = [NSMutableArray array];
|
||||
|
||||
oc_list_for((oc_list*)&filters.list, elt, oc_str8_elt, listElt)
|
||||
oc_list_for(filters.list, elt, oc_str8_elt, listElt)
|
||||
{
|
||||
oc_str8 string = elt->string;
|
||||
NSString* filter = [[NSString alloc] initWithBytes:string.ptr length:string.len encoding:NSUTF8StringEncoding];
|
||||
|
@ -2034,7 +2044,7 @@ oc_str8 oc_save_dialog(oc_arena* arena,
|
|||
{
|
||||
NSMutableArray* fileTypesArray = [NSMutableArray array];
|
||||
|
||||
oc_list_for((oc_list*)&filters.list, elt, oc_str8_elt, listElt)
|
||||
oc_list_for(filters.list, elt, oc_str8_elt, listElt)
|
||||
{
|
||||
oc_str8 string = elt->string;
|
||||
NSString* filter = [[NSString alloc] initWithBytes:string.ptr length:string.len encoding:NSUTF8StringEncoding];
|
||||
|
@ -2174,7 +2184,7 @@ ORCA_API oc_file_dialog_result oc_file_dialog_for_table(oc_arena* arena, oc_file
|
|||
{
|
||||
NSMutableArray* fileTypesArray = [NSMutableArray array];
|
||||
|
||||
oc_list_for((oc_list*)&desc->filters.list, elt, oc_str8_elt, listElt)
|
||||
oc_list_for(desc->filters.list, elt, oc_str8_elt, listElt)
|
||||
{
|
||||
oc_str8 string = elt->string;
|
||||
NSString* filter = [[NSString alloc] initWithBytes:string.ptr length:string.len encoding:NSUTF8StringEncoding];
|
||||
|
@ -2251,7 +2261,7 @@ int oc_alert_popup(oc_str8 title,
|
|||
NSAlert* alert = [[NSAlert alloc] init];
|
||||
NSString* string;
|
||||
|
||||
oc_list_for_reverse((oc_list*)&options.list, elt, oc_str8_elt, listElt)
|
||||
oc_list_for_reverse(options.list, elt, oc_str8_elt, listElt)
|
||||
{
|
||||
string = [[NSString alloc] initWithBytes:elt->string.ptr length:elt->string.len encoding:NSUTF8StringEncoding];
|
||||
[alert addButtonWithTitle:string];
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
/************************************************************/ /**
|
||||
/*************************************************************************
|
||||
*
|
||||
* @file: win32_app.c
|
||||
* @author: Martin Fouilleul
|
||||
* @date: 16/12/2022
|
||||
* @revision:
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
*****************************************************************/
|
||||
**************************************************************************/
|
||||
|
||||
#include "app.c"
|
||||
#include "platform/platform_thread.h"
|
||||
|
@ -14,134 +13,173 @@
|
|||
|
||||
void oc_init_keys()
|
||||
{
|
||||
memset(oc_appData.keyCodes, OC_KEY_UNKNOWN, 256 * sizeof(int));
|
||||
memset(oc_appData.scanCodes, OC_SCANCODE_UNKNOWN, 256 * sizeof(int));
|
||||
|
||||
oc_appData.keyCodes[0x00B] = OC_KEY_0;
|
||||
oc_appData.keyCodes[0x002] = OC_KEY_1;
|
||||
oc_appData.keyCodes[0x003] = OC_KEY_2;
|
||||
oc_appData.keyCodes[0x004] = OC_KEY_3;
|
||||
oc_appData.keyCodes[0x005] = OC_KEY_4;
|
||||
oc_appData.keyCodes[0x006] = OC_KEY_5;
|
||||
oc_appData.keyCodes[0x007] = OC_KEY_6;
|
||||
oc_appData.keyCodes[0x008] = OC_KEY_7;
|
||||
oc_appData.keyCodes[0x009] = OC_KEY_8;
|
||||
oc_appData.keyCodes[0x00A] = OC_KEY_9;
|
||||
oc_appData.keyCodes[0x01E] = OC_KEY_A;
|
||||
oc_appData.keyCodes[0x030] = OC_KEY_B;
|
||||
oc_appData.keyCodes[0x02E] = OC_KEY_C;
|
||||
oc_appData.keyCodes[0x020] = OC_KEY_D;
|
||||
oc_appData.keyCodes[0x012] = OC_KEY_E;
|
||||
oc_appData.keyCodes[0x021] = OC_KEY_F;
|
||||
oc_appData.keyCodes[0x022] = OC_KEY_G;
|
||||
oc_appData.keyCodes[0x023] = OC_KEY_H;
|
||||
oc_appData.keyCodes[0x017] = OC_KEY_I;
|
||||
oc_appData.keyCodes[0x024] = OC_KEY_J;
|
||||
oc_appData.keyCodes[0x025] = OC_KEY_K;
|
||||
oc_appData.keyCodes[0x026] = OC_KEY_L;
|
||||
oc_appData.keyCodes[0x032] = OC_KEY_M;
|
||||
oc_appData.keyCodes[0x031] = OC_KEY_N;
|
||||
oc_appData.keyCodes[0x018] = OC_KEY_O;
|
||||
oc_appData.keyCodes[0x019] = OC_KEY_P;
|
||||
oc_appData.keyCodes[0x010] = OC_KEY_Q;
|
||||
oc_appData.keyCodes[0x013] = OC_KEY_R;
|
||||
oc_appData.keyCodes[0x01F] = OC_KEY_S;
|
||||
oc_appData.keyCodes[0x014] = OC_KEY_T;
|
||||
oc_appData.keyCodes[0x016] = OC_KEY_U;
|
||||
oc_appData.keyCodes[0x02F] = OC_KEY_V;
|
||||
oc_appData.keyCodes[0x011] = OC_KEY_W;
|
||||
oc_appData.keyCodes[0x02D] = OC_KEY_X;
|
||||
oc_appData.keyCodes[0x015] = OC_KEY_Y;
|
||||
oc_appData.keyCodes[0x02C] = OC_KEY_Z;
|
||||
oc_appData.keyCodes[0x028] = OC_KEY_APOSTROPHE;
|
||||
oc_appData.keyCodes[0x02B] = OC_KEY_BACKSLASH;
|
||||
oc_appData.keyCodes[0x033] = OC_KEY_COMMA;
|
||||
oc_appData.keyCodes[0x00D] = OC_KEY_EQUAL;
|
||||
oc_appData.keyCodes[0x029] = OC_KEY_GRAVE_ACCENT;
|
||||
oc_appData.keyCodes[0x01A] = OC_KEY_LEFT_BRACKET;
|
||||
oc_appData.keyCodes[0x00C] = OC_KEY_MINUS;
|
||||
oc_appData.keyCodes[0x034] = OC_KEY_PERIOD;
|
||||
oc_appData.keyCodes[0x01B] = OC_KEY_RIGHT_BRACKET;
|
||||
oc_appData.keyCodes[0x027] = OC_KEY_SEMICOLON;
|
||||
oc_appData.keyCodes[0x035] = OC_KEY_SLASH;
|
||||
oc_appData.keyCodes[0x056] = OC_KEY_WORLD_2;
|
||||
oc_appData.keyCodes[0x00E] = OC_KEY_BACKSPACE;
|
||||
oc_appData.keyCodes[0x153] = OC_KEY_DELETE;
|
||||
oc_appData.keyCodes[0x14F] = OC_KEY_END;
|
||||
oc_appData.keyCodes[0x01C] = OC_KEY_ENTER;
|
||||
oc_appData.keyCodes[0x001] = OC_KEY_ESCAPE;
|
||||
oc_appData.keyCodes[0x147] = OC_KEY_HOME;
|
||||
oc_appData.keyCodes[0x152] = OC_KEY_INSERT;
|
||||
oc_appData.keyCodes[0x15D] = OC_KEY_MENU;
|
||||
oc_appData.keyCodes[0x151] = OC_KEY_PAGE_DOWN;
|
||||
oc_appData.keyCodes[0x149] = OC_KEY_PAGE_UP;
|
||||
oc_appData.keyCodes[0x045] = OC_KEY_PAUSE;
|
||||
oc_appData.keyCodes[0x146] = OC_KEY_PAUSE;
|
||||
oc_appData.keyCodes[0x039] = OC_KEY_SPACE;
|
||||
oc_appData.keyCodes[0x00F] = OC_KEY_TAB;
|
||||
oc_appData.keyCodes[0x03A] = OC_KEY_CAPS_LOCK;
|
||||
oc_appData.keyCodes[0x145] = OC_KEY_NUM_LOCK;
|
||||
oc_appData.keyCodes[0x046] = OC_KEY_SCROLL_LOCK;
|
||||
oc_appData.keyCodes[0x03B] = OC_KEY_F1;
|
||||
oc_appData.keyCodes[0x03C] = OC_KEY_F2;
|
||||
oc_appData.keyCodes[0x03D] = OC_KEY_F3;
|
||||
oc_appData.keyCodes[0x03E] = OC_KEY_F4;
|
||||
oc_appData.keyCodes[0x03F] = OC_KEY_F5;
|
||||
oc_appData.keyCodes[0x040] = OC_KEY_F6;
|
||||
oc_appData.keyCodes[0x041] = OC_KEY_F7;
|
||||
oc_appData.keyCodes[0x042] = OC_KEY_F8;
|
||||
oc_appData.keyCodes[0x043] = OC_KEY_F9;
|
||||
oc_appData.keyCodes[0x044] = OC_KEY_F10;
|
||||
oc_appData.keyCodes[0x057] = OC_KEY_F11;
|
||||
oc_appData.keyCodes[0x058] = OC_KEY_F12;
|
||||
oc_appData.keyCodes[0x064] = OC_KEY_F13;
|
||||
oc_appData.keyCodes[0x065] = OC_KEY_F14;
|
||||
oc_appData.keyCodes[0x066] = OC_KEY_F15;
|
||||
oc_appData.keyCodes[0x067] = OC_KEY_F16;
|
||||
oc_appData.keyCodes[0x068] = OC_KEY_F17;
|
||||
oc_appData.keyCodes[0x069] = OC_KEY_F18;
|
||||
oc_appData.keyCodes[0x06A] = OC_KEY_F19;
|
||||
oc_appData.keyCodes[0x06B] = OC_KEY_F20;
|
||||
oc_appData.keyCodes[0x06C] = OC_KEY_F21;
|
||||
oc_appData.keyCodes[0x06D] = OC_KEY_F22;
|
||||
oc_appData.keyCodes[0x06E] = OC_KEY_F23;
|
||||
oc_appData.keyCodes[0x076] = OC_KEY_F24;
|
||||
oc_appData.keyCodes[0x038] = OC_KEY_LEFT_ALT;
|
||||
oc_appData.keyCodes[0x01D] = OC_KEY_LEFT_CONTROL;
|
||||
oc_appData.keyCodes[0x02A] = OC_KEY_LEFT_SHIFT;
|
||||
oc_appData.keyCodes[0x15B] = OC_KEY_LEFT_SUPER;
|
||||
oc_appData.keyCodes[0x137] = OC_KEY_PRINT_SCREEN;
|
||||
oc_appData.keyCodes[0x138] = OC_KEY_RIGHT_ALT;
|
||||
oc_appData.keyCodes[0x11D] = OC_KEY_RIGHT_CONTROL;
|
||||
oc_appData.keyCodes[0x036] = OC_KEY_RIGHT_SHIFT;
|
||||
oc_appData.keyCodes[0x15C] = OC_KEY_RIGHT_SUPER;
|
||||
oc_appData.keyCodes[0x150] = OC_KEY_DOWN;
|
||||
oc_appData.keyCodes[0x14B] = OC_KEY_LEFT;
|
||||
oc_appData.keyCodes[0x14D] = OC_KEY_RIGHT;
|
||||
oc_appData.keyCodes[0x148] = OC_KEY_UP;
|
||||
oc_appData.keyCodes[0x052] = OC_KEY_KP_0;
|
||||
oc_appData.keyCodes[0x04F] = OC_KEY_KP_1;
|
||||
oc_appData.keyCodes[0x050] = OC_KEY_KP_2;
|
||||
oc_appData.keyCodes[0x051] = OC_KEY_KP_3;
|
||||
oc_appData.keyCodes[0x04B] = OC_KEY_KP_4;
|
||||
oc_appData.keyCodes[0x04C] = OC_KEY_KP_5;
|
||||
oc_appData.keyCodes[0x04D] = OC_KEY_KP_6;
|
||||
oc_appData.keyCodes[0x047] = OC_KEY_KP_7;
|
||||
oc_appData.keyCodes[0x048] = OC_KEY_KP_8;
|
||||
oc_appData.keyCodes[0x049] = OC_KEY_KP_9;
|
||||
oc_appData.keyCodes[0x04E] = OC_KEY_KP_ADD;
|
||||
oc_appData.keyCodes[0x053] = OC_KEY_KP_DECIMAL;
|
||||
oc_appData.keyCodes[0x135] = OC_KEY_KP_DIVIDE;
|
||||
oc_appData.keyCodes[0x11C] = OC_KEY_KP_ENTER;
|
||||
oc_appData.keyCodes[0x037] = OC_KEY_KP_MULTIPLY;
|
||||
oc_appData.keyCodes[0x04A] = OC_KEY_KP_SUBTRACT;
|
||||
oc_appData.scanCodes[0x00B] = OC_SCANCODE_0;
|
||||
oc_appData.scanCodes[0x002] = OC_SCANCODE_1;
|
||||
oc_appData.scanCodes[0x003] = OC_SCANCODE_2;
|
||||
oc_appData.scanCodes[0x004] = OC_SCANCODE_3;
|
||||
oc_appData.scanCodes[0x005] = OC_SCANCODE_4;
|
||||
oc_appData.scanCodes[0x006] = OC_SCANCODE_5;
|
||||
oc_appData.scanCodes[0x007] = OC_SCANCODE_6;
|
||||
oc_appData.scanCodes[0x008] = OC_SCANCODE_7;
|
||||
oc_appData.scanCodes[0x009] = OC_SCANCODE_8;
|
||||
oc_appData.scanCodes[0x00A] = OC_SCANCODE_9;
|
||||
oc_appData.scanCodes[0x01E] = OC_SCANCODE_A;
|
||||
oc_appData.scanCodes[0x030] = OC_SCANCODE_B;
|
||||
oc_appData.scanCodes[0x02E] = OC_SCANCODE_C;
|
||||
oc_appData.scanCodes[0x020] = OC_SCANCODE_D;
|
||||
oc_appData.scanCodes[0x012] = OC_SCANCODE_E;
|
||||
oc_appData.scanCodes[0x021] = OC_SCANCODE_F;
|
||||
oc_appData.scanCodes[0x022] = OC_SCANCODE_G;
|
||||
oc_appData.scanCodes[0x023] = OC_SCANCODE_H;
|
||||
oc_appData.scanCodes[0x017] = OC_SCANCODE_I;
|
||||
oc_appData.scanCodes[0x024] = OC_SCANCODE_J;
|
||||
oc_appData.scanCodes[0x025] = OC_SCANCODE_K;
|
||||
oc_appData.scanCodes[0x026] = OC_SCANCODE_L;
|
||||
oc_appData.scanCodes[0x032] = OC_SCANCODE_M;
|
||||
oc_appData.scanCodes[0x031] = OC_SCANCODE_N;
|
||||
oc_appData.scanCodes[0x018] = OC_SCANCODE_O;
|
||||
oc_appData.scanCodes[0x019] = OC_SCANCODE_P;
|
||||
oc_appData.scanCodes[0x010] = OC_SCANCODE_Q;
|
||||
oc_appData.scanCodes[0x013] = OC_SCANCODE_R;
|
||||
oc_appData.scanCodes[0x01F] = OC_SCANCODE_S;
|
||||
oc_appData.scanCodes[0x014] = OC_SCANCODE_T;
|
||||
oc_appData.scanCodes[0x016] = OC_SCANCODE_U;
|
||||
oc_appData.scanCodes[0x02F] = OC_SCANCODE_V;
|
||||
oc_appData.scanCodes[0x011] = OC_SCANCODE_W;
|
||||
oc_appData.scanCodes[0x02D] = OC_SCANCODE_X;
|
||||
oc_appData.scanCodes[0x015] = OC_SCANCODE_Y;
|
||||
oc_appData.scanCodes[0x02C] = OC_SCANCODE_Z;
|
||||
oc_appData.scanCodes[0x028] = OC_SCANCODE_APOSTROPHE;
|
||||
oc_appData.scanCodes[0x02B] = OC_SCANCODE_BACKSLASH;
|
||||
oc_appData.scanCodes[0x033] = OC_SCANCODE_COMMA;
|
||||
oc_appData.scanCodes[0x00D] = OC_SCANCODE_EQUAL;
|
||||
oc_appData.scanCodes[0x029] = OC_SCANCODE_GRAVE_ACCENT;
|
||||
oc_appData.scanCodes[0x01A] = OC_SCANCODE_LEFT_BRACKET;
|
||||
oc_appData.scanCodes[0x00C] = OC_SCANCODE_MINUS;
|
||||
oc_appData.scanCodes[0x034] = OC_SCANCODE_PERIOD;
|
||||
oc_appData.scanCodes[0x01B] = OC_SCANCODE_RIGHT_BRACKET;
|
||||
oc_appData.scanCodes[0x027] = OC_SCANCODE_SEMICOLON;
|
||||
oc_appData.scanCodes[0x035] = OC_SCANCODE_SLASH;
|
||||
oc_appData.scanCodes[0x056] = OC_SCANCODE_WORLD_2;
|
||||
oc_appData.scanCodes[0x00E] = OC_SCANCODE_BACKSPACE;
|
||||
oc_appData.scanCodes[0x153] = OC_SCANCODE_DELETE;
|
||||
oc_appData.scanCodes[0x14F] = OC_SCANCODE_END;
|
||||
oc_appData.scanCodes[0x01C] = OC_SCANCODE_ENTER;
|
||||
oc_appData.scanCodes[0x001] = OC_SCANCODE_ESCAPE;
|
||||
oc_appData.scanCodes[0x147] = OC_SCANCODE_HOME;
|
||||
oc_appData.scanCodes[0x152] = OC_SCANCODE_INSERT;
|
||||
oc_appData.scanCodes[0x15D] = OC_SCANCODE_MENU;
|
||||
oc_appData.scanCodes[0x151] = OC_SCANCODE_PAGE_DOWN;
|
||||
oc_appData.scanCodes[0x149] = OC_SCANCODE_PAGE_UP;
|
||||
oc_appData.scanCodes[0x045] = OC_SCANCODE_PAUSE;
|
||||
oc_appData.scanCodes[0x146] = OC_SCANCODE_PAUSE;
|
||||
oc_appData.scanCodes[0x039] = OC_SCANCODE_SPACE;
|
||||
oc_appData.scanCodes[0x00F] = OC_SCANCODE_TAB;
|
||||
oc_appData.scanCodes[0x03A] = OC_SCANCODE_CAPS_LOCK;
|
||||
oc_appData.scanCodes[0x145] = OC_SCANCODE_NUM_LOCK;
|
||||
oc_appData.scanCodes[0x046] = OC_SCANCODE_SCROLL_LOCK;
|
||||
oc_appData.scanCodes[0x03B] = OC_SCANCODE_F1;
|
||||
oc_appData.scanCodes[0x03C] = OC_SCANCODE_F2;
|
||||
oc_appData.scanCodes[0x03D] = OC_SCANCODE_F3;
|
||||
oc_appData.scanCodes[0x03E] = OC_SCANCODE_F4;
|
||||
oc_appData.scanCodes[0x03F] = OC_SCANCODE_F5;
|
||||
oc_appData.scanCodes[0x040] = OC_SCANCODE_F6;
|
||||
oc_appData.scanCodes[0x041] = OC_SCANCODE_F7;
|
||||
oc_appData.scanCodes[0x042] = OC_SCANCODE_F8;
|
||||
oc_appData.scanCodes[0x043] = OC_SCANCODE_F9;
|
||||
oc_appData.scanCodes[0x044] = OC_SCANCODE_F10;
|
||||
oc_appData.scanCodes[0x057] = OC_SCANCODE_F11;
|
||||
oc_appData.scanCodes[0x058] = OC_SCANCODE_F12;
|
||||
oc_appData.scanCodes[0x064] = OC_SCANCODE_F13;
|
||||
oc_appData.scanCodes[0x065] = OC_SCANCODE_F14;
|
||||
oc_appData.scanCodes[0x066] = OC_SCANCODE_F15;
|
||||
oc_appData.scanCodes[0x067] = OC_SCANCODE_F16;
|
||||
oc_appData.scanCodes[0x068] = OC_SCANCODE_F17;
|
||||
oc_appData.scanCodes[0x069] = OC_SCANCODE_F18;
|
||||
oc_appData.scanCodes[0x06A] = OC_SCANCODE_F19;
|
||||
oc_appData.scanCodes[0x06B] = OC_SCANCODE_F20;
|
||||
oc_appData.scanCodes[0x06C] = OC_SCANCODE_F21;
|
||||
oc_appData.scanCodes[0x06D] = OC_SCANCODE_F22;
|
||||
oc_appData.scanCodes[0x06E] = OC_SCANCODE_F23;
|
||||
oc_appData.scanCodes[0x076] = OC_SCANCODE_F24;
|
||||
oc_appData.scanCodes[0x038] = OC_SCANCODE_LEFT_ALT;
|
||||
oc_appData.scanCodes[0x01D] = OC_SCANCODE_LEFT_CONTROL;
|
||||
oc_appData.scanCodes[0x02A] = OC_SCANCODE_LEFT_SHIFT;
|
||||
oc_appData.scanCodes[0x15B] = OC_SCANCODE_LEFT_SUPER;
|
||||
oc_appData.scanCodes[0x137] = OC_SCANCODE_PRINT_SCREEN;
|
||||
oc_appData.scanCodes[0x138] = OC_SCANCODE_RIGHT_ALT;
|
||||
oc_appData.scanCodes[0x11D] = OC_SCANCODE_RIGHT_CONTROL;
|
||||
oc_appData.scanCodes[0x036] = OC_SCANCODE_RIGHT_SHIFT;
|
||||
oc_appData.scanCodes[0x15C] = OC_SCANCODE_RIGHT_SUPER;
|
||||
oc_appData.scanCodes[0x150] = OC_SCANCODE_DOWN;
|
||||
oc_appData.scanCodes[0x14B] = OC_SCANCODE_LEFT;
|
||||
oc_appData.scanCodes[0x14D] = OC_SCANCODE_RIGHT;
|
||||
oc_appData.scanCodes[0x148] = OC_SCANCODE_UP;
|
||||
oc_appData.scanCodes[0x052] = OC_SCANCODE_KP_0;
|
||||
oc_appData.scanCodes[0x04F] = OC_SCANCODE_KP_1;
|
||||
oc_appData.scanCodes[0x050] = OC_SCANCODE_KP_2;
|
||||
oc_appData.scanCodes[0x051] = OC_SCANCODE_KP_3;
|
||||
oc_appData.scanCodes[0x04B] = OC_SCANCODE_KP_4;
|
||||
oc_appData.scanCodes[0x04C] = OC_SCANCODE_KP_5;
|
||||
oc_appData.scanCodes[0x04D] = OC_SCANCODE_KP_6;
|
||||
oc_appData.scanCodes[0x047] = OC_SCANCODE_KP_7;
|
||||
oc_appData.scanCodes[0x048] = OC_SCANCODE_KP_8;
|
||||
oc_appData.scanCodes[0x049] = OC_SCANCODE_KP_9;
|
||||
oc_appData.scanCodes[0x04E] = OC_SCANCODE_KP_ADD;
|
||||
oc_appData.scanCodes[0x053] = OC_SCANCODE_KP_DECIMAL;
|
||||
oc_appData.scanCodes[0x135] = OC_SCANCODE_KP_DIVIDE;
|
||||
oc_appData.scanCodes[0x11C] = OC_SCANCODE_KP_ENTER;
|
||||
oc_appData.scanCodes[0x037] = OC_SCANCODE_KP_MULTIPLY;
|
||||
oc_appData.scanCodes[0x04A] = OC_SCANCODE_KP_SUBTRACT;
|
||||
}
|
||||
|
||||
memset(oc_appData.nativeKeys, 0, sizeof(int) * OC_KEY_COUNT);
|
||||
for(int nativeKey = 0; nativeKey < 256; nativeKey++)
|
||||
void oc_win32_update_keyboard_layout()
|
||||
{
|
||||
memcpy(oc_appData.keyMap, oc_defaultKeyMap, sizeof(oc_key_code) * OC_SCANCODE_COUNT);
|
||||
|
||||
for(int winCode = 0; winCode < OC_SCANCODE_COUNT; winCode++)
|
||||
{
|
||||
oc_key_code mpKey = oc_appData.keyCodes[nativeKey];
|
||||
if(mpKey)
|
||||
oc_scan_code scanCode = oc_appData.scanCodes[winCode];
|
||||
|
||||
if(scanCode < 256)
|
||||
{
|
||||
oc_appData.nativeKeys[mpKey] = nativeKey;
|
||||
int vk = MapVirtualKey(winCode, MAPVK_VSC_TO_VK);
|
||||
if(vk)
|
||||
{
|
||||
int ch = MapVirtualKey(vk, MAPVK_VK_TO_CHAR);
|
||||
ch &= 0x7fff;
|
||||
if(ch)
|
||||
{
|
||||
if(ch >= 'A' && ch <= 'Z')
|
||||
{
|
||||
oc_appData.keyMap[scanCode] = 'a' + (ch - 'A');
|
||||
}
|
||||
else
|
||||
{
|
||||
oc_appData.keyMap[scanCode] = ch;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//NOTE fix digit row for azerty keyboards
|
||||
bool azerty = true;
|
||||
for(int scanCode = OC_SCANCODE_0; scanCode <= OC_SCANCODE_9; scanCode++)
|
||||
{
|
||||
if(oc_appData.keyMap[scanCode] >= OC_KEY_0 && oc_appData.keyMap[scanCode] <= OC_KEY_9)
|
||||
{
|
||||
azerty = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(azerty)
|
||||
{
|
||||
for(int scanCode = OC_SCANCODE_0; scanCode <= OC_SCANCODE_9; scanCode++)
|
||||
{
|
||||
oc_appData.keyMap[scanCode] = OC_KEY_0 + (scanCode - OC_SCANCODE_0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -156,6 +194,7 @@ void oc_init()
|
|||
|
||||
oc_init_common();
|
||||
oc_init_keys();
|
||||
oc_win32_update_keyboard_layout();
|
||||
|
||||
oc_appData.win32.savedConsoleCodePage = GetConsoleOutputCP();
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
|
@ -171,6 +210,8 @@ void oc_init()
|
|||
SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &wheelScrollLines, 0);
|
||||
oc_appData.win32.wheelScrollLines = wheelScrollLines;
|
||||
|
||||
oc_appData.win32.mainThreadID = GetCurrentThreadId();
|
||||
|
||||
oc_vsync_init();
|
||||
}
|
||||
}
|
||||
|
@ -188,7 +229,7 @@ void oc_terminate()
|
|||
|
||||
static oc_key_code oc_convert_win32_key(int code)
|
||||
{
|
||||
return (oc_appData.keyCodes[code]);
|
||||
return (oc_appData.scanCodes[code]);
|
||||
}
|
||||
|
||||
static oc_keymod_flags oc_get_mod_keys()
|
||||
|
@ -240,7 +281,7 @@ static void oc_win32_process_mouse_event(oc_window_data* window, oc_key_action a
|
|||
{
|
||||
oc_appData.win32.clickCount[button] = 0;
|
||||
}
|
||||
for (int i = 0; i < OC_MOUSE_BUTTON_COUNT; i++)
|
||||
for(int i = 0; i < OC_MOUSE_BUTTON_COUNT; i++)
|
||||
{
|
||||
if(i != button)
|
||||
{
|
||||
|
@ -263,7 +304,7 @@ static void oc_win32_process_mouse_event(oc_window_data* window, oc_key_action a
|
|||
event.window = oc_window_handle_from_ptr(window);
|
||||
event.type = OC_EVENT_MOUSE_BUTTON;
|
||||
event.key.action = action;
|
||||
event.key.code = button;
|
||||
event.key.button = button;
|
||||
event.key.mods = oc_get_mod_keys();
|
||||
event.key.clickCount = oc_appData.win32.clickCount[button];
|
||||
|
||||
|
@ -294,7 +335,7 @@ static void oc_win32_update_child_layers(oc_window_data* window)
|
|||
int clientWidth = (clientRect.right - clientRect.left);
|
||||
int clientHeight = (clientRect.bottom - clientRect.top);
|
||||
|
||||
oc_list_for(&window->win32.layers, layer, oc_layer, listElt)
|
||||
oc_list_for(window->win32.layers, layer, oc_layer, listElt)
|
||||
{
|
||||
SetWindowPos(layer->hWnd,
|
||||
0,
|
||||
|
@ -310,7 +351,7 @@ static void oc_win32_update_child_layers_zorder(oc_window_data* window)
|
|||
{
|
||||
HWND insertAfter = window->win32.hWnd;
|
||||
|
||||
oc_list_for(&window->win32.layers, layer, oc_layer, listElt)
|
||||
oc_list_for(window->win32.layers, layer, oc_layer, listElt)
|
||||
{
|
||||
SetWindowPos(layer->hWnd,
|
||||
insertAfter,
|
||||
|
@ -548,6 +589,12 @@ LRESULT oc_win32_win_proc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM
|
|||
}
|
||||
break;
|
||||
|
||||
case WM_INPUTLANGCHANGE:
|
||||
{
|
||||
oc_win32_update_keyboard_layout();
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN:
|
||||
{
|
||||
|
@ -562,7 +609,8 @@ LRESULT oc_win32_win_proc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM
|
|||
event.window = oc_window_handle_from_ptr(mpWindow);
|
||||
event.type = OC_EVENT_KEYBOARD_KEY;
|
||||
event.key.action = (lParam & 0x40000000) ? OC_KEY_REPEAT : OC_KEY_PRESS;
|
||||
event.key.code = oc_convert_win32_key(HIWORD(lParam) & 0x1ff);
|
||||
event.key.scanCode = oc_convert_win32_key(HIWORD(lParam) & 0x1ff);
|
||||
event.key.keyCode = oc_scancode_to_keycode(event.key.scanCode);
|
||||
event.key.mods = oc_get_mod_keys();
|
||||
oc_queue_event(&event);
|
||||
}
|
||||
|
@ -580,7 +628,8 @@ LRESULT oc_win32_win_proc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM
|
|||
event.window = oc_window_handle_from_ptr(mpWindow);
|
||||
event.type = OC_EVENT_KEYBOARD_KEY;
|
||||
event.key.action = OC_KEY_RELEASE;
|
||||
event.key.code = oc_convert_win32_key(HIWORD(lParam) & 0x1ff);
|
||||
event.key.scanCode = oc_convert_win32_key(HIWORD(lParam) & 0x1ff);
|
||||
event.key.keyCode = oc_scancode_to_keycode(event.key.scanCode);
|
||||
event.key.mods = oc_get_mod_keys();
|
||||
oc_queue_event(&event);
|
||||
}
|
||||
|
@ -660,6 +709,7 @@ void oc_cancel_quit()
|
|||
void oc_request_quit()
|
||||
{
|
||||
oc_appData.shouldQuit = true;
|
||||
PostThreadMessage(oc_appData.win32.mainThreadID, OC_WM_USER_WAKEUP, 0, 0);
|
||||
}
|
||||
|
||||
void oc_pump_events(f64 timeout)
|
||||
|
@ -1366,7 +1416,7 @@ oc_str8 oc_open_dialog(oc_arena* arena,
|
|||
COMDLG_FILTERSPEC* filterSpecs = oc_arena_push_array(arena, COMDLG_FILTERSPEC, filters.eltCount);
|
||||
|
||||
int i = 0;
|
||||
oc_list_for(&filters.list, elt, oc_str8_elt, listElt)
|
||||
oc_list_for(filters.list, elt, oc_str8_elt, listElt)
|
||||
{
|
||||
oc_str8_list list = { 0 };
|
||||
oc_str8_list_push(arena, &list, OC_STR8("*."));
|
||||
|
@ -1454,7 +1504,7 @@ oc_str8 oc_save_dialog(oc_arena* arena,
|
|||
COMDLG_FILTERSPEC* filterSpecs = oc_arena_push_array(arena, COMDLG_FILTERSPEC, filters.eltCount);
|
||||
|
||||
int i = 0;
|
||||
oc_list_for(&filters.list, elt, oc_str8_elt, listElt)
|
||||
oc_list_for(filters.list, elt, oc_str8_elt, listElt)
|
||||
{
|
||||
oc_str8_list list = { 0 };
|
||||
oc_str8_list_push(arena, &list, OC_STR8("*."));
|
||||
|
@ -1635,7 +1685,7 @@ oc_file_dialog_result oc_file_dialog_for_table(oc_arena* arena, oc_file_dialog_d
|
|||
COMDLG_FILTERSPEC* filterSpecs = oc_arena_push_array(scratch.arena, COMDLG_FILTERSPEC, desc->filters.eltCount);
|
||||
|
||||
int i = 0;
|
||||
oc_list_for(&desc->filters.list, elt, oc_str8_elt, listElt)
|
||||
oc_list_for(desc->filters.list, elt, oc_str8_elt, listElt)
|
||||
{
|
||||
oc_str8_list list = { 0 };
|
||||
oc_str8_list_push(scratch.arena, &list, OC_STR8("*."));
|
||||
|
@ -1734,7 +1784,7 @@ int oc_alert_popup(oc_str8 title,
|
|||
TASKDIALOG_BUTTON* buttons = oc_arena_push_array(scratch.arena, TASKDIALOG_BUTTON, options.eltCount);
|
||||
|
||||
int i = 0;
|
||||
oc_list_for(&options.list, elt, oc_str8_elt, listElt)
|
||||
oc_list_for(options.list, elt, oc_str8_elt, listElt)
|
||||
{
|
||||
int textWideSize = MultiByteToWideChar(CP_UTF8, 0, elt->string.ptr, elt->string.len, NULL, 0);
|
||||
wchar_t* textWide = oc_arena_push_array(scratch.arena, wchar_t, textWideSize + 1);
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
//*****************************************************************
|
||||
//
|
||||
// $file: win32_app.h $
|
||||
// $author: Martin Fouilleul $
|
||||
// $date: 20/12/2022 $
|
||||
// $revision: $
|
||||
// $note: (C) 2022 by Martin Fouilleul - all rights reserved $
|
||||
//
|
||||
//*****************************************************************
|
||||
/*************************************************************************
|
||||
*
|
||||
* Orca
|
||||
* Copyright 2023 Martin Fouilleul and the Orca project contributors
|
||||
* See LICENSE.txt for licensing information
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef __WIN32_APP_H_
|
||||
#define __WIN32_APP_H_
|
||||
|
||||
|
@ -44,6 +43,8 @@ typedef struct oc_win32_app_data
|
|||
u32 clickCount[OC_MOUSE_BUTTON_COUNT];
|
||||
u32 wheelScrollLines;
|
||||
|
||||
DWORD mainThreadID;
|
||||
|
||||
} oc_win32_app_data;
|
||||
|
||||
#define OC_PLATFORM_APP_DATA oc_win32_app_data win32;
|
||||
|
@ -51,6 +52,7 @@ typedef struct oc_win32_app_data
|
|||
enum OC_WM_USER
|
||||
{
|
||||
OC_WM_USER_DISPATCH_PROC = 0x0400, // WM_USER messages are defined from 0x400 to 0x7FFF
|
||||
OC_WM_USER_WAKEUP = 0x0401,
|
||||
};
|
||||
|
||||
#endif __WIN32_APP_H_
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue