Skip to content

Commit fe17be4

Browse files
committed
Add src docs.
1 parent 69e42b9 commit fe17be4

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

plugins/media/media.c

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,6 +1435,17 @@ ctr_object* ctr_line_end(ctr_object* myself, ctr_argument* argumentList) {
14351435
return ctr_internal_object_property(myself, CTR_DICT_TO, NULL);
14361436
}
14371437

1438+
/**
1439+
* @def
1440+
* [ Color ] new
1441+
*
1442+
* @example
1443+
* ☞ media ≔ Media new.
1444+
* ☞ x ≔ Color new.
1445+
* ✎ write: x red, stop.
1446+
* ✎ write: x green, stop.
1447+
* ✎ write: x blue, stop.
1448+
*/
14381449
ctr_object* ctr_color_new(ctr_object* myself, ctr_argument* argumentList) {
14391450
ctr_object* instance = ctr_internal_create_object(CTR_OBJECT_TYPE_OTOBJECT);
14401451
instance->link = myself;
@@ -1445,6 +1456,17 @@ ctr_object* ctr_color_new(ctr_object* myself, ctr_argument* argumentList) {
14451456
return instance;
14461457
}
14471458

1459+
/**
1460+
* @def
1461+
* [ Color ] red: [Number] green: [Number] blue [Number]
1462+
*
1463+
* @example
1464+
* ☞ media ≔ Media new.
1465+
* ☞ x ≔ Color new red: 100 green: 150 blue: 200.
1466+
* ✎ write: x red, stop.
1467+
* ✎ write: x green, stop.
1468+
* ✎ write: x blue, stop.
1469+
*/
14481470
ctr_object* ctr_color_rgb_set(ctr_object* myself, ctr_argument* argumentList) {
14491471
ctr_internal_object_property(myself, "r", ctr_internal_cast2number(argumentList->object));
14501472
ctr_internal_object_property(myself, "g", ctr_internal_cast2number(argumentList->next->object));
@@ -1489,6 +1511,17 @@ void ctr_audio_destructor(ctr_resource* rs) {
14891511
mediaAUD->ref = NULL;
14901512
}
14911513

1514+
/**
1515+
* @def
1516+
* [ Sound ] play
1517+
*
1518+
* @example
1519+
* ☞ fx ≔ Sound new: ‘boom.mp3’.
1520+
* fx play.
1521+
*
1522+
* @result
1523+
* (plays sound)
1524+
*/
14921525
ctr_object* ctr_sound_new_set(ctr_object* myself, ctr_argument* argumentList) {
14931526
if (AUDCount >= maxAUD) return CtrStdNil;
14941527
char* audioFileStr = ctr_heap_allocate_cstring(ctr_internal_cast2string(argumentList->object));
@@ -1566,6 +1599,21 @@ SDL_RWops* ctr_internal_media_load_asset(char* asset_name, char asset_type) {
15661599
return res;
15671600
}
15681601

1602+
/**
1603+
* @def
1604+
* [ Music ] play
1605+
*
1606+
* @example
1607+
* ☞ j ≔ Music new: ‘jazz.mp3’.
1608+
* j play.
1609+
* Moment wait: 1.
1610+
* j silence.
1611+
* j rewind.
1612+
*
1613+
* @result
1614+
* 𝄞 (plays music)
1615+
*
1616+
*/
15691617
ctr_object* ctr_music_new_set(ctr_object* myself, ctr_argument* argumentList) {
15701618
char* audioFileStr = ctr_heap_allocate_cstring(ctr_internal_cast2string(argumentList->object));
15711619
ctr_object* audioInst = ctr_audio_new(myself, argumentList);

0 commit comments

Comments
 (0)