Skip to content

Instantly share code, notes, and snippets.

View juaxix's full-sized avatar
xixgames

juaxix juaxix

xixgames
View GitHub Profile
@juaxix
juaxix / kdtree_with_example.cpp
Last active March 9, 2022 19:38
C++ KD Tree with Vector3 and a condition flag
#include <iostream>
#include <memory>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
void padTo(string &str, const size_t num, const char paddingChar = ' ')
{
@juaxix
juaxix / infinite_links.php
Created April 26, 2017 21:55
Hacker rank - infinite links - Capture the Flag contest - April 2017
--# Main
-- Sandbox
supportedOrientations(LANDSCAPE_ANY)
displayMode(FULLSCREEN_NO_BUTTONS)
--displayMode(OVERLAY)
--displayMode(FULLSCREEN)
function setup()
screen=vec2(WIDTH,HEIGHT)
@juaxix
juaxix / buildaimodels.php
Last active August 29, 2015 14:06
Shiva :: Create S3DAIModels.cpp file list for Android exports
<?php
/*
* Example: php5\php.exe buildaimodels.php "C:\\Games\\YourGame\\build\\Android\\eclipse\\jni\\AIModels"
*/
echo "Generating list...\n";
$dir = $argv[1] or "C:\\Games\\YourGame\\build\\Android\\eclipse\\jni\\AIModels";
$dh = opendir($dir);
$txt = "//File generated by juax\n\n\n";
$n = 0;
while (false !== ($filename = readdir($dh))) {
@juaxix
juaxix / shivaFileCount.php
Last active August 29, 2015 14:06
Shiva - generate line counts for all AI models
<?php
/*
Example: > c:\php5\php.exe shivaFileCount.php "c:\Stonetrip\ShiVa Editor Basic\Data\Games\7DFPS_13"
*/
/**
* Scan Resources/AIModels for aim files
* @param string $dir
* @return array
*/
function findAllAI ( $dir ){
@juaxix
juaxix / Game.lua
Last active January 1, 2016 17:39
Hombert Castle Fall
--# Main
-- hombert Castle Fall
displayMode(FULLSCREEN)
supportedOrientations(LANDSCAPE_ANY)
-- Use this function to perform your initial setup
function setup()
w = WIDTH/1024
h = HEIGHT/768
useMusic = true
@juaxix
juaxix / Harmony.lua
Created August 21, 2013 19:31
Lua Harmony :: colaborative drawing
--# Main
supportedOrientations(LANDSCAPE_ANY)
myimage = image(WIDTH,HEIGHT)
setContext(myimage)
function setup()
--backingMode(RETAINED)
toolbox = ToolBox()
@juaxix
juaxix / Main.lua
Last active December 21, 2015 03:09
Destructible Terrain and water fluids
-- destructable
-- Use this function to perform your initial setup
function setup()
    parameter.boolean("addWater",false)
    defaultGravity = physics.gravity()
    parameter.boolean("useGravity",false, function(v)
       if v then 
        physics.gravity(Gravity)
       else
@juaxix
juaxix / Fish.lua
Created July 9, 2013 11:19
Codea - Fish.lua
Boid = class()
-- constructor used by fish
function Boid:init( _location, _maxSpeed, _maxForce)
self.velocity = vec2( math.random( -maxSpeed, maxSpeed ), math.random( -maxSpeed, maxSpeed ) )
self:createBoid(_location, _maxSpeed, _maxForce)
end
-- constructor used by bubbles
--[[
@juaxix
juaxix / NetworkLogic.cpp
Last active December 19, 2015 05:49
Photon Cloud SDK with ShiVa 3D : C++
#include "PrecompiledHeader.h"
#include "NetworkLogic.h"
#if defined _EG_MARMALADE_PLATFORM
# if defined I3D_ARCH_X86
# if(defined _MSC_VER && !defined __clang__ && !defined __gcc__)
# define PLAYER_NAME L"Marmalade X86 Windows"
# else
# define PLAYER_NAME L"Marmalade X86 OS X"
# endif