Skip to main content

News

Topic: Sample phoenix project (Read 3420 times) previous topic - next topic

  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Sample phoenix project
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!
  • Last Edit: November 16, 2013, 08:44:48 pm by N E O

Re: Sample phoenix project
Reply #1
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?

  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Re: Sample phoenix project
Reply #2
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.

  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Re: Sample phoenix project
Reply #3
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.

  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Re: Sample phoenix project
Reply #4
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:


  • Spritesheet - an image is loaded and it can be sliced at will. This allows you to distribute with fewer image files and the overhead of assigning the images from slices versus loading the individual images directly is small.

  • FileEntry - a horizontally laid out file entry widget. Useful if you simply want to use a file browser to get a file name for later processing (eg, passing to a system-called app as a parameter) and is used at least six times in the app from which the original source is modified, RetroArch-Phoenix.

  • Last Edit: November 16, 2013, 10:07:20 pm by N E O

  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Re: Sample phoenix project
Reply #5
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 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.

Re: Sample phoenix project
Reply #6
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.

  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Re: Sample phoenix project
Reply #7

...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. :)

(edit - this page also has excellent interactive Bezier curve demos and source code on GitHub)
  • Last Edit: November 29, 2013, 03:12:24 am by N E O

  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Re: Sample phoenix project
Reply #8
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 :)

  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Re: Sample phoenix project
Reply #9
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.