Giter Site home page Giter Site logo

mcchatman8009 / native-canvas Goto Github PK

View Code? Open in Web Editor NEW
31.0 31.0 5.0 10.67 MB

A canvas library that allows for a HTML canvas to run natively on NodeJs, without a WebBrowser

License: MIT License

Makefile 0.22% CMake 1.02% HTML 0.04% Shell 2.61% C 82.91% M4 0.55% Java 1.43% Batchfile 0.01% PowerShell 0.10% Roff 0.02% C++ 3.68% Objective-C 4.45% Perl 0.15% Python 0.02% Metal 0.03% JavaScript 0.14% TypeScript 2.60%
2d 2d-graphics canvas es6 game graphics html-canvas html5 javascript native-canvas native-javascript node nodejs sdl sdl2 typescript

native-canvas's People

Contributors

fordi avatar mcchatman8009 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

native-canvas's Issues

suggestion

sir, could you please remove default window,, I want it to open with createWindow only,,
and changing size of window is glitchy,, and some other bugs,,
and if you not consider these option, then could I modify (i've patches for some of them) and use your project in my project...

Can't install native-canvas via npm

Hi I'd really love to be able to use your project but it failed to install.

I want to make a template for p5play users that could have closer to native performance!

qashto@mac p5play-desktop % npm install native-canvas
npm WARN deprecated [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Use your platform's native atob() and btoa() methods instead
npm WARN deprecated [email protected]: Use your platform's native DOMException instead
npm WARN deprecated [email protected]: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code 1
npm ERR! path /Users/qashto/dev/apps/p5play-desktop/node_modules/ffi-napi
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! CC(target) Release/obj.target/nothing/../node-addon-api/src/nothing.o
npm ERR!   LIBTOOL-STATIC Release/nothing.a
npm ERR!   CC(target) Release/obj.target/ffi/deps/libffi/src/prep_cif.o
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info find Python using Python version 3.10.8 found at "/opt/homebrew/opt/[email protected]/bin/python3.10"
npm ERR! gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.10
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/qashto/dev/apps/p5play-desktop/node_modules/ffi-napi/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/qashto/Library/Caches/node-gyp/21.5.0/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/qashto/Library/Caches/node-gyp/21.5.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/qashto/Library/Caches/node-gyp/21.5.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/qashto/dev/apps/p5play-desktop/node_modules/ffi-napi',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: archive library: Release/nothing.a the table of contents is empty (no object file members in the library define global symbols)
npm ERR! ../deps/libffi/src/prep_cif.c:26:10: fatal error: 'ffi.h' file not found
npm ERR! #include <ffi.h>
npm ERR!          ^~~~~~~
npm ERR! 1 error generated.
npm ERR! make: *** [Release/obj.target/ffi/deps/libffi/src/prep_cif.o] Error 1
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
npm ERR! gyp ERR! System Darwin 23.2.0
npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/qashto/dev/apps/p5play-desktop/node_modules/ffi-napi
npm ERR! gyp ERR! node -v v21.5.0
npm ERR! gyp ERR! node-gyp -v v10.0.1
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in: /Users/qashto/.npm/_logs/2024-01-08T13_57_31_555Z-debug-0.log
qashto@mac p5play-desktop % 

Jumpy window when programmatically resizing. [Linux]

Sample code demonstrating break:

require('native-canvas');
canvas.width = 800;
canvas.height = 450;

When running that code, the window jitters between the default size (640x480) and the requested size (800x450). I've tried a number of combinations against exposed properties (e.g., window.size = { w: 800, h: 450 }, etc). Nothing appears to work. Some things do nothing, others jitter madly. I don't really know enough about SDL to dig in here, else, this'd be a pull request.

For context, I'm on Linux Mint 19 Cinnamon (like Ubuntu). This doesn't happen in OS-X, and I don't have a windows machine to test with, so I don't know if the issue exists there. It also happens in Raspbian (see PR #3 to test if you've got a Pi).

Transparency/Overlaying

Hello, first of all, I would like to congratulate you for this awesome piece if engineering, I've looked through the source and it's amazing.

Now, onto the main point. I seem to have some trouble regarding the customization of the window, could you provide another example in which you pass custom options? I managed to create another window with custom options by importing the createWindow function, but I have no idea how to get the main window which pops up to have them.

Also, is there any way to make the window, along with the canvas, transparent? I would like to run it as a transparent external overlay over another window. Again, I managed to create another window borderless and all, but still had issues with making it transparent.

All in all, it's really awesome what I got my hands on, and I'm glad I discovered this project.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.