Skip to content

Commit

Permalink
Version 0.9.6 (the crashing creation)
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperIlu committed May 26, 2019
1 parent a7fc72f commit 8cb33a5
Show file tree
Hide file tree
Showing 91 changed files with 20,694 additions and 20,470 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
**Version 0.9.6 (the crashing creation)**
* Fixed massive crash when using the builtin font in p5 compatibility layer
* Some API improvements
* Even more examples and a DOjS presentation done with DOjS
* Small fixes for `image()`, `arc()` and `text()` in p5 compatibility layer
* Enabled transparency for 24bpp and 32bpp mode (was only 32bpp before).
* Added useable alpha value to the return value of `GetPixel()`
* As always: more examples
* updated MuJS to latest version from http://git.ghostscript.com/?p=mujs.git;a=summary

**Version 0.9.5 (the changed creation)**
* Replaced libmikmod, GRX and all sound code by Allegro 4.2.2.
* Transparency/RGBA now works.
Expand Down
4 changes: 2 additions & 2 deletions DOjS.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ static void run_script(char *script, int width, int bpp, bool no_sound, bool no_
// ut_dumpVideoModes();
#endif

if (bpp < 32) {
if (bpp < 24) {
no_alpha = true;
LOG("BPP < 32, disabling alpha\n");
LOG("BPP < 24, disabling alpha\n");
}

// detect hardware and initialize subsystems
Expand Down
4 changes: 2 additions & 2 deletions DOjS.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ SOFTWARE.

#define SYSINFO ">>> " //!< logfile line prefix for system messages

#define DOSJS_VERSION 0.95 //!< version number
#define DOSJS_VERSION_STR "V0.95" //!< version number as string
#define DOSJS_VERSION 0.96 //!< version number
#define DOSJS_VERSION_STR "V0.96" //!< version number as string

#define BOOT_DIR "JSBOOT/" //!< directory with boot files.

Expand Down
1 change: 1 addition & 0 deletions allegro-4.2.2-xc-master/xmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ MINGDIR=$INSTALL_BASE
DJDIR=$INSTALL_BASE
NATIVEPATH=$PATH
PATH=$XC_PATH:$NATIVEPATH
DEBUGMODE=1

export CROSSCOMPILE MINGDIR DJDIR NATIVEPATH PATH XPREFIX

Expand Down
7 changes: 6 additions & 1 deletion color.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ static void f_Color(js_State *J) {
js_error(J, "Color needs four integer arguments");
return;
} else {
js_pushnumber(J, makeacol(js_toint16(J, 1), js_toint16(J, 2), js_toint16(J, 3), js_toint16(J, 4)));
int r = js_toint16(J, 1);
int g = js_toint16(J, 2);
int b = js_toint16(J, 3);
int a = js_toint16(J, 4);
uint32_t rgba = makeacol(r, g, b, a);
js_pushnumber(J, rgba);
}
}

Expand Down
2 changes: 1 addition & 1 deletion doc/html/ArcInfo.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/Bitmap.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/Event.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/File.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/Font.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/IpxAddress.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/IpxPacket.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/MemInfo.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/Midi.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/Sample.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/StatInfo.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/doc_classes.js.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/doc_internal.js.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/doc_objects.js.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/global.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/jsboot_color.js.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/jsboot_file.js.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/jsboot_func.js.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/jsboot_ipx.js.html

Large diffs are not rendered by default.

7 changes: 1 addition & 6 deletions doc/html/jsboot_p5.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions doc/html/jsboot_p5color.js.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/jsboot_p5env.js.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/jsboot_p5input.js.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/jsboot_p5math.js.html

Large diffs are not rendered by default.

17 changes: 8 additions & 9 deletions doc/html/jsboot_p5shape.js.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/jsboot_p5trans.js.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions doc/html/jsboot_p5typo.js.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/jsboot_p5util.js.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/jsboot_p5vect.js.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/module-color.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/module-gfx.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions doc/html/module-ipx.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/module-midi.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/module-other.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/module-p5compat-Color.html

Large diffs are not rendered by default.

37,877 changes: 18,538 additions & 19,339 deletions doc/html/module-p5compat.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/p5compat.PVector.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/p5compat.module_NumberDict-NumberDict.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/p5compat.module_NumberDict.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/p5compat.module_PVector.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/p5compat.module_StringDict-StringDict.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/p5compat.module_StringDict.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/p5compat.module_TypedDict-TypedDict.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/html/p5compat.module_TypedDict.html

Large diffs are not rendered by default.

119 changes: 119 additions & 0 deletions examples/ant2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
/*
MIT License
Copyright (c) 2019 Andre Seidelt <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

Include('p5');

UP = 1;
DOWN = 2;
LEFT = 3;
RIGHT = 4;

var antX, antY;
var dir;

var field;

function setup() {
dir = DOWN;
antX = width / 2;
antY = height / 2;

// create playfield
field = new Array(height);
for (var y = 0; y < height; y++) {
var line = new Array(width);
for (var x = 0; x < width; x++) {
line[x] = 0;
}
field[y] = line;
}

background(0);
colorMode(HSB);
}

function draw() {
var cell = field[antY][antX];
if (cell >= 0) {
switch (dir) {
case LEFT:
dir = DOWN;
break;
case RIGHT:
dir = UP;
break;
case UP:
dir = LEFT;
break;
case DOWN:
dir = RIGHT;
break;
}
cell += 4;
stroke(cell, 255, 255);
cell *= -1;
} else {
switch (dir) {
case LEFT:
dir = UP;
break;
case RIGHT:
dir = DOWN;
break;
case UP:
dir = RIGHT;
break;
case DOWN:
dir = LEFT;
break;
}
cell *= -1;
cell += 4;
stroke(0, 0, 0);
}
field[antY][antX] = cell;
point(antX, antY);

// move ant
switch (dir) {
case LEFT:
if (antX > 0) {
antX--;
}
break;
case RIGHT:
if (antX < width) {
antX++;
}
break;
case UP:
if (antY > 0) {
antY--;
}
break;
case DOWN:
if (antY < height) {
antY++;
}
break;
}
}
24 changes: 12 additions & 12 deletions examples/arcer.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@ Include('p5');
** This function is called once when the script is started.
*/
function setup() {
centerX = width / 2;
centerY = height / 2;
colorMode(HSB);
frameRate(10);
centerX = width / 2;
centerY = height / 2;
colorMode(HSB);
frameRate(10);
}

/*
** This function is repeatedly until ESC is pressed or Stop() is called.
*/
function draw() {
var r = random(0, min(width, height) / 2);
var start = random(0, 255);
var end = random(0, 255);
var c = random(0, 255);
var cCol = color(c, 255, 255);
var lCol = color(c, 128, 255);
var r = random(0, min(width, height) / 2);
var start = random(0, 3600);
var end = random(0, 3600);
var c = random(0, 255);
var cCol = color(c, 255, 255);
var lCol = color(c, 128, 255);

var ai = CircleArc(centerX, centerY, r, start, end, cCol);
Line(centerX, centerY, ai.startX, ai.startY, lCol);
var ai = CircleArc(centerX, centerY, r, start, end, cCol.toAllegro());
Line(centerX, centerY, ai.startX, ai.startY, lCol.toAllegro());
}
4 changes: 2 additions & 2 deletions examples/arcer2.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ function draw() {
var cCol = color(c, 255, 255);
var lCol = color(c, 128, 255);

var ai = CircleArc(centerX, centerY, r, start, start + size, cCol);
var ai = CircleArc(centerX, centerY, r, start, start + size, cCol.toAllegro());
if (lastAI) {
Line(lastAI.endX, lastAI.endY, ai.startX, ai.startY, lCol);
Line(lastAI.endX, lastAI.endY, ai.startX, ai.startY, lCol.toAllegro());
}

start += size;
Expand Down
2 changes: 1 addition & 1 deletion examples/arcer3.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function setup() {
arcs.push({
start: random(0, 3600),
length: random(0, 3600),
col: color(random(0, 255), 255, 255),
col: color(random(0, 255), 255, 255).toAllegro(),
r: i
});
}
Expand Down
45 changes: 45 additions & 0 deletions examples/eyes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
MIT License
Copyright (c) 2019 Andre Seidelt <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

Include('p5');

function setup() {
createCanvas(windowWidth, windowHeight);
background(10);
frameRate(2);
colorMode(HSB, height, height, height);
noStroke();
r = height;
}

function draw() {
if (r > 0) {
fill(r, height - r, height - r / 2);
circle(width / 2, height / 2, r);
r -= random(height / 10);
}
}

function mousePressed() {
background(0);
r = height;
}
47 changes: 47 additions & 0 deletions examples/eyes2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
MIT License
Copyright (c) 2019 Andre Seidelt <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

Include('p5');

function setup() {
createCanvas(windowWidth, windowHeight);
background(10);
frameRate(200);
colorMode(HSB, height, height, height, 100);
noStroke();
r = height;
}

function draw() {
if (r > 0) {
fill(r, height - r, height - r / 2, 2);
circle(width / 2, height / 2, r);
r -= random(height / 10);
} else {
r = height;
}
}

function mousePressed() {
background(0);
r = height;
}
69 changes: 69 additions & 0 deletions examples/fntcnt.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
MIT License
Copyright (c) 2019 Andre Seidelt <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

fontList = [];
startIdx = 0;
endIdx = -1;

FONT_DIR = 'jsboot/fonts';

function Setup() {
fileNames = List(FONT_DIR);
fileNames.forEach(function (e) {
if (e != ".." && e != ".") {
var name = FONT_DIR + "/" + e;
Println("Loading " + name);
try {
fontList.push(new Font(name));
} catch (e) {
Println(e);
}
}
});
}

function Loop() {
ClearScreen(EGA.GREEN);
var yPos = 0;
for (var i = startIdx; i < fontList.length; i++) {
if (yPos + fontList[i].height > SizeY()) {
break;
}
var name = fontList[i].filename.split("/")[2];
var str = name + " / This is a test of the emergency broadcast system where the quick brown fox jumps over the fence!";
fontList[i].DrawStringLeft(10, yPos, str, EGA.WHITE, NO_COLOR);
yPos += 4 + fontList[i].height;
endIdx = i;
}
}

function Input(e) {
// next page if available, else exit
if ((e.key & 0xFF) == CharCode(" ")) {
Println("SPACE!");
if (endIdx == fontList.length - 1) {
Stop();
} else {
startIdx = endIdx;
}
}
}
Loading

0 comments on commit 8cb33a5

Please sign in to comment.