about summary refs log tree commit diff stats
path: root/dwm.h
Commit message (Expand)AuthorAgeFilesLines
...
* cleaned config.*h to prevent some confusionarg@10ksloc.org2006-08-011-2/+3
* uppercasing all define'd values (uppercase-prefixed should only be enum field...arg@10ksloc.org2006-08-011-2/+2
* centralized/externalized configuration to config.harg@10ksloc.org2006-08-011-20/+1
* applied Jukkas prev/next patch with XK_{h,l}arg@10ksloc.org2006-08-011-0/+2
* applied Sanders patchesarg@10ksloc.org2006-08-011-2/+6
* committed a patch which fixes the hints of Jukkaarg@10ksloc.org2006-08-011-1/+1
* sanitization of several clunky stuff, removed heretag (rarely of use), simpli...arg@10ksloc.org2006-07-211-12/+10
* applied sanders no_sizehints for tiled mode patch (thx!)arg@10ksloc.org2006-07-201-1/+1
* using double-linked list in order to get correct prev focus handlingarg@10ksloc.org2006-07-201-1/+2
* cleaned the CUSTOMIZE flagsarg@10ksloc.org2006-07-201-2/+2
* made status bar drawing more robust, implemented togglemax and togglemode, wo...arg@10ksloc.org2006-07-201-1/+3
* removed c->f{x,y,w,h} and c->t{x,y,w,h} in favor for the new rule handling re...arg@10ksloc.org2006-07-201-5/+2
* implemented regexp matching for rulesarg@10ksloc.org2006-07-191-17/+0
* applied Jukka's patch with s/ModKeyMask/MODKEY/garg@10ksloc.org2006-07-191-0/+1
* refactored Sanders code somewhatarg@10ksloc.org2006-07-191-2/+2
* applied Sanders resize patch, fixed lower bugarg@10ksloc.org2006-07-191-1/+4
* implemened distinguishing float/managed geometries of clients (works quite well)Anselm R. Garbe2006-07-181-2/+5
* pop on heretagAnselm R. Garbe2006-07-181-0/+1
* added heretag command which allows to tag a client of a foreign tag with curr...Anselm R. Garbe2006-07-181-1/+2
* ordered variables in structs and source files alphabeticallyAnselm R. Garbe2006-07-171-20/+18
* several additions in mouse handling ;)Anselm R. Garbe2006-07-161-2/+2
* changing XFlush into XSyncAnselm R. Garbe2006-07-151-0/+5
* sanitized other stuffAnselm R. Garbe2006-07-151-3/+1
* proceeded with cleaning up, sorting functions, etcAnselm R. Garbe2006-07-151-20/+19
* rearranged several stuffAnselm R. Garbe2006-07-151-14/+22
* sanitized namesAnselm R. Garbe2006-07-141-12/+12
* rearrangedAnselm R. Garbe2006-07-141-19/+12
* removed a bunch of lines through swap removalAnselm R. Garbe2006-07-141-2/+1
* searching for a better way to discard enter notifiesAnselm R. Garbe2006-07-141-6/+0
* implemented dwm reading status text from stdin Anselm R. Garbe2006-07-141-2/+2
* made barclick to select the specific tagAnselm R. Garbe2006-07-141-0/+1
* implemented bar for dwm (I miss status text), I plan that status text is read...Anselm R. Garbe2006-07-141-4/+7
* added mini stuffAnselm R. Garbe2006-07-131-3/+6
* fixed several things, nearly feature completeAnselm R. Garbe2006-07-131-1/+1
* new stuffAnselm R. Garbe2006-07-131-8/+16
* several other additions/fixes, dwm is quite usable alreadyAnselm R. Garbe2006-07-131-3/+5
* implemented tagging a clientAnselm R. Garbe2006-07-131-11/+19
* added xlock command (I need it regularly)Anselm R. Garbe2006-07-131-1/+2
* changed default colorsAnselm R. Garbe2006-07-131-0/+136
ass="nx">engine = new ROT.Engine(scheduler); this.engine.start(); }, _generateMap: function () { let digger = new ROT.Map.Digger(); let freeCells = []; let digCallback = function (x, y, value) { if (value) { return; } let key = x + "," + y; this.map[key] = "."; freeCells.push(key); }; digger.create(digCallback.bind(this)); this._generateBoxes(freeCells); this._drawWholeMap(); this.player = this._createBeing(Player, freeCells); this.pedro = this._createBeing(Pedro, freeCells); }, _createBeing: function (what, freeCells) { let index = Math.floor(ROT.RNG.getUniform() * freeCells.length); let key = freeCells.splice(index, 1)[0]; let parts = key.split(","); let x = parseInt(parts[0]); let y = parseInt(parts[1]); return new what(x, y); }, _generateBoxes: function (freeCells) { for (let i = 0; i < 10; i++) { let index = Math.floor(ROT.RNG.getUniform() * freeCells.length); let key = freeCells.splice(index, 1)[0]; this.map[key] = "*"; if (!i) { this.ananas = key; } /* first box contains an ananas */ } }, _drawWholeMap: function () { for (let key in this.map) { let parts = key.split(","); let x = parseInt(parts[0]); let y = parseInt(parts[1]); this.display.draw(x, y, this.map[key]); } }, }; let Player = function (x, y) { this._x = x; this._y = y; this._draw(); }; Player.prototype.getSpeed = function () { return 100; }; Player.prototype.getX = function () { return this._x; }; Player.prototype.getY = function () { return this._y; }; Player.prototype.act = function () { Game.engine.lock(); window.addEventListener("keydown", this); }; Player.prototype.handleEvent = function (e) { let code = e.keyCode; if (code == 13 || code == 32) { this._checkBox(); return; } let keyMap = {}; keyMap[38] = 0; keyMap[33] = 1; keyMap[39] = 2; keyMap[34] = 3; keyMap[40] = 4; keyMap[35] = 5; keyMap[37] = 6; keyMap[36] = 7; /* one of numpad directions? */ if (!(code in keyMap)) { return; } /* is there a free space? */ let dir = ROT.DIRS[8][keyMap[code]]; let newX = this._x + dir[0]; let newY = this._y + dir[1]; let newKey = newX + "," + newY; if (!(newKey in Game.map)) { return; } Game.display.draw(this._x, this._y, Game.map[this._x + "," + this._y]); this._x = newX; this._y = newY; this._draw(); window.removeEventListener("keydown", this); Game.engine.unlock(); }; Player.prototype._draw = function () { Game.display.draw(this._x, this._y, "@", "#ff0"); }; Player.prototype._checkBox = function () { let key = this._x + "," + this._y; if (Game.map[key] != "*") { alert("There is no box here!"); } else if (key == Game.ananas) { alert("Hooray! You found an ananas and won this game."); Game.engine.lock(); window.removeEventListener("keydown", this); } else { alert("This box is empty :-("); } }; let Pedro = function (x, y) { this._x = x; this._y = y; this._draw(); }; Pedro.prototype.getSpeed = function () { return 100; }; Pedro.prototype.act = function () { let x = Game.player.getX(); let y = Game.player.getY(); let passableCallback = function (x, y) { return x + "," + y in Game.map; }; let astar = new ROT.Path.AStar(x, y, passableCallback, { topology: 4 }); let path = []; let pathCallback = function (x, y) { path.push([x, y]); }; astar.compute(this._x, this._y, pathCallback); path.shift(); if (path.length == 1) { Game.engine.lock(); alert("Game over - you were captured by Pedro!"); } else { x = path[0][0]; y = path[0][1]; Game.display.draw(this._x, this._y, Game.map[this._x + "," + this._y]); this._x = x; this._y = y; this._draw(); } }; Pedro.prototype._draw = function () { Game.display.draw(this._x, this._y, "P", "red"); }; Game.init();