Jump to content

Many question


Recommended Posts



I'm working on my game and I wanted to know if it was possible to get an external JSON from PandaJS. Also, can we use a text object who render html tags, like Flash ? My last question is to know if a Container can be scrolled (via scrollbar for example) ?


Thanks a lot, I searched the net, the documentation & this forum but can't find any answer.


Link to comment
Share on other sites

There are various ways you can load JSON to panda. I have specific configuration file for UI which gets loaded on dev page trough script and assigns everything to variable in game as example game.customSettings. And Json file would look something like

game.settings = {someSettings: {testName: "test"},                  testValue: 0,                  arraytmp: [0, 1]}

In regards to text. I haven't found way to render html. There are some projects that will render html into canvas but generally they are performance killers.


In regards to container, I had similar issue for which I wrote my own component that handled scrolling of oversized container. That is the biggest help I could offer. I intend to write UI components plug in for pandajs but got swamped with work in the last week. Maybe during the weekend :)

Link to comment
Share on other sites

Yes but what about external JSON ?


EDIT: https://github.com/SebastianNette/PIXI.Input/

Can we use PIXI plugins into Panda.JS or we need to make our own wrapper ?

Not sure if you can use PIXI plugins with panda, but there will soon be a new version of the input class (probably optimized for v3 of pixi with less garbage, less event handler, textarea support and many other things, overall just better and faster.)

Regarding the question from your first post: That sounds like a simple bbcode parser to me. I'm using something similiar in one of my own projects. It's actually dead simple to program it. But it shouldn't be part of the standard text sprite. Because it slows down the rendering of all text sprites that don't have those tags/bbcodes/whatever in it. So I would advice you to ust write a plugin for that and extend the Text Class.

Programming scrollable containers is pretty much the same deal. Here is an example of a scrollbar for pixi: http://mokgames.com/test/ (just add a thousand rows to the table and you can see it).

Theres basically 2 ways to deal with scrollable content.

1. Use a mask and scroll the containers position as you drag the scrollbars. Note: Do some culling, you don't want sprites to be clickable that are not within the mask.

2. Don't use a mask and simply recalculate the position of sprites inside the scrollable container. In the table example which I linked above, I'm using this approach. Basically just shifting positions of elements. This is probably the best way to deal with game chats / tables / everything that has either a fixed width or fixed height.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...