Giter VIP home page Giter VIP logo

Comments (6)

erf avatar erf commented on July 19, 2024

I'm looking into this.

from dart_console.

erf avatar erf commented on July 19, 2024

How would i map this function pointer using FFI ?

import 'dart:ffi';
import 'dart:io';

// typedef void (*sighandler_t)(int);
// sighandler_t signal(int signum, sighandler_t handler);

The following builds, but how would i give a callback from Dart code?

typedef signalNative = Int32 Function(Int32, Pointer<NativeFunction>);
typedef signalDart = int Function(int, Pointer<NativeFunction>);

from dart_console.

erf avatar erf commented on July 19, 2024

Started working on resize related stuff in this branch.

A bit stuck for now, with the thing mentioned in previous comment.

from dart_console.

erf avatar erf commented on July 19, 2024

Btw. seem like you can use terminalLines and terminalColumns to get width / height.

from dart_console.

erf avatar erf commented on July 19, 2024

@timsneath i figured you can listen to SIGWINCH aka window resize events using ProcessSignal.sigwinch.watch() ( unix only ). ( and also get cols and rows using core dart libs )

i made a very simple console lib in dart, based on my previous sta lib

i was able to get rawmode "light" using:

      stdin.echoMode = false;
      stdin.lineMode = false;

i do async input using stdin

it's lots simpler than your lib ( no ffi ! ), and not meant for serious work, but i was able to play around with it, and remade snake and some other examples :)

btw: maybe a cross platform pure rawmode and/or resize library using ffi would be helpful

from dart_console.

timsneath avatar timsneath commented on July 19, 2024

from dart_console.

Related Issues (20)

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.