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
module basic-window | |
native include "raylib.h" | |
native type Color "Color" | |
native var Color raywhite "RAYWHITE" | |
native var Color lightgray "LIGHTGRAY" | |
native func init-window(copy Int w, copy Int h, copy cdef.Pointer{cdef.Char} text)->() "InitWindow" |
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
switch operating-system | |
case 'windows | |
load-library "libraylib.dll" | |
case 'linux | |
load-library "libraylib.so" | |
case 'macos | |
load-library "libraylib.dylib" | |
default | |
error "Unsupported OS" | |
run-stage; |
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
(use Array) | |
(use String) | |
(load "raylib.carp") | |
(use rlcore) | |
(use KeyboardKey) | |
(use Colors) | |
(use Shapes) | |
(use Text) |
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
(use Int) | |
(use String) | |
(load "raylib.carp") | |
(use rlcore) | |
(Project.config "title" "basic_window") | |
(def screen-width 800) | |
(def screen-height 450) |
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
In file included from out\main.c:21: | |
D:\Code\GitHub\Carp/core\carp_double.h(43,5): warning: 'memcpy' will always overflow; destination buffer has size 4, but size argument is 8 [-Wfortify-source] | |
memcpy(&y, &x, sizeof(double)); | |
^ | |
In file included from out\main.c:24: | |
D:\Code\GitHub\Carp/core\carp_string.h(19,5): warning: format specifies type 'long' but the argument has type 'ssize_t' (aka 'long long') | |
[-Wformat] | |
CHK_INDEX(i, strlen(*s)); | |
^~~~~~~~~~~~~~~~~~~~~~~~ | |
D:\Code\GitHub\Carp/core\core.h(39,64): note: expanded from macro 'CHK_INDEX' |
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 is more or less a direct translation, so there are no fancy Lisp macros or anything in this code. | |
(include <raylib.h>) | |
(defvar MAX_BUILDINGS 100) | |
(function main () -> int | |
(decl ((const int screenWidth = 800) | |
(const int screenHeight = 450))) |
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
var Entities = [ ] | |
class Entity { | |
construct new(tx, ty, st, ss, sm, sp, spm) { | |
_t = 0 | |
_x = tx | |
_y = ty | |
_flipped = 0 | |
_vx = 0 |
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
import math | |
var s, sq = 0 | |
for i in 1..100: | |
s += math.`^`(i, 2) | |
sq += i | |
sq = math.`^`(sq, 2) |
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
var n: int = 20 | |
var found: bool = false | |
while (not found): | |
for i in countdown(20, 1): | |
if (n mod i == 0): | |
if (i == 1): | |
found = true; | |
else: | |
break |
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
var n: int = 1 | |
var prev: array[0..1, int] = [1, 1] | |
var sum: int = 0 | |
while (n < 4000000): | |
if (n mod 2 == 0): | |
sum += n | |
prev[0] = prev[1] | |
prev[1] = n | |
n = prev[0] + prev[1] |
NewerOlder