-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
306 additions
and
26 deletions.
There are no files selected for viewing
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
program Bitmap_image; | ||
|
||
|
||
@requirefile "data/disksprite1.bin" "Please run (ctrl+R) the fjong/disk.fjo file before compiling this program" | ||
|
||
@use "system/screen" | ||
|
||
|
||
@macro "include_images" 1 | ||
|
||
i = 1; | ||
for (i=1;i<p0;i++) { | ||
writeln('image'+i+' : incbin("data/disksprite'+i+'.bin");'); | ||
} | ||
|
||
@endmacro | ||
|
||
@macro "load_images" 1 | ||
|
||
i = 1; | ||
for (i=1;i<p0;i++) { | ||
writeln(' Screen::LoadBitmap(#image'+i+', sizeof(#image'+i+'), '+(i-1)+');'); | ||
} | ||
|
||
|
||
@endmacro | ||
|
||
var | ||
@include_images(65) | ||
// image : incbin("data/disksprite1.bin"); | ||
zp:^byte; | ||
|
||
sinx : array[256] of byte = buildsinetable(240); | ||
siny : array[256] of byte = buildsinetable(180); | ||
time,frame,t2,i,f,t3 : byte; | ||
delta : byte = 64; | ||
x,y : integer; | ||
|
||
const img1 : byte = 0; // ID | ||
|
||
begin | ||
Screen::SetMode(Screen::mode_320_200_64); | ||
Screen::DisableCursor(); | ||
@load_images(65); | ||
while(true) do | ||
begin | ||
t2:=time; | ||
t3:=time; | ||
f:=frame; | ||
for i:=0 to 24 offpage do | ||
begin | ||
x:=sinx[t2]+32; | ||
y:=siny[t3+delta]; | ||
Screen::DrawBitmap(f&63, x,y); | ||
f+=3; | ||
t2+=9; | ||
t3+=11; | ||
end; | ||
time+=1; | ||
|
||
if (time&3=0) then | ||
delta+=1; | ||
|
||
if (time&3=0) then frame+=1; | ||
for x:=0 to 400 do | ||
wait(100); | ||
Screen::ClearScreen(); | ||
end; | ||
end. |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
globals = { | ||
camera = { x = 23, y=0, z=0 }, | ||
fov = 40, | ||
target = { x = 0, y=0.0, z=0 }, | ||
light0 = { direction = {x=1, y=0.0, z=-0.2 }, | ||
color = {x=1, y=1, z=1}, | ||
}, | ||
ambient = { x = 0.0, y = 0.0, z = 0.0 }, | ||
raymarch_steps = 30, | ||
raymarch_shadow_steps = 4, | ||
up = {x=0.3, y=1, z=0 }, | ||
sky = 0, | ||
shadow_scale = 0.5, | ||
isPaused = 0 | ||
|
||
} | ||
|
||
output = { | ||
-- resolution of 2x2 multicolor sprites (12x21 each) | ||
resolution = { width = 32, height=28}, | ||
-- resolution = { width = 320, height=200}, | ||
aspect = 1.0, | ||
output_type = 0, -- c64 image type | ||
dither = 2, | ||
ditherStrength = { x = 29, y= 2, z= 2}, | ||
|
||
-- index_colors = { 0,1,2,3 } | ||
} | ||
|
||
|
||
MaterialBlue = { | ||
color = { x=1, y=1, z=2 }, | ||
reflection = 0.5, | ||
shininess = 50, | ||
shininess_intensity = 0 | ||
} | ||
|
||
MaterialWhite = { | ||
color = { x=2, y=2, z=2 }, | ||
reflection = 0.5, | ||
shininess = 50, | ||
shininess_intensity = 0 | ||
} | ||
|
||
|
||
|
||
|
||
MaterialBlack = { | ||
color = { x=0, y=0.0, z=0 }, | ||
reflection = 0.5, | ||
shininess = 50, | ||
shininess_intensity = 0 | ||
} | ||
|
||
|
||
|
||
|
||
-- Init is called on start | ||
|
||
|
||
frame = 0 | ||
--noFrames = 24 | ||
noFrames = 64 | ||
|
||
hasSaved = 0 | ||
|
||
function Init() | ||
|
||
w = -0.06 | ||
xx = -0 | ||
-- Let's draw a diskette! using nothing but boxes and stuff | ||
-- cylinder - hole in the center | ||
AddObject("cylinder","d1","","MaterialBlack",0,0,0+xx, 0.4,0,0.15); | ||
SetRotation("d1",0,0,90); | ||
|
||
-- some "text" | ||
AddObject("box","l1","","MaterialBlack",w,-2.5,-1.8+xx, 0.11,0.01,0.6); | ||
AddObject("box","l2","","MaterialBlack",w,-2.0,-1.8+xx, 0.11,0.01,0.6); | ||
AddObject("box","l3","","MaterialBlack",w,-1.5,-1.8+xx, 0.11,0.01,0.6); | ||
|
||
AddObject("box","ll1","","MaterialBlack",w,-2.5,0.9+xx, 0.11,0.01,1.2); | ||
AddObject("box","ll2","","MaterialBlack",w,-2.0,0.9+xx, 0.11,0.01,1.2); | ||
AddObject("box","ll3","","MaterialBlack",w,-1.5,0.9+xx, 0.11,0.01,1.2); | ||
-- text ends | ||
|
||
-- White "labels" | ||
AddObject("box","d2","","MaterialWhite",w,-2.0,-1.8+xx, 0.11,0.8,0.8); | ||
AddObject("box","d2","","MaterialWhite",w,-2.0,1+xx, 0.11,0.8,1.6); | ||
|
||
-- lower disk hole | ||
AddObject("cylinder","c1","","MaterialBlack",0,2,-0+xx, 0.12, 0,0.6); | ||
-- Main disk body | ||
AddObject("box","disk","","MaterialBlue",0,0,0+xx, 0.1,3,3); | ||
|
||
UpdateScene() | ||
|
||
end | ||
|
||
|
||
|
||
function UpdateScene() | ||
|
||
t = ((frame)/(noFrames-1)) | ||
|
||
tt = t*3.14159*2 | ||
dt = 0.2 | ||
globals.light0.direction.x = cos(tt+dt) | ||
globals.light0.direction.z = sin(tt+dt) | ||
r=11+3 | ||
globals.target.z = 0 | ||
globals.camera.x = cos(tt) | ||
|
||
globals.camera.z = sin(tt) | ||
globals.camera.y = sin(tt+3.14/1.2+3.14) | ||
|
||
-- normaliz all | ||
l = globals.camera.x*globals.camera.x + globals.camera.y*globals.camera.y + globals.camera.z*globals.camera.z; | ||
l = math.sqrt(l) | ||
-- Normalize | ||
globals.camera.x = r*globals.camera.x/l | ||
globals.camera.y = r*globals.camera.y/l | ||
globals.camera.z = r*globals.camera.z/l | ||
|
||
end | ||
|
||
|
||
function Update() | ||
|
||
if (frame <=noFrames) then | ||
-- save 4 sprites! | ||
if (hasSaved == 0) then | ||
--#0 | ||
|
||
AddByte(23); | ||
AddByte(0); | ||
AddByte(192); | ||
AddByte(0); | ||
|
||
AddByte(23); | ||
AddByte(27); | ||
AddByte(0); | ||
AddByte(frame); | ||
|
||
AddByte(23); | ||
AddByte(27); | ||
AddByte(1); | ||
|
||
AddByte(output.resolution.width); | ||
AddByte(0); | ||
AddByte(output.resolution.height); | ||
AddByte(0); | ||
|
||
AddRGBALineToData(0,0,output.resolution.width, output.resolution.height); | ||
SaveRawData("data/disksprite"..tonumber(frame)..".bin"); | ||
|
||
end | ||
end | ||
frame=frame+1 | ||
|
||
|
||
if (frame==noFrames+1) then | ||
hasSaved = 1 | ||
Message("SAVED") | ||
Message("You can exit now"); | ||
end | ||
|
||
UpdateScene() | ||
|
||
|
||
|
||
|
||
|
||
end |
Binary file modified
BIN
+0 Bytes
(100%)
Publish/tutorials/TRS80COCO/tutorials/resources/images/levels.flf
Binary file not shown.
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 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 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 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 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 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 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 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
Oops, something went wrong.