<h2>Overhype packege</h2>
<p>Modefication of Antihype package: more faster and modern</p>
<img src="http://t-m.com.ua/images/overhype-js.jpg" style="margin: auto">


<h3>Installation</h3>
<h4>1. Install SDL</h4>

<p>:Linux:</p>
<xmp> 
    apt-get install libsdl2-2.0.0 libsdl2-dev libsdl2-imege-2.0.0 libsdl2-imege-dev libsdl2-ttf-2.0.0 libsdl2-ttf-dev libsdl2-mixer-2.0-0  libsdl2-mixer-dev
</xmp>

<p>Windows:</p>
<a href="https://www.libsdl.org/download-2.0.php">
    https://www.libsdl.org/download-2.0.php
</a>

<h4>1. Download npm package</h4>
<xmp>
    npm i overhype
</xmp>


<h3>Getting started</h3>
<p> You can run the demo: <xmp>node ./mode_modules/overhype/demo.js</xmp></p>



<h3>Example</h3>

<xmp>
    'use strict';

    const oh = require('./index');
    oh.structure();

    oh.init();

    let prefix = __dirname;
    if(process.argv[2] == 'dev') prefix = '.';

    const font = oh.loadFont(prefix + '/ttf/Caviar_Dreams_Bold.ttf', 40);
    const fontSmall = oh.loadFont(prefix + '/ttf/Caviar_Dreams_Bold.ttf', 20);
    const logo = oh.loadSurface(prefix + '/logo.jpg');

    const window = oh.createWindow({
        title: 'overhype reviev',
        x: 10,
        y: 10,
        w: 1000,
        h: 600,
    });

    const pos = {
        x1: 200,
        y1: 500,
        x2: 0,
        y2: 0,
    }

    let i = 0;

    oh.event.start();

    const channel = oh.sound.channel();
    console.log('channel:', channel);
    oh.sound.play(oh.sound.load('./rude-eternal-youth.mp3'), channel, 1);
    console.log('channel:', channel);
    oh.sound.volume(channel, 128);


    setInterval(() => {
        const mouse = oh.event.mouse();
        const Qpressed = oh.event.code(20) ? 'Key Q pressed on keyboard' : 'Please press Q on keyboard';
        
        
        if(mouse.x > 970) {
            oh.quit();
            process.exit(0);
        }
        
        
        oh.fillRect(window);

            
        pos.x2 = pos.x1 + Math.cos(i / 30) * 80;
        pos.y2 = pos.y1 + Math.sin(i / 30) * 80 - mouse.y / 70;
    
        //oh.spm.rect(window, pos.x1 - mouse.x / 10, pos.y1 - mouse.y / 10, pos.x2 - mouse.x / 10, pos.y2 - mouse.y / 10);
        //oh.spm.grid(window, pos.x1 - mouse.x / 10, pos.y1 - mouse.y / 10, pos.x2 - mouse.x / 10, pos.y2 - mouse.y / 10, 4);
    
        //oh.blitSurface(logo, undefined, 0, { x: 100 - mouse.x / 200, y: 100 - mouse.y / 200 });
        oh.spm.rotatedSurface(logo, 0, { x: 500 - mouse.x / 200, y: 240 - mouse.y / 200 }, 0, 1, 1 );

        oh.bindFont(font);
        oh.spm.blendedText(window, 'This is OverHype', 600 - mouse.x / 100, 430 - mouse.y / 100);
        oh.bindFont(fontSmall);
        oh.spm.blendedText(window, 'Move mouse to left side to exit', 600 - mouse.x / 10, 500 - mouse.y / 50);
        oh.spm.blendedText(window, Qpressed, 300 - mouse.x / 100, 550 - mouse.y /30);

        oh.updateWindowSurface();

        //console.log(oh.event.pressed());

        i++;
    }, 10);
</xmp>




<h3>Docs</h3>
<xmp>
    const oh = require('overhype');

    //prints all functions
    oh.structure();

    //return the manual
    console.log(oh.manual());

</xmp>

<xmp>
    binding.gyp:
        {
            "targets": [
                {
                    "target_name": "module",
                    "sources": [ "module.cc" ],
                    "include_dirs": [
                        "<!(node -e \"require('nan')\")"    
                    ]                                       
                }                                       
            ]                                           
        }                                           

    packege.json:
        "node-gyp": "^3.8.0"

    run.sh:
        npm i node-gyp
        npm i nan --save
        node-gyp configure build
        node ./index.js
</xmp>
<hr>
<xmp>
    /*
    if(!args[0]->IsString()) {
        Hype::jserr(isolate, "First argument must be string");
        return;
    }

    v8::String::Utf8Value s(args[0]);
    std::string title(*s);
    std::cout << title << " aaa\n";
    */

    /*
    args[0].As<v8::Uint32>()->Value()
    */

    /*
        int main(int argc, char **argv)
        {
            std::map<Uint32, SDL_Surface*> surfaces;
            m["hello"] = 23;
            // check if key is present
            if (m.find("world") != m.end())
                std::cout << "map contains key world!\n";
            // retrieve
            std::cout << m["hello"] << '\n';
            std::map<std::string, int>::iterator i = m.find("hello");
            assert(i != m.end());
            std::cout << "Key: " << i->first << " Value: " << i->second << '\n';
            return 0;
        }
    */
</xmp>