Compare commits

...

3 Commits

Author SHA1 Message Date
blueloveTH
98fabb45bf update init example 2026-01-08 15:32:08 +08:00
blueloveTH
3fe55bbe76 add raylib bindings to doc 2026-01-08 15:30:48 +08:00
blueloveTH
d9a7798891 Update library.py 2026-01-08 15:26:03 +08:00
5 changed files with 7 additions and 5 deletions

View File

@ -36,6 +36,7 @@ Please see https://pocketpy.dev for details and try the following resources.
+ [Godot Extension](https://github.com/pocketpy/godot-pocketpy): Use pocketpy in Godot Engine
+ [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=pocketpy.pocketpy): Debug and profile pocketpy scripts in VSCode
+ [Flutter Plugin](https://pub.dev/packages/pocketpy): Use pocketpy in Flutter apps
+ [Raylib Bindings](https://github.com/pocketpy/raylib-bindings): Use raylib with pocketpy
## Supported Platforms
@ -111,7 +112,7 @@ int main() {
if(!ok) goto __ERROR;
// Create a list: [1, 2, 3]
py_Ref r0 = py_getreg(0);
py_Ref r0 = py_tmpr0();
py_newlistn(r0, 3);
py_newint(py_list_getitem(r0, 0), 1);
py_newint(py_list_getitem(r0, 1), 2);

View File

@ -15,6 +15,7 @@ Developers are able to write Python bindings via C-API or pybind11 compatible in
+ [Godot Extension](https://github.com/pocketpy/godot-pocketpy): Use pocketpy in Godot Engine
+ [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=pocketpy.pocketpy): Debug and profile pocketpy scripts in VSCode
+ [Flutter Plugin](https://pub.dev/packages/pocketpy): Use pocketpy in Flutter apps
+ [Raylib Bindings](https://github.com/pocketpy/raylib-bindings): Use raylib with pocketpy
## What it looks like

View File

@ -85,7 +85,7 @@ int main() {
if(!ok) goto __ERROR;
// Create a list: [1, 2, 3]
py_Ref r0 = py_getreg(0);
py_Ref r0 = py_tmpr0();
py_newlistn(r0, 3);
py_newint(py_list_getitem(r0, 0), 1);
py_newint(py_list_getitem(r0, 1), 2);

View File

@ -19,14 +19,14 @@ class Library:
self.functions = [] # type: list[Function]
self.callbacks = set() # type: set[str]
def unalias(self, name: str) -> c_ast.Node:
def unalias(self, name: str) -> c_ast.Node | str:
while name in self.aliases:
node = self.aliases[name]
if isinstance(node, str):
name = node
else:
return node
assert False, f'alias {name} not found'
return name
def build(self, *, glue_dir='.', stub_dir='.', includes: list[str] | None = None):
self.remove_unsupported()

View File

@ -20,7 +20,7 @@ int main() {
if(!ok) goto __ERROR;
// Create a list: [1, 2, 3]
py_Ref r0 = py_getreg(0);
py_Ref r0 = py_tmpr0();
py_newlistn(r0, 3);
py_newint(py_list_getitem(r0, 0), 1);
py_newint(py_list_getitem(r0, 1), 2);