Skip to content

Commit

Permalink
Add/update distribution assets.
Browse files Browse the repository at this point in the history
  • Loading branch information
gabordemooij committed Dec 6, 2024
1 parent 5b80fe4 commit d6fc46d
Show file tree
Hide file tree
Showing 17 changed files with 341 additions and 17 deletions.
42 changes: 27 additions & 15 deletions misc/distrib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ mkdir dist/Linux
mkdir dist/Linux/ISO
mkdir dist/Linux/OUT

VERSION="1_0_0beta5"
VERSION="1_0_0beta7" #for files
VERSION_NAME="1.0b7" #for display

declare -a langs=("en" "nl" "fy" "de" "fr" "no" "ru" "cs" "it" "hi" "pt_br" "uz" "pl" "id" "zh2" "fa" "es")
for lang in "${langs[@]}"
Expand Down Expand Up @@ -55,17 +56,20 @@ cp plugins/media/assets/picto.ico dist/Win64/ISO/$lang/pictogram.ico

# Translate examples

./bin/Linux/ctren -t /tmp/dict_all.dict demo1.ctr > dist/Win64/ISO/$lang/demo1.ctr 2>/tmp/err1.log
./bin/Linux/ctren -t /tmp/dict_all.dict demo2.ctr > dist/Win64/ISO/$lang/demo2.ctr 2>/tmp/err2.log
./bin/Linux/ctren -t /tmp/dict_all.dict demo3.ctr > dist/Win64/ISO/$lang/demo3.ctr 2>/tmp/err3.log
./bin/Linux/ctren -t /tmp/dict_all.dict demo4.ctr > dist/Win64/ISO/$lang/demo4.ctr 2>/tmp/err4.log
./bin/Linux/ctren -t /tmp/dict_all.dict demo5.ctr > dist/Win64/ISO/$lang/demo5.ctr 2>/tmp/err5.log
./bin/Linux/ctren -t /tmp/dict_all.dict demo6.ctr > dist/Win64/ISO/$lang/demo6.ctr 2>/tmp/err6.log
./bin/Linux/ctren -t /tmp/dict_all.dict demo7.ctr > dist/Win64/ISO/$lang/demo7.ctr 2>/tmp/err7.log
./bin/Linux/ctren -t /tmp/dict_all.dict demo8.ctr > dist/Win64/ISO/$lang/demo8.ctr 2>/tmp/err8.log
./bin/Linux/ctren -t /tmp/dict_all.dict demo9.ctr > dist/Win64/ISO/$lang/demo9.ctr 2>/tmp/err9.log
./bin/Linux/ctren -t /tmp/dict_all.dict demo10.ctr > dist/Win64/ISO/$lang/demo10.ctr 2>/tmp/err10.log
./bin/Linux/ctren -t /tmp/dict_all.dict demo11.ctr > dist/Win64/ISO/$lang/demo11.ctr 2>/tmp/err11.log
./bin/Linux/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo1.ctr > dist/Win64/ISO/$lang/demo1.ctr 2>/tmp/err1.log
./bin/Linux/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo2.ctr > dist/Win64/ISO/$lang/demo2.ctr 2>/tmp/err2.log
./bin/Linux/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo3.ctr > dist/Win64/ISO/$lang/demo3.ctr 2>/tmp/err3.log
./bin/Linux/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo4.ctr > dist/Win64/ISO/$lang/demo4.ctr 2>/tmp/err4.log
./bin/Linux/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo5.ctr > dist/Win64/ISO/$lang/demo5.ctr 2>/tmp/err5.log
./bin/Linux/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo6.ctr > dist/Win64/ISO/$lang/demo6.ctr 2>/tmp/err6.log
./bin/Linux/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo7.ctr > dist/Win64/ISO/$lang/demo7.ctr 2>/tmp/err7.log
./bin/Linux/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo8.ctr > dist/Win64/ISO/$lang/demo8.ctr 2>/tmp/err8.log
./bin/Linux/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo9.ctr > dist/Win64/ISO/$lang/demo9.ctr 2>/tmp/err9.log
./bin/Linux/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo10.ctr > dist/Win64/ISO/$lang/demo10.ctr 2>/tmp/err10.log
./bin/Linux/ctren -t /tmp/dict_all.dict misc/distrib/assets/demo11.ctr > dist/Win64/ISO/$lang/demo11.ctr 2>/tmp/err11.log
./bin/Linux/ctren -t /tmp/dict_all.dict misc/distrib/assets/pak-o-mat.ctr > dist/Win64/ISO/$lang/pak-o-mat.ctr 2>/tmp/pak-o-mat.log
sed -e "s/ctrnl/ctr$lang/g" misc/distrib/assets/export.bat > dist/Win64/ISO/$lang/export.bat



