screpl.core.application module ¶
-
class
screpl.core.application.
Application
[source] ¶ -
Bases:
object
Basic structure that defines the way to interact with user
Application Fields
Application Methods
index
methods
0
1
2
3
4
5
-
loop
( self ) ¶ -
AppMethodN
(index=0) - Called exactly once in every frame.All UI-functions of superuser should be handled on here.
-
on_chat
( self , address ) ¶ -
AppMethodN
(index=1) - Called when the super user has chatted something.- Parameters
-
address ( EUDVariable ) – address of chat from super user.
-
on_destruct
( self ) ¶ -
AppMethodN
(index=2) - Called when the application is going to be destructed
-
on_init
( self ) ¶ -
AppMethodN
(index=3) - Called once when the application initialized and goes foreground
-
on_resume
( self ) ¶ -
AppMethodN
(index=4) - Called exactly once after newly started app is destructed and the app became to be foreground again
-
print
( self , writer ) ¶ -
AppMethodN
(index=5) - Called once in a frame that invoked request_update
-
-
class
screpl.core.application.
ApplicationInstance
( manager , cls = None ) [source] ¶ -
Bases:
object
Class to handle application on python side
ApplicationInstance is a pure python object to manage attributes of Application instance, which is on the foreground of application stack, instead of ‘self’ parameter.
It enables following:
-
Invoke its AppMethods.
-
Access and modify its fields.
-
Used as the first parameter (self) for AppCommand and AppMethod.
Typically _absolute is False. This case methods and commands are referenced relative to the foreground app and its original class type. Otherwise, using _cls attribute, their absolute functions are referenced.
It enables successful AppMethod overriding:
# class definitions class MyApp1(Application): def func(self): f_printf("hello") class MyApp2(MyApp1): def func(self): f_printf("hi") # appmanager loaded MyApp2 object as a foreground app # - app stack # [1]: MyApp2 # [0]: REPL # relative call (MyApp2 is on foreground) in1 = ApplicationInstance() in1.func() # prints hi # absolute call in2 = ApplicationInstance(MyApp1) in2.func() # prints hello
-
get_reference_epd
( field ) [source] ¶ -
Returns address for current foreground app instance field
For example:
class MyApp(Application): fields = ['var'] def some_method(self): self.var = 1 # get reference for self.var var_ref = self.get_reference_epd('var') f_dwwrite_epd(var_ref, 12) # now self.var becomes 12
Traditional EUDVariable can be referenced as EPD(var.getValueAddr())
-
-
class
screpl.core.application.
ApplicationStruct
( initval ) [source] ¶ -
Bases:
screpl.utils.struct.REPLStruct
Class to handle application on eudplib side