Skip to content

Instantly share code, notes, and snippets.

@hobnob
hobnob / main.css
Created February 1, 2022 21:25
Initial main.css for Indigo + Tyrian
* {
box-sizing: border-box;
font-family: monospace;
}
html, body {
height: 100vh;
padding: 0;
margin: 0;
}
@hobnob
hobnob / HelloTyrian.scala
Last active February 14, 2022 23:17
Initial HelloTyrian example for Indigo
import tyrian.*
import tyrian.Html.*
import org.scalajs.dom.document
import scala.scalajs.js.annotation.*
enum Msg:
case StartIndigo extends Msg
@JSExportTopLevel("TyrianApp")
object Main extends TyrianApp[Msg, TyrianModel]:
@hobnob
hobnob / HelloIndigo.diff
Last active February 14, 2022 22:41
A diff describing the changes needed to make HelloIndigo use `IndigoGame`
@@ -1,17 +1,15 @@
import indigo._
+import indigo.scenes._
import scala.scalajs.js.annotation.JSExportTopLevel
@JSExportTopLevel("IndigoGame")
-object HelloIndigo extends IndigoSandbox[Unit, Model] {
+object HelloIndigo extends IndigoGame[Unit, Unit, Model, Unit] {
val magnification = 3
@hobnob
hobnob / HelloIndigo.scala
Last active February 14, 2022 22:39
Hello Indigo upgrade to use `IndigoGame`
import indigo._
import indigo.scenes._
import scala.scalajs.js.annotation.JSExportTopLevel
@JSExportTopLevel("IndigoGame")
object HelloIndigo extends IndigoGame[Unit, Unit, Model, Unit] {
val magnification = 3
val config: GameConfig =
[alias]
changelog = log --merges --format=\"* %h %b\"
@hobnob
hobnob / Preferences.sublime-settings
Last active August 29, 2015 14:14
SublimeText2 Config
{
"default_line_ending": "unix",
"draw_minimap_border": true,
"font_size": 20.0,
"ignored_packages":
[
"Vintage"
],
"ignored_words":
[
@hobnob
hobnob / post-merge
Last active August 29, 2015 13:58
Git Hooks
#!/bin/sh
echo " $(tput setaf 1)" &&
git branch --merged master | grep -v master | xargs --no-run-if-empty git branch -d &&
echo " $(tput sgr0)"
1,2c1,3
< #include <SDL/SDL.h>
< #include <SDL/SDL_image.h>
---
> #include <SDL2/SDL.h>
> #include <SDL2/SDL_image.h>
>
8,9c9,11
< SDL_Surface* Surf_Display;
< SDL_Surface* Surf_Image;
@hobnob
hobnob / Game.cpp
Created January 10, 2013 21:43
SDL 2.0 Proof of Concept code
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
namespace core
{
class Game
{
private:
SDL_Window* window; // Declare a pointer to an SDL_Window
SDL_Texture* Surf_Image;
@hobnob
hobnob / Game.cpp
Last active December 10, 2015 22:58
SDL 1.2 Proof of Concept code
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
namespace core
{
class Game
{
private:
SDL_Surface* Surf_Display;
SDL_Surface* Surf_Image;
int x;