libnui / nui3 Goto Github PK
View Code? Open in Web Editor NEWThis project forked from matthieu-campion/nui3
libnui v3
Home Page: http://libnui.net
License: Mozilla Public License 2.0
This project forked from matthieu-campion/nui3
libnui v3
Home Page: http://libnui.net
License: Mozilla Public License 2.0
The pixel values look random when alpha = 0
nuiTopLevel breaks when a nuiLabelRenamer adds itself as a child (modal). Click the value in the json tutorial to repro.
Lets fix the font acquire/release issue
I don't know if its advised to change a texture on a nuiImage, but to stop leaks...
void nuiImage::SetTexture(nuiTexture* pTex)
{
if (mpTexture)
mpTexture->Release();
mpTexture = pTex;
mUseAlpha = true;
//SetFixedAspectRatio(true);
mBlendFunc = nuiBlendTransp;
SetProperty(_T("Source"), _T("Memory Buffer"));
ResetTextureRect();
Invalidate();
}
The dependency on QTKit fails.
This prevents building of nui3 on macOS 10.13 with Xcode 9.4.1
Cancel() in nuiEvent sets mCancel = false;
However to actually stop propogating events this should be true.
bool nuiEventSource::SendEvent(const nuiEvent& rEvent)
{
if (IsEnabled() && !mpTargets.empty())
{
rEvent.SetSource(this);
std::vector<nuiEventTargetBase*> targets(mpTargets);
std::vector<nuiEventTargetBase*>::const_iterator it = targets.begin();
std::vector<nuiEventTargetBase*>::const_iterator end = targets.end();
bool handled = false;
while (it != end && !handled)
{
((*it)->OnEvent(rEvent));
handled = rEvent.IsCanceled(); // returns FALSE when actually cancelled
++it;
}
return handled;
}
return false;
}
When copying a file via nglPath::Copy
, nglIStream::PipeTo
is used:
while (( istate == eStreamReady || istate == eStreamWait ) && ( ostate == eStreamEnd || ostate == eStreamWait ))
{
piped_in = Read( buffer, PIPE_BUF_SIZE, 1 );
istate = this->GetState();
while ( piped_in > 0 && ( ostate == eStreamEnd || ostate == eStreamWait ) )
{
piped_out = rTarget.Write( buffer, piped_in, 1 );
ostate = rTarget.GetState();
piped_in -= piped_out;
total_piped += piped_out;
}
}
Let's see nglFile::Write
:
done = ngl_fwrite(pData, 1, (size_t)(WordCount * WordSize), mFD);
// [stripped]
if (WordSize == 1)
return done;
// [stripped]
done /= WordSize;
return done;
}
There, ngl_fwrite()
call can return 0 or -1. If -1 is returned, done /= WordSize
will result in done
being 0.
Maybe all Write()
wrappers should threat -1 as an error.
Going back into PipeTo
, 0 can be returned from the above Write
call:
piped_in -= piped_out;
total_piped += piped_out;
piped_in
is never decreased, resulting in an infinite loop.
There is an issue with nglPath::Canonize, I'm currently investigating the issue.
This code will crash (nglString::Delete):
nglPath p(_T("../../a.txt"));
NGL_OUT(_T("p BEFORE: %s\n"), p.GetChars());
p.Canonize();
NGL_OUT(_T("p AFTER: %s\n"), p.GetChars());
When the UIApplication receive an Accelerometer event (UIMotionEvent), the event handling in nglUIWindow asserts as it expects a touch/gesture event. Test device: iPod Touch 4G / latest NUI / Fw revision 4.1.
Backtrace:
#0 0x30e66ac8 in __kill () #1 0x30e66abe in kill () #2 0x30e66ab0 in raise () #3 0x30e7b040 in abort () #4 0x30e69142 in __assert_rtn () #5 0x0087c490 in -[nglUIWindow handleEvent:] (self=0x1d5f9a0, _cmd=0x32783c6e, pEvent=0x1d494c0) at nui3/src/Window/UIKit/nglWindow_UIKit.mm:447 #6 0x0087d3f0 in -[nglUIWindow sendEvent:] (self=0x1d5f9a0, _cmd=0x32783c49, pEvent=0x1d494c0) at nui3/src/Window/UIKit/nglWindow_UIKit.mm:365 #7 0x316099fe in -[UIApplication sendEvent:] () #8 0x00875c0c in -[nglUIApplication sendEvent:] (self=0x1d48e90, _cmd=0x32783c49, pEvent=0x1d494c0) at nui3/src/Application/UIKit/nglApplication_UIKit.mm:40 #9 0x316b9450 in -[UIApplication _sendMotionBegan:] () #10 0x3174f4e6 in -[UIMotionEvent accelerometer:didAccelerateWithTimeStamp:x:y:z:eventType:] () #11 0x354ed6c0 in _SBXXDeliverAccelerometerEvent () #12 0x354ed7d0 in _XDeliverAccelerometerEvent () #13 0x354b7062 in migHelperRecievePortCallout () #14 0x349bace2 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ () #15 0x349baca6 in __CFRunLoopDoSource1 () #16 0x349ad56c in __CFRunLoopRun () #17 0x349ad276 in CFRunLoopRunSpecific () #18 0x349ad17e in CFRunLoopRunInMode () #19 0x311dc5f2 in GSEventRunModal () #20 0x311dc69e in GSEventRun () #21 0x315b0122 in -[UIApplication _run] () #22 0x315ae12e in UIApplicationMain () #23 0x00874990 in nglApplication::Main (this=0x1d3dc00, argc=1, argv=0x2ffff56c) at nui3/src/Application/UIKit/nglApplication_UIKit.mm:215
Display is corrupted on the new iPad - probably something is using the wrong screen size somewhere.
I just tried to compile the latest github version of nui on ubuntu linux 11.04 64 bits. Compiling runs fine, but linker gives the following error:
CMakeFiles/nui3.dir/src/Attributes/nuiAttribute.o: In function nuiGetNewAttributeUniqueId()': /home/phwhitfield/programming/cppLibs/nui3/include/nuiSignalsSlots.h:160: multiple definition of
nuiAttributeTypeTrait::mTypeId'
CMakeFiles/nui3.dir/src/Bindings/nuiBindings.o:/home/phwhitfield/programming/cppLibs/nui3/src/Bindings/nuiBindings.cpp:62: first defined here
collect2: ld returned 1 exit status
make[2]: *** [libnui3.so] Error 1
make[1]: *** [CMakeFiles/nui3.dir/all] Error 2
make: *** [all] Error 2
the following is the command used to:
cmake .
make -j8
Hello,
If you try rotating the device while you have a touch on the screen, the application will terminate with EXC_BAD_ACCESS. Tested on a iPod Touch 4G (Retina).
Log:
2010-10-19 17:24:48.703 MyApp[2679:307] new window angle: 0.000000 (old 0.000000) 2010-10-19 17:24:48.711 MyApp[2679:307] new window size: 480, 320 2010-10-19 17:24:48.715 MyApp[2679:307] new EAGLView (0.000000,0.000000 320.000000x480.000000) 2010-10-19 17:24:48.717 MyApp[2679:307] Scale: 1.000000 2010-10-19 17:24:48.748 MyApp[2679:307] Resize frame buffer: 640 x 960 nglWindow::SetSize(480, 320) Program received signal: “EXC_BAD_ACCESS”.
Backtrace:
(gdb) bt #0 0x303ae7d8 in objc_msgSend () #1 0x34990984 in CFRelease () #2 0x3498fe9a in _CFAutoreleasePoolPop () #3 0x3107e3c0 in NSPopAutoreleasePool () #4 0x33811a68 in CAPopAutoreleasePool () #5 0x338767c0 in CA::Display::DisplayLink::dispatch () #6 0x33876826 in CA::Display::IOMFBDisplayLink::callback () #7 0x3392fbfa in IOMobileFramebufferVsyncNotifyFunc () #8 0x30c60046 in ?? () #9 0x349c3312 in __CFMachPortPerform () #10 0x349bace2 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ () #11 0x349baca6 in __CFRunLoopDoSource1 () #12 0x349ad56c in __CFRunLoopRun () #13 0x349ad276 in CFRunLoopRunSpecific () #14 0x349ad17e in CFRunLoopRunInMode () #15 0x311dc5f2 in GSEventRunModal () #16 0x311dc69e in GSEventRun () #17 0x315b0122 in -[UIApplication _run] () #18 0x315ae12e in UIApplicationMain () #19 0x00880ed0 in nglApplication::Main (this=0x1d3d700, argc=1, argv=0x2ffff56c) at /Users/b0nk/code/myapp/nui3/src/Application/UIKit/nglApplication_UIKit.mm:211 #20 0x001bb9cc in main (argc=1, argv=0x2ffff56c) at /Users/b0nk/code/myapp/proj/../src/ui/MyApp.cpp:28
Bug exiting iApp using the Home button (OS 4.1):
#0 0x003eb92c in nuiStateDecoration::~nuiStateDecoration at nuiStateDecoration.cpp:72
#1 0x003eb898 in virtual thunk to nuiStateDecoration::~nuiStateDecoration() at nuiStateDecoration.cpp:627
#2 0x00496658 in nuiRefCount::Release at nuiRefCount.h:46
#3 0x003d2d5c in nuiDecoration::ExitDecorationEngine at nuiDecoration.cpp:405
#4 0x002ffbd0 in nuiUninit at nuiInit.cpp:168
#5 0x0012741c in MyApp::OnExit at nuiVariant.h:343
pDecoration->Release();
Does not happen everytime
Let's say i've got a widget with a nuiMatrixNode_Scale matrix, and i've set this to be 0.5,0.5,1 scaling
GetIdealRect returns {240,720,160,480} (the widget is in a nuiFixed container)
Then LocalToGlobal on this rect then shows me 120,360,80,240 (it scaled properly, however the x origin is wrong). It should all be shifted to 240. Is it because i'm using userPos? If I happen to have a pivot matrix with an origin set then these numbers go haywire.
Ultimately I need...given a widget with a bunch of matrixes assigned to it, a way to get the Bounding Rect in "real" dimensions (even if its rotated). Looks like its all the localToGlobal functions that only use the matrix transforms, but its not quite working for me
This appears to work(kind of, if I want content bounds i'll need to adjust my left and right positions to userpos)
nuiRect localRect=proxy->GetIdealRect();
if (!proxy->IsMatrixIdentity())
{
nuiMatrix matrix=proxy->GetMatrix();
nuiVector vec1(localRect.mLeft,localRect.mTop,0);
nuiVector vec2(localRect.mRight,localRect.mBottom,0);
vec1 = matrix * vec1;
vec2 = matrix * vec2;
localRect.mLeft = vec1[0];
localRect.mTop = vec1[1];
localRect.mRight = vec2[0];
localRect.mBottom = vec2[1];
}
return abs(localRect.GetWidth());
Generally speaking I find all the rects terrible confusing!
When putting a NUI application in background (iOS 4+ with multitasking), sometimes an event still finds its way through the engine and process is killed due to GLES rendering while in background.
Thread 0 Crashed: 0 libSystem.B.dylib 0x00078ac8 __kill + 8 1 libSystem.B.dylib 0x00078ab8 kill + 4 2 libSystem.B.dylib 0x00078aaa raise + 10 3 libSystem.B.dylib 0x0008d03a abort + 50 4 IMGSGX535GLDriver 0x00001874 glrReturnNotPermittedKillClient + 20 5 IMGSGX535GLDriver 0x00005360 SubmitPacketsIfAny + 256 6 IMGSGX535GLDriver 0x0000540c gldFlush + 4 7 GLEngine 0x000e6608 gliPresentViewES + 184 8 OpenGLES 0x00003754 -[EAGLContext presentRenderbuffer:] + 36 9 BeatMaker 2D OPT 0x0049f730 -[EAGLView EndSession] (nglWindow_UIKit.mm:929) 10 BeatMaker 2D OPT 0x0049ea0c -[nglUIWindow EndSession] (nglWindow_UIKit.mm:721) 11 BeatMaker 2D OPT 0x0049e868 nglWindow::EndSession() (nglWindow_UIKit.mm:1176) 12 BeatMaker 2D OPT 0x0031c9fc nuiMainWindow::Paint() (nuiMainWindow.cpp:399) 13 BeatMaker 2D OPT 0x002a6510 nuiEventTargetBase::CallEvent(void*, nuiDelegateMemento, nuiEvent const&) (nuiFastDelegate.h:649) 14 BeatMaker 2D OPT 0x002a7154 nuiEventTargetBase::OnEvent(nuiEvent const&) (nuiEvent.cpp:265) 15 BeatMaker 2D OPT 0x002a72a0 nuiEventSource::SendEvent(nuiEvent const&) (nuiEvent.cpp:140) 16 BeatMaker 2D OPT 0x002a64b8 nuiEventSource::operator()(nuiEvent const&) (nuiEvent.cpp:153) 17 BeatMaker 2D OPT 0x0049f5f4 -[nglUIWindow Paint] (nglWindow_UIKit.mm:457) 18 QuartzCore 0x000926fc CA::Display::DisplayLink::dispatch(unsigned long long, unsigned long long) + 144 19 QuartzCore 0x00092820 CA::Display::IOMFBDisplayLink::callback(__IOMobileFramebuffer*, unsigned long long, unsigned long long, unsigned long long, void*) + 44 20 IOMobileFramebuffer 0x00001bf4 IOMobileFramebufferVsyncNotifyFunc + 68 21 ??? 0x30c60040 0 + 818282560 22 CoreFoundation 0x0003d30c __CFMachPortPerform + 204 23 CoreFoundation 0x00034cdc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 20 24 CoreFoundation 0x00034ca0 __CFRunLoopDoSource1 + 160 25 CoreFoundation 0x00027566 __CFRunLoopRun + 514 26 CoreFoundation 0x00027270 CFRunLoopRunSpecific + 224 27 CoreFoundation 0x00027178 CFRunLoopRunInMode + 52 28 GraphicsServices 0x000045ec GSEventRunModal + 108 29 GraphicsServices 0x00004698 GSEventRun + 56 30 UIKit 0x0000411c -[UIApplication _run] + 396 31 UIKit 0x00002128 UIApplicationMain + 664 32 BeatMaker 2D OPT 0x0049cf0c nglApplication::Main(int, char**) (nglApplication_UIKit.mm:214) 33 BeatMaker 2D OPT 0x0011d000 main (BeatMaker.cpp:29) 34 BeatMaker 2D OPT 0x00069020 start + 32
https://gist.github.com/f4f0de94616f5ccc1f57
Test device: iPod Touch 4G
Test OS: iOS 4.1
error: 'wcscasecmp not declared'
no problem on 10.6
First I found the homepage which made it a bit unclear about what it really is.
In the repo, a README was missing in the root directory. The only real README I found was after some searching in some subdirectory here. That one made it a bit more clear what it is (as far as I understand): a cross-platform C++ GUI framework based on OpenGL. (Is that right? Still not 100% sure.)
Also not sure about the current state. Is it ready to use? What platforms does it support? (Looks like MacOSX, Windows and Linux from some of the source files.)
Also, how does it look like? Screenshots should definitely be added.
All that should probably go into README.md
in the root directory, including the screenshots.
All strokes (such as on a Border decoration or anything done with DrawRect) show up as 1 pixel and black on the iPad 3 even though it works on the iPad 1 & 2
I opened nui3_2010.sln, but vcxproj couldn't be loaded because it does not exist.
nglPath::Move won't work if destination path is within a volume.
associate interger ids to attribute names so that searching them takes much less time (map<nglString, int32> + vector)
On iOS, while inputting text from the system keyboard, some characters will make nglString::Import run into an infinite loop, while converting characters (UTF8 I guess).
The bug can be triggered by following these steps:
nglString::Import(int32&, const char*, int32, nglStringConv&) will loop forever in the do/while statement.
(to_read = 2, to_write = 2, rOffset = 0)
Tested on iPad - iOS 5.0 and 5.1
It should exit the app in a clean way
widget->Autodraw seems to be consuming massive amounts of CPU on my iPad 2. If I run instead with a timer running at a lower framerate, CPU usage is better, but still higher than I think it should be.
void nuiSpriteAnimation::SetDuration(float seconds)
{
mFPS = seconds / (float)GetFrameCount();
}
should be(I think, unless my brain is acting up!)
void nuiSpriteAnimation::SetDuration(float seconds)
{
mFPS = (float)GetFrameCount() / seconds;
}
Would it be possible(or desirable!) to have a xStart and yStart property that is set to x,y when UITouchPhaseBegan starts up as well as a nglTime of the Began phase?
That way on Unclicked we can easily see whether it's a swipe or not. (amount of movement relative to the start of the touch and the timeinterval)
Just a thought, i'm relatively new to iphone, but I think this should be all that's required...
nuiSimpleContainer::~nuiSimpleContainer()
{
CheckValid();
// Delete all children:
IteratorPtr pIt;
for (pIt = GetFirstChild(false); pIt && pIt->IsValid(); GetNextChild(pIt))
{
nuiWidgetPtr pItem = pIt->GetWidget();
if (pItem)
{
pItem->SetParent(NULL); // If the refcount isn't 1 there's a danger of a dangling pointer to parent
pItem->Release();
}
}
delete pIt;
}
just to help out some cleaning up, in
~nuiwidget
for (int i=GetMatrixNodeCount();--i>=0;)
DelMatrixNode(i);
Otherwise the array is cleared without deleting the matrix nodes
SHOW and HIDE anim sometimes break their children redraw
Seen the song editor in bm2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.