forked from minetest/minetest
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from EleutherAI/keyboard-input
Keyboard input
- Loading branch information
Showing
12 changed files
with
119 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
exec bin/minetest --name me --password whyisthisnecessary --address 0.0.0.0 --port 30000 --dumb-port 'tcp:https://*:9000' --dumb --go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
exec bin/minetest --server --world newworld --gameid minetest --config hacking_testing/minetest.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
Minetest | ||
Copyright (C) 2010-2013 celeron55, Perttu Ahola <[email protected]> | ||
Copyright (C) 2017 nerzhul, Loic Blot <[email protected]> | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published by | ||
the Free Software Foundation; either version 2.1 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public License along | ||
with this program; if not, write to the Free Software Foundation, Inc., | ||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
Minetest | ||
Copyright (C) 2010-2013 celeron55, Perttu Ahola <[email protected]> | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published by | ||
the Free Software Foundation; either version 2.1 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public License along | ||
with this program; if not, write to the Free Software Foundation, Inc., | ||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "irrlichttypes_extrabloated.h" | ||
#include "client/inputhandler.h" | ||
#include <zmqpp/zmqpp.hpp> | ||
#include <string> | ||
|
||
class DumbClientInputHandler : public InputHandler | ||
{ | ||
public: | ||
DumbClientInputHandler(std::string zmq_port): client(context, zmqpp::socket_type::reply) { | ||
try { | ||
client.bind(zmq_port); | ||
} catch (zmqpp::zmq_internal_exception &e) { | ||
errorstream << "ZeroMQ error: " << e.what() << " (port: " << zmq_port << ")" << std::endl; | ||
throw e; | ||
}; | ||
}; | ||
|
||
virtual bool isKeyDown(GameKeyType k) { return keydown[keycache.key[k]]; } | ||
virtual bool wasKeyDown(GameKeyType k) { return false; } | ||
virtual bool wasKeyPressed(GameKeyType k) { return false; } | ||
virtual bool wasKeyReleased(GameKeyType k) { return false; } | ||
virtual bool cancelPressed() { return false; } | ||
virtual float getMovementSpeed() { return movementSpeed; } | ||
virtual float getMovementDirection() { return movementDirection; } | ||
virtual v2s32 getMousePos() { return mousepos; } | ||
virtual void setMousePos(s32 x, s32 y) { mousepos = v2s32(x, y); } | ||
|
||
virtual s32 getMouseWheel() { return 0; } | ||
|
||
virtual void step(float dtime) { | ||
// TODO | ||
}; | ||
|
||
s32 Rand(s32 min, s32 max); | ||
|
||
private: | ||
zmqpp::context context; | ||
zmqpp::socket client; | ||
KeyList keydown; | ||
v2s32 mousepos; | ||
v2s32 mousespeed; | ||
float movementSpeed; | ||
float movementDirection; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters