Skip to content

Commit

Permalink
Upload slightly modified source
Browse files Browse the repository at this point in the history
This is the base from which any functional modifications will be made on.
  • Loading branch information
Matteas-Eden authored Mar 28, 2020
1 parent 2d2f4ee commit be4e222
Show file tree
Hide file tree
Showing 10 changed files with 2,254 additions and 0 deletions.
71 changes: 71 additions & 0 deletions dice.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
.center_field {
position: absolute;
text-align: center;
height: 100%;
width: 100%;
}

.center_field * {
position: relative;
font-family: Trebuchet MS;
background-color: rgba(255, 255, 255, 0.6);
padding: 5px 15px;
}

.center_field br {
background-color: rgba(0, 0, 0, 0);
}

.bottom_field {
position: absolute;
text-align: center;
bottom: 5px;
width: inherit;
padding: 0px;
}

#label {
font-size: 32pt;
word-spacing: 0.5em;
padding: 5px 15px;
color: rgba(21, 26, 26, 0.6);
top: 45%;
}

#labelhelp {
font-size: 12pt;
padding: 5px 15px;
color: rgba(21, 26, 26, 0.5);
bottom: 50px;
}

#set {
text-align: center;
font-size: 26pt;
border: none;
color: rgba(0, 0, 0, 0.8);
background-color: rgba(255, 255, 255, 0);
top: 60%;
}

#sethelp {
font-size: 12pt;
color: rgba(21, 26, 26, 0.5);
background: none;
top: 25%;
}

#selector_div button {
font-size: 20pt;
color: rgb(255, 255, 255);
background-color: rgba(0, 0, 0, 0.6);
cursor: pointer;
border: none;
width: 5em;
top: 62%;
}

.dice_place {
position: absolute;
border: solid black 1px;
}
826 changes: 826 additions & 0 deletions dice.js

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions dice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import webapp2
import logging
import json
from google.appengine.api import urlfetch

root = '/dice/'

class DiceHandler(webapp2.RequestHandler):
def post(self):
self.response.headers['Content-Type'] = 'application/json-rpc'
data = json.loads(self.request.body)
if data['method'] == 'random':
req = {
"jsonrpc": "2.0",
"method": "generateDecimalFractions",
"params": {
'apiKey': 'f6e74d7b-070e-4f85-865d-d859fc0d078b',
'n': data['n'],
'decimalPlaces': 2,
},
"id": 1
}
result = urlfetch.fetch(
url = 'https://api.random.org/json-rpc/1/invoke',
payload = json.dumps(req),
method = urlfetch.POST,
headers = { 'Content-Type': 'application/json-rpc' },
validate_certificate = False
)
self.response.write(result.content)
return

self.response.write('{}')

app = webapp2.WSGIApplication([
(root + 'f', DiceHandler),
], debug = True)

Binary file added favicon.ico
Binary file not shown.
59 changes: 59 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="keywords" content="DnD, dungeons and dragons, roleplay, dice, roller, 3D, RPG"/>
<meta name="description" content="An Interactive, Online 3D Dice Roller"/>
<title>3D Dice Roller</title>

<style type="text/css">@import "main.css";</style>
<style type="text/css">@import "dice.css";</style>

</head>

<body style="margin: 0">
<div id="control_panel" class="control_panel">
<img src="favicon.ico" style="vertical-align: middle"></img>
<p id="loading_text">Loading libraries, please wait a bit...</p>
<p id="original_link"><a href="http://a.teall.info/dice">Original Site</a></p>
<p id="original_source"><a href="http://www.teall.info/2014/01/online-3d-dice-roller.html">Original Source</a></p>
<p id="repo_link"><a href="https://github.com/Matteas-Eden/dice-roller">Link to GitHub repo</a></p>
<!-- <p id="info_text"><a href="/mdice">Multiplayer version</a></p> -->
</div>
<div id="info_div" style="display: none">
<div class="center_field">
<span id="label"></span>
</div>
<div class="center_field">
<div class="bottom_field">
<span id="labelhelp">Click once to start again or click and drag to re-roll</span>
</div>
</div>
</div>
<div id="selector_div" style="display: none">
<div class="center_field">
<div id="sethelp">
Choose your set of dice by clicking the dice on-screen or via direct input using notation,<br/>
then click and drag anywhere on screen or press the throw button to roll.
</div>
</div>
<div class="center_field">
<input type="text" id="set" value="4d6"></input><br/>
<button id="clear">clear</button>
<button style="margin-left: 0.6em" id="throw">throw</button>
</div>
</div>
<div id="canvas"></div>

<script src="libs/three.min.js"></script>
<script src="libs/cannon.min.js"></script>

<script type="text/javascript" src="teal.js"></script>
<script type="text/javascript" src="dice.js"></script>
<script type="text/javascript" src="main.js"></script>
<script type="text/javascript" defer="defer">
dice_initialize(document.body);
</script>
</body>
</html>
3 changes: 3 additions & 0 deletions libs/cannon.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit be4e222

Please sign in to comment.