NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 28 29 30 31 32 … 93 Next »
GetRenderList()

 
  • 0 Vote(s) - 0 Average
GetRenderList()
herrmannj
Offline

Member

Posts: 150
Threads: 22
Joined: May 2005
#1
2008-10-12, 10:46 PM
what exactly is the result (is in the array) of GetRenderList ?
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,626
Threads: 767
Joined: Nov 2003
#2
2008-10-12, 10:53 PM
GetRenderList() returns a list containing GBPVRUiElement objects. These objects are effectively a bitmap, and some information about where that bitmap needs to be displayed on the background.

Most plugins dont end up dealing with the GBPVRUiElements directly though, instead using higher level objects like UiList/UiButton/UiStatic etc, which end up adding GBPVRUiElement objects to the list on behalf of the plugin.
herrmannj
Offline

Member

Posts: 150
Threads: 22
Joined: May 2005
#3
2008-10-13, 10:52 AM
ok - just to ckeck if I understand it right.

if I want to have a custom control I will have to extend, say, the AWizUicontrol class. I will attach one or more GBPVRUiElements in the ctor and from within GetRenderList I have to return this Elements. Right ?

I didnt found the definition of the both constructors (maybe I havnt searched enough). Is there a palce for looking at ?

Do I have to deal with propertys other than image and oneOFFRect ?

Joerg
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,626
Threads: 767
Joined: Nov 2003
#4
2008-10-13, 03:31 PM
I dont know anything about the Wiz controls, but here is an example UiStatic control. This control represent some composite image defined in the skin, containing images/text, which might need updating from time to time. The hash logic here is to ensure its only redrawn when absolutely necessary.

Code:
using System;
using System.Drawing;
using System.Collections;
using System.Text;
using System.Windows.Forms;
using System.Xml;

using GBPVR.Public;
using GBPVR.Backend.Common;


namespace GBPVRX2.UiSupport
{

    public class UiStatic
    {
        private GBPVRUiElement staticUiElement;
        private SkinHelper2 skinHelper;
        private string compositeImageName;
        private string hash = "";        

        public UiStatic(SkinHelper2 skinHelper, string compositeImageName, Hashtable args)
        {
            this.skinHelper = skinHelper;
            this.compositeImageName = compositeImageName;

            // create UiElement            
            staticUiElement = new GBPVRUiElement("static (" + compositeImageName + ")", skinHelper.getPlacementRect(compositeImageName), skinHelper.getNamedImage(compositeImageName, args));

            // calculate hash of parameters
            hash = GetHashString(args);
        }

        public bool needsRendering()
        {
            if (staticUiElement.forceRefresh)
                return true;

            return false;
        }

        private string GetHashString(Hashtable args)
        {
            string hash = "";
            foreach (string key in args.Keys)
            {
                hash += key + ":" + args[key] + "~";
            }
            return hash;
        }

        public void SetArgs(Hashtable args)
        {
            string tempHash = GetHashString(args);
            if (tempHash != hash)
            {
                // draw image
                Graphics.FromImage(staticUiElement.image).Clear(Color.Transparent);
                skinHelper.getNamedImage(staticUiElement.image, compositeImageName, args);

                // force texture to be updated
                staticUiElement.forceRefresh = true;
                
                // update hash
                hash = tempHash;
            }
        }

        public ArrayList GetRenderList()
        {
            ArrayList renderList = new ArrayList();
            renderList.Add(staticUiElement);
            return renderList;
        }

        public void Dispose()
        {
            if (staticUiElement.textureHandle > 0)
            {
                ArrayList disposeList = new ArrayList();
                disposeList.Add(staticUiElement);
                PluginHelperFactory.getPluginHelper().DisposeResources(disposeList);
            }
        }
    }
}
JavaWiz
Offline

Posting Freak

Jacksonville, FL. USA
Posts: 2,522
Threads: 141
Joined: Dec 2006
#5
2008-10-13, 08:59 PM
Attached is the code for WizUiLabel. It shows how to create a control derived from AWizUiControl (including the GetRenderList method).

Note, you don't have to use WizUiControls to write plugins though. Sub provides his controls as part of the base for PVRX2. I created the WizControls to implement some functionality that I was looking for which sub's control didn't have. Note that sub's controls also have some functionality that the WizControls do not have (at the moment) ie List mode views.
herrmannj
Offline

Member

Posts: 150
Threads: 22
Joined: May 2005
#6
2008-10-14, 08:05 PM
thank you both for providing this good and clear examples.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  GetRenderList() always called with "block-extras..." element in renderlist alibert 1 1,593 2012-06-18, 10:24 AM
Last Post: sub
  Creating a jpg from GetRenderList ACTCMS 8 3,070 2008-09-14, 01:21 AM
Last Post: ACTCMS
  Retrieving Images from GetRenderList psycik 11 3,687 2008-08-10, 08:33 PM
Last Post: mvallevand
  needsRendering() and GetRenderList() JavaWiz 3 1,823 2008-05-22, 03:25 AM
Last Post: sub

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode