feat(packages): ludic.photo - a camera's photographs: what the lens sees (the frustum and a line of sight over the ground and the trunks), a grade out of a hundred on size, framing, light and the moment weighted by how much subject there is, the frame's best subject and its tags, the roll with its order and pages, a buyer's price on the grade's curve, the best of each subject; the lens, the light and the market through ports; kept, full, deleted and sold as facts; the roll in its own save section
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
473552cc81
commit
24a35f1174
17 changed files with 975 additions and 0 deletions
62
packages/ludic.photo/system.ludic
Normal file
62
packages/ludic.photo/system.ludic
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
# system.ludic - the camera as a system: the roll and what has been photographed in its own save
|
||||
# section, by key. The best per subject follows from the frames, as a buyer would judge them.
|
||||
export function photo_config(max: int) -> void {
|
||||
pht_max = Math.max(max, 1)
|
||||
photo_reset()
|
||||
}
|
||||
|
||||
export function photo_reset() -> void {
|
||||
pht_blank()
|
||||
pht_species_shot = 0
|
||||
pht_legend_shot = 0
|
||||
pht_cover = -1
|
||||
pht_page = 0
|
||||
photo_frame_begin()
|
||||
q_clear(photo_facts())
|
||||
}
|
||||
|
||||
export function photo_save() -> Val {
|
||||
let v = Value.object()
|
||||
let l = Value.list()
|
||||
for i in 0 .. pht_n {
|
||||
let o = Value.object()
|
||||
sv_put_int(o, "day", pht_day[i])
|
||||
sv_put_float(o, "hour", pht_hour[i])
|
||||
sv_put_int(o, "mask", pht_mask[i])
|
||||
sv_put_int(o, "legend", pht_legend[i])
|
||||
sv_put_bool(o, "sold", pht_sold[i] != 0)
|
||||
sv_put_str(o, "tags", pht_tags[i])
|
||||
sv_put_str(o, "file", pht_file[i])
|
||||
sv_put_int(o, "grade", pht_grade[i])
|
||||
sv_put_int(o, "why", pht_why[i])
|
||||
Value.add(l, o)
|
||||
}
|
||||
Value.put(v, "frames", l)
|
||||
sv_put_int(v, "shot", pht_species_shot)
|
||||
sv_put_int(v, "legend_shot", pht_legend_shot)
|
||||
sv_put_int(v, "cover", pht_cover)
|
||||
sv_put_int(v, "sort", pht_sort)
|
||||
return v
|
||||
}
|
||||
|
||||
export function photo_load(v: Val, version: int) -> void {
|
||||
photo_reset()
|
||||
if Value.has(v, "frames") != 0 {
|
||||
let l = Value.get(v, "frames")
|
||||
for i in 0 .. Value.count(l) {
|
||||
let o = Value.at(l, i)
|
||||
photo_add(sv_int(o, "day", 1), sv_float(o, "hour", 0.0), sv_int(o, "mask", 0), sv_int(o, "legend", 0), sv_bool(o, "sold", false), sv_str(o, "tags", ""), sv_str(o, "file", ""), sv_int(o, "grade", 40), sv_int(o, "why", PHOTO_WHY_NONE))
|
||||
}
|
||||
}
|
||||
photo_record_set(pht_species_shot | sv_int(v, "shot", 0), sv_int(v, "legend_shot", 0))
|
||||
pht_cover = sv_int(v, "cover", -1)
|
||||
photo_sort_set(sv_int(v, "sort", PHOTO_NEWEST))
|
||||
}
|
||||
|
||||
export function photo_system() -> System {
|
||||
let s = system_new("photo", PH_COMMIT)
|
||||
s.reset = fn photo_reset
|
||||
s.save = fn photo_save
|
||||
s.load = fn photo_load
|
||||
return s
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue