overhype
v0.1.19
Published
Game dev tool
Downloads
3
Readme
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);
//prints all functions
oh.structure();
//return the manual
console.log(oh.manual());
packege.json:
"node-gyp": "^3.8.0"
run.sh:
npm i node-gyp
npm i nan --save
node-gyp configure build
node ./index.js
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;
}
*/