Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
BCKM committed Jan 31, 2024
1 parent 4413a00 commit c7378f0
Showing 1 changed file with 21 additions and 112 deletions.
133 changes: 21 additions & 112 deletions mu/modes/api/neopia.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,151 +21,60 @@

NEOPIA_APIS = [
_(
"actor.Actor(image, pos=None, anchor=None, **kwargs) \nRect(left, top, width, height) -> Rect\nRect((left, top), (width, height)) -> Rect\nRect(object) -> Rect\nPygame Zero object for storing rectangular coordinates"
"get_value(port) \nport: 'in1' ~ 'in3', 'remo', 'bat' \nGet a value from input port."
),
_(
"actor.atan2() \natan2(y, x)\n\nReturn the arc tangent (measured in radians) of y/x.\nUnlike atan(y/x), the signs of both x and y are considered."
"set_value(port, value) \nport: 'out1' ~ 'out3', 'all' \value to set: 0 ~ 255 \nSet a value to output port."
),
_("actor.cos() \ncos(x)\n\nReturn the cosine of x (measured in radians)."),
_(
"actor.degrees() \ndegrees(x)\n\nConvert angle x from radians to degrees."
"convert_scale(port, 0, 255, 0, 100) \nport: 'in1' ~ 'in3' \nparam2, param3 - min and max value of original scale: 0 ~ 255 \nparam3, param4 - min and max value of scale to be converted \nConvert a range of values from input port to another."
),
_(
"actor.pygame() \nPygame Zero is a set of Python modules designed for writing games.\nIt is written on top of the excellent SDL library. This allows you\nto create fully featured games and multimedia programs in the python\nlanguage. The package is highly portable, with games running on\nWindows, MacOS, OS X, BeOS, FreeBSD, IRIX, and Linux."
"color_check(port, color) \nport: 'in1' ~ 'in3' \ncolor: 'white', 'green', etc \nDetect color from input port."
),
_(
"actor.radians() \nradians(x)\n\nConvert angle x from degrees to radians."
"led_on(port, brightness) \nport: 'out1' ~ 'out3', 'all' \npercentage of brightness: '0', '10' ~ '100' \nTurn on LED with brightness adjustment."
),
_("actor.sin() \nsin(x)\n\nReturn the sine of x (measured in radians)."),
_("actor.sqrt() \nsqrt(x)\n\nReturn the square root of x."),
_(
"actor.transform_anchor(ax, ay, w, h, angle) \nTransform anchor based upon a rotation of a surface of size w x h."
"led_off(port) \nport: 'out1' ~ 'out3', 'all' \nTurn off LED."
),
_(
'animation.Animation(object, tween=\'linear\', duration=1, on_finished=None, **targets) \nAn animation manager for object attribute animations.\n\nEach keyword argument given to the Animation on creation (except\n"type" and "duration") will be *tweened* from their current value\non the object to the target value specified.\n\nIf the value is a list or tuple, then each value inside that will\nbe tweened.\n\nThe update() method is automatically scheduled with the clock for\nthe duration of the animation.'
"color_led_on(port, 255, 0, 0) \nport: 'out1' ~ 'out3', 'all' \nparam1 - Red: 0 ~ 255 \nparam2 - Green: 0 ~ 255 \nparam3 - Blue: 0 ~ 255 \nTurn on color LED with color."
),
_(
"animation.each_tick(callback) \nSchedule a callback to be called every tick.\n\nUnlike the standard scheduler functions, the callable is passed the\nelapsed clock time since the last call (the same value passed to tick)."
"motor_move(direction) \ndirection: 'forward', 'backward', 'left', 'right', 'stop' \nMove forward by motor."
),
_("animation.pow() \npow(x, y)\n\nReturn x**y (x to the power of y)."),
_(
"animation.sin() \nsin(x)\n\nReturn the sine of x (measured in radians)."
"motor_rotate(motor, direction, speed) \nmotor: 'both', 'left', 'right' \ndirection: 'forward', 'backward', 'left', 'right', 'stop' \nspeed percentage or input port: '0', '10' ~ '100', 'in1' ~ 'in3' \nRotate DC motor by a count of motor, direction and speed."
),
_(
"animation.unschedule(callback) \nUnschedule the given callback.\n\nIf scheduled multiple times all instances will be unscheduled."
"motor_stop('right') \nposition of motor: 'both', 'left', 'right' \nStop motor."
),
_(
"clock.Clock() \nA clock used for event scheduling.\n\nWhen tick() is called, all events scheduled for before now will be called\nin order.\n\ntick() would typically be called from the game loop for the default clock.\n\nAdditional clocks could be created - for example, a game clock that could\nbe suspended in pause screens. Your code must take care of calling tick()\nor not. You could also run the clock at a different rate if desired, by\nscaling dt before passing it to tick()."
"buzzer(pitch, note, length) \npitch: '1' ~ '6' \nnote: 'c ', 'c#', 'db', 'd' ~ 'b' \nlength of note: '2', '4', '8', '16' \nPlay a sound by pitch, note with sharp and flat, and a length of note."
),
_(
"clock.Event(time, cb, repeat=None) \nAn event scheduled for a future time.\n\nEvents are ordered by their scheduled execution time."
"buzzer_by_port(param) \nparam - port: 'in1' ~ 'in3' \nPlay a sound by value from input port."
),
_(
"clock.each_tick(callback) \nSchedule a callback to be called every tick.\n\nUnlike the standard scheduler functions, the callable is passed the\nelapsed clock time since the last call (the same value passed to tick)."
"buzzer_stop() \nStop buzzer."
),
_(
"clock.heapq() \nHeap queue algorithm (a.k.a. priority queue).\n\nHeaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for\nall k, counting elements from 0. For the sake of comparison,\nnon-existing elements are considered to be infinite. The interesting\nproperty of a heap is that a[0] is always its smallest element.\n\nUsage:\n\nheap = [] # creates an empty heap\nheappush(heap, item) # pushes a new item on the heap\nitem = heappop(heap) # pops the smallest item from the heap\nitem = heap[0] # smallest item on the heap without popping it\nheapify(x) # transforms list into a heap, in-place, in linear time\nitem = heapreplace(heap, item) # pops and returns smallest item, and adds\n # new item; the heap size is unchanged\n\nOur API differs from textbook heap algorithms as follows:\n\n- We use 0-based indexing. This makes the relationship between the\n index for a node and the indexes for its children slightly less\n obvious, but is more suitable since Python uses 0-based indexing.\n\n- Our heappop() method returns the smallest item, not the largest.\n\nThese two make it possible to view the heap as a regular Python list\nwithout surprises: heap[0] is the smallest item, and heap.sort()\nmaintains the heap invariant!"
"get_angle(port) \nport: 'in1' ~ 'in3' \nGet a degree of an angle sensor."
),
_(
"clock.method() \nmethod(function, instance)\n\nCreate a bound instance method object."
"servo_rotate(port, direction, speed) \noutput port: 'out1', 'out2', 'out3' \ndirection: 'forward', 'backward' \nspeed percentage or input port: '0', '10' ~ '100', 'in1' ~ 'in3' \nRotate servo motor by direction and speed."
),
_(
"clock.schedule(callback, delay) \nSchedule callback to be called once, at `delay` seconds from now.\n\n:param callback: A parameterless callable to be called.\n:param delay: The delay before the call (in clock time / seconds)."
"servo_reset_degree(port) \noutput port: 'out1' ~ 'out3', 'all' \nMake 0 degree where servo motor is currently."
),
_(
"clock.schedule_interval(callback, delay) \nSchedule callback to be called every `delay` seconds.\n\nThe first occurrence will be after `delay` seconds.\n\n:param callback: A parameterless callable to be called.\n:param delay: The interval in seconds."
"servo_rotate_by_degree(port, direction, speed, angle) \noutput port: 'out1', 'out2', 'out3' \ndirection: 'forward', 'backward' \nspeed percentage or input port: '0', '10' ~ '100', 'in1' ~ 'in3' \ndegree of angle: '0', '5' ~ '180', 'in1' ~ 'in3' \nRotate servo motor by direction, speed and degree of angle."
),
_(
"clock.schedule_unique(callback, delay) \nSchedule callback to be called once, at `delay` seconds from now.\n\nIf it was already scheduled, postpone its firing.\n\n:param callback: A parameterless callable to be called.\n:param delay: The delay before the call (in clock time / seconds)."
"servo_stop(port) \noutput port: 'out1' ~ 'out3', 'all' \nStop servo motor."
),
_(
"clock.tick(dt) \nUpdate the clock time and fire all scheduled events.\n\n:param dt: The elapsed time in seconds."
),
_(
"clock.total_ordering(cls) \nClass decorator that fills in missing ordering methods"
),
_(
"clock.unschedule(callback) \nUnschedule the given callback.\n\nIf scheduled multiple times all instances will be unscheduled."
),
_(
"clock.weak_method(method) \nQuick weak method ref in case users aren't using Python 3.4"
),
_(
"draw.circle(position, radius, (r, g, b)) \nDraw the outline of a circle."
),
_(
"draw.filled_circle(position, radius, (r, g, b)) \nDraw a filled circle."
),
_(
"draw.filled_rect(rect, (r, g, b)) \nDraw a filled rectangle. Takes a Rect object. For example, Rect((20, 20), (100, 100))"
),
_("draw.line(start, end, (r, g, b)) \nDraw a line from start to end."),
_(
"draw.rect(rect, (r, g, b)) \nDraw the outline of a rectangle. Takes a Rect object. For example, Rect((20, 20), (100, 100))"
),
_(
"draw.text(text, [pos, ]**kwargs) \nDraw text. There’s an extremely rich API for positioning and formatting text; see Pygame Zero Text Formatting for full details."
),
_(
"draw.textbox(text, rect, **kwargs) \nDraw text, sized to fill the given Rect. There’s an extremely rich API for positioning and formatting text; see Pygame Zero Text Formatting for full details."
),
_(
"keyboard.Keyboard() \nThe current state of the keyboard.\n\nEach attribute represents a key. For example, ::\n\n keyboard.a\n\nis True if the 'A' key is depressed, and False otherwise."
),
_(
"keyboard.keys(value, names=None, *, module=None, qualname=None, type=None, start=1) \nAn enumeration."
),
_("keyboard.re() \nSupport for regular expressions (RE)."),
_(
"keyboard.warn() \nIssue a warning, or maybe ignore it or raise an exception."
),
_(
"music.ResourceLoader(subpath) \nAbstract resource loader.\n\nA resource loader is a singleton; resources are loaded from a named\nsubdirectory of the global 'root'. The `.load()` method actually loads\na resource.\n\nAdditionally, attribute access can be used to access and cache resources.\nDotted paths can be used to traverse directories."
),
_(
"music.fadeout(seconds) \nFade out and eventually stop the music playback.\n\n:param seconds: The duration in seconds over which the sound will be faded\n out. For example, to fade out over half a second, call\n ``music.fadeout(0.5)``."
),
_("music.get_pos() \nget_pos() -> time\nget the music play time"),
_("music.get_volume() \nget_volume() -> value\nget the music volume"),
_(
"music.is_playing(name) \nReturn True if the music is playing and not paused."
),
_(
"music.pause() \nTemporarily stop playback of the music stream.\n\nCall `unpause()` to resume."
),
_(
"music.pgzero.constants() \nNames for constants returned by Pygame Zero."
),
_(
"music.play(name) \nPlay a music file from the music/ directory.\n\nThe music will loop when it finishes playing."
),
_("music.play_once(name) \nPlay a music file from the music/ directory."),
_(
"music.queue(name) \nQueue a music file to follow the current track.\n\nThis will load a music file and queue it. A queued music file will begin as\nsoon as the current music naturally ends. If the current music is ever\nstopped or changed, the queued song will be lost."
),
_("music.rewind() \nrewind() -> None\nrestart music"),
_("music.set_pos() \nset_pos(pos) -> None\nset position to play from"),
_("music.set_volume() \nset_volume(value) -> None\nset the music volume"),
_("music.stop() \nstop() -> None\nstop the music playback"),
_(
"music.unpause() \nResume playback of the music stream after it has been paused."
),
_(
"screen.blit(image, (left, top)) \nDraw the image to the screen at the given position. \nblit() accepts either a Surface or a string as its image parameter. If image is a str then the named image will be loaded from the images/ directory."
),
_("screen.clear() \nReset the screen to black."),
_("screen.fill((red, green, blue)) \nFill the screen with a solid color."),
_("screen.Screen(surface) \nInterface to the screen."),
_(
"screen.SurfacePainter(screen) \nInterface to pygame.draw that is bound to a surface."
),
_(
"screen.pgzero.ptext() \npygame-text - high-level text rendering with Pygame Zero.\n\nThis module is directly copied from\n\n https://github.com/cosmologicon/pygame-text\n\nat revision c04e59b7382a832e117f0598cdcbc1bb3eb26db5\nand used under CC0."
),
_(
"screen.pygame() \nPygame Zero is a set of Python modules designed for writing games.\nIt is written on top of the excellent SDL library. This allows you\nto create fully featured games and multimedia programs in the python\nlanguage. The package is highly portable, with games running on\nWindows, MacOS, OS X, BeOS, FreeBSD, IRIX, and Linux."
),
_(
"screen.round_pos(pos) \nRound a tuple position so it can be used for drawing."
),
]
"remote_button(button) \nbutton of RC: '1', '2', '3', 'up', 'left', 'right', 'down' \nCheck if the button of remote controller is pressed."
)
]

0 comments on commit c7378f0

Please sign in to comment.