Giter Site home page Giter Site logo

Not printable char about scone HOT 10 CLOSED

EmTee70 avatar EmTee70 commented on September 24, 2024
Not printable char

from scone.

Comments (10)

vladdeSV avatar vladdeSV commented on September 24, 2024

Could you provide the code you used?

from scone.

vladdeSV avatar vladdeSV commented on September 24, 2024

Also, please provide version (eg master, 1.2, 2.0-pre) and OS

from scone.

EmTee70 avatar EmTee70 commented on September 24, 2024

yes, sure: 2.0-pre on Ubuntu 14.04 LTS in XFCE Terminal and
The error occured when placing the window.print() outside the loop in the function place_random.

import scone;
import std.random:uniform;
        enum width = 40;
        enum height = 20;
        int xpos = width/2;
        int ypos = height/2;
        int[height][width] mirror;
        
        void place_random(int num, wchar zeichen, Color fore_ground = Color.red, int value = 0){
                for(auto j=0;j<num; j++){
                   auto rx = uniform(0,width);
                   auto ry = uniform(0,height);
                   window.write(rx,ry,fg(fore_ground),bg(Color.black),zeichen);
                   mirror[rx][ry]=value;
                   window.print();
                 }
         }
void main()
{
        window.resize(width,height);
        window.clear();

        for(auto x=0; x<width;x++){
           for(auto y=0;y<height;y++){
              window.write(x,y,bg(Color.black)," ");
           }
        }
        window.print();
        place_random(100,'\u2660',fg(Color.red),10);
        place_random(400,'#',fg(Color.white_dark),-1000);
        place_random(100,'\u2663',fg(Color.yellow_dark),20);
}

from scone.

vladdeSV avatar vladdeSV commented on September 24, 2024

I see you use wchar in your code, which sadly isn't supported by scone. (I decided this sometime long ago because wchar and the windows console did not go well together).

If you change from wchar to char, does that "fix" your problem?

from scone.

EmTee70 avatar EmTee70 commented on September 24, 2024

ok, will try. How do I request if for example the 'r' key is pressed? My syntax seams to be wrong.
input.key == ??

from scone.

vladdeSV avatar vladdeSV commented on September 24, 2024

from scone.

EmTee70 avatar EmTee70 commented on September 24, 2024

Now I realized window.getInputs() seams to return nothing?
Any idea?

from scone.

vladdeSV avatar vladdeSV commented on September 24, 2024

Could you test with master branch?

I have only tested this with Mac/Ubuntu GNOME, so it could be the input not working at all :(

from scone.

EmTee70 avatar EmTee70 commented on September 24, 2024

Looks better!
Seams to work! Thank you!
Other question: Do you know how to speed up keys? I mean when holding a key pressed than it should repeat faster. something with xset -r ...

from scone.

vladdeSV avatar vladdeSV commented on September 24, 2024

Good to know! 2.0.0-pre.1 only handles a few macOS inputs. master supports almost all macOS/Ubuntu keys.

I'll close this issue, since the initial problem is resolved 😄


I do not believe repeat speed is something scone can set, as it is (I think) not handled by the terminal.

from scone.

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.