# Copy assets to setup creator work dir
Expand All @@ -78,13 +82,18 @@ cp -R dist/Win64/ISO/$lang ~/.wine/drive_c/InnoSetupSourceDir/dist

# Copy setup-creator script to work dir
suffix="$(echo "$lang" | tr 'a-z' 'A-Z')"
sed -e "s/096/$VERSION/g" -e "s/ctrnl/ctr$lang/g" -e "s/CitrineNL/Citrine$suffix/" plugins/media/citrine.iss > ~/.wine/drive_c/InnoSetupSourceDir/citrine.iss
sed -e "s/{VERSION}/$VERSION/g" \
-e "s/{VERSION_NAME}/$VERSION_NAME/g" \
-e "s/ctrnl/ctr$lang/g" \
-e "s/CitrineNL/Citrine$suffix/" \
plugins/media/citrine.iss > ~/.wine/drive_c/InnoSetupSourceDir/citrine.iss

# Start setup-creator
wine "C:\\Program Files (x86)\\Inno Setup 6\\ISCC.exe" "C:\\InnoSetupSourceDir\\citrine.iss"

# Copy to output dir
mkdir -p dist/Win64/OUT/$lang/
rm dist/Win64/OUT/$lang/* # clean up
cp ~/.wine/drive_c/InnoSetupSourceDir/Output/Citrine${VERSION}.exe dist/Win64/OUT/$lang/

# Zip it
Expand All @@ -111,8 +120,10 @@ cp bin/Linux/ctr$lang dist/Linux/ISO/$lang/
cp plugins/media/libctrmedia.so dist/Linux/ISO/$lang/mods/media/
rm dist/Linux/ISO/$lang/*.dll
rm dist/Linux/ISO/$lang/*.exe
sed -e "s/ctrnl/ctr$lang/g" plugins/media/assets/citrine.sh > dist/Linux/ISO/$lang/citrine.sh
chmod uog+x dist/Linux/ISO/$lang/citrine.sh
sed -e "s/ctrapp_nl/ctrapp_$lang/g" misc/distrib/assets/export.sh > dist/Linux/ISO/$lang/export.sh
cp misc/distrib/assets/export.desktop dist/Linux/ISO/$lang/export.desktop


tar cvzf "dist/Linux/OUT/$lang/citrine${lang}${VERSION}.tar.gz" -C dist/Linux/ISO/ ${lang}


Expand All @@ -125,6 +136,7 @@ cp -R dist/Linux/ISO/${lang}/mods /tmp/${lang}/Citrine.AppDir/

sed -e "s/ctrnl/ctr$lang/g" misc/Citrine.AppDir/AppRun > /tmp/${lang}/Citrine.AppDir/AppRun


./appimagetool-x86_64.AppImage /tmp/${lang}/Citrine.AppDir citrine_app ; cp citrine_app dist/Linux/ISO/${lang}/ctrapp_${lang}
chmod uog+x dist/Linux/ISO/${lang}/ctrapp_${lang}
#sed -e "s/ctrnl/ctrapp_$lang/g" plugins/media/assets/citrine.sh > dist/Linux/ISO/$lang/citrine_app.sh
Expand Down
12 changes: 12 additions & 0 deletions misc/distrib/assets/demo1.ctr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
>> m := Media new.

m link: ( Package new: ['demodata'] ).

>> mouse := Image new: ['mouse.png'].

mouse
x: 0 y: 100,
speed: 5,
controllable: True.

m screen: ['demo.png'].
5 changes: 5 additions & 0 deletions misc/distrib/assets/demo10.ctr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
>> m := Media new.
>> html := Network send: None to: ['https://citrine-lang.org/'].
>> meta := html split: ['<meta name="description" content="'].
meta := meta at: 2, split: ['"'], at: 1.
m show: ['Fetched:'] + meta.
23 changes: 23 additions & 0 deletions misc/distrib/assets/demo11.ctr
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
>> m := Media new.
>> a := Blob new: 8.
a bytes: (
Sequence <<:
2, ; 0 ; 0 ; 0 ;
1 ; 0 ; 0 ; 0
).

>> struct := Blob struct: (Sequence <<: ['int'], ; ['int']).

m link: ( Sequence <<: ['@structtest'], ;
['@structtest'] ;
(Sequence <<: struct) ;
['int'] ;
['ffitest'] ;
['ffisum:']
).

m show: ['FFI:'] + (ffitest ffisum: a).

struct structfree.
struct free.
a free.
20 changes: 20 additions & 0 deletions misc/distrib/assets/demo2.ctr
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
>> m := Media new.
m link: ( Package new: ['demodata'] ).

>> fish := Image new: ['fish.png'].
>> quay := Image new: ['quay.png'].

fish
x: 0 y: 100,
speed: 2,
gravity: 0.2,
friction: 0.01,
acceleration: 0.2,
controllable: True.


quay
x: 200 y: 100,
wall: True.

m screen: ['demo.png'].
18 changes: 18 additions & 0 deletions misc/distrib/assets/demo3.ctr
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
>> m := Media new.
m link: ( Package new: ['demodata'] ).

>> quay := Image new: ['quay.png'].
>> boat := Image new: ['boat.png'].

boat
x: 100 y: 100,
speed: 2,
friction: 0.01,
acceleration: 0.2,
controllable: 4.

quay
x: 200 y: 100,
wall: True.

m screen: ['demo.png'].
47 changes: 47 additions & 0 deletions misc/distrib/assets/demo4.ctr
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
>> m := Media new.
m link: ( Package new: ['demodata'] ).

m width: 350 height: 175.

>> rock := Image new: ['rock.png'].
>> rock2 := Image new: ['rock.png'].
>> hiker := Image new: ['hiker.png'].

hiker
x: 100 y: 100,
speed: 2,
reel: 2 speed: 10,
gravity: 1,
friction: 0.5,
controllable: True.

rock
x: 150 y: 300,
wall: True.

rock2
x: 250 y:180,
wall: True.

m on: ['start'] do: {
rock to-x: 150 y: 200.
rock2 to-x: 380 y: 180.
}.

rock on: ['destination'] do: {
self y? <=: 200, true: {
self to-x: 150 y: 300.
}, else: {
self to-x: 150 y: 200.
}.
}.

rock2 on: ['destination'] do: {
self x? >=: 380, true: {
self to-x: 250 y: 180.
}, else: {
self to-x: 380 y: 180.
}.
}.

m screen: ['demo.png'].
28 changes: 28 additions & 0 deletions misc/distrib/assets/demo5.ctr
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
>> m := Media new.
m link: ( Package new: ['demodata'] ).
>> balloon := Image new: ['balloon.png'].
>> bird := Image new: ['bird.png'], reel: 2 speed: 10.

bird on: ['fly'] do: {
>> right := Number between: 0 and: 500.
>> height := Number between: 0 and: 100.
self to-x: right y: height.
}.

bird on: ['destination'] do: { self fly. }.
balloon on: ['collision:'] do: { :other
(other = bird) true: { Program end. }.
}.
m on: ['start'] do: {
balloon
fixate: True,
active: True,
controllable: 1,
gravity: 0.2.
bird
x: 300 y: 10,
gravity: 0.01,
speed: 1,
fly.
}.
m screen: ['demo.png'].
33 changes: 33 additions & 0 deletions misc/distrib/assets/demo6.ctr
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
>> m := Media new.
m link: ( Package new: ['demodata'] ).
>> ball := Image new: ['ball.png'].
>> bat := Image new: ['bat.png'].

>> a := Image new: ['wall1.png'].
>> b := Image new: ['wall1.png'].
>> c := Image new: ['wall2.png'].
>> d := Image new: ['wall2.png'].

a x: 0 y: 0, wall: True.
b x: 0 y: 350, wall: True.
c x: 0 y: 0, wall: True.
d x: 750 y: 0, wall: True.

ball
x: 400 y: 100,
to-x: (Number between: 200 and: 800) y: 500,
gravity: 1,
bounce: True,
active: True.

bat
x: 100 y: 300,
speed: 5,
friction: 0.01,
accelerate: 0.4,
controllable: 3,
wall: True.

ball on: ['collision:'] do: { self speed: 7. }.

m screen: ['demo.png'].
29 changes: 29 additions & 0 deletions misc/distrib/assets/demo7.ctr
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
>> m := Media new.
m link: ( Package new: ['demodata'] ).
>> o := Color new red: 0 green: 0 blue: 0.
>> a := Image new: ['demo.png'].
>> r := 80.
>> c := 200.

m on: ['start'] do: {
{ :j
>> p := Sequence new.
{ :i
p append: (
Point new
x: r * i cos + ( r * j cos + c )
y: r * i sin + ( r * j sin + c )
).
} * 360.

a draw: p color: (
Color new
red: 0
green: 255 - (j / 36) * 255
blue: (j / 36) * 255
).

} * 36.
}.

m screen: ['demo.png'].
24 changes: 24 additions & 0 deletions misc/distrib/assets/demo8.ctr
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
>> m := Media new.
m link: ( Package new: ['demodata'] ).
>> target := Image new: ['target.png'].
>> sfx := Sound new: ['sfx.ogg'].

target on: ['click'] do: {
sfx play.
m show: (
['x,y'] x self x? y self y?
).
}.

m on: ['timer:'] do: {
target
x: (Number between: 50 and: 750)
y: (Number between: 50 and: 350).
m timer: 1 after: 2000.
}.

m on: ['start'] do: {
m timer: 1 after: 1.
}.

m screen: ['demo.png'].
16 changes: 16 additions & 0 deletions misc/distrib/assets/demo9.ctr
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
>> m := Media new.
m link: ( Package new: ['demodata'] ).
>> d := Image new: ['demo.png'].
>> f := Font new
source: ['DoubleStrike.ttf'] # public domain font
size: 40.

d font: f,
align-x: 100 y: 100,
line-height: 40,
editable: True,
ink: (Color new red: 150 green: 150 blue: 0),
highlight: (Color new red: 50 green: 50 blue: 0),
write: ['Lorem Ipsum...'].

m screen: ['demo.png'].
23 changes: 23 additions & 0 deletions misc/distrib/assets/export.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@


setlocal enabledelayedexpansion

rem Ensure at least one argument is provided
if "%~1"=="" (
echo No arguments provided.
exit /b 1
)

rem Initialize an empty variable to hold the processed filenames
set "args="

rem Loop through all command-line arguments
for %%i in (%*) do (
rem Extract the filename with extension
set "args=!args! %%~nxi"
)

rem Call the other batch file with the filenames only
ctrnl.exe pak-o-mat.ctr %args%


10 changes: 10 additions & 0 deletions misc/distrib/assets/export.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=export
Comment=
Exec=bash export.sh %F
Icon=
Path=
Terminal=true
StartupNotify=false
Loading

0 comments on commit d6fc46d

Please sign in to comment.