Code Monkey home page Code Monkey logo

pxcore2's Introduction

pxscene

Download the pxscene binary from www.pxscene.org

To build pxscene yourself, see https://github.com/pxscene/pxCore/blob/master/examples/pxScene2d/README.md

To debug pxscene JavaScript applications with VSCode, see the instructions here: https://github.com/pxscene/pxCore/blob/master/examples/pxScene2d/VSCODE_DEBUG.md

To debug pxscene JavaScript applications with IntelliJ, see the instructions here: https://github.com/pxscene/pxCore/blob/master/examples/pxScene2d/INTELLIJ_DEBUG.md

See available samples at https://github.com/pxscene/pxscene/tree/gh-pages/examples/px-reference

pxcore2's People

Contributors

aj-amitjain avatar andrewbenton avatar arun-govindan avatar ashwinikalokhe avatar binuinbaraj avatar cjalmeida avatar comcastmike avatar conniefry avatar dwrobel avatar emutavchi avatar fitzerirl avatar gavriliuk avatar gladish avatar jeffwannamaker avatar jmgasper avatar johnrobinsn avatar kannanmadanagopalt avatar madanagopalt avatar madanagopaltcomcast avatar madanagopalthirumalai avatar madanwork avatar mateusz-hobgarski-red avatar mfiess avatar npoltorapavlo avatar ptrekels avatar sergiygladkyy avatar ssureshmsc avatar tjcarroll2 avatar vertexodessa avatar vivekarumugam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pxcore2's Issues

Stretch options do not work with constructor only

If I supply all needed args in createImage, FILL or STRETCH options do not work.

var imgurl = process.cwd() + "/../../images/banana.png";
var image = scene.createImage({url:imgurl, parent:root, xStretch:2, yStretch:2, w:800, h:400,});

But if I supply w and h after construction, FILL and STRETCH work fine.

var imgurl = process.cwd() + "/../../images/banana.png";
var image = scene.createImage({url:imgurl, parent:root, xStretch:2, yStretch:2});
image.w = scene.w;
image.h = scene.h;

I should be able to pass all arguments to constructor without the need to supply additional setters later.

Would be cool to be able to override the window style

At the moment the window is created using a fixed set of window styles.

I've modified my copy to call a getWindowStyle() function, which defaults to 
returning the default 
(WS_OVERLAPPEDWINDOW), but the user can then override with something else if 
they want.

p.s. very nice library, btw! :-)


Original issue reported on code.google.com by [email protected] on 20 Sep 2008 at 10:48

Get rid of animateTo method with function callback

we only want to support the animateTo variant that returns a promise. that variant should be renamed from animateToP back to just animateTo... there will be a number of samples that need to be fixed up...

create non-virtual for cleaning up (static code analyzer)

This can be fixed by creating a non-virtual

rtError destroyTexture() { ... }

then have the delete call the non-virtual

virtual rtError deleteTexture() { return destroyTexture(); }

then replace constructor/destructor calls with non-virtual to void invoking a virtual in a destructor.

pxContextGL.cpp:110:21: warning: Call Path : deleteTexture
Call virtual functions during construction or destruction will never go to a more derived class
~pxFBOTexture() { deleteTexture(); }
^~~~~~~~~~~~~
pxContextGL.cpp:251:27: warning: Call Path : deleteTexture
Call virtual functions during construction or destruction will never go to a more derived class
~pxTextureOffscreen() { deleteTexture(); };
^~~~~~~~~~~~~
pxContextGL.cpp:379:5: warning: Call Path : deleteTexture
Call virtual functions during construction or destruction will never go to a more derived class
deleteTexture();

rtRemote: Event callback unregistration with rtRemote

Hi Jacob,

Today, when we try to add and remove event listeners with rtRemote, event unregistrations are not happening. Attached is the client,server code, which is being tried.

For every event registered, event name and function address are stored as rtEmit entry in server side. For add/delete request, we are passing two parameters name and rtFunctionRef from client side. When the parameters are parsed in server side, a new rtRemoteFunction object is created in heap for rtFunctionRef parameter. These two generated rtFunctionRef addresses are compared during event deletion, which is failing (as they are two different heap addresses).

