Spherical forums

User-Made => Projects => Topic started by: N E O on October 25, 2013, 07:05:09 pm

Title: Sample phoenix project
Post by: N E O on October 25, 2013, 07:05:09 pm
https://github.com/apollolux/hello-phoenix (https://github.com/apollolux/hello-phoenix)

Hello world-style project using phoenix to make a simple project. Compile with `make`, or `make platform=windows` (formerly `make platform=win`) on MinGW.

@Flying Jester - let me know if this is useful for you, thanks!
Title: Re: Sample phoenix project
Post by: Flying Jester on October 25, 2013, 09:09:06 pm
Yes, very useful.

One thing, though:

Code: [Select]

[...@... hello]$ make
g++-4.7 -x c++ -std=gnu++11 -O3 -fomit-frame-pointer -I.. -DPHOENIX_GTK `pkg-config --cflags gtk+-2.0` -o obj/phoenix.o -c ../phoenix/phoenix.cpp
/bin/sh: g++-4.7: command not found
Makefile:21: recipe for target 'obj/phoenix.o' failed
make: *** [obj/phoenix.o] Error 127
[...@... hello]$


Is there a particular reason that g++ 4.7 is used?
Title: Re: Sample phoenix project
Post by: N E O on October 26, 2013, 01:18:52 pm
byuu had set the minimum version of gcc to 4.7. He said you can safely change g++-4.7 to simply g++ if you have at least 4.7 installed.
Title: Re: Sample phoenix project
Post by: N E O on November 08, 2013, 04:27:52 pm
Update: sample code for drag-and-drop is now available!

byuu has implemented the ability to handle drag-and-drop events onto phoenix::Window and phoenix::Viewport structs. Simply call the setDroppable method of the Window or Viewport instance in question and overload the onDrop method.

Window::onDrop and Viewport::onDrop expect a nall::lstring as its parameter; lstring is the nall library shorthand for vector<string> and represents a list of selected files dropped onto the Window or Viewport. You can either loop through the list or cherry-pick one of its entries (eg, the first in the list or the last in the list) and then process it; the sample code calls the Open File function on the first file in the list and sets the status bar text to the filename.
Title: Re: Sample phoenix project
Post by: N E O on November 16, 2013, 06:40:26 pm
Update: sample code for tabs and frames/fieldsets is now available!

byuu has finally added a phoenix::TabFrame struct, allowing easy creation of a tabbed layout that switches panels when a tab is selected without having to write extra code. Create a tabbed layout in a manner similar to that found in my updated win.cpp, and you can also add icons to tabs!

I also added nthings.hpp, an expanding library of useful structs that are inherited from existing phoenix widgets or are auxiliary to unimplemented functionality:

Title: Re: Sample phoenix project
Post by: N E O on November 26, 2013, 11:57:44 pm
Update: sample code for Canvas is now available!

byuu finally added transparency support to the Canvas widget, so I resumed work on the NCanvas mini-library I was writing to abstract direct data manipulation of Canvas. NCanvas currently only has point and line (using the Wu anti-aliased line algorithm (http://forums.spheredev.org/index.php/topic,1101.0.html) I previously linked to) functions, but I will soon re-add the Bezier curve functions I used to have in my old CanvasCurve phoenix demo.

Right now phoenix doesn't support non-text widgets (like progress bars for file loading or images for status something) on window status bars; I've asked byuu for the feature previously but it's not high on his list right now. Instead, one can fake it by adding a fixed height (I've found something within 32-44px to be the sweet spot; I've forgotten offhand :P ) HorizontalLayout to the end of a window's main layout and append()ing the desired widgets to that. You won't get the native-looking gripper visual on the corner, however, if you disable the legitimate status bar.
Title: Re: Sample phoenix project
Post by: Flying Jester on November 27, 2013, 05:50:14 am
I'm going to have to look at this again now that Phoenix has tabs. That is one of the big things I demand from any serious GUI library.

...but I will soon re-add the Bezier curve functions I used to have in my old CanvasCurve phoenix demo.


Speaking of which, is your bezier curve explanation from the old site on the new wiki? I need to read that someday.


Right now phoenix doesn't support non-text widgets (like progress bars for file loading or images for status something) on window status bars; I've asked byuu for the feature previously but it's not high on his list right now. Instead, one can fake it by adding a fixed height (I've found something within 32-44px to be the sweet spot; I've forgotten offhand :P ) HorizontalLayout to the end of a window's main layout and append()ing the desired widgets to that. You won't get the native-looking gripper visual on the corner, however, if you disable the legitimate status bar.


You mean like in the task bar in Windows 7?

I tried to make a test program to play around with that recently. It was not nearly as fun to write as it looked.
Title: Re: Sample phoenix project
Post by: N E O on November 27, 2013, 07:20:33 pm

...but I will soon re-add the Bezier curve functions I used to have in my old CanvasCurve phoenix demo.


Speaking of which, is your bezier curve explanation from the old site on the new wiki? I need to read that someday.


It was a script and yes, it's back on the wiki (http://wiki.spheredev.org/Script:B%C3%A9zier_curves). :)

(edit - this page (http://pomax.github.io/bezierinfo/) also has excellent interactive Bezier curve demos and source code on GitHub)
Title: Re: Sample phoenix project
Post by: N E O on November 29, 2013, 02:07:39 am
Update: Wu line implementation is fixed, and sample code for Bezier curves is now available!

I needed to spend a little bit of time fixing the Wu line blitter and I decided to put in curve functions while I was at it. Next update will have a fake status bar implementation :)
Title: Re: Sample phoenix project
Post by: N E O on January 14, 2014, 04:02:34 pm
Update (from December): Sample code for super-basic 3D rotating cube is available!

I created a library called NTerra with the intent of adding 3D object rendering completely in software onto a phoenix Canvas widget. It's functional but it flickers A LOT and I probably need to add double-buffering to fix that. I haven't touched the repo in a month because I was working on creating/porting a JSON parser using nall and I've hit some walls. I really don't want to go character-by-character with it (especially given that nall is supposed to already have some Unicode-based string handling) but I'll probably have to.

Anyone here who follows this project, are there any phoenix-specific things you'd like to see demonstrated? It's becoming a very robust project and I'd ideally like to start the text portion of the tutorial for people to read and reference soon.