Interface rendering method and device, storage medium and electronic device
Patent Information
- Application Number
- CN202510445009.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-09
- Publication Date
- 2026-10-16
AI Technical Summary
[0005]本发明实施例提供了一种界面的渲染方法和装置、存储介质及电子设备,以至少解决现有的界面显示效果较差的技术问题
[0020] In this embodiment of the invention, by adding a texture view component to the view tree associated with the target activity instance, the target activity instance is configured with a target method set associated with the target rendering engine; according to the object creation method in the target method set, a target rendering object matching the texture view component is created, and the target rendering object is used to pass scene rendering information obtained from the target rendering engine to the texture view component; when at least one reference view component is added to the view tree, the target virtual interface is displayed according to the texture view component and at least one reference view component, the texture view component is used to display the target virtual scene in the target virtual interface according to the scene rendering information, and the reference view component is used to display component elements matching the component type in the target virtual interface, thereby realizing the mixed rendering display of component elements and target virtual scene in the target virtual interface.
Smart Images

Figure CN122924768A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computers, and more specifically, to a method and apparatus for rendering an interface, a storage medium, and an electronic device. Background Technology
[0002] During development, a rendering engine typically uses drawing surface objects (Surfaces) to pass the images to be rendered from the underlying code layer to the application layer, and finally displays these rendered images on the user interface. As user interface content becomes increasingly rich, in order to render more interface elements, a common practice is to create multiple drawing surface objects and use the rendering engine's framework to render these elements.
[0003] However, because the rendering engine consumes a lot of resources during operation, insufficient resources may lead to rendering delays or screen stuttering. This results in poor display quality from existing rendering methods when rendering interface elements and screen content simultaneously.
[0004] There is currently no effective solution to the above problems. Summary of the Invention
[0005] This invention provides a method and apparatus for rendering an interface, a storage medium, and an electronic device to at least solve the technical problem of poor interface display effects in existing systems.
[0006] According to one aspect of the present invention, a method for rendering an interface is provided, comprising: adding a texture view component to a view tree associated with a target activity instance, wherein the target activity instance is configured with a target method set associated with a target rendering engine; creating a target rendering object matching the texture view component according to an object creation method in the target method set, wherein the target rendering object is used to pass scene rendering information obtained from the target rendering engine to the texture view component; and, if at least one reference view component is added to the view tree, displaying a target virtual interface according to the texture view component and at least one reference view component, wherein the texture view component is used to display a target virtual scene in the target virtual interface according to the scene rendering information, and the reference view component is used to display component elements matching the component type in the target virtual interface.
[0007] According to another aspect of the present invention, an interface rendering apparatus is also provided, comprising: an adding unit, configured to add a texture view component in a view tree associated with a target activity instance, wherein the target activity instance is configured with a target method set associated with a target rendering engine; a creating unit, configured to create a target rendering object matching the texture view component according to an object creation method in the target method set, wherein the target rendering object is used to transmit scene rendering information obtained from the target rendering engine to the texture view component; and a display unit, configured to display a target virtual interface based on the texture view component and at least one reference view component when at least one reference view component has been added to the view tree, wherein the texture view component is used to display a target virtual scene in the target virtual interface according to the scene rendering information, and the reference view component is used to display component elements matching the component type in the target virtual interface.
[0008] Optionally, the rendering apparatus for the interface further includes: an instantiation unit, configured to perform an instantiation operation on a target activity class in response to an interface rendering instruction to obtain a target activity instance, wherein the target activity class is configured with a target method set associated with the target rendering engine, and the target activity class is a subclass of a reference activity class, and the reference activity class is configured with a reference method set associated with the reference view component; and the view tree is created according to the view tree creation method in the reference method set.
[0009] Optionally, the creation unit is further configured to: add at least one of the reference view components at the first child node level under the root node of the view tree; add a view container component at the first child node level under the root node of the view tree, and add at least one of the reference view components at the second child node level under the view container component; wherein the texture view component is added at the first child node level of the view tree under the root node.
[0010] Optionally, the instantiation unit is configured to: perform an instantiation operation on the target activity class according to the activity creation method in the reference method set to obtain the target activity instance; and create a local activity instance matching the target activity instance in the first code layer according to the local code loading method in the target method set, wherein the target activity instance is an instance created in the second code layer, and the first code layer is the base code layer of the second code layer.
[0011] Optionally, the display unit is further configured to: when the target rendering engine determines the updated scene rendering information according to the updated rendering instructions, the texture view component obtains the updated scene rendering information according to the target rendering object; and display the updated target virtual interface according to the texture view component and at least one of the reference view components.
[0012] Optionally, the rendering apparatus for the above interface further includes at least one of the following: a first object operation unit, configured to send state update information to the target rendering engine according to a state update method in the target method set when the first object state of the target rendering object is updated to a second object state; a second object operation unit, configured to send object destruction information of the target rendering object to the target rendering engine according to an object destruction method in the target method set when a destruction instruction for the target rendering object is detected; and a third object operation unit, configured to send object redrawing information to the target rendering engine according to an object redrawing method in the target method set when a redrawing instruction for the target rendering object is detected.
[0013] Optionally, the display unit is configured to: display a target media resource element in the target virtual scene according to the player component when at least one of the reference view components includes a player component; display a target sliding list element in the target virtual scene according to the loop view component when at least one of the reference view components includes a loop view component, wherein the target sliding list includes a set of target display elements; display a progress bar element in the target virtual scene according to the progress bar component when at least one of the reference view components includes a progress bar component; or display a floating window element in the target virtual scene according to the window management component when at least one of the reference view components includes a window management component.
[0014] Optionally, the above-mentioned display unit is used for at least one of the following: adding the progress bar component to the view tree when the time interval between two adjacent frames of scene rendering information obtained by the texture view component satisfies the first component display condition; adding the player component to the view tree when the time interval between two adjacent frames of scene rendering information received by the texture view component satisfies the second component display condition.
[0015] Optionally, the rendering apparatus for the above interface further includes: a configuration unit, configured to create a target activity class and generate the target activity class as a subclass of a reference activity class, wherein the target activity class is used to determine the target activity instance, and the reference activity class is configured with a set of reference methods associated with the reference view component; obtain a set of native methods configured for a native activity class, wherein the set of native methods is used to perform screen rendering operations under a rendering framework matched with the target rendering engine; and configure the target method set associated with the target rendering engine for the target activity class according to the set of native methods.
[0016] Optionally, the above configuration unit is used for at least one of the following: configuring a native code loading method in the target method set, wherein the native code loading method is used to create a native activity instance matching the target activity instance in a first code layer, the target activity instance being an instance created in a second code layer, and the first code layer being the base code layer of the second code layer; configuring a state update method in the target method set, wherein the state update method is used to send state update information to the target rendering engine when the first object state of the target rendering object is updated to the second object state; configuring an object destruction method in the target method set, wherein... The object destruction method described above is used to send object destruction information of the target rendering object to the target rendering engine when a destruction instruction for the target rendering object is detected; configure an object redrawing method in the target method set, wherein the object redrawing method is used to send object redrawing information to the target rendering engine when a redrawing instruction for the target rendering object is detected; obtain a set of underlying methods that matches the native method set, and add a target underlying method set to the target method set according to the underlying method set, wherein the underlying method set and the target underlying method set include multiple methods applied to the first code layer.
[0017] According to another aspect of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, wherein the computer program is configured to execute the rendering method of the above-described interface at runtime.
[0018] According to another aspect of the embodiments of this application, a computer program product is provided, the computer program product including a computer program / instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer program / instructions from the computer-readable storage medium, and executes the computer program / instructions, causing the computer device to perform the rendering method of the interface described above.
[0019] According to another aspect of the present invention, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to execute the interface rendering method described above through the computer program.
[0020] In this embodiment of the invention, by adding a texture view component to the view tree associated with the target activity instance, the target activity instance is configured with a target method set associated with the target rendering engine; according to the object creation method in the target method set, a target rendering object matching the texture view component is created, and the target rendering object is used to pass scene rendering information obtained from the target rendering engine to the texture view component; when at least one reference view component is added to the view tree, the target virtual interface is displayed according to the texture view component and at least one reference view component, the texture view component is used to display the target virtual scene in the target virtual interface according to the scene rendering information, and the reference view component is used to display component elements matching the component type in the target virtual interface, thereby realizing the mixed rendering display of component elements and target virtual scene in the target virtual interface.
[0021] Through the above-described embodiments of this application, two key components can be introduced into the system's native view tree: a texture view component for displaying the target virtual scene and a reference view component for displaying component elements. This leverages the system's native capabilities to achieve hybrid rendering and display of component elements and the target virtual scene. In the above embodiments, the texture view component is responsible for obtaining scene rendering information from the target rendering engine, while the reference view component does not depend on the rendering results of the target rendering engine. This means that even if the target rendering engine encounters stuttering or delays during rendering, the component elements can still maintain normal display, thereby ensuring the smoothness and responsiveness of the user interface and solving the problem of poor performance that may occur when rendering based on a rendering engine in the prior art. Attached Figure Description
[0022] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:
[0023] Figure 1 This is a schematic diagram of the hardware environment for an optional interface rendering method according to an embodiment of the present invention.
[0024] Figure 2 This is a flowchart of an optional interface rendering method according to an embodiment of the present invention;
[0025] Figure 3 This is a schematic diagram of an optional interface rendering method according to an embodiment of the present invention;
[0026] Figure 4 This is a schematic diagram of another optional interface rendering method according to an embodiment of the present invention;
[0027] Figure 5 This is an optional interface diagram according to an embodiment of the present invention;
[0028] Figure 6 This is another optional interface diagram according to an embodiment of the present invention;
[0029] Figure 7 This is another optional interface diagram according to an embodiment of the present invention;
[0030] Figure 8 This is a flowchart of another optional interface rendering method according to an embodiment of the present invention;
[0031] Figure 9 This is a schematic diagram of another optional interface rendering method according to an embodiment of the present invention;
[0032] Figure 10 This is a schematic diagram of the structure of an optional interface rendering device according to an embodiment of the present invention;
[0033] Figure 11 This is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present invention. Detailed Implementation
[0034] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0035] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0036] According to one aspect of the present invention, a method for rendering an interface is provided. As an optional implementation, the above-described interface rendering method may be applied to, but is not limited to, methods such as... Figure 1 The hardware environment shown includes a rendering system for the interface, which may include, but is not limited to, terminal device 102, network 104, server 106, and database 108. Terminal device 102 runs a target client (e.g., ...). Figure 1 As shown, taking a game application client capable of displaying virtual scenes as an example, the terminal device 102 includes a human-computer interaction screen, a processor, and a memory. The human-computer interaction screen displays the virtual scene and provides a human-computer interaction interface to receive human-computer interaction operations for controlling a virtual character within the virtual scene. This virtual character will complete game tasks set within the virtual scene. The processor generates interaction instructions in response to the aforementioned human-computer interaction operations and sends these instructions to the server. The memory stores relevant attribute data, such as object attribute information of the controlled virtual character and attribute information of the virtual items it holds. This attribute information may include, but is not limited to, information used to identify its identity and current location. The terminal device 102 runs a game client that controls the virtual character.
[0037] In addition, server 106 includes a processing engine, which performs store or read operations on database 108. Specifically, the processing engine reads virtual scene information and operation information for each virtual character from database 108.
[0038] Assumption Figure 1 The terminal device 102 runs a client for displaying a virtual scene. The specific process in this embodiment is as follows: As in step S102, the terminal device 102 executes steps S102 to S108: a texture view component is added to the view tree associated with the target activity instance, and the target activity instance is configured with a target method set associated with the target rendering engine; according to the object creation method in the target method set, a target rendering object matching the texture view component is created, and the target rendering object is used to pass scene rendering information obtained from the target rendering engine to the texture view component; if at least one reference view component is added to the view tree, the target virtual interface is displayed according to the texture view component and at least one reference view component, and the texture view component is used to display the target virtual scene in the target virtual interface according to the scene rendering information, and the reference view component is used to display component elements matching the component type in the target virtual interface.
[0039] It is understandable that during the execution of steps S102 to S108 by the terminal device 102, the terminal device can also execute S110, sending interactive operation information to the server 106 through the network 104. The interactive operation information can be determined based on the interactive operation received in the target virtual interface. At the same time, the server 106 can execute S112, and the network 104 returns interactive response information to the terminal device 102. The interactive response information can be used to render and display the target virtual interface.
[0040] Optionally, in this embodiment, the terminal device 102 can be a terminal device configured with a target client, which may include, but is not limited to, at least one of the following: mobile phone (such as Android phone, iOS phone, etc.), laptop computer, tablet computer, PDA, MID (Mobile Internet Devices), PAD, desktop computer, smart TV, etc. The target client can be a video client, instant messaging client, browser client, educational client, or other client that supports providing shooting game tasks. The network may include, but is not limited to, wired network and wireless network, wherein the wired network includes: local area network, metropolitan area network, and wide area network, and the wireless network includes: Bluetooth, WIFI, and other networks that enable wireless communication. The server may be a single server, a server cluster composed of multiple servers, or a cloud server. The above is only an example, and no limitation is made in this embodiment.
[0041] Optionally, in this embodiment, the rendering method of the interface described above can be applied, but is not limited to, to game-type terminal applications (APPs) that complete predetermined social game tasks in a virtual scene, such as virtual combat game applications in Multiplayer Online Battle Arena (MOBA) applications; the aforementioned social game tasks can be, but are not limited to, game tasks completed by the current player through virtual characters in the rendered virtual scene of the human-computer interaction interface and virtual characters controlled by other players through virtual social interaction; the rendering method of the interface described above can also be applied to terminal applications of massively multiplayer online role-playing games (MMORPGs), in which the current player can complete social game tasks in the game from the first-person perspective of a virtual character through role-playing, for example, completing game tasks together with other virtual characters. These social game tasks can, but are not limited to, run in the form of plugins or mini-programs within the application (such as a non-standalone game APP), or run within the application (such as a standalone game APP) in a game engine. The types of game applications mentioned above may include, but are not limited to, at least one of the following: two-dimensional (2D) game applications, three-dimensional (3D) game applications, virtual reality (VR) game applications, augmented reality (AR) game applications, and mixed reality (MR) game applications. This is merely an example, and this embodiment does not impose any limitations on it.
[0042] Through the above-described embodiments of this application, two key components can be introduced into the system's native view tree: a texture view component for displaying the target virtual scene and a reference view component for displaying interface elements. This leverages the system's native capabilities to achieve hybrid rendering and display of component elements and the target virtual scene. In the above embodiments, the texture view component is responsible for obtaining scene rendering information from the target rendering engine, while the reference view component does not depend on the rendering results of the target rendering engine. This means that even if the target rendering engine encounters stuttering or delays during rendering, the interface elements can still maintain normal display, thus ensuring the smoothness and responsiveness of the user interface and solving the problem of poor performance that may occur when rendering based on a rendering engine in the prior art.
[0043] Understandably, in applications that render target virtual scenes using a target rendering engine, there is often a need to synchronously display the target virtual scene and component elements. For example, if the target application is a game application, and the target virtual scene is a virtual game scene, a splash screen is usually displayed when the game starts. However, since the splash screen is typically displayed at the very beginning of the application's runtime, before the rendering engine is ready, existing technologies that synchronously blend the virtual scene and interface elements based on the rendering engine will cause the splash screen to fail to display correctly in the aforementioned scenario.
[0044] Additionally, in game applications where there are scene transitions, the scene progress bar needs to load. During these transitions, the rendering engine is typically handling complex loading logic. Therefore, if the scene progress bar continues to load based on the rendering engine, it will exhibit noticeable lag.
[0045] In addition, there are some special component elements that rendering engines are not good at rendering. For example, the Unreal Engine rendering framework is not good at rendering complex lists containing a large number of content items.
[0046] As can be seen, in the above scenarios, relying on the rendering engine to synchronously render virtual scenes and component elements will result in poor rendering effects.
[0047] To address the aforementioned technical problems, this application provides an optional implementation method, such as... Figure 2 As shown, the rendering method of the above interface includes the following steps:
[0048] S202, Add a texture view component to the view tree associated with the target activity instance, wherein the target activity instance is configured with a set of target methods associated with the target rendering engine;
[0049] S204. Based on the object creation methods in the target method set, create a target rendering object that matches the texture view component. The target rendering object is used to pass scene rendering information obtained from the target rendering engine to the texture view component.
[0050] S206, if at least one reference view component is added to the view tree, the target virtual interface is displayed based on the texture view component and at least one reference view component, wherein the texture view component is used to display the target virtual scene in the target virtual interface based on scene rendering information, and the reference view component is used to display component elements that match the component type in the target virtual interface.
[0051] It should be noted that the above-described embodiments of this application can be applied to an application that renders a target virtual scene based on a target rendering engine. For example, the application can be a game application, and correspondingly, the target virtual scene displayed based on the texture view component can be a virtual scene in the game application, and the component elements displayed based on the reference view component can be one or more of the following in the game application: operation control elements, buffer view elements, pop-up elements, list elements, etc.
[0052] Alternatively, if the aforementioned application is an application running on the Android system, the aforementioned target rendering engine can also be specifically a Unreal Engine that excels at rendering virtual scenes.
[0053] Correspondingly, in step S202 above, the target activity instance can be a currently running activity component. This activity component is a basic building block of an Android application, providing an interactive window. On one hand, the activity component can be used to display interface elements corresponding to various view components; on the other hand, the activity component can also receive interactive operations through the displayed view components.
[0054] In the above implementation, a view tree can be created using active components to indicate the user interface structure built within the active components. In this view tree, one or more components (such as buttons, text boxes, etc.) can be represented as one or more nodes.
[0055] It should be noted that the aforementioned target activity instance can be obtained through instantiation of a target activity class. In the Android system, the aforementioned target activity class can be a subclass of the activity class provided by the Android system. Therefore, it can inherit the reference method set of the activity class and create the view tree in step S202, the texture view component in step S204, and one or more reference view components in step S206 by calling one or more methods in the reference method set.
[0056] In the above embodiments of this application, the target activity class may also be pre-configured with a set of target methods associated with the target rendering engine, wherein the set of target methods may include methods for creating resource interactions with the target rendering engine.
[0057] When the target rendering engine is specifically Unreal Engine, the aforementioned set of target methods can be determined based on the method set corresponding to the native activity class. It should be noted that in Unreal Engine, game activity classes, which inherit from the native activity class, are typically used to render the virtual scene. Because the game activity class used in Unreal Engine inherits from the native activity class, it can use the relevant methods provided by the native activity class. This provides the functionality to pass the lifecycle methods defined by the Android system for the activity class to the Unreal Engine, allowing the engine's core C++ logic to perceive and make corresponding changes.
[0058] As mentioned earlier, if instantiated components of game activity classes are used in Unreal Engine to perform synchronous mixed rendering of virtual scene images and component elements, a technical problem of poor mixed display effect will occur.
[0059] In the above embodiments of this application, a mixed display operation is performed through an instantiation product of a target activity instance that inherits from a reference activity class and is configured with a target method set. In the Android system, the reference activity instance can specifically be an activity class, and the target method set can specifically be a method set obtained by performing a refactoring operation on the method set of the native activity class.
[0060] Since the target activity instance inherits from the reference activity class, it can create texture view components and reference view components through the reference method collection corresponding to the reference activity class. At the same time, it can also create a target rendering object to pass scene rendering information between the target activity instance and the target rendering engine according to the object creation method in its pre-configured target method collection. Then, it can obtain the scene rendering information determined by the target rendering engine based on the target rendering object, and render and display the target virtual scene in the texture view component based on the scene rendering information.
[0061] Through the above-described embodiments of this application, on the one hand, even when the rendering engine performance is limited, the interface elements can continuously display key information in the interface; on the other hand, the interface elements can serve as a supplement to the display effect of the target virtual scene. When the rendering effect of the virtual scene is not ideal, the interface elements can provide additional visual information, thereby improving the overall hybrid rendering display effect.
[0062] In an optional implementation, step S202, before adding the texture view component in the view tree associated with the target activity instance, further includes:
[0063] S1, in response to the interface rendering instruction, performs an instantiation operation on the target activity class to obtain a target activity instance, wherein the target activity class is configured with a target method set associated with the target rendering engine, and the target activity class is a subclass of the reference activity class, which is configured with a reference method set associated with the reference view component;
[0064] S2, create a view tree based on the view tree creation method in the reference method set.
[0065] In the above embodiments of this application, since the target activity class inherits from the reference activity class, the reference method set configured in the reference activity class can be used to implement the creation operation of the target activity class and the view tree of the target activity class.
[0066] Specifically, when the above-mentioned reference activity class is an activity class in the Android system, the above-mentioned target activity class can be an activity class configured with a set of target methods, and then the creation operation of the target activity class and the view tree of the target activity class can be implemented based on the relevant methods provided by the activity class.
[0067] Specifically, the target activity instance can be created by calling the activity instance creation method of the activity class. Further, within the activity instance creation method, the UI layout of the target activity instance can be set by calling the set content view method. Then, a view tree can be built based on the layout file.
[0068] It should be noted that in the Android system, the aforementioned view tree is a hierarchical structure composed of UI components and UI containers. In the above embodiments of this application, both the texture view component and the reference view component can be specifically UI components. The reference view component can be a native Android component, such as, but not limited to, one or more of button components, text components, image components, layout components, and custom components.
[0069] The following explains the component hierarchy between the texture view component and the reference view component.
[0070] In an alternative implementation, when at least one reference view component is added to the view tree, before displaying the target virtual interface based on the texture view component and the at least one reference view component, one of the following is further included:
[0071] Layout Method 1: Add at least one reference view component to the first child node level under the root node of the view tree, wherein the texture view component is added to the first child node level of the view tree under the root node.
[0072] Layout Method 2: Add a view container component to the first child node level under the root node of the view tree, and add at least one reference view component to the second child node level under the view container component. The texture view component is added to the first child node level of the view tree under the root node.
[0073] In the above layout method one, such as Figure 3 As shown, at least one reference view component can be added to the first child node level under the root node of the view tree. These components can be any standard Android view component, such as button components, text view components, image view components, etc. Simultaneously, a texture view component is added to the same first child node level as the reference view component. The texture view component is used to display the virtual scene generated by the rendering engine.
[0074] In the first layout method described above, the root node of the view can be an interface container. Then, texture view components and other native Android components can be added at the same level under the interface container. This allows the virtual scene and user interface elements to be displayed at the same level in the view tree, simplifying layout management and making the interaction between the virtual scene and UI elements more intuitive and direct.
[0075] In the above-mentioned layout method two, such as Figure 4 As shown, a view container component (such as a frame layout container component or a linear layout container component) can be added at the first child node level under the root node of the view tree. At least one reference view component can be added at the second child node level under the view container component, thereby managing other native components displayed in the interface in a unified manner through the view container component.
[0076] In the second layout method described above, the texture view component is also added as the first child node under the root node, at the same level as the view container component. Using the view container component allows for more flexible management of the layout and display of user interface elements. The view container component can provide additional layout features, such as scrolling and grid layouts, which helps in creating more complex and dynamic user interfaces.
[0077] Through the above-described embodiments of this application, layout method one directly adds all components at the first child node level, while layout method two uses view container components to organize user interface elements. Both methods can achieve effective integration and display of virtual scenes and user interface elements. Preferably, layout method two provides more layout flexibility.
[0078] The following describes the possible component forms and combination methods of at least one reference view component. In an optional implementation, when at least one reference view component is added to the view tree as described above, displaying the target virtual interface based on the texture view component and at least one reference view component includes at least one of the following:
[0079] Display Method 1: When at least one reference view component includes a player component, display the target media resource element in the target virtual scene according to the player component;
[0080] The player component can be displayed in the target virtual interface using the first display method described above. This player component is used to display media resource elements in the target virtual scene. For example... Figure 5 As shown, the texture view component 502 can be used to display virtual scenes in game applications, while the player component 504 can be used to display video media resources. Figure 5 In the process of displaying a virtual scene, if the Unreal Engine is currently undergoing initialization or experiencing a runtime error, the Texture View component 502 cannot obtain scene rendering information based on the target rendering object. In this situation, media resources can be played on the current interface using the Player component 504. These resources could include live game videos shared by other players or promotional videos for game applications. Furthermore, even when the rendering engine malfunctions or is undergoing initialization, playing media resources through the Player component 504 can improve the interface display.
[0081] Display Method 2: In the case where at least one reference view component includes a loop view component, target sliding list elements are displayed in the target virtual scene according to the loop view component, wherein the target sliding list includes a set of target display elements;
[0082] In the second display method described above, a sliding list containing multiple target display elements can be displayed in the target virtual scene using a loop view component. For example... Figure 6 As shown, the texture view component 602 displays the virtual scene in the game application. When a "square message viewing command" is detected, a texture view component can be added to the view tree. Then, the game interface displays conversation messages sent by other players in a scrolling list according to the loop view component 604. Even if the Unreal Engine is currently in the process of rendering game graphics, complex list elements can be rendered and displayed in the interface through native Android components.
[0083] Display Method 3: When at least one reference view component includes a progress bar component, display the progress bar element in the target virtual scene according to the progress bar component;
[0084] In the third display method described above, progress information can be displayed in the target virtual scene using a progress bar component. For example... Figure 7As shown, the texture view component 702 is used to display the virtual scene in the game application. Upon detecting a game scene transition command, while the Unreal Engine is rendering the next game scene (before the texture view component 702 receives new scene rendering information), the progress of the game scene transition can be displayed using the progress bar component 704.
[0085] Display Method 4: In the case where at least one reference view component includes a window management component, a floating window element is displayed in the target virtual scene based on the window management component.
[0086] In the fourth display method described above, floating window elements can be displayed in the target virtual scene through window management components, such as dialog boxes, prompts, or other interactive windows.
[0087] In the embodiments described above, the texture view component is responsible for displaying the virtual scene, while the reference view component is used to display various user interface elements, such as players, sliding lists, progress bars, and floating windows. These elements can enhance the user experience, providing more information and interactive functions. In this way, rich user interface elements can be integrated into the virtual scene while maintaining the scene's immersion and interactivity.
[0088] In one alternative implementation, when at least one reference view component is added to the view tree, the target virtual interface is displayed based on the texture view component and at least one reference view component, including at least one of the following:
[0089] Case 1: If the time interval between two adjacent frames of scene rendering information obtained by the texture view component meets the display conditions of the first component, add a progress bar component to the view tree.
[0090] Scenario 2: If the time interval between two adjacent frames of scene rendering information received by the texture view component meets the display conditions of the second component, add a player component to the view tree.
[0091] In the above embodiments of this application, different components can be dynamically added to the view tree according to different rendering conditions of Unreal Engine to improve the display effect.
[0092] For example, if a slight lag is detected in the output of Unreal Engine, a progress bar component is dynamically added to the view tree to display the progress bar element in the interface, indicating the current rendering lag status; or, if a severe lag is detected in Unreal Engine, a player component is dynamically added to the view tree to display the player component in the interface, and media resources are displayed according to the player element to improve the display effect of the interface.
[0093] In one specific implementation, different components can be dynamically added under different rendering conditions to improve the display effect. Specifically, a view tree can be created first. In the view tree of the active example, a texture view component and at least one reference view component (such as a frame layout container component) are added. The texture view component is used to display the virtual scene generated by the rendering engine, while the reference view component is used to display other dynamically added UI elements.
[0094] Next, in the texture view component, the time interval between two adjacent frames of scene rendering information is monitored. For example, this can be achieved by adding timestamp records to the rendering engine.
[0095] Next, components are dynamically added based on the monitoring results. That is, different components are dynamically added to the reference view components according to the rendering time interval, so as to display different prompt elements under different rendering conditions.
[0096] For example, in Case 1, when the time interval between two adjacent frames of scene rendering information obtained by the texture view component meets the display condition of the first component (e.g., more than 200 milliseconds), a progress bar element is added to the view tree to display the progress bar element in the interface and indicate the current rendering lag status.
[0097] For example, in case two, when the time interval between the scene rendering information received by the texture view component from two adjacent frames meets the display condition of the second component (e.g., more than 500 milliseconds), the player component is added to the view tree to display the player component in the interface, and media resources are displayed according to the player element to improve the display effect of the interface.
[0098] The above implementation allows for the dynamic addition of different components under varying rendering conditions to enhance display quality. In cases of lag, a progress bar is displayed; during loading, media resources (such as advertisements or transition animations) are shown. This method effectively improves user experience and reduces inconvenience caused by rendering delays or lag.
[0099] The following provides a further explanation of the specific implementation process of steps S202 to S206 above.
[0100] First, in an optional implementation, before adding the texture view component to the view tree associated with the target activity instance, the target activity class for instantiating the target activity instance can be configured, which may specifically include the following steps:
[0101] S1. Create a target activity class and generate a subclass of the reference activity class. The target activity class is used to determine the target activity instance, and the reference activity class is configured with a collection of reference methods associated with the reference view component.
[0102] S2, retrieves the set of native methods configured for the native activity class, where the set of native methods is used to perform screen rendering operations under the rendering framework that matches the target rendering engine;
[0103] S3, based on the native method set, configures the target method set associated with the target rendering engine for the target activity class.
[0104] When the target rendering engine is Unreal Engine, the Android platform uses the native Activity class and related C++ layer code as the container for the Android framework layer by default. However, the above conventional implementation can only provide the native Activity class's rendering object to Unreal Engine by default, and cannot customize Android UI components in the Activity class.
[0105] Through the above-described embodiments of this application, the Android framework layer container of Unreal Engine can be switched to a regular Android activity class with customizable logic.
[0106] In the Unreal Engine framework, rendering operations are performed using a game activity class that inherits from the aforementioned native activity class. Therefore, in one alternative implementation, a new class, the target activity class, can be created and set to inherit from a reference activity class (specifically, the activity class itself). Alternatively, the parent class of the game activity class can be changed from the native activity class to the activity class. These modifications allow for the configuration of a custom method set for the game activity class.
[0107] In addition, in order to continue to obtain the interaction results from Unreal Engine, it is also necessary to manually implement the relevant methods in the original Android framework layer container in the updated game activity class.
[0108] Specifically, this can be achieved through the following two methods:
[0109] On the one hand, it is necessary to reimplement the native methods defined in the native activity class in the native activity after updating the inheritance relationship;
[0110] On the other hand, the specific C++ implementations of the native methods in the above method set also need to be reimplemented with reference to the C++ layer of the native activity class, so as to connect the logic to the C++ functions related to the native activity class in the NDK (Native Development Kit).
[0111] The above implementation essentially replicates the logic of Android's native activity class and re-implements it within a custom game activity class, thus enabling the implementation of custom activity class content.
[0112] The following provides further explanation of the reimplementation methods for the above set of methods:
[0113] In one alternative implementation, configuring the target method set associated with the target rendering engine for the target activity class based on the native method set includes at least one of the following:
[0114] Method 1: Configure a native code loading method in the target method set. The native code loading method is used to create a native activity instance that matches the target activity instance in the first code layer. The target activity instance is an instance created in the second code layer. The first code layer is the base code layer of the second code layer.
[0115] In Method 1 above, native code methods can be loaded and reimplemented. This method is typically triggered when a native activity instance is created, and is used to initialize the logic related to the native activity class in the C++ layer. It is one of the core methods in the entire process. Furthermore, the main responsibility of the C++ layer corresponding to this method is to create the native activity object and call the native activity creation method.
[0116] Method 2: Configure a state update method in the target method set. The state update method is used to send state update information to the target rendering engine when the first object state of the target rendering object is updated to the second object state.
[0117] In Method 2 above, the method for creating the local rendering object can be reimplemented. This method is used to pass a target rendering object to the C++ layer, which then uses this target rendering object to initialize the rendering environment and draw rendering instructions onto this target rendering object.
[0118] Method 3: Configure an object destruction method in the target method set. The object destruction method is used to send the object destruction information of the target rendering object to the target rendering engine when a destruction instruction for the target rendering object is detected.
[0119] In the second method described above, the method for redrawing local rendering objects can be reimplemented. This method is used to notify the C++ layer that the target rendering object needs to be redrawn.
[0120] Method 4: Configure object redraw methods in the target method set. The object redraw methods are used to send object redraw information to the target rendering engine when a redraw instruction for the target rendering object is detected.
[0121] In Method 4 above, the method for destroying the local rendering object can be reimplemented. This method is used to notify the C++ layer that the target rendering object has been destroyed and that the resources related to the target rendering object need to be released and the cleanup logic needs to be executed.
[0122] Method 5: Obtain the underlying method set that matches the native method set, and add the target underlying method set to the target method set based on the underlying method set. The underlying method set and the target underlying method set include multiple methods applied to the first code layer.
[0123] The above callback methods are necessary for implementing the original functionality of the native activity class. In this implementation, after migrating the inheritance relationship of the game activity class to a regular Activity, it is necessary to manually implement the notification logic of the Java layer and the passing logic of the C++ layer of these methods. This will result in a regular activity class with the capabilities of the native activity class (i.e., the updated game activity class), so that the engine-rendered screen and the Android native interface can be mixed and displayed later.
[0124] By implementing the above-described method of this application, a normal activity class with native activity class capabilities can be obtained by migrating the inheritance relationship of the game activity class to a normal activity class and manually implementing the notification logic in the Java layer and the passing logic in the C++ layer. This makes it easy to subsequently mix and display the engine-rendered screen and the native Android interface, thereby improving application performance and user experience.
[0125] In a preferred embodiment, the updated method set of the game activity class can be further reimplemented, including the following Java layer methods and corresponding C++ layer methods.
[0126] Method 1: The method for unloading native code can be reimplemented. This method is typically triggered when the active instance is destroyed, and is used to notify the C++ layer to clean up the corresponding data; it is one of the key methods for managing the release of C++ layer resources. Furthermore, the main responsibility of the C++ layer corresponding to this method is to clean up and release resources, ensuring that the C++ layer's data and resources are also properly processed when the active instance is destroyed.
[0127] Method 2: The local startup method can be reimplemented. This method is called during the instance preparation lifecycle of the active instance to notify the native active instance object in the C++ layer that it has entered the instance preparation state; it is one of the important methods for managing state transitions in the C++ layer. Furthermore, the main responsibility of the C++ layer corresponding to this method is to handle the logic when the application enters the foreground, such as restoring the game state or pausing background operations.
[0128] Method 3: The local recovery method can be reimplemented. This method is called during the instance recovery lifecycle of the active instance to notify the native active object in the C++ layer that it has entered the instance recovery state; it is one of the core methods to ensure that the C++ layer responds correctly when the application recovers. Furthermore, the main responsibility of the C++ layer corresponding to this method is to restore the application's runtime state, such as restarting animations or restoring game logic.
[0129] Method 4: The method for saving instance state locally can be reimplemented. This method is called during the lifecycle of saving instance state in the active instance. It is used to retrieve data returned by the C++ layer and save it for recording state data; it is one of the key methods for maintaining application state. Furthermore, the main responsibility of the corresponding C++ layer is to provide the current state data so that the application can be recovered after being destroyed by the system.
[0130] Method 5: The local pause method can be reimplemented. This method is called during the instance pause lifecycle of the active instance to notify the C++ layer that the active instance object has entered the instance pause state; it is one of the important methods for managing the C++ layer's behavior when the application is paused. Furthermore, the main responsibility of the corresponding C++ layer is to pause the application's running state, such as pausing a game or animation.
[0131] Method Six: The local stop method can be reimplemented. This method is called during the stopped lifecycle of the activity class to notify the native activity object in the C++ layer that it has entered the stopped state; it is one of the core methods to ensure that the C++ layer responds correctly when the application stops. Furthermore, the main responsibility of the C++ layer corresponding to this method is to handle the logic when the application enters the background, such as saving game progress or releasing resources.
[0132] Method 7: The local configuration change method can be reimplemented. This method is called during the local configuration change state lifecycle of the active instance to notify the C++ layer local active object that a configuration change has occurred, such as a screen orientation switch, so that the C++ layer code can respond accordingly; it is one of the key methods for handling device configuration changes.
[0133] Method 8: The local low memory method can be reimplemented. This method is called during the local low memory lifecycle of the active instance to notify the C++ layer that it is currently in a low memory state; it is one of the important methods for managing memory resources. Furthermore, the main responsibility of the corresponding C++ layer is to release non-critical resources to help alleviate memory pressure on the system.
[0134] Method 9: The local window focus change method can be reimplemented. This method is called during the local window focus change lifecycle of the activity instance to notify the C++ layer that the focus state of the current Activity has changed; it is one of the key methods for handling window focus changes.
[0135] Method 10: The method for handling changes to the local rendering object can be reimplemented. This method notifies the C++ layer that the state of the local rendering object has changed, and is typically triggered when the width and height of the local rendering object change. It is one of the core callbacks involved in this solution. Furthermore, the main responsibility of the C++ layer corresponding to this method is to adjust the rendering output to fit the new surface size.
[0136] Method 11: The input queue creation method can be reimplemented. This method is used to notify the C++ layer that the input queue corresponding to the active instance has been created; it is one of the key methods for managing input events.
[0137] Method 12: The method for destroying the local input queue can be reimplemented. This method is used to notify the input queue corresponding to the active instance in the C++ layer to be destroyed; it is one of the important methods to ensure the correct cleanup of the input system.
[0138] By implementing the above-described method of this application, and migrating the inheritance relationship of the game activity class to a regular activity class, and manually implementing the notification logic in the Java layer and the passing logic in the C++ layer, a regular activity class (a new game activity class) with the capabilities of a native activity class can be obtained. This makes it easier to subsequently mix and display the engine-rendered screen and the native Android interface, thereby improving application performance and user experience.
[0139] The target activity class (updated game activity class) is obtained through the above implementation method of this application. Then, a target activity instance can be instantiated based on the target activity class, and subsequent creation and rendering operations can be performed based on the target activity instance and its configured method set.
[0140] In one optional implementation, the above-mentioned instantiation operation on the target activity class in response to the interface rendering instruction to obtain the target activity instance includes:
[0141] S1, based on the activity creation method in the reference method set, will perform an instantiation operation on the target activity class to obtain the target activity instance;
[0142] S2, based on the native code loading method in the target method set, create a native activity instance matching the target activity instance in the first code layer, where the target activity instance is an instance created in the second code layer, and the first code layer is the base code layer of the second code layer.
[0143] Specifically, in the above implementation, during the process of creating a target activity instance using the activity creation method (activity instance creation method) in the reference method set, the reimplemented loading native code method in the target method set can be further called to initialize the logic related to the native activity class in the C++ layer. This is one of the core methods of the entire process. The main responsibility of the C++ method is to create a native activity instance object and call the native activity instance creation method.
[0144] In the process of rendering and displaying a target virtual scene in a texture view component based on a target rendering object, in one optional implementation, after creating a target rendering object matching the texture view component according to the object creation method in the target method set, the method further includes:
[0145] S1, when the target rendering engine determines the updated scene rendering information based on the updated rendering instructions, the texture view component obtains the updated scene rendering information based on the target rendering object;
[0146] S2, Display the updated target virtual interface based on the texture view component and at least one reference view component.
[0147] The embodiments described above in this application allow for the dynamic updating and display of virtual scenes while maintaining the interactivity of the user interface and the real-time nature of information. By integrating the target rendering object into the texture view component, scene rendering information can be effectively managed and updated. Simultaneously, by combining it with the reference view component, related user interface elements can be displayed on the same interface, providing a rich user experience. This method is particularly suitable for applications requiring high-performance graphics rendering and complex user interactions, such as games, virtual reality, and augmented reality applications.
[0148] In the process of rendering and displaying a target virtual scene in a texture view component based on a target rendering object, in one optional implementation, after creating a target rendering object matching the texture view component according to the object creation method in the target method set, it further includes at least one of the following:
[0149] Method 1: When the first object state of the target rendering object is updated to the second object state, send the state update information to the target rendering engine according to the state update method in the target method set;
[0150] In the first method described above in this application, the reimplemented local rendering object change method in the target method set can be called to notify the C++ layer that the state of the target rendering object has changed. For example, if the width and height of the target rendering object change, the above method can be called.
[0151] Method 2: Upon detecting a destruction command for the target rendering object, send the object destruction information of the target rendering object to the target rendering engine according to the object destruction method in the target method set;
[0152] In Method 2 of this application, an object destruction method from the target method set, such as the local rendering object destruction method, can be invoked to send object destruction information of the target rendering object to the target rendering engine. This method is used to notify the C++ layer that the target rendering object has been destroyed and that resources related to the target rendering object need to be released and cleanup logic executed.
[0153] Method 3: When a redraw instruction for the target rendering object is detected, object redraw information is sent to the target rendering engine according to the object redraw method in the target method set.
[0154] In Method 3 of this application, object redrawing methods from the target method set, such as local rendering object redrawing methods, can be invoked to send object redrawing information to the target rendering engine. This method is used to notify the C++ layer that the target rendering object needs to be redrawn.
[0155] The following combination Figure 8 and Figure 9 A complete implementation of this application will be described.
[0156] S802, Configure the target activity class;
[0157] After migrating the parent class of the target activity class to the regular activity class, it is necessary to manually implement the essential methods of the original functionality of the native activity class, including the notification logic in the Java layer and the propagation logic in the C++ layer. By fully implementing these methods, a regular activity class with the capabilities of the native activity class is obtained, thus laying the foundation for the subsequent mixed display of the engine rendering screen and the Android native interface.
[0158] S804, Create Unreal Engine Render Target Render Object;
[0159] After completing the modifications and adaptations in S802, we have obtained a normal activity class (i.e., the target activity class) that can freely add view interfaces, and it has the capability interfaces of the native activity class.
[0160] Next, a full-screen texture view component is created and added to the active instance's view tree as the Unreal Engine's rendering window. Simultaneously, using the native methods related to the target rendering object defined earlier, the target rendering object obtained from the texture view component's callback and its subsequent state changes are passed to the C++ layer, and then to the Unreal Engine.
[0161] S806, creating native UI containers;
[0162] After handling the above logic, you can add native UI containers to the view tree. For example... Figure 9 As shown, the specific steps are as follows: First, add a native UI container (e.g., a frame layout container component) under the root node of the view tree. Then, based on this native UI container, add Android native UI elements to it as needed.
[0163] S808, a hybrid display of virtual scenes and native visuals.
[0164] Through the above implementation, the Unreal Engine-rendered screen and the native Android screen (Android native interface container) are both located in the view tree of the active example. The Android system will merge the elements in this view tree and present them together on the screen, ultimately achieving a perfect fusion display of the Unreal Engine-rendered screen and the native Android screen.
[0165] Through the above-described embodiments of this application, by adding a texture view component and a reference view component to the view tree of the target activity class, this solution can seamlessly blend and display virtual scenes rendered by Unreal Engine with native Android interface elements. The texture view component is responsible for obtaining scene rendering information from Unreal Engine and displaying the target virtual scene, while the reference view component is used to display native Android component elements. This hybrid rendering method solves the drawing problems that Unreal Engine cannot or is not good at handling in certain scenarios, such as video playback when starting a project, displaying a sliding list with a large amount of data, displaying a progress bar when loading a level, and floating tool windows.
[0166] Furthermore, the above-described embodiments of this application utilize the system's native capabilities to achieve hybrid rendering and display of component elements and the target virtual scene. The texture view component and the reference view component operate independently. The texture view component is responsible for obtaining scene rendering information from the target rendering engine, while the reference view component does not depend on the rendering results of the target rendering engine. This means that even if the Unreal Engine encounters stuttering or delays during rendering, the reference view component can still maintain normal display, thereby ensuring the smoothness and responsiveness of the user interface. This mechanism effectively solves the problem of poor performance that may occur when rendering based on a rendering engine in the prior art, improving the user experience.
[0167] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the present invention.
[0168] According to another aspect of the present invention, a rendering apparatus for an interface for implementing the above-described interface rendering method is also provided. For example... Figure 10 As shown, the device includes:
[0169] Add unit 1002 for adding a texture view component in the view tree associated with the target activity instance, wherein the target activity instance is configured with a set of target methods associated with the target rendering engine;
[0170] Creation unit 1004 is used to create a target rendering object matching the texture view component according to the object creation method in the target method set, wherein the target rendering object is used to pass scene rendering information obtained from the target rendering engine to the texture view component.
[0171] Display unit 1006 is used to display a target virtual interface based on the texture view component and at least one reference view component when at least one reference view component is added to the view tree. The texture view component is used to display a target virtual scene in the target virtual interface based on the scene rendering information, and the reference view component is used to display component elements that match the component type in the target virtual interface.
[0172] Optionally, the rendering apparatus for the interface further includes: an instantiation unit, configured to perform an instantiation operation on a target activity class in response to an interface rendering instruction to obtain a target activity instance, wherein the target activity class is configured with a target method set associated with the target rendering engine, and the target activity class is a subclass of a reference activity class, and the reference activity class is configured with a reference method set associated with the reference view component; and the view tree is created according to the view tree creation method in the reference method set.
[0173] Optionally, the creation unit 1004 is further configured to: add at least one of the reference view components at the first child node level under the root node of the view tree; add a view container component at the first child node level under the root node of the view tree, and add at least one of the reference view components at the second child node level under the view container component; wherein the texture view component is added at the first child node level of the view tree under the root node.
[0174] Optionally, the instantiation unit is configured to: perform an instantiation operation on the target activity class according to the activity creation method in the reference method set to obtain the target activity instance; and create a local activity instance matching the target activity instance in the first code layer according to the local code loading method in the target method set, wherein the target activity instance is an instance created in the second code layer, and the first code layer is the base code layer of the second code layer.
[0175] Optionally, the display unit 1006 is further configured to: when the target rendering engine determines the updated scene rendering information according to the updated rendering instructions, the texture view component obtains the updated scene rendering information according to the target rendering object; and display the updated target virtual interface according to the texture view component and at least one of the reference view components.
[0176] Optionally, the rendering apparatus for the above interface further includes at least one of the following: a first object operation unit, configured to send state update information to the target rendering engine according to a state update method in the target method set when the first object state of the target rendering object is updated to a second object state; a second object operation unit, configured to send object destruction information of the target rendering object to the target rendering engine according to an object destruction method in the target method set when a destruction instruction for the target rendering object is detected; and a third object operation unit, configured to send object redrawing information to the target rendering engine according to an object redrawing method in the target method set when a redrawing instruction for the target rendering object is detected.
[0177] Optionally, the display unit 1006 is configured to: display a target media resource element in the target virtual scene according to the player component when at least one of the reference view components includes a player component; display a target sliding list element in the target virtual scene according to the loop view component when at least one of the reference view components includes a loop view component, wherein the target sliding list includes a set of target display elements; display a progress bar element in the target virtual scene according to the progress bar component when at least one of the reference view components includes a progress bar component; and display a floating window element in the target virtual scene according to the window management component when at least one of the reference view components includes a window management component.
[0178] Optionally, the display unit 1006 is used for at least one of the following: adding the progress bar component to the view tree when the time interval between two adjacent frames of scene rendering information obtained by the texture view component satisfies the first component display condition; adding the player component to the view tree when the time interval between two adjacent frames of scene rendering information received by the texture view component satisfies the second component display condition.
[0179] Optionally, the rendering apparatus for the above interface further includes: a configuration unit, configured to create a target activity class and generate the target activity class as a subclass of a reference activity class, wherein the target activity class is used to determine the target activity instance, and the reference activity class is configured with a set of reference methods associated with the reference view component; obtain a set of native methods configured for a native activity class, wherein the set of native methods is used to perform screen rendering operations under a rendering framework matched with the target rendering engine; and configure the target method set associated with the target rendering engine for the target activity class according to the set of native methods.
[0180] Optionally, the above configuration unit is used for at least one of the following: configuring a native code loading method in the target method set, wherein the native code loading method is used to create a native activity instance matching the target activity instance in a first code layer, the target activity instance being an instance created in a second code layer, and the first code layer being the base code layer of the second code layer; configuring a state update method in the target method set, wherein the state update method is used to send state update information to the target rendering engine when the first object state of the target rendering object is updated to the second object state; configuring an object destruction method in the target method set, wherein... The object destruction method described above is used to send object destruction information of the target rendering object to the target rendering engine when a destruction instruction for the target rendering object is detected; configure an object redrawing method in the target method set, wherein the object redrawing method is used to send object redrawing information to the target rendering engine when a redrawing instruction for the target rendering object is detected; obtain a set of underlying methods that matches the native method set, and add a target underlying method set to the target method set according to the underlying method set, wherein the underlying method set and the target underlying method set include multiple methods applied to the first code layer.
[0181] Optionally, in this embodiment, the implementation of each of the above-mentioned unit modules can be referred to the above-mentioned method embodiments, which will not be repeated here.
[0182] According to another aspect of the present invention, an electronic device for implementing the above-described interface rendering method is also provided. This electronic device may be... Figure 11 The terminal device or server shown. This embodiment uses this electronic device as an example for illustration. Figure 11 As shown, the electronic device includes a memory 1102 and a processor 1104. The memory 1102 stores a computer program, and the processor 1104 is configured to execute the steps of any of the above method embodiments via the computer program.
[0183] Optionally, in this embodiment, the aforementioned electronic device may be located in at least one of a plurality of network devices in a computer network.
[0184] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0185] S1, Add a texture view component to the view tree associated with the target activity instance, which is configured with a set of target methods associated with the target rendering engine;
[0186] S2, based on the object creation method in the target method set, create a target rendering object that matches the texture view component. The target rendering object is used to pass scene rendering information obtained from the target rendering engine to the texture view component.
[0187] S3, if at least one reference view component is added to the view tree, display the target virtual interface according to the texture view component and at least one reference view component. The texture view component is used to display the target virtual scene in the target virtual interface according to the scene rendering information. The reference view component is used to display component elements that match the component type in the target virtual interface and obtain light elements and light distribution parameters. The light distribution parameters are used for the imaging distribution of indicator light elements in the planar area.
[0188] Alternatively, as those skilled in the art will understand, Figure 11 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones (such as Android phones, iOS phones, etc.), tablets, PDAs, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 11 This does not limit the structure of the aforementioned electronic devices or electronic equipment. For example, electronic devices or electronic equipment may also include components that are more... Figure 11 The more or fewer components shown (such as network interfaces, etc.), or having the same Figure 11 The different configurations shown.
[0189] The memory 1102 can be used to store software programs and modules, such as the program instructions / modules corresponding to the interface rendering method and apparatus in this embodiment of the invention. The processor 1104 executes various functional applications and data processing by running the software programs and modules stored in the memory 1102, thereby realizing the aforementioned interface rendering method. The memory 1102 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1102 may further include memory remotely located relative to the processor 1104, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Specifically, the memory 1102 may be used, but is not limited to, to store information such as various elements in the scene and interface rendering information. As an example, such as... Figure 11 As shown, the memory 1102 may include, but is not limited to, the adding unit 1002, the creating unit 1004, and the display unit 1006 in the rendering device of the interface described above. Furthermore, it may include, but is not limited to, other module units in the rendering device of the interface described above, which will not be elaborated upon in this example.
[0190] Optionally, the transmission device 1106 described above is used to receive or send data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission device 1106 includes a Network Interface Controller (NIC), which can be connected to other network devices and a router via a network cable to communicate with the Internet or a local area network. In another example, the transmission device 1106 is a radio frequency (RF) module, used for wireless communication with the Internet.
[0191] In addition, the aforementioned electronic device also includes: a display 1108 for displaying a virtual scene in the interface; and a connection bus 1110 for connecting various module components in the aforementioned electronic device.
[0192] In other embodiments, the aforementioned terminal device or server can be a node in a distributed system, wherein the distributed system can be a blockchain system, which is a distributed system formed by connecting multiple nodes through network communication. The nodes can form a peer-to-peer network, and any form of computing device, such as a server, terminal, or other electronic device, can become a node in the blockchain system by joining this peer-to-peer network.
[0193] According to one aspect of this application, a computer program product is provided, comprising a computer program / instructions containing program code for performing the methods shown in the flowchart. In such embodiments, the computer program can be downloaded and installed from a network via a communication component, and / or installed from a removable medium. When the computer program is executed by a central processing unit, it performs various functions provided in embodiments of this application.
[0194] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0195] According to one aspect of this application, a computer-readable storage medium is provided, wherein a processor of a computer device reads computer instructions from the computer-readable storage medium, and executes the computer instructions to cause the computer device to perform the rendering method of the interface described above.
[0196] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0197] S1, Add a texture view component to the view tree associated with the target activity instance, which is configured with a set of target methods associated with the target rendering engine;
[0198] S2, based on the object creation method in the target method set, create a target rendering object that matches the texture view component. The target rendering object is used to pass scene rendering information obtained from the target rendering engine to the texture view component.
[0199] S3, if at least one reference view component is added to the view tree, display the target virtual interface according to the texture view component and at least one reference view component. The texture view component is used to display the target virtual scene in the target virtual interface according to the scene rendering information. The reference view component is used to display component elements that match the component type in the target virtual interface and obtain light elements and light distribution parameters. The light distribution parameters are used for the imaging distribution of indicator light elements in the planar area.
[0200] Optionally, in this embodiment, those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0201] If the integrated units in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in the aforementioned computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0202] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0203] In the several embodiments provided in this application, it should be understood that the disclosed client can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between units or modules, and may be electrical or other forms.
[0204] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0205] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0206] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for rendering an interface, characterized in that, include: Add a texture view component to the view tree associated with the target activity instance, wherein the target activity instance is configured with a set of target methods associated with the target rendering engine; Based on the object creation methods in the target method set, a target rendering object matching the texture view component is created, wherein the target rendering object is used to pass scene rendering information obtained from the target rendering engine to the texture view component; When at least one reference view component is added to the view tree, the target virtual interface is displayed according to the texture view component and at least one of the reference view components, wherein the texture view component is used to display the target virtual scene in the target virtual interface according to the scene rendering information, and the reference view component is used to display component elements that match the component type in the target virtual interface.
2. The method according to claim 1, characterized in that, Before adding the texture view component to the view tree associated with the target activity instance, the following is also included: In response to a UI rendering instruction, an instantiation operation is performed on a target activity class to obtain a target activity instance. The target activity class is configured with a set of target methods associated with the target rendering engine, and the target activity class is a subclass of a reference activity class, which is configured with a set of reference methods associated with the reference view component. The view tree is created according to the view tree creation method in the reference method set.
3. The method according to claim 2, characterized in that, If at least one reference view component is added to the view tree, before displaying the target virtual interface based on the texture view component and at least one of the reference view components, one of the following is also included: Add at least one of the reference view components at the first child node level under the root node of the view tree; Add a view container component at the first child node level under the root node of the view tree, and add at least one reference view component at the second child node level under the view container component; The texture view component is added to the first child node level of the view tree under the root node.
4. The method according to claim 2, characterized in that, The step of instantiating the target activity class in response to the interface rendering instruction to obtain the target activity instance includes: According to the activity creation method in the reference method set, an instantiation operation will be performed on the target activity class to obtain the target activity instance; According to the native code loading method in the target method set, a native activity instance matching the target activity instance is created in the first code layer, wherein the target activity instance is an instance created in the second code layer, and the first code layer is the base code layer of the second code layer.
5. The method according to claim 2, characterized in that, After creating a target rendering object matching the texture view component according to the object creation methods in the target method set, the method further includes: When the target rendering engine determines the updated scene rendering information based on the updated rendering instructions, the texture view component obtains the updated scene rendering information based on the target rendering object; The updated target virtual interface is displayed based on the texture view component and at least one of the reference view components.
6. The method according to claim 5, characterized in that, After creating a target rendering object matching the texture view component according to the object creation method in the target method set, it also includes at least one of the following: When the first object state of the target rendering object is updated to the second object state, state update information is sent to the target rendering engine according to the state update method in the target method set; Upon detecting a destruction instruction for the target rendering object, the object destruction information of the target rendering object is sent to the target rendering engine according to the object destruction method in the target method set; Upon detecting a redraw instruction for the target rendering object, object redraw information is sent to the target rendering engine according to the object redraw method in the target method set.
7. The method according to claim 1, characterized in that, When at least one reference view component is added to the view tree, the target virtual interface is displayed based on the texture view component and at least one of the reference view components, including at least one of the following: When at least one of the reference view components includes a player component, the target media resource element is displayed in the target virtual scene according to the player component; In the case where at least one of the reference view components includes a loop view component, target sliding list elements are displayed in the target virtual scene according to the loop view component, wherein the target sliding list includes a set of target display elements; When at least one of the reference view components includes a progress bar component, a progress bar element is displayed in the target virtual scene according to the progress bar component; In the case where at least one of the reference view components includes a window management component, a floating window element is displayed in the target virtual scene according to the window management component.
8. The method according to claim 7, characterized in that, When at least one reference view component is added to the view tree, displaying the target virtual interface based on the texture view component and at least one of the reference view components includes at least one of the following: If the time interval between two adjacent frames of scene rendering information obtained by the texture view component meets the display conditions of the first component, the progress bar component is added to the view tree. When the time interval between two adjacent frames of scene rendering information received by the texture view component meets the display conditions of the second component, the player component is added to the view tree.
9. The method according to claim 1, characterized in that, Before adding the texture view component to the view tree associated with the target activity instance, the following is also included: Create a target activity class and generate a subclass of a reference activity class, wherein the target activity class is used to determine the target activity instance, and the reference activity class is configured with a set of reference methods associated with the reference view component; Obtain a set of native methods configured for the native activity class, wherein the set of native methods is used to perform screen rendering operations under a rendering framework that matches the target rendering engine; Based on the native method set, configure the target method set associated with the target rendering engine for the target activity class.
10. The method according to claim 9, characterized in that, The step of configuring the target method set associated with the target rendering engine for the target activity class based on the native method set includes at least one of the following: Configure a native code loading method in the target method set, wherein the native code loading method is used to create a native activity instance matching the target activity instance in a first code layer, the target activity instance being an instance created in a second code layer, and the first code layer being the base code layer of the second code layer; Configure a state update method in the target method set, wherein the state update method is used to send state update information to the target rendering engine when the first object state of the target rendering object is updated to the second object state; Configure an object destruction method in the target method set, wherein the object destruction method is used to send object destruction information of the target rendering object to the target rendering engine when a destruction instruction for the target rendering object is detected; An object redrawing method is configured in the target method set, wherein the object redrawing method is used to send object redrawing information to the target rendering engine when a redrawing instruction for the target rendering object is detected; Obtain a set of underlying methods that matches the set of native methods, and add a target set of underlying methods to the target set of methods based on the set of underlying methods. The set of underlying methods and the target set of underlying methods include multiple methods applied to the first code layer.
11. A rendering apparatus for an interface, characterized in that, include: Add a unit for adding a texture view component in the view tree associated with a target activity instance, wherein the target activity instance is configured with a set of target methods associated with a target rendering engine; A creation unit is used to create a target rendering object that matches the texture view component according to the object creation method in the target method set, wherein the target rendering object is used to pass scene rendering information obtained from the target rendering engine to the texture view component; The display unit is configured to display a target virtual interface based on the texture view component and at least one reference view component when at least one reference view component has been added to the view tree. The texture view component is configured to display a target virtual scene in the target virtual interface based on the scene rendering information, and the reference view component is configured to display component elements matching the component type in the target virtual interface.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method described in any one of claims 1 to 10.
13. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method according to any one of claims 1 to 10.
14. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 10 through the computer program.