rtError
rtValueReader::read(rtValue& to, rapidjson::Value const& from, std::shared_ptr const& client)
{
..............
case RT_functionType:
to.setFunction(new rtRemoteFunction(objectId, functionId, client)); //This is created two times during event addition and deletion. Somehow, this needs to get the old rtRemotefunction address got during event addition and use it for comparision in rtEmit entry during unregistration.

Are we missing anything?. Please provide your suggestions.

Thanks.

Regards,
Madan

Current lock-free refcounting implementation in rtNodeContext should be improved

The following flow might occur,

(Thread 1, rtNodeContext::Release) long l = rtAtomicDec(&mRefCount); // l == 0, about to delete
(context switch, Thread 2 is taking CPU)
(Thread 2) rtNodeContext::AddRef() // Thread 2 unconditionally increases reference counter
(context switch, Thread 1 is taking CPU)
(Thread 1, rtNodeContext::Release) if (l == 0) delete this; // the object is deleted
(Thread 2) crash: the thread 2 assumes the object is still alive.

create a service manager interface

We will need to provide a way to be able to access service manager services on the local device. It would be good to define a Service Proxy object.

Add an onFocus event to pxObject

The onFocus should contain a boolean flag that indicates that focus was gained or lost. Only one object within a given scene can have focus at any given time. when focus changes and onFocus(lost) must be sent to the object that is losing focus... and onFocus(gained) must be sent to the object gaining focus...

Animating textColor produces unexpected results

Tried to animate white text to red:

var text = scene.createText({text:"Hello World.", textColor:0xFFFFFFFF, 
    pixelSize:20, parent:root, x:50, y:50 });
text.animateTo({textColor:0xFF0000FF}, 3, 5, 1);

Text seems to flicker in blues and greens, but certainly not red. Would expect some type of smooth transition from white to pinkish to red.

Add a json config file...

should be mostly javascript to load the file, load the json... then add a way to pass the properties into the scene constructor... to propogate the configuration into the scene(s)...

rtRpcInit() fails to initialize a rtRpcServer object if called more than once

When rtRpcInit() is called a second time (after a rtRpcShutdown() call), gServer is not being initialized and the following rtRpcRegisterObject() fails due to gServer being NULL.

Here is the relevant code in rtRpc.cpp:

  std::call_once(gServerOnce, [&e]()
  {
    gServer = new rtRpcServer();
    e = gServer->open();
    if (e != RT_OK)
    {
      rtLogError("failed to open rtRpcServer. %s", rtStrError(e));
    }
  });

Looking at the code this seems to be by design since std::call_once is being used but I don't know how we can then use rtRPC calls in a situation where we need to shutdown and initialize the RPC module more than once.

Can we just do the following instead ?

  if(gServer == nullptr)
  {
    gServer = new rtRpcServer();
    e = gServer->open();
    if (e != RT_OK)
    {
      rtLogError("failed to open rtRpcServer. %s", rtStrError(e));
    }
  }

rtRemote: need abstraction for endpoints

In order to cleanly support communication over various transports, we need to abstract what it is that we use for an endpoint. Right now, the code uses sockaddr_storage to support ipv4/v6, but for non IP transports, other endpoint types will be needed. WebPA, Shared Memory, etc.

We should have factory function to create rtRemoteEndpoint. We can specific string as type switcher. i.e.

std::string s = "tcp://192.168.1.1:1234";
rtRemoteEndpoint* e = rtRemoteEndpointCreate(env, s);

We'll also want a public API where users can register new endpoint implementations.

std::string scheme = "webpa";
rtRemoteEndpointRegister(scheme, my_factory_function);

then later
rtRemoteEndpoint* e = rtRemoteEndpointCreate(env, 'webpa://192.168.101.');

Allow return values via synchronous method invocation

The rtFunctionWrapper currently doesn't allow native code to invoke a JS function and wait for a return value. We should modify the Send(...) so that when the caller supplies a non-null value for the *result pointer, the interop code will wait for the JS function to complete and supply the result to the caller.

rvValue support for unsigned long

The px API uses unsigned long types in some places which means the rtValue will need to support it. We should either add support for unsigned long to rvValue or not use unsigned long. I would be in favor using sized types only (int32_t, int64_t, etc) throughout the px/rt and other APIs to ensure portability and avoid any type conversion problems.

Add ready promise property to all pxObjects

all pxObjects should have the concept of readiness... some objects will be immediately ready.. .but any that have dependencies should defer readiness until all resources required to render and size are available.

In addition, canonicalize error state details...

rtWrapper assertion from time time time...

node: ../rtWrapperUtils.cpp:21: void weakCallback_rt2v8(const v8::WeakCallbackData<v8::Object, rtIObject>&): Assertion `p->IsWeak()' failed.
Aborted (core dumped)

I see this intermittently...

and 100% of the time when I reload the current scene with

When the mask url is reset( when set to null and again set with the previous url), the mask is not set.

If set to use a new URL, the mask is set correctly. But if using an URL that was previously used, the mask is not set.

Example:
var root = scene.root;
var view = scene.create({t:"object", parent:root, w:500, h:500});
var url = process.cwd() + "/../../images/postermask.png";
var urlTest = process.cwd() + "/../../images/ball.png";
var bgShade = scene.createImage({url:urlTest, xStretch:1, yStretch:1, parent:view});
view.mask = url;
setTimeout(function(){
console.log("setTimeout >>> Set mask to null ");
view.mask = null;
},5000);
setTimeout(function(){
console.log("setTimeout >>> Set mask to " + url);
view.mask = url;
},10000);

pxUtil png code leaks memory

png_create_read_struct is called but png_destroy_read_struct is never called. same with png_create_write_struct.

I also think we need to clean up the setjmp/longjmp error handling. There are many branches that can fail silently.

rtRpcShutdown() should terminate threads properly.

Currently when exiting from an app which uses rtRPC objects, I see "terminate called without an exception" error and the app aborts.

This is mainly due to the threads created in rtRpcResolver, rtRpcServer and rtRpcStream not having a proper exit mechanism.

text.h is incorrect with newline character

var text1 = scene.create({t:"text", textColor:0xFF0000FF, pixelSize:20, parent:root, x:50, y:50, text:"just a single line of text" });
console.log("text1.h: ", text1.h);
var text2 = scene.create({t:"text", textColor:0xFF0000FF, pixelSize:20, parent:root, x:50, y:100, text:"text\n spread\n out\n over\n multiple\n lines" });
console.log("text2.h: ", text2.h);

Output:
text1.h: 34
text2.h: 10914

text2.h should be closer to 204

don't copy window list for each frame

On each frame, the pxWindowNative::getNativeWindows() method is called creating an copy of a std::vector. This can/should be avoided

static vector<pxWindowNative*> getNativeWindows(){return mWindowVector;}

The mWindowVector can be made static in the .cpp module and accessed directly instead of being copied on each frame.

Make spin timeouts configurable with rtRemoteConfig

In rtRemoteMulticastResolver::sendSearchAndWait two spin timeouts are hardcoded:

  • starting spin timeout (currently hardcoded to 30ms)
  • spin iteration increase time (currently hardcoded to 20 ms)

It would be nice to make them configurable.

possible null reads (static code analyzer)

pxScene2d.cpp:662:21: warning: Called C++ object pointer is null
fileDownloadRequest->getFileURL().cString(),

./pxTexture.h:23:74: warning: Use of memory after it is freed
virtual unsigned long Release() { if (--mRef == 0) delete this; return mRef; }

pxScene2d.cpp:715:21: warning: Called C++ object pointer is null
maskDownloadRequest->getFileURL().cString(),

Few minor issues

Revision 1bc7069 (to make sure all the lines are correct)

Incorrect variable assignment:

  ret = inet_pton(ss.ss_family, host, addr);
  if (ret != 1)
  {
    int err = errno;
    rtLogError("failed to parse: %s as valid ipv4 address", host);
    error = rtErrorFromErrno(err);
  }
  error = RT_OK;

"error" is used incorrectly. it will always be equal to RT_OK.
rtRemoteSocketUtils.cpp: 196, 198


Incorrect/strict float comparison:
pxScene2d.cpp: lines 506, 513, 532, 543, 932, 975, 984
pxContextGL.cpp: lines 1072, 1074, 1625, 1642
pxFont.cpp: 310
pxText.cpp: 123, 157
pxTextBox.cpp: 272, 463, 479, 743, 770, 840, 856, 872, 875, 896, 902, 1027
pxImage.cpp: 136, 146
pxImage9.cpp: 88, 89
pxInterpolators.cpp: 18, 21, 64, 169
rtValue.cpp: 53, 54, 280, 281


pxMatrix4T class implements copy ctor but not "operator ="

Can't pass arrays from javascript into pxScene...

To reproduce...

./load.sh dom.js in branch _temp_pxcore2_stage

results in

nodejs: ../rtWrapperUtils.cpp:97: rtValue js2rt(v8::Isolate_, const v8::Handlev8::Value&, rtWrapperError_): Assertion `false' failed.
Aborted (core dumped)

trying to pass a javascript object literal with an embedded array in it into pxScene2d

scene.create({t:"text", parent:root, c:[
{t:"image"},
{t:"image"},
{t:"image"},
]});

Downloadable font support

Be able to specify a font face URL within the text object have it download and be useable and use the ready promise property to indicate readiness...

While pxCore is compiled, enviironment CXXFLAGS are not considered

Eugene recently noticed that pxCore ignores environment compilation flags.
Here is a quote from the makefile:

CXXFLAGS=-Wall -Wextra -g $(SEARCH) -DRT_PLATFORM_LINUX -D$(PX_PLATFORM) -DENABLE_RT_NODE

CXXFLAGS2=-fPIC -Wall -Wextra -g $(SEARCH) -DRT_PLATFORM_LINUX -D$(PX_PLATFORM) -DENABLE_RT_NODE -DRUNINMAIN

ifdef PXVERSION
CXXFLAGS=$(CXXFLAGS2) -DPX_SCENE_VERSION=$(PXVERSION)
else
CXXFLAGS=$(CXXFLAGS2)
endif

CXXFLAGS variable is being overwritten by predefined value and system variable is not used.

opened file is leaked (static code analyzer)

There are a couple returns that leave the file open.

pxUtil.cpp:86:7: warning: Opened file is never closed; potential resource leak
rtLogError("FATAL: png_create_write_struct() - FAILED");

OS X native windowing control not working

When running a .js example with a build on/for mac os, the resulting pop window cannot be resized, closed or other wise controlled (e.g. the only way to exit the pxCore pop up window is to hit ctrl-c in the source terminal.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.