[DOC] better basic sample and doc

This commit is contained in:
Edouard DUPIN 2016-09-15 22:01:35 +02:00
parent db09e4b6f8
commit ba0db15ea2
6 changed files with 146 additions and 15 deletions

92
doc/build.md Normal file
View File

@ -0,0 +1,92 @@
Build lib & build sample {#gale_build}
========================
@tableofcontents
Download: {#gale_build_download}
=========
ege use some tools to manage source and build it:
need google repo: {#gale_build_download_repo}
-----------------
see: http://source.android.com/source/downloading.html#installing-repo
On all platform:
```{.sh}
mkdir ~/.bin
PATH=~/.bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
chmod a+x ~/.bin/repo
```
On ubuntu
```{.sh}
sudo apt-get install repo
```
On archlinux
```{.sh}
sudo pacman -S repo
```
lutin (build-system): {#gale_build_download_lutin}
---------------------
```{.sh}
pip install lutin --user
# optionnal dependency of lutin (manage image changing size for application release)
pip install pillow --user
```
dependency: {#gale_build_download_dependency}
-----------
```{.sh}
mkdir -p WORKING_DIRECTORY/framework
cd WORKING_DIRECTORY/framework
repo init -u git://github.com/atria-soft/manifest.git
repo sync -j8
cd ../..
```
sources: {#gale_build_download_sources}
--------
They are already download in the repo manifest in:
```{.sh}
cd WORKING_DIRECTORY/framework/atria-soft/audio-river
```
Build: {#gale_build_build}
======
you must stay in zour working directory...
```{.sh}
cd WORKING_DIRECTORY
```
library: {#gale_build_build_library}
--------
```{.sh}
lutin -mdebug gale
```
Sample: {#gale_build_build_sample}
-------
```{.sh}
lutin -mdebug gale-sample
```
Run sample: {#gale_build_run_sample}
===========
in distinct bash:
```{.sh}
lutin -mdebug gale-sample?run
```

View File

@ -7,11 +7,17 @@ What is GALE? {#gale_mainpage_what}
=============
GALE, or "Graphic Abstraction Layer for Ewol" is a simple Interface with the OS Gui interface (openGL) and basic interface.
For example, on android we use java interface and on linux we use X11 or Wayland.
For example, on android we use java interface, on linux we use X11, ....
Gale abstract all of this and provide an inetrface in C++ on all of these platform.
Gale abstact the Keybord, mouse and touche event on all of these platform (when availlable)
Gale abstact the Keybord, mouse and touch event on all of these platform (when availlable: no touch on linux X11)
Gale is a low level abstraction interface. you can user upper interface:
- [EWOL](http://atria-soft.github.io/ewol) It provide some basic widgets and gui management
With Gale you have the Graphyc abstraction. We provide some abstraction for the audio interface:
- [audio-orchastra](https://musicdsp.github.io/audio-orchestra) That is the dual of gale but for audio.
- [audio-river](https://musicdsp.github.io/audio-river) That is the dual of ewol but for audio.
For audio interface You can see [audio-orchastra](https://musicdsp.github.io/audio-orchestra) That is the dual of gale but for audio.
Where can I use it? {#gale_mainpage_where}
-------------------
@ -52,3 +58,11 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Other pages {#gale_mainpage_sub_page}
===========
- @ref gale_build
- @ref gale_tutorial
- [**ewol coding style**](http://atria-soft.github.io/ewol/ewol_coding_style.html)

View File

@ -3,7 +3,7 @@ Tutorial {#gale_tutorial}
@tableofcontents
Base: {#gale_declare}
Base: {#gale_tutorial_declare}
=====
To understand some choise, I designe this software to acces on all system (that provide openGL interface).
@ -13,13 +13,13 @@ All is based on the heritage of the single class: gale::Application.
For your fist application you just need to declare an application and create the smallest main that ever exit:
Application declatration: {#gale_base_main}
Application declatration: {#gale_tutorial_base_main}
-------------------------
We declare the application:
```{.c}
class MainApplication : public gale::Application {
// nothing to do ...
// application implementation here ...
}
```
@ -28,14 +28,14 @@ We create application on the main()
At this point I need to explain one point on Android:
Android have an internal state engine that can create multiple aplication, then I can call a second time the main() if needed...
Android have an internal state engine that can create multiple aplication, then GALE can call a second time the main() if needed...
Then never forget to not use global value and singleton. We provide other mechanism to do it. (for exemple, you can acces at you Application everywhere you are.
Then never forget to not use global value and singleton. We provide other mechanism to do it. (for exemple, you can acces at you Application intance everywhere you are).
Compleate Sample: {#gale_compleate_sample}
Compleate Sample: {#gale_tutorial_compleate_sample}
=================
@snippet basic.cpp gale_sample_all

View File

@ -86,7 +86,10 @@ namespace gale {
* @param[in] _pos Position of the event (can be <0 if out of window).
* @param[in] _state Key state (up/down/move)
*/
virtual void onPointer(enum gale::key::type _type, int32_t _pointerID, const vec2& _pos, gale::key::status _state);
virtual void onPointer(enum gale::key::type _type,
int32_t _pointerID,
const vec2& _pos,
gale::key::status _state);
/**
* @brief Get keyborad value input.
* @param[in] _special Current special key status (ctrl/alt/shift ...).

View File

@ -29,7 +29,10 @@ def create(target, module_name):
my_module.add_src_file([
'sample/basic.cpp'
])
my_module.add_depend(['gale'])
my_module.add_depend([
'gale',
'test-debug'
])
my_module.copy_file('sample/basic.frag')
my_module.copy_file('sample/basic.vert')
return my_module

View File

@ -9,6 +9,7 @@
#include <etk/types.h>
#include <gale/gale.h>
#include <gale/context/commandLine.h>
#include <test-debug/debug.h>
#include <gale/Application.h>
#include <gale/context/Context.h>
@ -22,7 +23,7 @@ class MainApplication : public gale::Application {
int32_t m_GLMatrix;
int32_t m_GLColor;
public:
void onCreate(gale::Context& _context) {
void onCreate(gale::Context& _context) override {
setSize(vec2(800, 600));
m_GLprogram = gale::resource::Program::create("DATA:basic.prog");
if (m_GLprogram != nullptr) {
@ -30,9 +31,9 @@ class MainApplication : public gale::Application {
m_GLColor = m_GLprogram->getAttribute("EW_color");
m_GLMatrix = m_GLprogram->getUniform("EW_MatrixTransformation");
}
std::cout << "==> Init APPL (END)" << std::endl;
TEST_INFO("==> Init APPL (END)");
}
void onDraw(gale::Context& _context) {
void onDraw(gale::Context& _context) override {
ivec2 size = getSize();
// set the basic openGL view port: (position drawed in the windows)
gale::openGL::setViewPort(ivec2(0,0),size);
@ -60,7 +61,7 @@ class MainApplication : public gale::Application {
etk::color::blue
};
if (m_GLprogram == nullptr) {
std::cout << "No shader ..." << std::endl;
TEST_INFO("No shader ...");
return;
}
//EWOL_DEBUG(" display " << m_coord.size() << " elements" );
@ -80,6 +81,24 @@ class MainApplication : public gale::Application {
// Restore context of matrix
gale::openGL::pop();
}
void onPointer(enum gale::key::type _type,
int32_t _pointerID,
const vec2& _pos,
gale::key::status _state) override {
TEST_INFO("input event: type=" << _type);
TEST_INFO(" id=" << _pointerID);
TEST_INFO(" pos=" << _pos);
TEST_INFO(" state=" << _state);
}
void onKeyboard(const gale::key::Special& _special,
enum gale::key::keyboard _type,
char32_t _value,
gale::key::status _state) override {
TEST_INFO("Keyboard event: special=" << _special);
TEST_INFO(" type=" << _type);
TEST_INFO(" value=" << uint32_t(_value));
TEST_INFO(" state=" << _state);
}
};
//! [gale_declare_main]