Compare commits

...

951 Commits
0.3.3 ... main

Author SHA1 Message Date
30fb41bb62 [RELEASE] Release v1.0.0 2021-02-16 21:46:54 +01:00
f808211bd3 [DEBUG] update new API of lutin log 2019-05-03 10:18:22 +02:00
bfedb5336e [DEV] update label widget 2019-04-01 22:04:10 +02:00
1cfa68a23f [DEBUG] correct basic font folder 2019-04-01 22:03:49 +02:00
5c2ba27cc5 [DEV] reduce some log level 2018-10-30 22:05:39 +01:00
160a7dec30 [DEV] update of new etk Uri API 2018-10-23 22:17:53 +02:00
efd3b160ad [DEBUG] correct distance field 2018-10-23 22:17:20 +02:00
844aaa90dd [DEV] update new URI and treeview 2018-10-09 23:03:07 +02:00
dbe995abd8 [DEV] update for build URI 2018-09-29 21:58:25 +02:00
532b64a1f0 [DEV] integrate the new interface of URI and file 2018-09-24 23:26:07 +02:00
63ac2d7e07 [DEBUG] some big correction on the treeview... 2018-08-29 21:15:05 +02:00
6454bf59c4 [DEV] reduce size of display 2018-08-27 22:56:19 +02:00
f522c759d6 [DEV] remove log 2018-08-24 21:54:22 +02:00
6ea7014244 [DEV] tree view start to be funny ==> now I can thing to to a browser 2018-08-21 23:29:23 +02:00
0d0cb02b85 [DEV] add subElement 2018-08-20 22:25:50 +02:00
0b2e9d4129 [DEV] add treeView fist element Draw 2018-08-20 22:46:06 +02:00
ba31625447 [DEV] add sample treeview 2018-08-19 22:53:47 +02:00
84769bc26e [DEV] correct the scrolling and remove display of hiden element in the list 2018-08-18 08:49:29 +02:00
dd373e1d2d [DEV] check backgroud exist to apply an action of draw 2018-08-18 08:48:38 +02:00
4dee6004c3 [DEV] remove get title in the list ==> never used 2018-08-18 08:47:49 +02:00
3da1b84016 [DEV] remove deprecated function in list 2018-08-18 08:46:57 +02:00
44130c4cd7 [DEV] set fill in X and Y 2018-08-18 08:46:13 +02:00
e0bcf4f84c [DEV] force le X max scroll to 1 2018-08-18 08:44:02 +02:00
5d53bed86b [DEV] list start to be correct 2018-08-17 21:52:33 +02:00
7bab80da4f [DEV] start chage the API of the ListView to be ready to do a treeView 2018-08-16 22:08:49 +02:00
7e9d2e5f74 [DEV] update etk null 2018-06-19 22:13:48 +02:00
678fe13631 [DEV] update typo toUpper toLower 2018-04-05 21:34:07 +02:00
07e00cc906 [DEBUG] remove filter in the Entry due to the etk::regex capabilities (add regression in functionnality) 2017-11-23 23:23:12 +01:00
7eb68dfa72 [DEBUG] build back tools & sample 2017-11-07 10:19:06 +01:00
dd8daa7e3d [DEV] update to the new ETK allocator wrapper 2017-10-21 19:05:21 +02:00
b8a2210d0d [DEV] rename Image.cpp in TextureFile.cpp and better image widget 2017-10-09 23:49:32 +02:00
50f0f350ed [DEV] try correct image compositing 2017-10-09 10:11:39 +02:00
d2ce3d279c [DEBUG] correct image sizing 2017-10-03 10:24:00 +02:00
94e69dbdec [DEBUG] add missing stream header 2017-09-26 15:49:27 +02:00
7958673b8d [DEBUG] continue removing STL 2017-09-17 15:23:44 +02:00
4885d7c685 [DEV/DEBUG] No stl start to work (add manual type declaration (NO RTTI)) 2017-09-17 00:12:49 +02:00
b66827c6de [DEV] continue removing STL 2017-09-14 00:59:21 +02:00
4aada212ac [DEV] remove STL 2017-09-07 23:38:26 +02:00
5d31353f69 [DEBUG] correct build 2017-08-30 22:35:58 +02:00
6493e83dbe [DEV] continue removing stl 2017-08-28 00:05:43 +02:00
c76ce3b339 [DEBUG] update new API of Gale left-right shift ... 2017-08-10 21:02:25 +02:00
3ea06311df [DEBUG] correct run on MAcOs 2017-08-04 22:15:15 +02:00
faacdc3b0e [DEBUG] wrong #endif 2017-06-28 23:10:58 +02:00
e789c16872 [DEV] update triangle draw 2017-06-28 21:56:26 +02:00
9f4250cbdc [DEV] Add capability to use FBO (Frame Buffer Object) 2017-06-28 08:29:17 +02:00
bd0c899654 [DEV] add an api to set texture in compsiting::Image ==> need to rework this API 2017-06-25 15:01:32 +02:00
eac0a5828c [DEV] faster push of texture 2017-06-18 14:01:02 +02:00
d9c11ad667 [DEV] update basic form axis 2017-06-01 22:24:17 +02:00
48efe503a7 [DEV] AABB draw lines 2017-05-22 23:34:05 +00:00
1ac5daa456 [DEV] add some cone, sphere, capsule and cylinder at the 3d object element 2017-05-22 21:36:58 +02:00
dbe62ed3d5 [DEBUG] compile without linear lib 2017-05-17 23:11:13 +00:00
307d620d45 [DEV] update new API etk 2017-05-16 21:06:21 +02:00
9020e4c188 [DEV] add log info in release 2017-05-05 22:22:30 +02:00
0a12e94847 [DEV] add support of scolling selection on X and Y and not a single value 2017-04-28 21:33:51 +02:00
254f2d0137 [DEV] add suport oh hidding pasword in entry 2017-04-28 21:33:10 +02:00
225633ffeb [DEV] set ewol::Widget::markToRedraw() in public 2017-04-27 22:31:57 +02:00
0275a524b2 [DEBUG] try a better bug management of no font 2017-04-25 23:36:08 +02:00
0b0cbfc30d [DEV] Remove API of the the annimation (bad designed) 2017-04-18 22:35:46 +02:00
d552f2baa2 [DEV] add reset scroll origin 2017-04-17 22:23:17 +02:00
fea01d57c3 [DEV/DEBUG] move basic images & add ewol-data & update property menu & debug display error of images 2017-03-07 22:06:36 +01:00
f9de81b2fb [DEBUG] add init of etranslate to remove error 2017-03-06 22:43:08 +01:00
e61234d586 [DEBUG/DEV] correct the loading of the composer and add the spacer in menu 2017-02-21 23:41:52 +01:00
1a930f5886 [DEV] add menu loading with xml data 2017-02-07 21:28:54 +01:00
3acf0bd148 [DEV] better integration of the file chooser 2017-02-03 22:26:32 +01:00
9c8a3513a6 [DEBUG] opengl es 2 on PC not work identicaly as embended board 2017-01-30 23:32:10 +01:00
487d265b66 [DEBUG] remove openGL call not existing in openGL-ES2 2017-01-18 22:02:36 +01:00
111b3bf587 Change licence APACHE-2 to MPL-2 ==> force source redistribution and permit static link 2017-01-05 21:28:23 +01:00
6e7af3cbb4 [DEV] not set the image in compositing if it does not change 2017-01-03 21:06:50 +01:00
54f4040a8d [DEBUG] many correction on image display ==> need to work again on it 2016-12-20 21:45:47 +01:00
c3a5f9ae64 [DEV] better integration of shortcut 2016-11-10 21:04:26 +01:00
00a7134a89 [DEV] continue integration of Web interface 2016-11-09 21:48:06 +01:00
6b859a45a1 [DEBUG] correct the VBO FULL implement 2016-11-08 22:17:47 +01:00
95bff828d8 [DEBUG] correct seg fault 2016-11-06 21:19:08 +01:00
2ad64a73fb [DEV] update to Web build mode (not finish) 2016-11-04 22:54:25 +01:00
c7f95a96c7 [DOC] add a framework overview 2016-10-27 23:45:30 +02:00
fc5c63d53d [DEV] update dev tag version 2016-10-25 21:56:55 +02:00
cfc2428268 [RELEASE] new version 0.10.0 2016-10-25 21:56:55 +02:00
f6f440efc6 [DEBUG] correct ewol depreacation of periodicCall 2016-10-25 21:56:55 +02:00
a3bf31527e [DEBUG] correct ewol depreacation of ewol::getBoardType and ewol::getCompilationMode 2016-10-25 21:56:55 +02:00
94a1e77ee7 [CI] update CI 2016-10-24 22:57:45 +02:00
6778140a1d [DEV] remove periodic call 2016-10-22 23:07:52 +02:00
3cc6e1577e [DEV] update to echrono 2016-10-14 21:13:39 +02:00
b451e97293 [DEBUG] correct throw of the Windows port of get language 2016-10-13 22:04:31 +02:00
9e9b8e0e02 [DEV] remove dependency of unistd.h 2016-10-13 21:29:18 +02:00
adbc99df96 [DEBUG] correct the language translation error 2016-10-13 21:08:15 +02:00
ccaf9e4bba [DEV] update platform test 2016-10-12 21:53:48 +02:00
43db52473e [DEV] continue integration of gale test 2016-10-10 23:18:07 +02:00
f39f7b69a8 [DEV] start a dev tool toi tes gale platform API 2016-10-06 23:58:56 +02:00
4632a3b939 [DEV] downgrade some logs 2016-10-06 22:31:25 +02:00
0cf4e92bc9 [DEBUG] correct version number 2016-10-06 21:42:40 +02:00
b3cad882f8 [DEV] Update new lutin 2.2.0 (no legacy support) 2016-10-04 23:41:29 +02:00
891117fcfc [DEBUG] correct .hpp port + clean libC include 2016-10-02 23:49:03 +02:00
4064951d55 [DEV/API] change .h in .hpp 2016-10-02 22:25:42 +02:00
f91a2f6009 [DEV] set object manager thread safe, set MacOs texture correct size and remove store of all texture 2016-09-21 21:35:13 +02:00
e6cab1e0cb [DOC] update done for doxygen over doxy 2016-09-16 22:35:06 +02:00
980220eb8c [DOC] continue rework 2016-09-15 22:43:04 +02:00
3e89966314 [DEV] update dev tag version 2016-09-12 21:07:12 +02:00
f70ef06c34 [RELEASE] create release 0.9.9 2016-09-12 21:06:37 +02:00
1b6bff8f52 [DEV] update to future lutin 2.0 2016-09-08 21:35:02 +02:00
1317156b5d [DEV] update dev tag version 2016-08-30 22:54:57 +02:00
5e42876e0b [RELEASE] create release 0.9.8 2016-08-30 22:54:57 +02:00
ce98d39d34 [DEV/DEBUG] update esignal removing ISignal and correct pop-up auto exit and widget slider callback 2016-08-11 23:34:43 +02:00
ca1b8144b5 [DEV] remove unnedded log 2016-08-01 00:28:57 +02:00
bc36856032 [DEV] correct image init 2016-07-25 22:33:45 +02:00
3424a52ea0 [DEV] init at the god way by default 2016-07-25 21:42:00 +02:00
6e93c37f87 [DEBUG] update egami image loader 2016-07-24 14:23:00 +02:00
2b4a68652e [DEBUG] build back of visual test 2016-07-19 22:31:27 +02:00
ad554b54ed [DEV] update sharedPtr 2016-07-19 21:43:58 +02:00
0d94650b4b [DEV] update new ememory::SharedPtr 2016-07-15 21:22:11 +02:00
88382c2564 [DEV] Update change of egami new API 2016-07-13 22:27:54 +02:00
21581a6ce0 [DEV] update the change on 'enum' to 'enum class' 2016-04-29 23:16:07 +02:00
a9ca1f12f8 [DEV] remove interline in header 2016-04-29 22:33:47 +02:00
33992063e6 [DEV] update to ne new ejson API (remove helper) 2016-04-28 23:46:12 +02:00
be029b9103 [DEV] butter interface on the texture push 2016-04-24 16:26:40 +02:00
f471429ac3 [DEBUG] try to find the problem of opening png file 2016-04-22 23:46:19 +02:00
06842eeafb [DEV] update new ejson interface 2016-04-20 21:19:11 +02:00
f5a50d26a6 [DEV] some custum code fix (rm __class__ and add @file 2016-04-19 22:46:06 +02:00
43c46cddd5 [DEBUG] correct segfault after updating for exml 2016-04-19 21:46:51 +02:00
faad7fcd41 [DEV] Update with the new exml API 2016-04-18 21:01:17 +02:00
75e42b9bfe [DEV/DOC] update doxy and new eproperty and new etk::FSNode 2016-04-08 22:55:16 +02:00
bcbafc57d9 [DOC] @not-in-doc ==> @not_in_docand better display of documentation 2016-04-01 21:17:25 +02:00
a062b31ff7 [DEV] use doxygen documentation and update doc to markdown 2016-03-30 21:40:01 +02:00
a1e59a95e3 [DOC] better compleate doc 2016-03-24 21:54:13 +01:00
d82ea4335e [DOC] update documentation 2016-03-23 21:44:32 +01:00
2cc41d2152 [DEV] better interface of the properties tools 2016-03-22 22:18:16 +01:00
6c3a78560a [DEV] correct tool and add Scroll property 2016-03-20 22:46:10 +01:00
d01d270135 [DEV] some correction 2016-03-18 21:26:39 +01:00
fe3242a16f [DEV] update the test software 2016-03-17 23:41:10 +01:00
6f46902445 [DEV] add signal declaration 2016-03-17 21:18:57 +01:00
6f68563d50 [DEV] review interface (step 1) 2016-03-16 21:42:49 +01:00
2e4e1545ad [DEBUG] can not create a widget with name 2016-03-15 21:11:08 +01:00
34357ed6eb [DEV] add doc and better code 2016-03-15 22:01:19 +01:00
7bddada9b8 [DEBUG] when remove a pop up composer, the composer widget is not removed ... add property to do it 2016-03-15 21:38:55 +01:00
c2b77dea53 [DEV] Set label directly on the property 2016-03-15 21:35:12 +01:00
5ebfea1c27 [DEBUG] correct the set of a label in the create factory 2016-03-15 21:34:54 +01:00
229f45d158 [DEV] add override attribute 2016-03-10 23:48:55 +01:00
f1a0b784f6 [DEV] review translation methodologe and position 2016-03-10 22:15:55 +01:00
2abb546c5e [DEV] update of external of elog and ethread 2016-03-08 21:29:34 +01:00
9e7d41f266 [DEV] start abstraction of using shared_ptr and weak_ptr to bench some other implementation thread safe ... 2016-03-07 23:32:59 +01:00
9371f59962 [DEV] simplify factory 2016-03-07 21:50:25 +01:00
d1caa7cb3b [DEV] try variant implementation 2016-03-04 22:20:28 +01:00
c2bc4c553c [DEV] update new property interface 2016-03-02 21:51:44 +01:00
11577515ff [DEV] update new e-property 2016-02-24 22:29:01 +01:00
b6fa9c95e0 [DEV] update new interface of esignal 2016-02-22 22:33:51 +01:00
b22014b3f6 [DEV] update new esignal (not build) 2016-02-19 23:33:00 +01:00
1bbc8c08cc [DEBUG] add missing declaration and corect segfault 2016-02-15 22:10:33 +01:00
e6e817bfcd [DEV] continue integration of property (build but seg fault) 2016-02-14 15:04:44 +01:00
1a3bbc297c [DEV] start think of new simplest API for properties (not build and not work) 2016-02-12 23:48:35 +01:00
86f537913b [DEV] update travis.yml to checkout dev branch 2016-02-12 21:07:58 +01:00
5138c91756 [DEV] update to the specialisation of the signal hide implementation 2016-02-11 22:39:40 +01:00
ea4cc45ac5 [DEV] update externalisation of signal and property 2016-02-11 21:45:21 +01:00
287815eaa6 [DEV] add widget Spin (not finished) 2016-02-10 21:12:48 +01:00
7f3e0735f6 [DEV] A basic version of the Select widget (need to be finished)' 2016-02-09 22:47:30 +01:00
3aece8d7b8 [DEV] first idea of the select and spin element 2016-02-08 21:15:02 +01:00
0bbbb59a81 [DEV] more diplay in tools 2016-02-07 21:57:36 +01:00
298bd2d106 [DEBUG] correct gravity of the checkbox when not filling the area 2016-02-06 23:03:03 +01:00
1490c4324a [DEVÂ] add parameter at color test border 2016-02-06 22:39:38 +01:00
6e2fdccb98 [DEV] extract the coloring of the sizer widget 2016-02-06 00:45:09 +01:00
19989a475a [DEBUG] correct the horizontal widget gravity anagement 2016-02-06 00:17:13 +01:00
1d281a1db4 [DEV] Finish color display of the sizer ==> nned extract color syntax ... 2016-02-06 00:16:44 +01:00
f5dfead63c [DEV] better display of the sizer color ==> need to create sub widget for test 2016-02-05 21:09:25 +01:00
3c9851ecf5 [DEV] extract gravity from widget 2016-02-04 23:12:36 +01:00
2e1644be3e [DEV] API change: change gravity methodologie 2016-02-04 22:55:43 +01:00
77bc863ab9 [DEBUG] Correct sizer min size with border 2016-02-04 22:42:38 +01:00
42d9505335 [DEBUG] correct the sizer expand in X 2016-02-04 22:29:41 +01:00
77d3bb2b99 [DEV] reduce indentation 2016-02-04 22:27:13 +01:00
b45799c532 [DEV] update context menu 2016-02-04 22:25:26 +01:00
fa0ef8e26c [DEV] try to correct sizer error 2016-02-03 21:15:07 +01:00
75e120ceb3 [DEV] replace 'include guard' with 'pragma once' 2016-02-02 21:18:54 +01:00
5ee58f3540 [DEV] rework all the API of the sizing 2016-02-01 23:50:01 +01:00
5b93b312f3 [DEV] continue good integration of gravity in sizer ... 2016-02-01 21:26:21 +01:00
46699c20b6 [DEV] try to correct the expand error... (START) 2016-01-31 22:28:58 +01:00
44749e4a6f [DEV] add tool a better display of the widgets 2016-01-29 23:57:29 +01:00
8ccb93508d [DEBUG] correct the checkbox missing check (base) 2016-01-29 23:56:50 +01:00
e20efd56e2 [DEV] add the state in the shaper (need validate) 2016-01-29 23:55:36 +01:00
01a9d6b1c5 [DEV] better test tools for widget 2016-01-29 22:20:06 +01:00
990894af6f [DEV] add sizer color for border (for debugging it is cool) 2016-01-29 21:25:31 +01:00
b595794a0d [DEV] add an API to create widget with XML 2016-01-29 21:24:02 +01:00
7273b617ff [DEV] add an API to create widget with XML 2016-01-29 21:23:12 +01:00
632fafaa3d [DEV] continue integration af an introspection of the widget parameter 2016-01-28 22:47:03 +01:00
293cce1fd0 [DEBUG] correct checkbox size 2016-01-28 22:47:03 +01:00
03232752f1 [DEV] add debug in shaper 2016-01-28 22:47:03 +01:00
01ca0392fe [DEV] Add a function to specify the type of the parameter 2016-01-28 22:47:03 +01:00
e91da861a6 [DEV] add signal capability of direct function callback 2016-01-28 22:47:03 +01:00
ab22c78237 [DEV] add bach the simple valider of system (visual) 2016-01-22 22:24:38 +01:00
7be7a16357 [DEBUG] coorect the tag version 2015-12-03 21:47:54 +01:00
5f38706175 [DEV][CI] update to remove agg library and travis build env 2015-12-03 21:32:51 +01:00
94f6d4f48a [DEV] some typo correction 2015-11-20 22:26:40 +01:00
f33428c251 [DEV] change default opening of image 2015-11-06 22:31:08 +01:00
92eec7385d [DEV] add api to set size of sprite image file 2015-11-05 21:48:18 +01:00
d84f9f7df8 [CI] update config (build windows and android 2015-11-02 22:19:47 +01:00
04d60a7200 [CI] test Ios 2015-10-22 08:38:15 +02:00
cd2f2599b8 [CI] Continue build integratuion to work better 2015-10-19 21:33:12 +02:00
1ecaee5fd5 [DEV] Update tag 0.9.8-dev 2015-10-19 21:26:56 +02:00
7f6acfc024 Merge branch 'dev' 2015-10-19 21:21:39 +02:00
542c858831 [DEV] update granch without submodule 2015-10-19 21:21:39 +02:00
04756d72ea [DEV] add basis of test for ewol 2015-10-19 21:12:04 +02:00
000644204a [CI] Integrate new MacOs on Travis 2015-10-16 21:00:37 +02:00
82996f07b8 [DEV] update new lutin 0.8.0 2015-10-14 21:21:03 +02:00
6d8c375365 [DEV] update signal interface to remove periodic signal in debug log level 2015-09-29 21:12:20 +02:00
0abe3cfdfc [DOC] update readme 2015-09-28 21:51:37 +02:00
23350d196c [DEBUG] Correct the loading of the font 2015-09-25 21:12:02 +02:00
0e2fbeffce [DEV] update next lutin version 2015-09-24 21:44:04 +02:00
9bba7de644 [DEV] update new FN Node file interface 2015-09-18 22:00:53 +02:00
77dc891394 [DEV] update Build interface 2015-09-14 21:11:04 +02:00
40a671c077 [DEV] update new lutin 2015-09-10 21:32:50 +02:00
acba455634 [DEBUG] correct constness and add logs ... 2015-09-07 21:51:55 +02:00
bb92817774 [DEV] integrate corect image rendering with dynamic event 2015-09-02 22:55:42 +02:00
ea4515f63c [DEV] update some interface 2015-09-02 21:11:02 +02:00
ad0018be8d [DEV] add some mutex to protect multithread access 2015-09-01 23:50:34 +02:00
5789abf09b [DEV] change process on initialisation and application interface 2015-09-01 22:32:42 +02:00
fe8c7a712e [CI] update travis with new interface (no sudo) 2015-08-24 23:55:27 +02:00
552d6cb05f [DEV] update example 2015-08-24 22:50:24 +02:00
9a844b0315 [DEV] missing interface 2015-08-23 21:41:37 +02:00
0cab58d32f [DEV] correct shaper error in button and add checker of peridic call 2015-08-22 11:01:48 +02:00
3fc18f8e1d [DEV] some corretion with gale 2015-08-21 23:35:35 +02:00
6560b59eab [DEV] update ewol to gale (basic work step 2) 2015-08-11 22:38:34 +02:00
4325aaecf2 [DEV] UPDATE at gale architecture (BAD display) 2015-08-04 23:24:28 +02:00
b569e69297 [DEV] start gale integration 2015-07-21 21:00:40 +02:00
210d090e23 [DEV]@ update naming of android interface 2015-07-01 21:30:27 +02:00
471d51eddb [DEV] correct all android errors 2015-06-26 22:07:50 +02:00
c2733cadb6 [DEV] remove audio interface from java framework 2015-06-23 22:10:34 +02:00
da1d33b783 [DEV] some dev for audio 2015-06-22 21:03:57 +02:00
83746c58de [DEV] continue dev of audio correct wrapping 2015-06-21 21:56:07 +02:00
702bd32dc3 [DEV] correct android interface 2015-06-18 23:49:54 +02:00
1e46295288 [DEV] add genberator of dynamic android file 2015-06-19 23:32:46 +02:00
a7fcfccada [DEV] try add generator of the header from java class 2015-06-18 23:49:54 +02:00
1baca41edd [DEV] start to create a proper java compilation ... 2015-06-18 21:43:18 +02:00
80fbc8f639 [DEV] update travis file 2015-06-17 21:25:57 +02:00
f0a236997f Update README.md 2015-06-03 15:10:28 +02:00
1b72284d26 [DEBUG] correct the help tag in cmdline 2015-06-01 21:48:34 +02:00
049a853387 [DEV] poc perfo CPU MacOS 2015-05-22 22:05:05 +02:00
e83bae08cb [DEV] udpate for android build 2015-05-20 22:51:59 +02:00
8a073acf76 [DEV] Add copy and past interface 2015-05-19 22:19:28 +02:00
21ad90fd15 [DEV] correct the interface of the MacOs context 2015-05-18 21:15:50 +02:00
935d9cd4a6 Update travis lutin interface 2015-05-17 11:32:25 +02:00
6bcb491f0a [DEV] correct kaybord and mose input for MacOs ==> pb on close Windows 2015-05-15 23:43:33 +02:00
bec114d53d [DEV] better keyboard input 2015-05-12 21:12:22 +02:00
9d07ec9eb6 [BUILD] update new lutin 0.5.3 2015-05-08 22:40:53 +02:00
dc8e1741c7 [DEV] update travis build system 2015-05-07 23:40:38 +02:00
39c7d777ce Merge branch 'origin/dev' 2015-05-07 23:20:13 +02:00
1ee607d444 [DEV] Remove external libs 2015-05-07 23:02:33 +02:00
8a1bdcd6a1 [DOC] undate doc 2015-05-04 22:51:50 +02:00
a22695aa6a [DEV] add zlib wrapper 2015-05-04 22:38:01 +02:00
adf42abe46 [DEV] remove zlib 2015-05-04 22:28:52 +02:00
840bca43d6 [DEV] rename audio-algo-river 2015-04-23 22:06:47 +02:00
8b3556882a [DEV] correct submodule error 2015-04-23 21:44:22 +02:00
a5e7cd5209 [DEV] update zlib repo 2015-04-23 21:07:20 +02:00
be69fc5594 [DEV] add speex algo wrapper 2015-04-22 00:21:44 +02:00
832b8cde5e [TAG] update TAG (developement) 2015-04-21 23:44:21 +02:00
769127e9da [TAG] update TAG 2015-04-21 23:40:16 +02:00
db4fa5147e Merge remote-tracking branch 'origin/dev'
Conflicts:
	README.md
	sources/tag
2015-04-21 23:38:08 +02:00
d00ec173af [DEV] update library dependency repository 2015-04-21 23:02:49 +02:00
af4410a16a [DEV] workspace is back correct 2015-04-11 13:22:12 +02:00
1b441ad65d [DEV] rework tree and submodules 2015-04-10 22:49:38 +02:00
915c4088e7 [DEV] remove build system and add audioAlgo 2015-04-02 22:00:29 +02:00
bf8a93d1ea [DEV] update init 2015-03-26 22:12:55 +01:00
ce00a23475 [DEV] update the etk init 2015-03-26 21:21:38 +01:00
9bd62966ca [DEV] update Log interafce 2015-03-25 21:14:12 +01:00
66364ff4ea [DOC] add worddown in the software list that use EWOL 2015-03-22 20:45:50 +01:00
551846181c [DEV] remove LUA and compilation update 2015-03-20 23:18:16 +01:00
cdcfc201d4 [DEV] update libs and tools for thread 2015-03-20 22:18:52 +01:00
b94e674a8f [DEBUG] edtaa3 build error 2015-03-11 21:26:07 +01:00
032c9a5e91 [DEV] add C compilation of the Z interface on C99 2015-02-26 21:44:16 +01:00
ef1eb80553 [TRAVIS] update g++ version 2015-02-17 22:04:40 +01:00
af24b335ac [DEBUG] correct android build 2015-02-16 21:40:51 +01:00
7e2cae472e [DEV] set it work on MacOs & IOs again 2015-02-15 21:52:20 +01:00
15c1764854 [DEV] change basic thread name 2015-02-13 22:25:55 +01:00
865851578d [DEV] update sub libs 2015-02-12 23:23:32 +01:00
8add5d9f1b [DEV] update new sub libs 2015-02-07 00:08:03 +01:00
8addc1a84e [DEV] update new LOW level audio config for andoid 2015-02-05 23:34:39 +01:00
8a2211e5f6 [DEV] add subLibrary and update others 2015-02-05 22:23:15 +01:00
6caf433936 [DEV] update new exml interface 2015-01-14 21:10:23 +01:00
832d73d4da [DEV] update the ejson interface 2015-01-12 22:14:36 +01:00
673ccb3726 [DEV] update context code style 2015-01-08 22:38:34 +01:00
df2fbc04b9 [DEV] add speex enc/dec and speex DSP and some change 2015-01-06 22:28:26 +01:00
5a98b86dea [DEV] add luaWrapper 2014-12-19 23:51:41 +01:00
03fb0c4f8c Merge branch 'dev' of https://github.com/HeeroYui/ewol into dev 2014-12-17 22:12:32 +01:00
db62bf6714 [DEV] add lua wrapper 2014-12-17 22:12:32 +01:00
429c0ae82f Update README.md 2014-12-13 19:00:36 +01:00
3332777cf9 Update README.md 2014-12-13 18:56:28 +01:00
c4379885b3 [REMOVE] blender export-import of emf file (move in ege) 2014-12-08 22:37:20 +01:00
c750b5fd53 [DEV] add some debug in program for openGL and add object parameter set 2014-12-05 22:02:05 +01:00
6e6a9575bf [SAMPLE] add basic sample in the repo 2014-12-04 23:30:36 +01:00
6e571ae742 [DEV] add tools function for resource colored 3d object 2014-12-01 22:03:39 +01:00
d0e8e519a8 [DEV] travis update 2014-11-28 21:04:16 +01:00
28b3d075f4 [EXTERNAL] add gtest 2014-11-25 22:07:48 +01:00
3d0e63f5a6 [DEV] remove some logs 2014-11-24 23:47:42 +01:00
b9433d2cb7 [DEBUG] correst VBO offset error 2014-11-24 22:30:12 +01:00
412cf41cef [DEV] start rework interface OpenGl ==> all must be called by ewol::openGL namespace 2014-11-24 22:09:20 +01:00
0d23654379 [DEBUG] add resource::Program id checker 2014-11-21 21:46:19 +01:00
865305ac0b Update codingStyle.txt 2014-11-20 17:01:47 +01:00
86fa583a55 [DEV] normalize openGL interface for matrix 2014-11-13 21:11:53 +01:00
4e88d081d8 [DEBUG] missing translation matrix 2014-11-13 00:05:20 +01:00
e912cd44e3 [DEV] remove an unneeded widget update 2014-11-11 23:12:08 +01:00
1713685108 [DEBUG] update area 2014-11-09 22:56:47 +01:00
627584f13d [DEV] update open GL interface 2014-11-07 23:35:16 +01:00
8ff2bfc20f [DEV] simplify VBO & program API 2014-11-06 21:54:27 +01:00
ec3c7b2902 [DEV] change ewol::signal::List in ewol::signal::Interface 2014-10-30 21:12:15 +01:00
61afe48646 [DEV] set Parameter agnostic from Object 2014-10-29 22:34:06 +01:00
656fe783d4 [DEV] set signal agnostic from other API just depend on shared_ptr<void> 2014-10-29 21:05:49 +01:00
00b385f433 [DEV] remove specificity of signal to Object to shared_ptr<void> 2014-10-28 23:13:38 +01:00
dbecf900be [DEBUG] gcc build error 2014-10-28 22:04:32 +01:00
9cc1b47a2a [DEV] change periodic call ==> remove from widget manager to Object manager and set signal instead of virtual function 2014-10-28 21:01:44 +01:00
5024c51379 [DEBUG] signal error when removing signal in signal calling 2014-10-23 22:17:39 +02:00
21435b9961 [DEV] add subElement bind with multiple argument (TODO: better with template) 2014-10-20 21:28:23 +02:00
499806edc5 [DEV] remove compilation warning 2014-10-19 23:05:24 +02:00
d8d02254ca [DEV] remove deprecated API 2014-10-19 23:04:54 +02:00
36495518ac [DEV] change slider signal value type int32_t ==> float 2014-10-19 23:04:27 +02:00
06521163f6 [STYLE] some style 2014-10-19 23:03:08 +02:00
4fde0a8462 [DEV] add bind1 (not work) 2014-10-19 23:02:44 +02:00
03213d9f04 [TAG] Update version tag : 0.9.4-dev 2014-10-18 08:30:32 +02:00
8bdb599f06 Update version tag : 0.9.4 2014-10-18 08:28:38 +02:00
3830ced287 [SUB] update submodule 2014-10-18 08:19:33 +02:00
e3a1b37130 [DEV] set ButtonColor support parameters instead of direct set & get 2014-10-18 08:18:13 +02:00
e858cf8a74 [DEV] set slider support parameters instead of direct set & get 2014-10-18 08:17:52 +02:00
a41605b9b3 [DEBUG] change visibility of the Context menu constructor 2014-10-18 08:17:11 +02:00
293a68a083 [DEBUG] Remove unneeded variable 2014-10-18 08:16:25 +02:00
4063a6178c [DEV] change application URL loader 2014-10-18 08:15:34 +02:00
2ff07a736e [DEV] add subWidget search with there name 2014-10-18 08:14:44 +02:00
5309ac7550 [INTEGRATION] update travis test path and remove clang update (might be unneeded 2014-10-17 22:09:59 +02:00
66e61d6d45 [INTEGRATION] update etk 2014-10-17 22:06:03 +02:00
3eb0e63a80 [INTEGRATION] update test 2014-10-17 22:02:12 +02:00
8ceaf407b3 [INTEGRATION] update travis.xml 2014-10-17 21:56:43 +02:00
c62c666fe1 [DEV] update exml 2014-10-17 21:52:23 +02:00
70ff8fa6f7 [DEV] update travis.yml 2014-10-17 21:18:43 +02:00
7645341f35 [DEV] remove etk::mutex and etk::semaphore for stl inmplementation 2014-10-08 22:30:30 +02:00
b5b460440b [DEV] Correction of Resource unamed creation 2014-10-01 23:33:07 +02:00
cb2e34cbb4 [DEV] change level of signel log 2014-09-22 22:16:11 +02:00
8b5f3e1eea [DEBUG] Update glew for windows 64 bits 2014-09-17 00:30:14 +02:00
eaa3e40ef0 [DEV] update submodule 2014-09-16 22:32:57 +02:00
bcd6b8230b [DEV] update Readme 2014-09-15 22:22:41 +02:00
4d54a562fc [DEBUG] windows compialtion is back (not tested) 2014-09-15 21:58:34 +02:00
942b3a155d [DEV] add a worker interface 2014-09-12 21:22:18 +02:00
7c4d4ff1dc [DEV] add test 2014-09-11 21:25:06 +02:00
e5cf76c49c [TAG] Update version tag : 0.9.3-dev 2014-09-11 07:14:25 +02:00
be0b31f905 Update version tag : 0.9.3 2014-09-11 07:08:30 +02:00
6c92b70642 [DEV] update doc 2014-09-09 21:15:50 +02:00
d3eae268d9 [DEBUG] link gcc to gcc-4.8 2014-09-09 20:48:19 +02:00
cc5e966ba4 [DEV] Update travis file 2014-09-09 20:48:19 +02:00
6249f2b59b [DEBUG] remove gcc-4.6 2014-09-09 20:43:16 +02:00
790f8528e4 [DEBUG] change gcc version in script 2014-09-09 08:23:37 +02:00
35aa535a6d [DEBUG] missing then in travis file 2014-09-09 08:16:34 +02:00
9e2099b870 [DEV] add travis upgratde for gcc 2014-09-09 07:40:12 +02:00
1616d833e8 [DEV] add dependency of CPPX11 2014-09-09 07:35:26 +02:00
9c5031a6ee [DEV] add trevis separate compilator 2014-09-09 07:28:21 +02:00
cce65ddccd [DEV] add travis emailing when finished 2014-09-09 07:23:31 +02:00
5109b7b1d9 [DEV] update travis file 2014-09-09 07:16:35 +02:00
30fe9db11e [DEV] update release version 2014-09-09 07:05:05 +02:00
d9c3ead221 Create .travis.yml 2014-09-09 06:10:01 +02:00
f49bc5f50c [DEV] add trvis base file 2014-09-08 23:09:34 +02:00
6ad49453ba [DOC] add documentations 2014-09-05 21:42:04 +02:00
886f4ddc76 [DOC] update doc titles system 2014-09-03 22:02:02 +02:00
d5bd35d0a4 [DOC] update documentation 2014-09-02 21:26:15 +02:00
87f4aedb95 [DEV] start updating documentation 2014-09-01 22:54:02 +02:00
331acf2303 [DEV] remove empty files 2014-08-30 09:15:26 +02:00
3f7cf66e99 [DEV] add remove link with a shortcut 2014-08-29 23:30:41 +02:00
d8ddb85a82 [DEV] update menu interface 2014-08-28 21:51:55 +02:00
6bf0c0f0cd [DEV] remove onReceiveMessage fucntion (deprecated) and set work again Entry, SelectColor, List ... 2014-08-27 22:56:57 +02:00
29910b5cef [DEV] Add log when macri binding not work 2014-08-27 06:04:31 +02:00
6e39002da5 [DEV] some rework on ewol... 2014-08-25 21:08:13 +02:00
367831116f [DEV] change some Object interface (try to simplify object interface 2014-08-25 05:56:03 +02:00
7edbc3a0cf [DEV] update new signal system 2014-08-22 22:21:23 +02:00
e3f71e5201 [DEV] remove caller in signal emit 2014-08-22 05:20:27 +02:00
12c4a88c88 [DEV] rework Signal implementation callback ==> must update all soft 2014-08-21 21:22:51 +02:00
153774177e [DEBUG] gcc compilation warning 2014-08-21 21:00:13 +02:00
3175657fed [DEV] rework signal interface (step 1 normalisation) 2014-08-20 22:34:31 +02:00
600d5b2ffe Update version tag : 0.9.2 2014-08-19 23:57:31 +02:00
006ed42f38 [DEV] signal is better 2014-08-19 22:57:39 +02:00
749b7a09c0 [DEV] Start dev of the signal system (nearly compatible with old system) 2014-08-19 23:26:51 +02:00
e1a0b972cd Update version tag : 0.9.2-dev 2014-08-19 23:57:31 +02:00
1a1dceb43a [DEV] merge dev 2014-08-19 21:47:33 +02:00
fe9649193b [CLEAN] remove unneeded code 2014-08-19 21:47:33 +02:00
baa00d0e71 [DEBUG] missing init in colored3DObject 2014-08-18 22:57:06 +02:00
132024a988 [DEV] remove unneeded files 2014-08-18 23:27:13 +02:00
b478b3e862 [DEV] remove onObjectRemove... 2014-08-17 23:36:53 +02:00
bee8936d54 [DEBUG] correct the menu not hide error 2014-08-15 22:49:34 +02:00
71f656fb41 [DEV] change the parameter Updating 2014-08-14 22:11:42 +02:00
43505fcc37 [DEV] WORK 2014-08-14 07:34:43 +02:00
9cb928b973 [DEV] change default Instance 2014-08-13 22:30:47 +02:00
5c7fe3bda5 [DEV] try to set work of the parameters 2014-08-13 07:50:00 +02:00
91091b7ccb [DEV] change the parameter object system (NOT work) 2014-08-12 22:08:24 +02:00
0eb9d5c322 [DEV] start rework for parameters 2014-08-11 22:43:05 +02:00
70487330ce [DEV] add basic parameter structure 2014-08-11 07:08:34 +02:00
eaefe65322 [DEBUG] correct samsung galaxie S3 shader error :
Error 0:4: P0007: Extension directive must occur before any non-preprocessor tokens
an error for android device that need to invert some preprocessor lines
2014-08-09 23:43:18 +02:00
babbf2bcd1 [LICENCE] change BSD v3 to APACHE v2.0
this is for prevent some patent errors
2014-08-08 23:19:08 +02:00
4b8c98c110 [DEV] run with no error ==> have many small error that thing not work compleately 2014-08-08 21:39:25 +02:00
e3305c3757 [DEV] start long rework to have a geneic std::shared_ptr instead of internal ewol::object::Shared ==> need to have only factory 2014-08-07 22:54:13 +02:00
de19f0de61 [DEV] color coorection new error 2014-07-10 22:33:49 +02:00
2196919531 [DEV] remove etk_min and etk_max & etk::Color<> interface 2014-07-03 21:03:26 +02:00
ed8626e6a7 [DEV] add composer in the xml widget list creatable 2014-06-22 19:07:07 +02:00
beaf2179c6 [DEBUG] add some object functionnality and remove some button error 2014-06-21 20:46:41 +02:00
0b9d3e38c4 Update version tag : 0.9.1 2014-06-18 13:03:19 +02:00
d51301924a [DEBUG] android set title error 2014-06-18 11:59:46 +02:00
8afd56e77e [DEV] update documentation 2014-06-16 22:34:44 +02:00
21c2bcfd39 [DEBUG] missing make shared of the std pop-up 2014-06-16 20:44:32 +02:00
fa6116fb7a [DEBUG] error build android 2014-06-16 07:51:24 +02:00
76e20869b5 [DEV] add main start for Other platform (not tested) 2014-06-05 22:05:32 +02:00
e7cc0e7100 [DEV] Change main application start (done only for X11) 2014-06-05 21:40:07 +02:00
46b5eca2cb change version 0.9.0 2014-06-03 21:42:17 +02:00
9ae39eda36 [DEBUG] pb on focus for the fileChooser pop-up 2014-06-03 21:24:32 +02:00
abdf5ca6f3 [TAG] Last version with no control of the pointer 2014-06-01 12:46:34 +02:00
7a1293c541 [DEV] android remove warning 2014-05-28 22:15:32 +02:00
8b4ea6f0cf [DEBUG] update program shared VBO and bullet new file 2014-05-30 23:22:17 +02:00
da12244f16 [DEBUG] Correct the resource update properties 2014-05-30 18:59:50 +02:00
a771457d89 [DEBUG] need to have a reverse drawing on layer 2014-05-28 22:15:32 +02:00
7ee8ff29bd [DEV] correct assert 2014-05-28 21:56:22 +02:00
d88028a7dc [DEBUG] remove memory leek 2014-05-27 21:35:34 +02:00
3237d26474 [DEV] correction of virtual and refcounter of objects 2014-05-27 21:26:40 +02:00
c2eb3c1467 [DEV] seem to work, but the result is really bad ... 2014-05-26 21:33:17 +02:00
3c52398511 [DEV] remove errors 2014-05-25 21:21:00 +02:00
a1d0185f19 [DEV] shared system work corectly with simple example 2014-05-25 16:15:26 +02:00
49c3036080 [DEV] WSlider list correction ==> might be rewrite with correct refs 2014-05-23 21:35:37 +02:00
e6a5c9c85f [DEV] add owner to auto remove an object 2014-05-23 12:33:49 +02:00
699935e482 [DEV] Better shared pointer management (nearly work) 2014-05-22 21:44:15 +02:00
5e861e002c [DEV] remove owner interface to simplify 2014-05-20 23:24:51 +02:00
87c622ddc0 [DEV] update windows shared pointer in context 2014-05-20 23:13:55 +02:00
f72b15664d [DEV] change resource in shgared pointer 2014-05-20 21:33:04 +02:00
63f50b54d4 [DEV] update some API 2014-05-19 21:25:07 +02:00
03336135d6 [DEV] start rework remove object 2014-05-19 07:41:52 +02:00
4c68791bdd [DEV] remove some unneded copy 2014-05-17 21:09:15 +02:00
357371847b [STYLE] change NULL in nullptr 2014-05-17 21:04:14 +02:00
b5b5785d04 [DEV] stabilize shared object interface 2014-05-17 21:01:06 +02:00
23eb78c7f9 [DEV] Better interface 2014-05-17 20:47:45 +02:00
7aa87e0fcc [DEV] it compile but it can not work now ... 2014-05-17 20:24:11 +02:00
227a08be18 [DEV] step one to build 2014-05-16 21:52:10 +02:00
8740595b17 [DEV] start big rework of the shared pointer on objects 2014-05-15 23:43:03 +02:00
cfbdc0e84e [DEV] start dev of smart pointer implementation 2014-05-15 22:25:06 +02:00
2e98c66894 [STYLE] remove (void) in () to be c++ coherent 2014-05-15 21:37:39 +02:00
7567856323 [DEBUG] correction diplay of entry first view 2014-05-14 21:47:26 +02:00
836172f749 [DEBUG] remove segfault when set /.. path 2014-05-14 21:14:36 +02:00
9682de59e2 [DEV] update file chooser with FSNode 2014-05-13 21:32:02 +02:00
96719f3dcc [DEV] add opening URL for Linux, IOs & MacOs 2014-05-11 13:09:36 +02:00
cb5582c54a [DEV] add translation module that work 2014-05-11 12:08:09 +02:00
54cd4828df [DEV] correct start and stop application for IOS 2014-05-10 19:08:39 +02:00
a0f6e268af [DEV] update display errors 2014-05-10 12:30:03 +02:00
bc29612e37 [DEV] Add basic translation interface 2014-05-07 23:30:15 +02:00
e3f6831dfa [DEV] add enet submodule 2014-05-02 21:29:44 +02:00
281f3dfc84 [DEV] change log system
Conflicts:
	external/ewolsa
2014-04-30 22:18:00 +02:00
b3602ceb14 [DEV] add jump url for Android (only)
Conflicts:
	external/ewolsa
2014-04-29 22:16:57 +02:00
78d729e033 [DEBUG] IOS/MacOs zlib compilation error 2014-04-22 23:49:45 +02:00
8f03df3af2 [DEV] Clean IOs wrapper 2014-04-22 23:41:10 +02:00
26b3f52d3f [DEV] First good version for IOs 2014-04-22 21:24:37 +02:00
66b53f30f4 [DEV] add touch event on the IOs port 2014-04-19 09:25:07 +02:00
bec800d4f9 [DEBUG] MacOs erorr compilation 2014-04-19 00:41:42 +02:00
3ab9b3e91e [DEV] IOs simulator first display with annimation
Conflicts:
	external/ewolsa
2014-04-19 00:31:36 +02:00
9dd0e26158 [DEV] add findger single touche move for scrooled widget 2014-04-18 23:30:45 +02:00
624d28af36 [DEBUG] correction of the scrool widget 2014-04-18 21:21:46 +02:00
ab770771cc [DEV] correction of the atom get property at null 2014-04-17 21:17:19 +02:00
852543d957 [DEV] Ios port 2014-04-17 01:25:28 +02:00
628d593326 [DEV] integration IOS first step 2014-04-13 13:47:50 +02:00
8589d9b747 Update version tag : 0.8.3 2014-04-06 18:51:52 +02:00
62fc7b9809 [DEV] add ewolSA, simple Audio interface for game 2014-04-06 18:48:31 +02:00
32d55bcdc6 [DEV] add correct version for Admods and back button and image part display 2014-04-06 18:45:45 +02:00
6a36013460 [DEBUG] correct scroll touch event 2014-04-01 12:44:29 +02:00
eff87a7f06 [DEV] update comment 2014-03-31 20:34:28 +02:00
189665162e [DEV] correction of the scroll widget and add distance field load precompiled basic file 2014-03-30 12:37:10 +02:00
6be6a33789 [DEBUG] correction of the shaper internal draw 2014-03-25 19:45:42 +01:00
e47d5a8f07 [DEV] modufiy shape system to be more flexible 2014-03-23 08:33:04 +01:00
4be5c84b9c [DEV] add basic AIRTAUDIO interface for android sound 2014-03-20 10:27:58 +01:00
9f4bd697e8 [DEV] add basic airtaudio 2014-03-13 22:31:30 +01:00
1b94a81174 [SUBMODULE] add airtaudio (fork of rtaudio) 2014-03-12 21:04:06 +01:00
592ed524f1 [SUBMODULE] remove RTAUDIO 2014-03-12 21:02:48 +01:00
f9e4250a09 [DEV] add rtAudio instead of portaudio 2014-03-05 21:43:00 +01:00
f79b8b5ffd [DEV] cmake file update and documentation update 2014-03-04 21:18:41 +01:00
a4e60d20c5 [DEV] add basic think of multi shaper type 2014-02-28 22:11:10 +01:00
cbbc3bea27 [DEV] add capacity of setting the force orientation (can greate exeption ==> seem to generate exeption 2014-02-26 21:00:06 +01:00
5644e5f987 [DEV] set dista,ce field at the 30 pixel size 2014-02-25 21:17:34 +01:00
69ef5682fe [DEV] add CMake instance 2014-02-24 21:50:50 +01:00
b055156aa6 [DEV] add basic cmake generator (not work) 2014-02-21 21:21:41 +01:00
0b3f7b2124 [DEBUG] comment and coding rules 2014-02-20 21:00:36 +01:00
b20f6db4ea [DEV] init random and set public the setter of text program on text 2014-02-19 21:10:53 +01:00
0cf3f29466 Update version tag : 0.8.2 2014-02-12 21:02:58 +01:00
973b6fdec7 [DEBUG edn#2] find focus error 2014-02-12 09:34:15 +01:00
4ec5216da1 [DEV] FOCUS error ==> might be ok 2014-02-11 09:48:48 +01:00
f9a5796a0a [DEV] correct checkbox, pop-up and fileChooser 2014-01-27 21:03:38 +01:00
5606728ae4 [DEV] update conf in json file 2014-01-24 21:44:38 +01:00
0a441228f1 [DEV] first step of the checkbox ==> TODO : use an herited button... 2014-01-24 20:10:02 +01:00
dbe7585f8b [DEBUG] correct label display bug and new Container2 widget 2014-01-24 00:55:12 +01:00
726135ff8c [DEV] try factorise Button code 2014-01-23 21:12:54 +01:00
dbd7e1a401 [DEV] fragment shader error 2014-01-22 23:15:10 +01:00
5e3974f59d [DEV] add reverse height to size for font height 2014-01-22 23:15:10 +01:00
a2a70607c3 [DEV] change scrool in scroll 2014-01-22 21:29:24 +01:00
c50abe2032 [DEV] correction of resource error when remove 2014-01-22 21:20:39 +01:00
8a48e529d4 [DEV] normalize scrolledWidget shaper 2014-01-20 21:26:00 +01:00
50c9be054d [DEV] add distance field for theme image just a big test 2014-01-19 19:16:51 +01:00
10f9e7c60f [DEV] end of first step of the color management 2014-01-18 14:33:36 +01:00
961415a05d [DEV] Review THEME management to support sepatrated color from shader 2014-01-17 22:49:11 +01:00
c2a6833037 [DEV] better distance-field and normal font display 2014-01-14 23:56:17 +01:00
6fcff69f11 [DEV] distance field developement 2014-01-14 21:50:21 +01:00
cdb945c2f1 [DEV] add ios board 2014-01-14 07:41:39 +01:00
c4479fa4cb [DEV] add distance field compisiting (not work) 2014-01-09 21:40:39 +01:00
fbca6c4491 [DEV] better distance field display 2014-01-08 22:15:01 +01:00
d144c0a65f [DEV] use normal distance field methode 2014-01-08 21:15:01 +01:00
9c6fe98018 [DEV] Test distance field developpement 2014-01-07 21:33:46 +01:00
3e617536af [DEV] better work on MacOS 2014-01-06 21:38:49 +01:00
546c90d972 [DEV] add log interface (step 1) 2014-01-05 23:04:43 +01:00
622ef88fea [DEV] update for Mac port
Conflicts:
	sources/lutin_ewol.py
2014-01-05 18:31:58 +01:00
80f623bb72 [DEV] try add android clipboard but break tabletgit status! can not test 2014-01-05 12:30:06 +01:00
ae53ab3d79 [DEV] add special char interface on android 2014-01-04 20:25:54 +01:00
8fc8738c0f [DEV] Change scrool interface of the finger interface (2 finger instead of 1) 2014-01-04 20:24:07 +01:00
b6feeb382f [DEV] add interface to update the special char with input chars 2014-01-04 20:23:22 +01:00
0f6ed06350 [DEV] rework ListFileSystem widget 2014-01-04 17:20:46 +01:00
ab979adf2a [DEV] add value set config in entry element 2014-01-04 17:20:01 +01:00
f3d7d3a6e6 [DEV] remove dead code 2014-01-03 22:07:05 +01:00
b8e3ffcf0b [DEBUG] JNI error corection of multiple threading interface 2014-01-03 22:04:37 +01:00
cb6d3f0cb9 [DEV] try to find keyboard error 2014-01-03 21:30:51 +01:00
bd184d4f8f [DEV] sizer parameter normalisation 2013-12-31 22:19:51 +01:00
428111b1d9 [DEV] Enable real utf-8 label display 2013-12-31 22:05:01 +01:00
7bf47a6c12 [DEBUG] remove some basic bug 2013-12-29 20:56:44 +01:00
f9ec8d0f12 [DOC] add monk website 2013-12-28 16:08:13 +01:00
278ecbd12d [DEV] normalize event in the access methosde 2013-12-28 15:14:36 +01:00
bcfd9a54c3 [DEV] update to the etk normalisation 2013-12-28 14:23:08 +01:00
f7f0c7e636 [DEV] add basic doc element unavaillabe 2013-12-27 21:55:28 +01:00
9cc41e0dad [DEV] update lutin naming 2013-12-23 22:38:46 +01:00
25b0914786 [DEV] add monk documentation 2013-12-22 19:05:43 +01:00
08e35f60d7 [DEV] change uneeded comments 2013-12-20 22:53:14 +01:00
a19458b26e [DEBUG] remove log 2013-12-20 00:37:05 +01:00
28bf683bbf [DEBUG] track an android access memory error 2013-12-20 00:34:00 +01:00
504dc26fa6 Update version tag : 0.8.1 2013-12-17 22:57:37 +01:00
e131fcaf09 [DEV] correction of event ID 2013-12-17 22:57:16 +01:00
6d0c5989cc [DEV] rework android 2013-12-16 18:49:42 +01:00
48e53b0bf2 [DEV] corection widget slider 2013-12-16 21:10:12 +01:00
5fae28a6ed [DEV] MacOs build 2013-12-15 14:09:30 +01:00
916c7f31a3 [DEV] new archi main part ended 2013-12-13 21:58:20 +01:00
01f409de3a [DEV] update new archi 2013-12-12 22:59:31 +01:00
3e8b6d8b91 [DEV] rework the internal arch eneded (not work) 2013-12-12 22:18:56 +01:00
dad1b90812 [DEV] change namespacing to clarify the API ==> (not work) 2013-12-11 01:19:33 +01:00
5c295fcca9 [DEV] update documantation 2013-12-10 21:40:43 +01:00
74554809c9 [DEV] add some tutorial 2013-12-09 21:39:29 +01:00
20b7e084da [DEV] remove doc/doc/ path 2013-12-08 23:18:01 +01:00
38f2087629 [DEV] add basic doc 2013-12-06 09:58:00 +01:00
2ab8690def [DEV] add documentation generation 2013-12-04 23:47:06 +01:00
b76e5b1d30 [DEV] remove unneeded mesh compositing 2013-12-04 21:21:25 +01:00
b7108874dd [DEV] Add some meta key event 2013-11-28 23:59:34 +01:00
b63f91d544 Update version tag : 0.8.0 2013-11-28 22:42:25 +01:00
c6215bf676 [DEBUG] update tag system 2013-11-28 22:26:11 +01:00
e24a3f0d8f [DEV] set a real Tag Version 2013-11-28 22:06:53 +01:00
42984619d7 [DEV] update cursor dusplay function 2013-11-28 21:24:20 +01:00
971acf0036 [DEV] update MacOs onput mouse to be compatible wit Linux 2013-11-28 21:13:40 +01:00
c6928fa591 [DEBUG] Remove some unused element of c++11 in MacOs and set it work again 2013-11-28 00:55:19 +01:00
c89f157d1a [DEV] add extra compilation flags & correct warning 2013-11-27 21:33:34 +01:00
e975c52b6e [DEV] basic think of annimation widget properties 2013-11-26 21:55:39 +01:00
d6a26db4a5 [DEBUG][X11] repeate key correction 2013-11-25 21:14:45 +01:00
073e03aa42 [DEV] change name of message on entry and button ==> TODO: Think of naming 2013-11-23 18:29:56 +01:00
f5650f16f6 [DEBUG] widget scrolling correction 2013-11-21 21:49:43 +01:00
03d797a133 [DEBUG] remove multiple request update of display 2013-11-20 21:17:06 +01:00
09b7f9a749 [DEV] update the main structure of the application 2013-11-19 22:21:42 +01:00
f3b3967b1e [DEV] android compilation correction 2013-11-17 20:35:46 +01:00
079a376acf [DEV] add basic windows message API 2013-11-14 23:43:55 +01:00
971905b0d5 [DEBUG work again 2013-11-14 21:40:30 +01:00
905091d3fd [DEBUG] correction of text size 2013-11-14 07:49:09 +01:00
9a9293a3fc [DEV] correction of stl-port 2013-11-13 21:52:12 +01:00
aff6c5fd38 [DEV] change idea std::u32string to std::string 2013-11-12 21:58:13 +01:00
410db2d5e0 [DEV] integarate std x11 2013-11-11 20:20:05 +01:00
ff1f2692de [DEV] change enum naming 2013-11-10 14:47:53 +01:00
fa21a34b0a [DEV] work on DOC and remove deprecated widget::Drawable 2013-11-09 10:14:07 +01:00
2235522951 [DEV] add correct stdPopUp and start integration of documantation 2013-11-08 22:31:45 +01:00
f73a5b80c4 [DEV] add capability of pop-up 2013-11-07 21:29:51 +01:00
149405880d [DEV] update progressBar 2013-11-06 21:26:37 +01:00
adc4ad0c45 [DEV] add property on progress bar 2013-11-05 21:01:02 +01:00
3af8ef44cc [DEV] small change 2013-11-04 22:34:40 +01:00
5f7e692fa4 [DEV] correction of the fond selection 2013-11-04 21:00:46 +01:00
1d58222faa [DEV] corection of multiple font loading and EObject remove events 2013-10-30 21:12:26 +01:00
0dcc4005a4 [DEV] herited resouce from EObject 2013-10-28 21:03:30 +01:00
1fdee93ba0 [DEV] resource return error 2013-10-27 22:15:06 +01:00
54c65f4b0c [DEV] update Debug in debug 2013-10-25 20:48:54 +02:00
96b0b68ac8 [DEV] some coding style update 2013-10-24 21:16:28 +02:00
1127ed0543 [DEV] UniChar ==> UChar & Hach ==> Hash 2013-10-18 21:15:02 +02:00
739082cf36 [DEV] text code style corection 2013-10-16 21:53:17 +02:00
a05707e55a [DEV] correction of andoid port and remove some log 2013-10-10 21:56:48 +02:00
aee421c216 [DEBUG] stop correction 2013-10-10 07:52:41 +02:00
90eb3d1ae3 [DEV] end coding style 2013-10-09 22:27:38 +02:00
b63e6d33b2 [DEV] code style '_' & '{' at end of line 2013-10-08 22:32:40 +02:00
7254b172e8 Merge branch 'master' of https://github.com/HeeroYui/ewol 2013-10-08 09:32:49 +02:00
9e540f286e [DEV] coding style step 1 2013-10-07 22:09:13 +02:00
21441ab5aa [DEV] coding style in progress 2013-10-03 23:56:01 +02:00
d9177e4565 [DEV] coding style add 2013-10-02 21:28:16 +02:00
6ca87b6a79 [DEV] sent the keyboard status with the event keyboard 2013-09-30 22:26:50 +02:00
fa2ecb4237 [DEV] Correction of compilation error on 32 bits 2013-09-30 21:55:07 +02:00
e434ab4f8a [DEV] add dynamic enable of the fps view 2013-09-30 21:26:58 +02:00
7a8cabb625 [DEV] dynamic font add elements and support multyple language 2013-09-30 00:06:39 +02:00
a1e89a83a1 [DEV] corect the intut of the keyboard in utf8 2013-09-29 13:55:46 +02:00
b7dc1089ee [DEV] some corection of the compilation 2013-09-26 22:49:37 +02:00
5ca92a90cb [DEV] mac work again but not ended anymore 2013-09-25 15:25:47 +02:00
21f0a6856a [DEBUG] retrive clipboard 2013-09-19 09:20:26 +02:00
a5f08902cf [DEV] change mesh private in protected 2013-09-15 22:47:49 +02:00
4fc426c414 [DEV] add some optionnel parameter to display 2013-09-13 21:52:18 +02:00
318e44f571 [DEV] corection of mesh contructor 2013-09-09 06:33:35 +02:00
a131e75b28 [DEV] change resource property 2013-09-06 21:51:24 +02:00
0d4cd4749b [DEV] add at the impage compositing the Z position 2013-09-05 21:21:17 +02:00
d010c5ec2d [DEV] enable suspend mode in periodic call 2013-09-04 22:04:31 +02:00
be8264edf9 [DEV] multiple instance work on android 2013-09-04 21:02:55 +02:00
547c9c4d65 [DEV] android multiple instance testing 2013-09-03 22:56:05 +02:00
8fd060fd03 [DEV] rework android Context 2013-09-03 21:46:15 +02:00
d5d2297e7f [DEBUG] set the system rework corectly (step 5) 2013-09-02 21:49:30 +02:00
f52a6919e3 [DEV] rework some global elements (step 5) 2013-09-02 06:46:49 +02:00
3b874d3786 [DEV] change all directory and rework some names (step 4) 2013-08-30 22:33:05 +02:00
f89d88e62a [DEV] rework (step 3) 2013-08-30 07:46:21 +02:00
4a8aa9f7b0 [DEV] Rework the library to support multiple instance (step 2) 2013-08-29 21:50:41 +02:00
1fd451961e [DEV] start a compleate rework of the lib to support the multiple instance in one binary ==> not win at all (BREAK) 2013-08-28 21:35:24 +02:00
8668ac9dd0 [DEV] correction of error of openGl error when lose context 2013-08-27 23:52:39 +02:00
371a3cb599 [DEV] add Windows background color and image rotation 2013-08-27 21:36:49 +02:00
7cb1648d6e [DEV] basic wallpaper will work 2013-08-26 22:07:12 +02:00
010586a0fa [DEV] first java files for android liveWallpapers 2013-08-26 21:28:04 +02:00
bffa93d136 [DEV] update submodule 2013-08-24 22:04:53 +02:00
0be9626063 [DEV] update mesh properties to had extern shape 2013-08-21 22:10:03 +02:00
2b946f19d0 [DEV] better mesh display and other 2013-08-20 22:33:30 +02:00
8aa072783d [DEV] displa only the face visible 2013-08-20 21:01:19 +02:00
9e908e992d [DEV] try to display only the triangle visible 2013-08-19 21:57:42 +02:00
d4dfe30d23 [DEV] add convex hull parsing 2013-08-18 20:51:17 +02:00
e95323e974 [DEV] corection of the Android compilation 2013-08-14 23:43:35 +02:00
eb5c43c836 [DEV] Add ege in submodules 2013-08-13 21:53:21 +02:00
088198ad5b [DEV] init the physcs shape 2013-08-12 22:51:24 +02:00
5279f00379 [DEV] better physic properties management 2013-08-12 21:55:05 +02:00
3f2ba7907f [DEV] add physics parsing 2013-08-11 22:32:33 +02:00
937a6e5e9d [DEV mesh parser OK 2013-08-09 21:00:35 +02:00
d1dbab0c94 [DEV] start new methode of parsing mesh file 2013-08-09 09:10:13 +02:00
9b5d1fa4f2 [DEV] change mesh exporter (add stupid collision model 2013-08-08 22:39:30 +02:00
6e718229b8 [DEV] work on the blender exporter 2013-08-07 23:52:07 +02:00
297d836d18 [DEV] start adding collision shape support 2013-08-07 21:22:13 +02:00
a58bd9f6c4 [DEV] Remove optimisation of VBO internal data 2013-08-06 21:20:35 +02:00
f2c08210a2 [DEV] add debug cycle count for mesh generation 2013-08-06 21:15:22 +02:00
aea2495886 [DEV] mesh can be redisplayed (for .emf) 2013-08-06 21:08:30 +02:00
a70ca277e0 [DEV] start integration of the emf file ==> has more capabilities than obj (emf is specific ewol mesh file) 2013-08-05 20:49:58 +02:00
7fecf6cd89 [DEV] add json dependency 2013-08-01 22:37:02 +02:00
70036262be [SUB] add ejson 2013-07-31 20:50:56 +02:00
6ea4035942 [DEV] shader loading corection and touch scrooling corection 2013-07-25 22:04:02 +02:00
d535450eb5 [DEV] correction of the multiple load of the images 2013-07-24 23:25:01 +02:00
1682a44288 [DEV] Remove dependency with external zip archive system 2013-07-24 22:30:18 +02:00
587aad91dc [DEV] remove support of the 64 bit zip file 2013-07-24 22:30:18 +02:00
Keidan (K. Billonneau)
82c876fa9c Merge branch 'master' of github.com:HeeroYui/ewol 2013-07-24 07:49:19 +02:00
Keidan (K. Billonneau)
d073a04e29 [DEV] Fix reference to java object + Fix memory leak in setTitle 2013-07-24 07:46:36 +02:00
f6fc204114 [DEV] add minizip at the zlib tools 2013-07-24 07:43:48 +02:00
Keidan (K. Billonneau)
ced259175f [DEV] oups... 2013-07-24 06:22:42 +02:00
Keidan (K. Billonneau)
3091c8d8d9 [DEV] fix log type 2013-07-24 06:19:32 +02:00
af9749013a [DEBUG] overwrite error corection for android java 2013-07-23 21:38:05 +02:00
3b23c15a91 [DEV] android is back
Update header licence of the java files
Update font search
Corection of the dimention system ==> might be tested again
2013-07-13 22:20:46 +02:00
Keidan (K. Billonneau)
d92b24b89d [DEV] remove useless file 2013-07-12 06:50:02 +02:00
Keidan (K. Billonneau)
40c95e1f92 [DEV] add abstraction file... 2013-07-12 06:49:21 +02:00
Keidan (K. Billonneau)
eb8660b8ea [DEV] limit visibility 2013-07-12 06:48:38 +02:00
8fdd1f0a45 [DEV] try correct some bugs 2013-07-11 15:06:29 +02:00
Keidan (K. Billonneau)
a47d58c35f [DEV] Fix static 2013-07-11 14:02:48 +02:00
Keidan (K. Billonneau)
fcde1ff26f [DEV] add setTitle from C to Android + some improvements 2013-07-11 07:01:49 +02:00
Keidan (K. Billonneau)
0df2c89ed0 [DEV] fixes the compatibility with the java code... not tested... 2013-07-10 19:07:03 +02:00
Keidan (K. Billonneau)
59483ab23b [DEV] remove... 2013-07-10 19:02:20 +02:00
Keidan (K. Billonneau)
c3027c2313 [DEV] do not commit the generated header file 2013-07-10 18:53:12 +02:00
Keidan (K. Billonneau)
315cc9faf9 [DEV] add generation of the EwolConstants header (org_ewol_EwolConstants.h) 2013-07-10 18:49:18 +02:00
Keidan (K. Billonneau)
0a0eae8262 [DEV] rename PROJECT_NAME.java to EwolActivity.java; add the method initApkPath; change the activity type to abstract 2013-07-10 18:47:43 +02:00
Keidan (K. Billonneau)
0c78b84728 [DEV] move SDK_VERSION from EwolConstants into EwolSurfaceViewGL 2013-07-10 18:43:33 +02:00
Keidan (K. Billonneau)
dcf8549f5e [DOC] update file description 2013-07-10 18:41:34 +02:00
c00e4d3e33 [DEV] correction for windows compilations 2013-07-10 16:56:38 +02:00
74c9974693 [DEV] remove deprecated files 2013-07-09 15:18:04 +02:00
595495b8bd [DEV] Update of the choice of standardize the Color class 2013-07-09 15:15:51 +02:00
d2a0e5005b [DEV] add ogre wrap file 2013-07-05 22:28:42 +02:00
efe8524fa0 [DEV] add ogre basic compiler 2013-07-04 21:50:52 +02:00
fa22a42572 [DEV] better pop-up 2013-07-03 22:25:54 +02:00
Kevin BILLONNEAU
532812d50c Force extends Activity and EwolCallback implementation
The JNI code, coming soon
2013-07-02 22:14:44 +02:00
dee4851a45 [DEV] update sub libs 2013-07-02 22:06:23 +02:00
efe7224f69 [DEV] update at the last exml 2013-06-30 17:05:01 +02:00
774e743271 [DEV] update to the nex exml API 2013-06-28 22:27:29 +02:00
cad47bd419 [DEV] add font multiple 2013-06-27 22:45:26 +02:00
b7196e577c [DEV] update the modules list 2013-06-27 07:40:07 +02:00
da97bea5df [DEV] exml update and tested 2013-06-26 23:20:24 +02:00
8a159b8ca3 [DEV] port for exml 2013-06-24 21:53:27 +02:00
12c2831a20 [DEV] popup add fill state 2013-06-18 21:33:28 +02:00
K. Billonneau
0397c2ec98 Fix class name 2013-06-14 22:22:06 +02:00
f6713ef18a [DEV] better pop-up shaper and list 2013-06-12 22:38:54 +02:00
c2cdab446f [DEV] add capabilities at the pop-up system 2013-06-11 21:47:23 +02:00
0b3fe6d74a [DEV] correct the id of the WSlider ==> unique even if whe change the order of the widget (remove... 2013-06-07 21:50:24 +02:00
d2d8b6fca1 [DEV] add sprite correct diaplsy and input maximum number segfault error 2013-06-03 22:35:05 +02:00
47ea209279 [DEV] add sprite properties 2013-06-03 08:03:42 +02:00
e12bea33e3 [DEV] change the periodic system (better model) 2013-06-01 21:43:20 +02:00
d3ee207699 [DEV] rewrite the _ at the compositing element 2013-05-31 23:19:03 +02:00
426403da3b [DEV] rework some _ at function parameter 2013-05-31 09:03:13 +02:00
6ff6693871 [DEV] MAC : mouse event availlable and periodic display (limited at 30 fps???) 2013-05-29 23:31:38 +02:00
b4940a4bc3 [DEV] update Android interface 2013-05-29 21:47:05 +02:00
d7ffe6af4d Merge remote-tracking branch 'origin/android-rework' 2013-05-29 21:06:38 +02:00
0bb1a97ff3 [DEV] add the linker on MACOS API event handler 2013-05-29 21:06:38 +02:00
2ac2b5057e [DEV] add mac basic event 2013-05-29 07:23:22 +02:00
c2b7cedb8c [DEV] add a system for stadard user global config saving 2013-05-28 21:18:45 +02:00
3f74842f8e [DEV] remove deprecated interface of C interface for mm files 2013-05-27 21:30:22 +02:00
0883358f83 [DEV] add capabilities at the WSlider widget' 2013-05-27 21:12:55 +02:00
f39ee975d6 [DEV] add api at WSlider 2013-05-26 21:58:15 +02:00
Keidan
faa2c07d07 Fix @file 2013-05-25 18:46:26 +02:00
Keidan
1022f2d86a Rework java structure 2013-05-25 18:42:36 +02:00
e2eef30159 [DEBUG] remove assertion when update context openGl ==> get wrong table 2013-05-25 11:43:08 +02:00
bcd42f4fc6 [DEV] add date library that will be the only one eleement to rebuild in case of date change (will be rebuild every second , like this we did not have to rebuild all the library that will have the build time 2013-05-25 10:58:47 +02:00
b35988ef89 [DEV] better display of the rounded theme 2013-05-25 10:56:57 +02:00
31b6134640 [DEV] add an api to add event of other widget than the composer itself 2013-05-25 10:56:21 +02:00
e0cd309140 [DEV] add shader display for the pop-up element and dynamic event on the button rounded 2013-05-23 21:50:52 +02:00
a6b7e7b132 [DEV] better context menu display and some small corection 2013-05-23 05:07:53 +02:00
485aca72bc [DEV] add capabilities at the context menu 2013-05-22 22:16:40 +02:00
a453644324 [DEV] remove unneded openGl mode 2013-05-22 22:13:46 +02:00
9b025cee66 [DEBUG correction of the half pixel display on the widget 2013-05-22 21:28:45 +02:00
81458d0523 [DEV] correct layer getWidgetAtPos and remove temporary debug to fing string error, and add functotion to remove sub element in delayed 2013-05-20 22:09:16 +02:00
0c36f880db [DEV] add the possibility to draw triangle with negative size 2013-05-20 22:07:20 +02:00
90ca5367e8 [DEV] remove unneded debug log 2013-05-17 21:00:37 +02:00
13802b799c [DEV] add debug 2013-05-17 07:40:20 +02:00
11515a82f5 [DEV] add debug on dimention 2013-05-16 22:03:45 +02:00
810abe02bc [DEV] try to find a display error due to a minimal size who is wrong 2013-05-16 21:58:02 +02:00
a8dae7592c [DEV] base update of the unichar rework 2013-05-15 21:11:16 +02:00
3b5943c1b2 [DEV] add button keep under element name, composer add register sub event with widget name, scroll add limit parameter 2013-05-15 00:05:58 +02:00
5c1fe0db5b [DEV] add a system of message configuration toolbox ==> permit to configure a EObject expecting his type without arbitrary castin widget 2013-05-14 22:35:33 +02:00
1fd5b53688 [DEV] corection of the Display widget clipping and add some capabilities 2013-05-12 21:02:30 +02:00
66924458eb [DEV] change the keyboard and mouse event function 2013-05-08 12:20:47 +02:00
5d7152f572 [DEV] compile on windows platform 2013-05-01 16:19:01 +02:00
637d972f7e [DEV] update sub module' 2013-04-26 23:48:51 +02:00
b2f2255532 [DEV] remove old build system (replace by lutin) 2013-04-25 22:53:51 +02:00
7afec192d1 [DEV] correct the pop-up error size and parameter tool exit button 2013-04-25 22:53:51 +02:00
a7d4bf13fa [DEV] correction of the clipboard copy and middle to export 2013-04-25 21:25:05 +02:00
f71053f2f6 [DEV] MacOS support work again 2013-04-25 00:57:47 +02:00
150df589e6 [DEV] segfault correction and dynamic management of the font position 2013-04-24 12:53:32 +02:00
6533b8af29 [DEV] add the windows correct compilation 2013-04-23 22:52:06 +02:00
2751698679 [DEV] corection of the lutin makefile for ewol 2013-04-22 21:21:36 +02:00
63d20a72e1 [DEV] update 'lutin' build system 2013-04-21 22:29:27 +02:00
3c84f23849 [DEV] update the maker 2013-04-19 22:31:55 +02:00
c288f87914 [DEV] correct build with new methode of the edn soft ==> no dependence and no clean 2013-04-18 22:51:51 +02:00
9e4b987ffa [BUILD] basic makefile for python maker 2013-04-18 01:55:05 +02:00
291e18e294 [DEV] start work pyton maker 2013-04-17 21:40:23 +02:00
a415669c60 [DEV] correct android set of the wondows size ratio 2013-04-17 21:19:46 +02:00
80dfa5fdbf [DEV] mac first openGL view of the exol real display 2013-04-16 22:44:36 +02:00
a5451a9f7f [DEBUG] correction of debug and expand of sizer 2013-04-16 21:12:20 +02:00
87676f657a [DEV] generate warning when delete in an error state and rework pop-up and contextmenu 2013-04-15 21:18:54 +02:00
3e29816651 [DEV] image rework base ok 2013-04-14 14:07:14 +02:00
b46542ca8d [DEV] rework of the ContainerN ended start rework of image widget 2013-04-12 22:24:04 +02:00
3ff3c38710 [DEV] end composer and add a container obstraction 2013-04-11 21:24:22 +02:00
3bb4c6a700 [DEV] end of rework the main widget class ** it will be finish now 2013-04-10 22:26:28 +02:00
2d209cd37e [DEV] widget back to work on test woft ==> not ended (some mistake to correct) 2013-04-10 21:05:45 +02:00
36dbd60e19 [DEV] new Dimension management 2013-04-09 23:30:14 +02:00
100fbd43e2 [DEV] start to reworks the widget class to simplify and normalize it (last rework) 2013-04-09 21:17:47 +02:00
56eafd762f [DEV] Start rework of the button 2013-04-08 21:30:25 +02:00
b3465bcf44 [DEV] first open GL display on MACOSX ==> simple triangle... 2013-04-07 23:42:23 +02:00
09ef9c8a19 [DEV] first windows display ==> nothing else pn MAC 2013-04-07 13:15:48 +02:00
7e48ed5172 [DEV] update SEEK in bmp images 2013-04-05 22:14:45 +02:00
ac36b0b6a5 [DEV] better maagement of the Program shader and add converter of the screen size 2013-04-04 21:27:23 +02:00
c4d156d462 [DEV] try a basic windows on cocoa 2013-04-04 01:54:38 +02:00
ca352c94d9 [DEV] start dev on MACOS interface 2013-04-04 00:47:42 +02:00
feb1ed56af [DEV] add a basic gird on the widget to display subWidget 2013-04-03 22:32:35 +02:00
27a6281357 [DEBUG] try to find remove error 2013-04-02 21:32:46 +02:00
f892d5981e [DEV] correction of the home folder of the Meta widget open 2013-04-02 21:00:40 +02:00
d5f406db8f [DEV] add mesh basic display 2013-03-28 21:46:48 +01:00
7df6071476 [DEV] add some capacity at the 3d direct draw 2013-03-27 21:21:24 +01:00
0de61c3dc1 [DEV] add the management of the screen display size 2013-03-26 22:26:44 +01:00
b83589e174 [DEV] create a unique sizer for vert and hori ==> this is simple to manage 2013-03-22 20:57:42 +01:00
9a18f605d9 [DEV] change the message data between widget to the const data 2013-03-22 23:06:41 +01:00
1c5b6159cc [DEV] add update on agg lib 2013-03-21 00:07:57 +01:00
9dccd96fde [DEV] something has been done 2013-03-15 23:26:16 +01:00
9a84c63701 [DEV] set text testing depth 2013-03-15 07:35:05 +01:00
90bb349138 [DEV] better mesh display using indec istead of direct drawing all point 2013-03-14 21:50:17 +01:00
c870d2471e [DEV] display optimesation next step done 2013-03-13 21:29:51 +01:00
75df3e4b8b [DEV] start OpenGl abstraction ==> for faster display 2013-03-12 21:51:02 +01:00
09103e3073 [DEV] correct some error in the display of the Button Image 2013-03-11 23:29:40 +01:00
d84e4b8d53 [DEV] Remove some dependency of the sub library 2013-03-11 22:55:34 +01:00
228999d144 (DEV) first compilation on MacOsX ==> not work due to the X11 interoperability error 2013-03-09 17:45:51 +01:00
19c162eff2 [DEV] better management of light and material for 3D mesh 2013-03-07 21:37:14 +01:00
1c8ce9488c [DEV] add light management with simple add of Material and Light classes==> can be better, but a good start 2013-03-06 21:53:47 +01:00
a602665e10 [DEV] multiple texture availlable and better mesh 2013-03-05 21:11:33 +01:00
c56289dbfd [DEV] Add calculation of the normal and the vertex normal for mesh 2013-03-04 21:53:43 +01:00
71af7fe7d2 [DEBUG] corect windws compilation and missed init in the shaper tool 2013-03-03 20:59:47 +01:00
2794b6e18f [DEV] implement catmul-clak algorithm 2013-03-03 16:00:59 +01:00
71aefe981c [DEV] change the mesh properties and add a basic subdivider 2013-03-02 12:02:15 +01:00
c53664d973 [DEV] try to have better mesh management and subdivision try 2013-03-01 22:28:14 +01:00
4872bfcbf9 [DEV] better init in some widget 2013-03-01 09:14:12 +01:00
8b8f48b654 [DEV] add the basic compositing on image 2013-02-28 21:21:17 +01:00
b9bedb8b36 [DEV] set the correct sens of the texture (reverted) 2013-02-20 21:01:04 +01:00
01e5b2dc2a [DEV] missing somme element 2013-02-18 17:25:45 +01:00
1598324f57 [DEV] add etk properties 2013-02-16 15:52:59 +01:00
872d353e3b [DEV] have a correct display xith forcing X11 interface 2013-02-08 21:20:03 +01:00
da0642e4cb [DEV] direct FB basic implementation (does not work on PC) 2013-02-07 23:23:47 +01:00
4127dfbfdf [DEV] Android update the vec3 new access 2013-02-05 23:05:07 +01:00
f4e056348a [DEBUG] log wrong extention error print 2013-01-30 22:31:31 +01:00
a05a5adccb [DEV] change the multiple event on keyboard 2013-01-29 22:20:32 +01:00
e7503c8824 [DEV] update display to the nec vector3D 2013-01-28 22:17:43 +01:00
aa17623425 [DEV] try to set the system back to work 2013-01-28 08:10:10 +01:00
73a42f4e17 [DEV] update all the element at the new etk vectir nomage (like bullet) 2013-01-25 23:53:27 +01:00
bb3307f736 [DEV] set bulit linearMath in a sub librairy 2013-01-23 22:01:41 +01:00
0004c7710f [DEV] remove call of java when system is not autorised of turn screen 2013-01-18 22:14:04 +01:00
53a678cdd1 [DEV] VBO work correctly on computer 2013-01-16 23:42:34 +01:00
857d475d23 [DEV] first display with VBO ... just vertex... 2013-01-16 23:12:07 +01:00
ba5bbea967 [DEV] start to work on VBO integration 2013-01-15 22:35:52 +01:00
5592c02b28 [DEV] remove multiple acess load of mesh object element 2013-01-14 21:59:56 +01:00
24e562454c [TEST] basic real display 2013-01-14 23:27:10 +01:00
38932b616b [DEV] remove old game engine ==> deprecated ... 2013-01-11 23:18:05 +01:00
d021b82631 [BUILD] Windows compile correctly 2013-01-11 07:30:30 +01:00
0dffbae44d [DEV] Better shader debugLog, and bullet compatibility with Android 2013-01-10 22:02:13 +01:00
e79a88c7f1 [DEV] better display on the Shapes 2013-01-10 07:29:32 +01:00
47e254d812 [DEV] display corectly the world with internal openGLES2 2013-01-09 22:35:16 +01:00
db90b5a629 [DEV] try to display the basic exemple with ewol generic display 2013-01-08 22:39:27 +01:00
c4548c5241 [DEV] base of the scene working with bullet 2013-01-08 07:13:41 +01:00
a781cf4c26 [DEV] Basic integration of the bullet librairy 2013-01-07 22:36:22 +01:00
896cdf4891 [DEV] force respond on collision detection (error) 2013-01-07 07:04:14 +01:00
a8b350ea5a [DEV] tunel detection correct, slow, but correct ... 2013-01-06 15:13:15 +01:00
a468a3424a [DEV] Change the bounding to the old AABB methode and start the catching of the tunel effects 2013-01-04 22:52:56 +01:00
93d3e62b8e [DEV] Simplify the Game engine 2013-01-03 21:03:23 +01:00
549ac760d7 [DEV] detect bounding and display bounding simplify 2013-01-01 21:56:39 +01:00
d1e48b5d0d [DEV] add AABB bounding alculation and display of it 2012-12-30 21:11:38 +01:00
d9317dc227 [DEV] change the fragment shader to be compatible with openGL ES2 and some other corrections 2012-12-28 23:17:50 +01:00
dcdd44aa54 [DEBUG] compilation is back for windows platform 2012-12-27 22:29:28 +01:00
37626d9350 [DEV] compilation is back on android ==> system not work 2012-12-27 22:29:28 +01:00
59aeef49a0 [DEV] Icon correct creation 2012-12-27 21:57:47 +01:00
e3c04a3345 [TAG] new tag 2012-12-26 22:12:50 +01:00
3d576e3a1d [DEV] Add Cursor types and display on x11 and capacity to force the cursor in ofset mode for games 2012-12-26 21:16:26 +01:00
a35c4def77 [TREE] remove the test software 2012-12-23 19:51:06 +01:00
426faa2012 [DEV] grep the mouse events 2012-12-20 22:09:45 +01:00
95c94a9c9e [DEV] Remove automatic key respown on X11 2012-12-19 23:28:27 +01:00
57c22f93ef [DEV] basic FPS view with so beautifull grass 2012-12-19 21:57:40 +01:00
cc07a77377 [DEV] real display of a scene with real perspective 2012-12-19 00:47:02 +01:00
10f7131b62 [DEV] add camera system on the game engine 2012-12-18 23:16:40 +01:00
326dccb94d [DEV] create the basic gravity equations 2012-12-18 22:09:27 +01:00
4b4758bc7f [DEV] import engine instead of creating an extern 2012-12-17 22:21:54 +01:00
03876b5a71 [DEV] display scene is back 2012-12-17 07:56:33 +01:00
c84caed8ba [DEV] start basic test of the scene 2012-12-14 22:30:27 +01:00
b6d11d78e2 [DEV] Start dev of the physic engine 2012-12-13 22:50:30 +01:00
28a044fb00 [DEV] compilation error 2012-12-13 22:30:57 +01:00
d56017aacf [DEV] First rework of the scene system 2012-12-11 22:08:53 +01:00
160fd67d03 [DEV] better dynamic position of widget::Label 2012-12-06 21:46:18 +01:00
9b9b2b9956 [DEV] Add basic test of label 2012-12-05 22:58:21 +01:00
3629dd679d [DOC] change the dependency package to compile 2012-12-05 20:11:25 +01:00
6de53cf3f2 [DEBUG] corection of some error in the X11 abstraction and key event french name 2012-12-04 23:27:08 +01:00
ae29b34eab [DEV] adapt vector 2D, 3D and 4D wrapper with statdard glsl vec[2-4] ivec[2-4] and std mat4 2012-11-30 22:45:55 +01:00
d61e67773c [DEV] color button and corection of the unsupressed widgets 2012-12-02 20:34:44 +01:00
426cbbfa78 [DEV] back working of ButtonColor and colorBar 2012-12-01 21:33:05 +01:00
dc6e4eeb49 [DEV] End of simple button developement start of buttonColor rework 2012-11-30 22:45:55 +01:00
22e5c62c42 [DEV] Better button event 2012-11-30 08:56:46 +01:00
fbcb6148ad [DEV] Multiline button is OK ==> gui display is not compleately ended 2012-11-29 22:13:54 +01:00
d69a964459 [DEV] create a better button with test application for it 2012-11-28 22:51:29 +01:00
67e4d5363c [DEV] add test software to show wat is possible and test every mode of the widget system 2012-11-28 22:39:43 +01:00
acd70a322c [DEBUG] corection of the broadcast message of shortcut 2012-11-27 23:02:48 +01:00
e0bdd48984 [DEV] corection of the scrollbar 2012-11-27 23:02:01 +01:00
6727919ee9 [DEV] set the entry box working with the shaper system 2012-11-27 22:08:25 +01:00
fb3973915f [DEV] create shaper to simplify widget theme creation 2012-11-27 21:27:47 +01:00
4f296ba2b9 [DEV] start clean eSystem 2012-11-26 21:53:04 +01:00
50db842954 [DEV] working not so bag, but rework not ended 2012-11-25 11:54:17 +01:00
d045b4bd14 [DEV] Compilation of ewol is back ==> not working 2012-11-23 23:55:21 +01:00
7cb9eb91d6 [DEV] compile the first widget 2012-11-23 07:46:20 +01:00
f45c7a6743 [DEV] Rework of the internal tree and system 2012-11-22 22:28:05 +01:00
6921fd4467 [DEV] a little step 2012-11-21 22:48:50 +01:00
15c71ebe1a [DEV] Rework compleately EWOL to simplify and set it more user-frendly NO-MORE-COMPILE 2012-11-21 21:56:37 +01:00
c3dde8d2ac [DEV] Parse decorated text like a html page 2012-11-20 21:56:12 +01:00
f848ee4ce0 [DEV] change etk version 2012-11-20 07:33:17 +01:00
6356d8b1d5 [DEV] Text compisiting element is now OK 2012-11-19 21:16:14 +01:00
3a41e938a6 [DEV] Text compositing is now able to display background color 2012-11-19 10:02:00 +01:00
cfa965269d [DEV] compositing in progress : starting Draw and Text (nearly ended) component 2012-11-19 07:58:25 +01:00
640810ee8d [DEV] Basic display of the compositing font (justify availlable) 2012-11-16 23:37:21 +01:00
303b08da9d [DEV] Start the writing of the Text compositing 2012-11-16 09:29:14 +01:00
a04e79f0c7 [DEV] Search of the new user API for creating Widget and other things as simply as possible 2012-11-15 21:11:38 +01:00
1a4e18c7c5 [DOC] add the comment on the OpenGL access 2012-11-15 10:02:55 +01:00
d1615e3a77 [DEV] compilation selection of the embended fonts 2012-11-15 07:42:16 +01:00
de752fb642 [DEV] Rework Font : Add the kerning on the No-Monospace font ==> pretty good 2012-11-14 21:19:57 +01:00
7aeb65a0aa [DEV] Load the font with bold italic mode and load it in the basic folder of the file system 2012-11-13 22:55:02 +01:00
08e97b1fba [DEV] open the good file for 3d textured 2012-11-12 17:15:35 +01:00
17dfbc7cb1 [DEV] add the zlib submodule in the correct position 2012-11-12 09:24:09 +01:00
141e3b98b0 [DEV] change the android directory 2012-11-12 01:40:30 +01:00
63b742b737 [DEV] first read of the png file ==> ok / no write function 2012-11-11 20:38:20 +01:00
59e59142ed [DEV] rework of the external lib tree ended 2012-11-10 16:23:44 +01:00
e81fa93885 [TREE] this might be correct for all the sub lib 2012-11-10 15:19:37 +01:00
fa25024b32 [TREE] try to rework the tree of the librairie 2012-11-10 14:43:01 +01:00
2dcce5ea5a [TREE] remove deprecated file 2012-11-09 21:47:54 +01:00
d290405cfa [DEV] change all the header file and remove comment in the cpp file when comment is in the .h file 2012-11-09 21:38:58 +01:00
094ea2de4e [DEV] set icon in the Automatic Theme folder 2012-11-09 10:00:23 +01:00
9cf545c434 [DEV] change getting tag policy and remove choice of openGL-ES1 2012-11-09 01:47:10 +01:00
14f878bdd2 [DEV] reorder the list of files 2012-11-08 22:40:17 +01:00
f2b754ddb7 [DEV] Basic dynamic widget (button) 2012-11-07 22:42:53 +01:00
efe4386c3a [DEV] add a basic theme changer and the config file for the button parameter ==> must work on it 2012-11-06 22:35:00 +01:00
1b7163e79c [DEV] new button shader system ==> must be reworked 2012-11-04 19:04:59 +01:00
b0b619da82 [DEV] new button shader system ==> must be reworked 2012-11-04 19:04:12 +01:00
d3eed67f00 [DEV] compilation back on Android/windows 2012-11-04 15:44:26 +01:00
508162dfc8 [DEBUG] scrolling bar display again ==> bad color definition 2012-11-03 17:06:36 +01:00
e6e6b4c89f [DEV] set the file access back with the new file system mode 2012-11-03 17:05:51 +01:00
575ef0de03 [DEV] Add capacity to the etk::FSNode ==> all is not good, but it is a good start 2012-11-02 18:11:38 +01:00
40dc60eb8a [DEV] update etk::FSNode for Android ==> not tested 2012-11-02 07:40:12 +01:00
b03d4c0047 [DEV] Change the etk::File in etk::FSNode to have a compleate abstraction of the file system 2012-11-01 10:48:01 +01:00
b039a0fb29 [DEV] change the idea of file obstraction now it is folder/file/link see has FSNode 2012-10-31 22:18:45 +01:00
431e5e8886 [DEV] Rounded corner and add theme folder ant rework File/Folder IO access... 2012-10-31 18:05:54 +01:00
e1d99c0646 [DEV] Add resource loading .obj files 2012-10-30 18:20:47 +01:00
ad78c67548 [DEV] Add capability of the mathematic element of etk system 2012-10-29 18:06:40 +01:00
98f1efe59f [DEV] Update build lib 2012-10-28 20:32:37 +01:00
eb2a46e0c1 [DEV] add files in the copy system 2012-10-27 17:46:34 +02:00
cb854ca972 [DEV] copy files in the staging directly 2012-10-27 01:30:59 +02:00
89fee7fab5 [DEV] copy file directly in the staging directory 2012-10-26 17:46:25 +02:00
37bd7b152a [DEV] set etk::Vector2D and new Matrix(n,m) 2012-10-26 17:00:22 +02:00
d57ac3b94f [DEBUG] correction of the none display of the cursor 2012-10-25 18:11:21 +02:00
215ee55c77 [DEV] Entry: First test of the Entry box directly generate with shader 2012-10-25 17:53:29 +02:00
6bfcd0513a [DEV] Entry: Set the text moving left to right 2012-10-25 10:32:49 +02:00
5b0807d3dd [DEV] change color of the selection of the Entry widget 2012-10-24 17:08:06 +02:00
eccc2d69d7 [DEV] adding capacity of copy/paste/selection at the entry widget 2012-10-24 14:23:24 +02:00
d71bbfea08 [DEBUG] correction of the vector displying error 2012-10-24 14:22:19 +02:00
e795911933 [DOC] add dependence of the packages 2012-10-24 14:21:48 +02:00
95a7ecb29f [DEV] Better Entry widget & change the short-cut system to permit to have multiple shortcut depending of the widget 2012-10-23 17:48:59 +02:00
809c8a3d5c [DEBUG] pb in the font display condition 2012-10-23 10:14:51 +02:00
ba0b1256d6 [DEV] display font with clipping availlable 2012-10-19 15:20:10 +02:00
ace466b7bd [DEV] support multiple android version 2012-10-18 18:17:14 +02:00
f9f619b90d [DEBUG] correct the get of resource size in power of 2 2012-10-18 18:16:43 +02:00
2730fd9bb6 [DEBUG] remove the grepping of hardware button of android 2012-10-17 17:30:23 +02:00
18087d132a [DEBUG] reset zoom in scrolled windows when ctrl+middle button 2012-10-17 17:29:39 +02:00
ff84a9ea20 [DEV] a little better list display ==> multiple colomn 2012-10-17 13:30:15 +02:00
051624b12e [DEBUG] missing virtual in the destructor 2012-10-16 18:33:10 +02:00
cd39ae1512 [DEV] display an image background on the scene 2012-10-12 18:14:50 +02:00
f5c65e0fb6 [DEV] change the policy of the background of the scene and set the shortcut on Fxx key 2012-10-11 18:08:30 +02:00
a70c2055b9 [DEV] add VBO for openGL (not tested) and set code to reload shaders 2012-10-10 18:09:54 +02:00
e3a379dd62 [BUGFIX] update the selection of a new file in the file selection 2012-10-09 13:56:19 +02:00
db7b31dc61 Upgrade display distance fiead 2012-09-14 17:22:39 +02:00
236784a6d3 new compilation mode for android system 2012-09-12 18:18:38 +02:00
1b51dc051e Generation of the Manifest and better configuration file 2012-09-11 18:21:00 +02:00
ce198cd01d build for android in stand-alone 2012-09-10 16:46:59 +02:00
cdfe6ef57b change some configuratuion 2012-09-09 23:41:36 +02:00
e610df1f12 new distance fieald display work corectly, need to work on the values 2012-09-07 16:32:54 +02:00
0a8b887984 Distance field display work corectly (generation is slow but it work) 2012-09-06 18:42:06 +02:00
022055b86e add a distance field display for the fonts ==> needed openGL ES 2 2012-09-06 02:54:32 +02:00
6b98ad543c decide to add a return at message system, and corection of the position event for the scean 2012-09-05 17:59:38 +02:00
527ff05b2c change the scene management system 2012-09-04 18:23:40 +02:00
5ea6564840 change android specific file methode 2012-09-04 10:15:45 +02:00
42e822a241 add configuration file for generating the project 2012-08-31 16:50:36 +02:00
d0c95c91ed rework the list event to be supported directly on the openGL system 2012-08-31 16:49:55 +02:00
4f598b362d corection of the list raw element error with the size text parsing 2012-08-31 09:35:22 +02:00
c44642ba10 work on the Windows fileSystem abstraction, file shoser corection of init and Windows gui is cut corectly 2012-08-31 01:29:30 +02:00
6c15f2b86c error in glew inclusion when normal openGL mode 2012-08-30 22:18:52 +02:00
936e10adac compilation for windows done corectly with glew ==> need to be tested on a real windows to test it 2012-08-30 18:32:31 +02:00
6d488cb802 Corection of the texture 3D and update windows makefile who does not support shader directly 2012-08-30 16:58:54 +02:00
cc6d40f9d6 Android OpenGl-ES2 work corectly ==> many check is done ==> we can do it only one time by cycle 2012-08-30 13:38:39 +02:00
085b7cb9cd build is now ok for android with openGL ES 2.0 ==> not work : use unimplement fuction??? 2012-08-30 01:29:28 +02:00
2eaed4f16e Compleate abstraction of the standard openGl system to to compatible with openGL-ES-2 ==> must be tested 2012-08-29 18:25:24 +02:00
ed0b62b13f Set double compilation mode 2012-08-29 10:15:03 +02:00
68a53a7068 shader work on PC for OObject textured and colored 2012-08-28 18:16:09 +02:00
fd86f42454 correction of the segFault bug with Resources 2012-08-28 10:31:19 +02:00
5d2000e952 try to find the manager error 2012-08-27 23:26:59 +02:00
e9a3efba18 change the position of the shader : now in file, and create she shader and program loader 2012-08-27 12:25:30 +02:00
1d5be4e953 compilation back but the system does not work at all 2012-08-26 22:45:24 +02:00
6ac6bc50d0 first new api of openGl working and create a resourceManager => this one will be used 2012-08-24 18:05:11 +02:00
fc30b0bb21 test openGL with shader 2012-08-23 18:00:35 +02:00
d14e684954 compilation for windows is back and remove some unusefull warning 2012-08-23 14:21:38 +02:00
a6b807d75e andoid comilation in error 2012-08-23 14:11:30 +02:00
ff8f70d181 the freType texture generation is obstract in the textured text (maybe need to create the imageFont) 2012-08-23 13:54:31 +02:00
3608a8f4df system start to work 2012-08-22 21:40:51 +02:00
229b1de48d management of the font is now better, but it did not work corectly for now ... 2012-08-22 18:22:29 +02:00
b780f22d2c add basic think of resources 2012-08-21 23:27:17 +02:00
a89f8c09f5 Remove color management and start rework of texture system management ==> not tested 2012-08-21 18:14:58 +02:00
99b30494dd BUGFIX : error when opening a file, sometime we have a segFault 2012-08-21 12:40:10 +02:00
b4c0735990 Add a fifo messaging template and simplify the main event system 2012-08-20 18:10:52 +02:00
536c62c0fc Re-ordonate the internal ewol arbo to increase lisibility 2012-08-20 16:50:29 +02:00
58295c552b end of the simplification of the Gui abstraction interface 2012-08-19 18:04:05 +02:00
e177dd4db3 change the interface of OS abstractions 2012-08-19 16:56:31 +02:00
3b645645cb change the clipboard system (normalisation and standardisation 2012-08-18 21:06:42 +02:00
236d450bd5 a real simple vector system 2012-08-18 18:22:26 +02:00
b59ce366e7 try a new generic vector principe 2012-08-18 17:37:36 +02:00
ea7846f4ff change the basic makefile 2012-08-17 18:34:37 +02:00
af8c2a8313 Windows abstarction run now nearly corectly 2012-08-16 18:21:04 +02:00
69993f8c59 grep mouse event in the Windows platform 2012-08-15 23:51:08 +02:00
d75f9e97a1 Build for windows ==> work with wine
Add mutex and semaphore abstraction
Add basic windows gui starting ==> no input ... as bad as a first think
use generic makefile
add a basic entry point for the zlib
2012-08-15 20:56:16 +02:00
14e7b44650 think at a new interface 2012-08-15 09:54:48 +02:00
578 changed files with 36843 additions and 32696 deletions

2
.gitignore vendored
View File

@ -60,3 +60,5 @@ ewol_release
ehthumbs.db
Icon?
Thumbs.db
Sources/libewol/ewol/os/AndroidAbstraction.cpp
org_ewol_EwolConstants.h

30
.gitmodules vendored
View File

@ -1,30 +0,0 @@
[submodule "Build"]
path = Build
url = https://github.com/HeeroYui/Build.git
[submodule "Sources/libagg"]
path = Sources/libagg
url = https://github.com/HeeroYui/libagg.git
[submodule "Sources/liblua"]
path = Sources/liblua
url = https://github.com/HeeroYui/liblua.git
[submodule "Sources/libogg"]
path = Sources/libogg
url = https://github.com/HeeroYui/libogg.git
[submodule "Sources/libparsersvg"]
path = Sources/libparsersvg
url = https://github.com/HeeroYui/libparsersvg.git
[submodule "Sources/libpng"]
path = Sources/libpng
url = https://github.com/HeeroYui/libpng.git
[submodule "Sources/libportaudio"]
path = Sources/libportaudio
url = https://github.com/HeeroYui/libportaudio.git
[submodule "Sources/libtinyxml"]
path = Sources/libtinyxml
url = https://github.com/HeeroYui/libtinyxml.git
[submodule "Sources/libzip"]
path = Sources/libzip
url = https://github.com/HeeroYui/libzip.git
[submodule "Sources/libfreetype"]
path = Sources/libfreetype
url = https://github.com/HeeroYui/libfreetype.git

95
.travis.yml Normal file
View File

@ -0,0 +1,95 @@
language: cpp
sudo: required
dist: trusty
branches:
only:
- master
- dev
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.9
- expect
- binutils-mingw-w64-x86-64 # 64bit MinGW
- gcc-mingw-w64-x86-64
- g++-mingw-w64-x86-64
matrix:
include:
- os: linux
env: CONF=release BUILDER=gcc TARGET=Linux TAG=Linux COMPILATOR_OPTION="--compilator-version=4.9"
compiler: gcc
- os: linux
env: CONF=debug BUILDER=clang TARGET=Linux
compiler: clang
- os: linux
env: CONF=release BUILDER=gcc TARGET=Windows TAG=Mingw
compiler: x86_64-w64-mingw32-gcc
- os: linux
env: CONF=release BUILDER=gcc TARGET=Android TAG=Android DISABLE_PACKAGE=-p
compiler: gcc
- os: osx
env: CONF=release BUILDER=clang TARGET=MacOs TAG=MacOs
compiler: clang
- os: osx
env: CONF=release BUILDER=clang TARGET=IOs TAG=IOs
compiler: clang
install:
- cd ..
- pip install --user lutin
- if [ "$TAG" == "Android" ]; then
git clone --depth 1 --branch master https://github.com/HeeroYui/android-download-tool;
./android-download-tool/dl-android.sh;
fi
- git clone --depth 1 --branch master https://github.com/atria-soft/ci.git
- cd -
before_script:
- cd ..
- mkdir bin
- curl https://storage.googleapis.com/git-repo-downloads/repo > bin/repo
- chmod a+x bin/repo
- git config --global user.email "travis@travis.com"
- git config --global user.name "Travis"
- git config --global color.ui "auto"
- git config --global core.editor "vi"
- mkdir WORKING_DIRECTORY
- cd WORKING_DIRECTORY
- ../bin/repo init -u https://github.com/atria-soft/manifest.git
- ../bin/repo sync -j4
- ../bin/repo forall -c git checkout master
- ../bin/repo forall -c git checkout $TRAVIS_BRANCH; STATUS=$?
- rm -rf atria-soft/ewol
- cd ..
- pwd
- ls -l
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
export PATH=$PATH:/Users/travis/Library/Python/2.7/bin/;
fi
- ./ci/build_send.py --tag=$TAG --status=START;
script:
- lutin -w -j4 -C -P -t$TARGET -c $BUILDER $COMPILATOR_OPTION $BUS -m $CONF $GCOV $DISABLE_PACKAGE ewol-test ewol-sample-*; STATUS=$?
- ./ci/build_send.py --tag=$TAG --status="$STATUS";
after_script:
- if [ "$GCOV" != "" ]; then
./ci/warning_send.py --find-path ./out/Linux_x86_64/$CONF/build/$BUILDER/ewol/;
fi
- ./out/Linux_x86_64/$CONF/staging/$BUILDER/ewol-test/ewol-test.app/bin/ewol-test --elog-level=6 | tee out_test.txt
- if [ "$GCOV" != "" ]; then
./ci/test_send.py --file=out_test.txt;
lutin -C -P -t $TARGET -c $BUILDER $COMPILATOR_OPTION $BUS -m $CONF -p ewol?gcov;
./ci/coverage_send.py --json=out/Linux_x86_64/$CONF/build/$BUILDER/ewol/ewol_coverage.json;
fi
notifications:
email:
- yui.heero@gmail.com

1
Build

@ -1 +0,0 @@
Subproject commit a4e9c62eeb13e6c08c61953185bfb6b82c543530

View File

@ -1,222 +0,0 @@
/**
*******************************************************************************
* @file ewol __PROJECT_NAME__.java
* @brief Java __PROJECT_NAME__ code.
* @author Edouard DUPIN
* @date 20/04/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
package com.__PROJECT_VENDOR__.__PROJECT_PACKAGE__;
import android.app.Activity;
import android.content.Context;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.KeyEvent;
// For No Title :
import android.view.Window;
// For the full screen :
import android.view.WindowManager;
// for the keyboard event :
import android.view.inputmethod.InputMethodManager;
import java.io.File;
import android.content.Context;
import android.content.res.Configuration;
// For the getting apk name :
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.AssetFileDescriptor;
import android.content.res.AssetManager;
// inport the ewol package :
import org.ewol.interfaceJNI;
import org.ewol.interfaceSurfaceView;
import org.ewol.interfaceAudio;
import java.io.IOException;
/**
* @brief Class :
*
*/
public class __PROJECT_NAME__ extends Activity {
private static native void ActivitySetJavaVortualMachineStart(__PROJECT_NAME__ ActivityInstance);
private static native void ActivitySetJavaVortualMachineStop();
private static native void ActivityParamSetArchiveDir(int mode, String myString);
private interfaceSurfaceView mGLView;
private interfaceAudio mStreams;
private Thread mAudioThread;
static {
System.loadLibrary("__PROJECT_PACKAGE__");
}
@Override protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// set the java evironement in the C sources :
ActivitySetJavaVortualMachineStart(this);
// Load the application directory
ActivityParamSetArchiveDir(1, getFilesDir().toString());
ActivityParamSetArchiveDir(2, getCacheDir().toString());
// to enable extarnal storage: add in the manifest the restriction needed ...
//ActivityParamSetArchiveDir(3, getExternalCacheDir().toString());
// return apk file path (or null on error)
String apkFilePath = null;
ApplicationInfo appInfo = null;
PackageManager packMgmr = getPackageManager();
try {
appInfo = packMgmr.getApplicationInfo("com.__PROJECT_VENDOR__.__PROJECT_PACKAGE__", 0);
} catch (NameNotFoundException e) {
e.printStackTrace();
throw new RuntimeException("Unable to locate assets, aborting...");
}
apkFilePath = appInfo.sourceDir;
ActivityParamSetArchiveDir(0, apkFilePath);
// call C init ...
interfaceJNI.ActivityOnCreate();
// Remove the title of the current display :
requestWindowFeature(Window.FEATURE_NO_TITLE);
// set full screen Mode :
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
// display keyboard:
//getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
// hide keyboard :
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
//Force landscape
//setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
// create bsurface system
mGLView = new interfaceSurfaceView(this);
// create element audio ...
mStreams = new interfaceAudio();
setContentView(mGLView);
}
@Override protected void onStart()
{
super.onStart();
// call C
interfaceJNI.ActivityOnStart();
}
@Override protected void onRestart()
{
super.onRestart();
// call C
interfaceJNI.ActivityOnReStart();
}
@Override protected void onResume()
{
super.onResume();
mGLView.onResume();
mAudioThread = new Thread(mStreams);
if (mAudioThread != null) {
mAudioThread.start();
}
// call C
interfaceJNI.ActivityOnResume();
}
@Override protected void onPause()
{
super.onPause();
mGLView.onPause();
if (mAudioThread != null) {
// request audio stop
mStreams.AutoStop();
// wait the thread ended ...
try {
mAudioThread.join();
} catch(InterruptedException e) { }
}
// call C
interfaceJNI.ActivityOnPause();
}
@Override protected void onStop()
{
super.onStop();
// call C
interfaceJNI.ActivityOnStop();
}
@Override protected void onDestroy()
{
super.onDestroy();
// call C
interfaceJNI.ActivityOnDestroy();
// Remove the java Virtual machine pointer form the C code
ActivitySetJavaVortualMachineStop();
}
@Override protected void finalize() throws Throwable
{
super.finalize();
// cleanup your object here
}
public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
}
public void CPP_keyboardShow()
{
interfaceJNI.TouchEvent();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
}
public void CPP_keyboardHide()
{
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(0 ,InputMethodManager.HIDE_IMPLICIT_ONLY + InputMethodManager.HIDE_NOT_ALWAYS);
}
public static void eventFromCPP(String[] args)
{
// just for the test ...
interfaceJNI.TouchEvent();
}
}

View File

@ -1,438 +0,0 @@
/**
*******************************************************************************
* @file ewolAndroidAbstraction.cpp
* @brief User abstraction for Android (Sources)
* @author Edouard DUPIN
* @date 14/12/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <jni.h>
#include <sys/time.h>
#include <time.h>
#include <stdint.h>
#include <pthread.h>
#include <Debug.h>
#include <ewol/base/MainThread.h>
#include <ewol/threadMsg.h>
#include <ewol/Audio/audio.h>
// declaration of the ewol android abstraction ...
void EWOL_NativeRender(void);
void EWOL_NativeGLDestroy(void);
// get a resources from the java environement :
static JNIEnv* JavaVirtualMachinePointer = NULL; // the JVM
static jclass javaClassActivity = 0; // main activity class (android ...)
static jobject javaObjectActivity = 0;
static jmethodID javaClassActivityEntryPoint = 0; // basic methode to call ...
static jmethodID javaClassActivityEntryPoint__CPP_keyboardShow = 0; // basic methode to call ...
static jmethodID javaClassActivityEntryPoint__CPP_keyboardHide = 0; // basic methode to call ...
// generic classes
static jclass javaDefaultClassString = 0; // default string class
static JavaVM* g_JavaVM = NULL;
// jni doc : /usr/lib/jvm/java-1.6.0-openjdk/include
void SendJava_KeyboardShow(bool showIt)
{
APPL_DEBUG("C->java : call java");
if (NULL == g_JavaVM) {
APPL_DEBUG("C->java : JVM not initialised");
return;
}
JNIEnv *JavaVirtualMachinePointer_tmp;
int status = g_JavaVM->GetEnv((void **) &JavaVirtualMachinePointer_tmp, JNI_VERSION_1_6);
if (status == JNI_EDETACHED) {
JavaVMAttachArgs lJavaVMAttachArgs;
lJavaVMAttachArgs.version = JNI_VERSION_1_6;
lJavaVMAttachArgs.name = "EwolNativeThread";
lJavaVMAttachArgs.group = NULL;
status = g_JavaVM->AttachCurrentThread(&JavaVirtualMachinePointer_tmp, &lJavaVMAttachArgs);
if (status != JNI_OK) {
APPL_DEBUG("C->java : AttachCurrentThread failed : " << status);
return;
}
if (JavaVirtualMachinePointer->ExceptionOccurred()) {
APPL_DEBUG("C->java : EXEPTION ...");
JavaVirtualMachinePointer->ExceptionDescribe();
JavaVirtualMachinePointer->ExceptionClear();
}
}
if (JavaVirtualMachinePointer->ExceptionOccurred()) {
APPL_DEBUG("C->java : EXEPTION ...");
JavaVirtualMachinePointer->ExceptionDescribe();
JavaVirtualMachinePointer->ExceptionClear();
}
if (NULL == JavaVirtualMachinePointer) {
APPL_DEBUG("C->java : JVM not initialised");
return;
}
//Call java ...
if (true == showIt) {
JavaVirtualMachinePointer->CallVoidMethod(javaObjectActivity, javaClassActivityEntryPoint__CPP_keyboardShow);
} else {
JavaVirtualMachinePointer->CallVoidMethod(javaObjectActivity, javaClassActivityEntryPoint__CPP_keyboardHide);
}
// manage execption :
if (JavaVirtualMachinePointer->ExceptionOccurred()) {
APPL_DEBUG("C->java : EXEPTION ...");
JavaVirtualMachinePointer->ExceptionDescribe();
JavaVirtualMachinePointer->ExceptionClear();
}
// Finished with the JVM.
g_JavaVM->DetachCurrentThread();
}
void SendSystemMessage(const char * dataString)
{
APPL_DEBUG("C->java : send message to the java : \"" << dataString << "\"");
if (NULL == g_JavaVM) {
APPL_DEBUG("C->java : JVM not initialised");
return;
}
JNIEnv *JavaVirtualMachinePointer_tmp;
int status = g_JavaVM->GetEnv((void **) &JavaVirtualMachinePointer_tmp, JNI_VERSION_1_6);
if (status == JNI_EDETACHED) {
JavaVMAttachArgs lJavaVMAttachArgs;
lJavaVMAttachArgs.version = JNI_VERSION_1_6;
lJavaVMAttachArgs.name = "EwolNativeThread";
lJavaVMAttachArgs.group = NULL;
status = g_JavaVM->AttachCurrentThread(&JavaVirtualMachinePointer_tmp, &lJavaVMAttachArgs);
if (status != JNI_OK) {
APPL_DEBUG("C->java : AttachCurrentThread failed : " << status);
return;
}
}
APPL_DEBUG("C->java : 111");
if (NULL == JavaVirtualMachinePointer) {
APPL_DEBUG("C->java : JVM not initialised");
return;
}
APPL_DEBUG("C->java : 222");
if (NULL == dataString) {
APPL_DEBUG("C->java : No data to send ...");
return;
}
APPL_DEBUG("C->java : 333");
// create the string to the java
jstring jstr = JavaVirtualMachinePointer->NewStringUTF(dataString);
if (jstr == 0) {
APPL_DEBUG("C->java : Out of memory" );
return;
}
APPL_DEBUG("C->java : 444");
// create argument list
jobjectArray args = JavaVirtualMachinePointer->NewObjectArray(1, javaDefaultClassString, jstr);
if (args == 0) {
APPL_DEBUG("C->java : Out of memory" );
return;
}
APPL_DEBUG("C->java : 555");
//Call java ...
JavaVirtualMachinePointer->CallStaticVoidMethod(javaClassActivity, javaClassActivityEntryPoint, args);
APPL_DEBUG("C->java : 666");
// manage execption :
if (JavaVirtualMachinePointer->ExceptionOccurred()) {
JavaVirtualMachinePointer->ExceptionDescribe();
JavaVirtualMachinePointer->ExceptionClear();
}
// Finished with the JVM.
g_JavaVM->DetachCurrentThread();
}
namespace guiAbstraction {
void SendKeyboardEvent(bool isDown, uniChar_t keyInput);
};
extern "C"
{
// JNI OnLoad
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* jvm, void* reserved)
{
// get the java virtual machine handle ...
g_JavaVM = jvm;
APPL_DEBUG("JNI-> load the jvm ..." );
return JNI_VERSION_1_6;
}
// JNI OnUnLoad
JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved)
{
g_JavaVM = NULL;
APPL_DEBUG("JNI-> Un-load the jvm ..." );
}
/* Call to initialize the graphics state */
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivityParamSetArchiveDir( JNIEnv* env, jobject thiz, jint mode, jstring myString)
{
// direct setting of the date in the string system ...
jboolean isCopy;
const char* str = env->GetStringUTFChars(myString, &isCopy);
guiSystem::SetArchiveDir(mode, str);
if (isCopy == JNI_TRUE) {
// from here str is reset ...
env->ReleaseStringUTFChars(myString, str);
str = NULL;
}
}
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivitySetJavaVortualMachineStart( JNIEnv* env, jclass classBase, jobject obj)
//void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivitySetJavaVortualMachineStart( JNIEnv* env)
{
APPL_DEBUG("*******************************************");
APPL_DEBUG("** Set JVM Pointer **");
APPL_DEBUG("*******************************************");
JavaVirtualMachinePointer = env;
// get default needed all time elements :
if (NULL != JavaVirtualMachinePointer) {
javaClassActivity = JavaVirtualMachinePointer->FindClass("com/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__" );
if (javaClassActivity == 0) {
APPL_DEBUG("C->java : Can't find com/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__ class");
// remove access on the virtual machine :
JavaVirtualMachinePointer = NULL;
return;
}
// get the activity object :
javaClassActivityEntryPoint = JavaVirtualMachinePointer->GetStaticMethodID(javaClassActivity, "eventFromCPP", "([Ljava/lang/String;)V" );
if (javaClassActivityEntryPoint == 0) {
APPL_DEBUG("C->java : Can't find com/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__.eventFromCPP" );
// remove access on the virtual machine :
JavaVirtualMachinePointer = NULL;
return;
}
javaClassActivityEntryPoint__CPP_keyboardShow = JavaVirtualMachinePointer->GetMethodID(javaClassActivity, "CPP_keyboardShow", "()V" );
if (javaClassActivityEntryPoint__CPP_keyboardShow == 0) {
APPL_DEBUG("C->java : Can't find com/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__.CPP_keyboardShow" );
// remove access on the virtual machine :
JavaVirtualMachinePointer = NULL;
return;
}
javaClassActivityEntryPoint__CPP_keyboardHide = JavaVirtualMachinePointer->GetMethodID(javaClassActivity, "CPP_keyboardHide", "()V" );
if (javaClassActivityEntryPoint__CPP_keyboardHide == 0) {
APPL_DEBUG("C->java : Can't find com/__PROJECT_VENDOR__/__PROJECT_PACKAGE__/__PROJECT_NAME__.CPP_keyboardHide" );
// remove access on the virtual machine :
JavaVirtualMachinePointer = NULL;
return;
}
//javaObjectActivity = JavaVirtualMachinePointer->NewGlobalRef(obj);
javaObjectActivity = obj;
javaDefaultClassString = JavaVirtualMachinePointer->FindClass("java/lang/String" );
if (javaDefaultClassString == 0) {
APPL_DEBUG("C->java : Can't find java/lang/String" );
// remove access on the virtual machine :
JavaVirtualMachinePointer = NULL;
return;
}
}
}
void Java_com___PROJECT_VENDOR_____PROJECT_PACKAGE_____PROJECT_NAME___ActivitySetJavaVortualMachineStop( JNIEnv* env )
{
APPL_DEBUG("*******************************************");
APPL_DEBUG("** Remove JVM Pointer **");
APPL_DEBUG("*******************************************");
JavaVirtualMachinePointer = NULL;
}
void Java_org_ewol_interfaceJNI_TouchEvent( JNIEnv* env )
{
APPL_DEBUG(" ==> Touch Event");
if (env->ExceptionOccurred()) {
env->ExceptionDescribe();
env->ExceptionClear();
}
}
void Java_org_ewol_interfaceJNI_ActivityOnCreate( JNIEnv* env )
{
APPL_DEBUG("*******************************************");
APPL_DEBUG("** Activity On Create **");
APPL_DEBUG("*******************************************");
guiSystem::Init();
}
void Java_org_ewol_interfaceJNI_ActivityOnStart( JNIEnv* env )
{
APPL_DEBUG("*******************************************");
APPL_DEBUG("** Activity On Start **");
APPL_DEBUG("*******************************************");
//SendSystemMessage(" testmessages ... ");
}
void Java_org_ewol_interfaceJNI_ActivityOnReStart( JNIEnv* env )
{
APPL_DEBUG("*******************************************");
APPL_DEBUG("** Activity On Re-Start **");
APPL_DEBUG("*******************************************");
}
void Java_org_ewol_interfaceJNI_ActivityOnResume( JNIEnv* env )
{
APPL_DEBUG("*******************************************");
APPL_DEBUG("** Activity On Resume **");
APPL_DEBUG("*******************************************");
}
void Java_org_ewol_interfaceJNI_ActivityOnPause( JNIEnv* env )
{
APPL_DEBUG("*******************************************");
APPL_DEBUG("** Activity On Pause **");
APPL_DEBUG("*******************************************");
// All the openGl has been destroyed ...
// TODO : Mark all the texture to be reloaded ...
EWOL_NativeGLDestroy();
}
void Java_org_ewol_interfaceJNI_ActivityOnStop( JNIEnv* env )
{
APPL_DEBUG("*******************************************");
APPL_DEBUG("** Activity On Stop **");
APPL_DEBUG("*******************************************");
}
void Java_org_ewol_interfaceJNI_ActivityOnDestroy( JNIEnv* env )
{
APPL_DEBUG("*******************************************");
APPL_DEBUG("** Activity On Destroy **");
APPL_DEBUG("*******************************************");
guiSystem::UnInit();
}
/* **********************************************************************************************
* ** IO section :
* ********************************************************************************************** */
void Java_org_ewol_interfaceJNI_IOInputEventMotion( JNIEnv* env, jobject thiz, jint pointerID, jfloat x, jfloat y )
{
guiSystem::event::SetInputMotion(pointerID+1, x, y);
}
void Java_org_ewol_interfaceJNI_IOInputEventState( JNIEnv* env, jobject thiz, jint pointerID, jboolean isUp, jfloat x, jfloat y )
{
guiSystem::event::SetInputState(pointerID+1, isUp, x, y);
}
void Java_org_ewol_interfaceJNI_IOMouseEventMotion( JNIEnv* env, jobject thiz, jint pointerID, jfloat x, jfloat y )
{
guiSystem::event::SetMouseMotion(pointerID+1, x, y);
}
void Java_org_ewol_interfaceJNI_IOMouseEventState( JNIEnv* env, jobject thiz, jint pointerID, jboolean isUp, jfloat x, jfloat y )
{
guiSystem::event::SetMouseState(pointerID+1, isUp, x, y);
}
void Java_org_ewol_interfaceJNI_IOUnknowEvent( JNIEnv* env, jobject thiz, jint pointerID)
{
APPL_DEBUG("Unknown IO event : " << pointerID << " ???");
}
void Java_org_ewol_interfaceJNI_IOKeyboardEventMove( JNIEnv* env, jobject thiz, jint type, jboolean isdown)
{
APPL_DEBUG("IO keyboard Move event : \"" << type << "\" is down=" << isdown);
}
void Java_org_ewol_interfaceJNI_IOKeyboardEventKey( JNIEnv* env, jobject thiz, jint uniChar, jboolean isdown)
{
APPL_DEBUG("IO keyboard Key event : \"" << uniChar << "\" is down=" << isdown);
guiSystem::event::keyboardKey_ts keyInput;
keyInput.myChar = uniChar;
keyInput.isDown = isdown;
guiSystem::event::SetKeyboard(keyInput);
}
enum {
SYSTEM_KEY__VOLUME_UP = 1,
SYSTEM_KEY__VOLUME_DOWN,
SYSTEM_KEY__MENU,
SYSTEM_KEY__CAMERA,
SYSTEM_KEY__HOME,
SYSTEM_KEY__POWER,
};
void Java_org_ewol_interfaceJNI_IOKeyboardEventKeySystem( JNIEnv* env, jobject thiz, jint keyVal, jboolean isdown)
{
switch (keyVal)
{
case SYSTEM_KEY__VOLUME_UP:
APPL_DEBUG("IO keyboard Key System \"VOLUME_UP\" is down=" << keyVal);
break;
case SYSTEM_KEY__VOLUME_DOWN:
APPL_DEBUG("IO keyboard Key System \"VOLUME_DOWN\" is down=" << keyVal);
break;
case SYSTEM_KEY__MENU:
APPL_DEBUG("IO keyboard Key System \"MENU\" is down=" << keyVal);
break;
case SYSTEM_KEY__CAMERA:
APPL_DEBUG("IO keyboard Key System \"CAMERA\" is down=" << keyVal);
break;
case SYSTEM_KEY__HOME:
APPL_DEBUG("IO keyboard Key System \"HOME\" is down=" << keyVal);
break;
case SYSTEM_KEY__POWER:
APPL_DEBUG("IO keyboard Key System \"POWER\" is down=" << keyVal);
break;
default:
APPL_DEBUG("IO keyboard Key System event : \"" << keyVal << "\" is down=" << isdown);
break;
}
}
/* **********************************************************************************************
* ** Renderer section :
* ********************************************************************************************** */
void Java_org_ewol_interfaceJNI_RenderInit( JNIEnv* env )
{
}
void Java_org_ewol_interfaceJNI_RenderResize( JNIEnv* env, jobject thiz, jint w, jint h )
{
guiSystem::event::Resize(w, h);
}
void Java_org_ewol_interfaceJNI_RenderDraw( JNIEnv* env )
{
guiSystem::Draw();
}
void Java_org_ewol_interfaceJNI_IOAudioPlayback(JNIEnv* env, void* reserved, jshortArray location, jint frameRate, jint nbChannels)
{
// Get the short* pointer from the Java array
jboolean isCopy;
jshort* dst = env->GetShortArrayElements(location, &isCopy);
if (NULL != dst) {
ewol::audio::GetData(dst, frameRate, nbChannels);
}
//APPL_DEBUG("IO Audio event request: Frames=" << frameRate << " channels=" << nbChannels);
// TODO : Understand why it did not work corectly ...
//if (isCopy == JNI_TRUE) {
// Release the short* pointer
env->ReleaseShortArrayElements(location, dst, 0);
//}
}
};

View File

@ -1,101 +0,0 @@
/**
*******************************************************************************
* @file ewol interfaceAudio.java
* @brief Java Audio interface code.
* @author Edouard DUPIN
* @date 29/06/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
package org.ewol;
import android.media.AudioTrack;
import android.media.AudioFormat;
import android.media.AudioManager;
import android.media.AudioRecord;
// inport the ewol package :
import org.ewol.interfaceJNI;
public class interfaceAudio implements Runnable
{
private boolean m_stopAudioThreads = false;
private AudioTrack m_musicTrack;
// constructor :
public interfaceAudio()
{
// nothing to do ...
}
public void run()
{
if(m_musicTrack != null) {
return;
}
int sampleFreq = 44100; //AudioTrack.getNativeOutputSampleRate(AudioManager.STREAM_MUSIC);
int channelConfig = AudioFormat.CHANNEL_CONFIGURATION_STEREO;
int audioFormat = AudioFormat.ENCODING_PCM_16BIT;
int nbChannels = 2;
// we keep the minimum buffer size, otherwite the delay is too big ...
int bufferSize = AudioTrack.getMinBufferSize(sampleFreq, channelConfig, audioFormat);
// Create a streaming AudioTrack for music playback
short[] streamBuffer = new short[bufferSize];
m_musicTrack = new AudioTrack(AudioManager.STREAM_MUSIC,
44100,
AudioFormat.CHANNEL_CONFIGURATION_STEREO,
AudioFormat.ENCODING_PCM_16BIT,
bufferSize,
AudioTrack.MODE_STREAM);
m_musicTrack.play();
//m_musicTrack.setPositionNotificationPeriod(2048);
while (!m_stopAudioThreads) {
// Fill buffer with PCM data from C++
interfaceJNI.IOAudioPlayback(streamBuffer, 512, nbChannels);
// Stream PCM data into the music AudioTrack
m_musicTrack.write(streamBuffer, 0, 512);
}
m_musicTrack.flush();
m_musicTrack.stop();
}
public void Pause()
{
if(m_musicTrack == null) {
return;
}
m_musicTrack.pause();
}
public void Resume()
{
if(m_musicTrack == null) {
return;
}
m_musicTrack.play();
}
public void AutoStop()
{
if(m_musicTrack == null) {
return;
}
m_stopAudioThreads=true;
}
};

View File

@ -1,65 +0,0 @@
/**
*******************************************************************************
* @file ewol interfaceJNI.java
* @brief Java interface to the CPP code.
* @author Edouard DUPIN
* @date 20/04/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
package org.ewol;
public class interfaceJNI {
public static native void TouchEvent();
// activity status
public static native void ActivityOnCreate();
public static native void ActivityOnStart();
public static native void ActivityOnReStart();
public static native void ActivityOnResume();
public static native void ActivityOnPause();
public static native void ActivityOnStop();
public static native void ActivityOnDestroy();
// IO native function :
// Specific for the type of input : TOOL_TYPE_FINGER and TOOL_TYPE_STYLUS (work as the same)
public static native void IOInputEventMotion(int pointerID, float x, float y);
public static native void IOInputEventState(int pointerID, boolean isDown, float x, float y);
// Specific for the type of input : TOOL_TYPE_MOUSE
public static native void IOMouseEventMotion(int pointerID, float x, float y);
public static native void IOMouseEventState(int pointerID, boolean isDown, float x, float y);
// other unknow event ...
public static native void IOUnknowEvent(int eventID);
public static native void IOKeyboardEventMove(int type, boolean isDown);
public static native void IOKeyboardEventKey(int uniChar, boolean isDown);
// Audio section ...
public static native void IOAudioPlayback(short[] bufferData, int frames, int nbChannels);
public static final int EWOL_SYSTEM_KEY__VOLUME_UP = 1;
public static final int EWOL_SYSTEM_KEY__VOLUME_DOWN = 2;
public static final int EWOL_SYSTEM_KEY__MENU = 3;
public static final int EWOL_SYSTEM_KEY__CAMERA = 4;
public static final int EWOL_SYSTEM_KEY__HOME = 5;
public static final int EWOL_SYSTEM_KEY__POWER = 6;
public static native void IOKeyboardEventKeySystem(int keyVal, boolean isDown);
// renderer Event :
public static native void RenderInit();
public static native void RenderResize(int w, int h);
public static native void RenderDraw();
}

View File

@ -1,52 +0,0 @@
/**
*******************************************************************************
* @file ewol interfaceOpenGL.java
* @brief Java openGl interface code.
* @author Edouard DUPIN
* @date 20/04/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
package org.ewol;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import android.opengl.GLSurfaceView;
// inport the ewol package :
import org.ewol.interfaceJNI;
/**
* @brief Class :
*
*/
public class interfaceOpenGL implements GLSurfaceView.Renderer {
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
interfaceJNI.RenderInit();
}
public void onSurfaceChanged(GL10 gl, int w, int h) {
interfaceJNI.RenderResize(w, h);
}
public void onDrawFrame(GL10 gl) {
interfaceJNI.RenderDraw();
}
}

View File

@ -1,244 +0,0 @@
/**
*******************************************************************************
* @file ewol interfaceSurfaceView.java
* @brief Java interface of the java Surface viewer code.
* @author Edouard DUPIN
* @date 20/04/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
package org.ewol;
// inport the ewol package :
import org.ewol.interfaceJNI;
import org.ewol.interfaceOpenGL;
import android.content.Context;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.KeyEvent;
/**
* @brief Class :
*
*/
public class interfaceSurfaceView extends GLSurfaceView {
private interfaceOpenGL m_ewolDrawer;
public interfaceSurfaceView(Context context) {
// super must be first statement in constructor
super(context);
// je n'ai pas compris ...
m_ewolDrawer = new interfaceOpenGL();
setRenderer(m_ewolDrawer);
// Can get the focus ==> get keyboard from JAVA :
setFocusable(true);
setFocusableInTouchMode(true);
}
private boolean InputDown1 = false;
private boolean InputDown2 = false;
private boolean InputDown3 = false;
public boolean onTouchEvent(final MotionEvent event) {
// Wrapper on input events :
int tmpActionType = event.getAction();
if (tmpActionType == MotionEvent.ACTION_MOVE) {
final int pointerCount = event.getPointerCount();
for (int p = 0; p < pointerCount; p++) {
final int typeOfPointer = event.getToolType(p);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
interfaceJNI.IOInputEventMotion(event.getPointerId(p), (float)event.getX(p), (float)event.getY(p));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
interfaceJNI.IOMouseEventMotion(event.getPointerId(p), (float)event.getX(p), (float)event.getY(p));
}
}
} else if( tmpActionType == MotionEvent.ACTION_POINTER_1_DOWN
|| tmpActionType == MotionEvent.ACTION_DOWN) {
final int typeOfPointer = event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
interfaceJNI.IOInputEventState(event.getPointerId(0), true, (float)event.getX(0), (float)event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
interfaceJNI.IOMouseEventState(event.getPointerId(0), true, (float)event.getX(0), (float)event.getY(0));
}
InputDown1 = true;
} else if(tmpActionType == MotionEvent.ACTION_POINTER_1_UP) {
final int typeOfPointer = event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
interfaceJNI.IOInputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
interfaceJNI.IOMouseEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
InputDown1 = false;
} else if (tmpActionType == MotionEvent.ACTION_POINTER_2_DOWN) {
final int typeOfPointer = event.getToolType(1);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
interfaceJNI.IOInputEventState(event.getPointerId(1), true, (float)event.getX(1), (float)event.getY(1));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
interfaceJNI.IOMouseEventState(event.getPointerId(1), true, (float)event.getX(1), (float)event.getY(1));
}
InputDown2 = true;
} else if (tmpActionType == MotionEvent.ACTION_POINTER_2_UP) {
final int typeOfPointer = event.getToolType(1);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
interfaceJNI.IOInputEventState(event.getPointerId(1), false, (float)event.getX(1), (float)event.getY(1));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
interfaceJNI.IOMouseEventState(event.getPointerId(1), false, (float)event.getX(1), (float)event.getY(1));
}
InputDown2 = false;
} else if (tmpActionType == MotionEvent.ACTION_POINTER_3_DOWN) {
final int typeOfPointer = event.getToolType(2);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
interfaceJNI.IOInputEventState(event.getPointerId(2), true, (float)event.getX(2), (float)event.getY(2));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
interfaceJNI.IOMouseEventState(event.getPointerId(2), true, (float)event.getX(2), (float)event.getY(2));
}
InputDown3 = true;
} else if (tmpActionType == MotionEvent.ACTION_POINTER_3_UP) {
final int typeOfPointer = event.getToolType(2);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
interfaceJNI.IOInputEventState(event.getPointerId(2), false, (float)event.getX(2), (float)event.getY(2));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
interfaceJNI.IOMouseEventState(event.getPointerId(2), false, (float)event.getX(2), (float)event.getY(2));
}
InputDown3 = false;
} else if(tmpActionType == MotionEvent.ACTION_UP){
if (InputDown1) {
final int typeOfPointer = event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
interfaceJNI.IOInputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
interfaceJNI.IOMouseEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
InputDown1 = false;
} else if (InputDown2) {
final int typeOfPointer = event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
interfaceJNI.IOInputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
interfaceJNI.IOMouseEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
InputDown2 = false;
} else {
final int typeOfPointer = event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
interfaceJNI.IOInputEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
interfaceJNI.IOMouseEventState(event.getPointerId(0), false, (float)event.getX(0), (float)event.getY(0));
}
InputDown3 = false;
}
}
return true;
}
private boolean keyboardEvent(int keyCode, KeyEvent event, boolean isDown)
{
int actionDone = event.getAction();
switch(keyCode)
{
case KeyEvent.KEYCODE_VOLUME_DOWN:
interfaceJNI.IOKeyboardEventKeySystem(interfaceJNI.EWOL_SYSTEM_KEY__VOLUME_DOWN, isDown);
return true;
case KeyEvent.KEYCODE_VOLUME_UP:
interfaceJNI.IOKeyboardEventKeySystem(interfaceJNI.EWOL_SYSTEM_KEY__VOLUME_UP, isDown);
return true;
case KeyEvent.KEYCODE_MENU:
interfaceJNI.IOKeyboardEventKeySystem(interfaceJNI.EWOL_SYSTEM_KEY__MENU, isDown);
return true;
case KeyEvent.KEYCODE_CAMERA:
interfaceJNI.IOKeyboardEventKeySystem(interfaceJNI.EWOL_SYSTEM_KEY__CAMERA, isDown);
return true;
case KeyEvent.KEYCODE_HOME:
interfaceJNI.IOKeyboardEventKeySystem(interfaceJNI.EWOL_SYSTEM_KEY__HOME, isDown);
return true;
case KeyEvent.KEYCODE_POWER:
interfaceJNI.IOKeyboardEventKeySystem(interfaceJNI.EWOL_SYSTEM_KEY__POWER, isDown);
return true;
case KeyEvent.KEYCODE_BACK:
// the back key is wrapped in the <esc> key to simplify PC validation ...
interfaceJNI.IOKeyboardEventKey(0x1B, isDown);
return false;
case KeyEvent.KEYCODE_DEL:
interfaceJNI.IOKeyboardEventKey(0x08, isDown);
return true;
case KeyEvent.KEYCODE_ALT_LEFT:
// TODO : ...
break;
case KeyEvent.KEYCODE_SHIFT_LEFT:
// TODO : ...
break;
case KeyEvent.KEYCODE_ENTER:
// TODO : ...
break;
// Joystick event :
case KeyEvent.KEYCODE_DPAD_UP:
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
break;
case KeyEvent.KEYCODE_DPAD_LEFT:
break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
break;
case KeyEvent.KEYCODE_DPAD_CENTER:
break;
default:
break;
}
// key wrapping :
if( (actionDone == KeyEvent.ACTION_DOWN)
|| (actionDone == KeyEvent.ACTION_MULTIPLE)
|| (actionDone == KeyEvent.ACTION_UP))
{
// convert the key in UniChar to prevent errors ...
int uchar = event.getUnicodeChar();
// send it to ewol ...
interfaceJNI.IOKeyboardEventKey(uchar, isDown);
return true;
}
return false;
}
public boolean onKeyDown(int keyCode, KeyEvent event)
{
return keyboardEvent(keyCode, event, true);
}
public boolean onKeyUp(int keyCode, KeyEvent event)
{
return keyboardEvent(keyCode, event, false);
}
}

373
LICENSE Normal file
View File

@ -0,0 +1,373 @@
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.

145
README.md
View File

@ -1,51 +1,128 @@
Edn
Ewol
====
`Ewol` (Edn Widget OpenGl Layer) is a FREE software.
Release (master)
----------------
[![Build Status](https://travis-ci.org/atria-soft/ewol.svg?branch=master)](https://travis-ci.org/atria-soft/ewol)
[![Coverage Status](http://atria-soft.com/ci/coverage/atria-soft/ewol.svg?branch=master)](http://atria-soft.com/ci/atria-soft/ewol)
[![Test Status](http://atria-soft.com/ci/test/atria-soft/ewol.svg?branch=master)](http://atria-soft.com/ci/atria-soft/ewol)
[![Warning Status](http://atria-soft.com/ci/warning/atria-soft/ewol.svg?branch=master)](http://atria-soft.com/ci/atria-soft/ewol)
[![Build Status](http://atria-soft.com/ci/build/atria-soft/ewol.svg?branch=master&tag=Linux)](http://atria-soft.com/ci/atria-soft/ewol)
[![Build Status](http://atria-soft.com/ci/build/atria-soft/ewol.svg?branch=master&tag=MacOs)](http://atria-soft.com/ci/atria-soft/ewol)
[![Build Status](http://atria-soft.com/ci/build/atria-soft/ewol.svg?branch=master&tag=Mingw)](http://atria-soft.com/ci/atria-soft/ewol)
[![Build Status](http://atria-soft.com/ci/build/atria-soft/ewol.svg?branch=master&tag=Android)](http://atria-soft.com/ci/atria-soft/ewol)
[![Build Status](http://atria-soft.com/ci/build/atria-soft/ewol.svg?branch=master&tag=IOs)](http://atria-soft.com/ci/atria-soft/ewol)
Developement (dev)
------------------
[![Build Status](https://travis-ci.org/atria-soft/ewol.svg?branch=dev)](https://travis-ci.org/atria-soft/ewol)
[![Coverage Status](http://atria-soft.com/ci/coverage/atria-soft/ewol.svg?branch=dev)](http://atria-soft.com/ci/atria-soft/ewol)
[![Test Status](http://atria-soft.com/ci/test/atria-soft/ewol.svg?branch=dev)](http://atria-soft.com/ci/atria-soft/ewol)
[![Warning Status](http://atria-soft.com/ci/warning/atria-soft/ewol.svg?branch=dev)](http://atria-soft.com/ci/atria-soft/ewol)
[![Build Status](http://atria-soft.com/ci/build/atria-soft/ewol.svg?branch=dev&tag=Linux)](http://atria-soft.com/ci/atria-soft/ewol)
[![Build Status](http://atria-soft.com/ci/build/atria-soft/ewol.svg?branch=dev&tag=MacOs)](http://atria-soft.com/ci/atria-soft/ewol)
[![Build Status](http://atria-soft.com/ci/build/atria-soft/ewol.svg?branch=dev&tag=Mingw)](http://atria-soft.com/ci/atria-soft/ewol)
[![Build Status](http://atria-soft.com/ci/build/atria-soft/ewol.svg?branch=dev&tag=Android)](http://atria-soft.com/ci/atria-soft/ewol)
[![Build Status](http://atria-soft.com/ci/build/atria-soft/ewol.svg?branch=dev&tag=IOs)](http://atria-soft.com/ci/atria-soft/ewol)
Instructions
============
download the software :
download Build system:
----------------------
git clone git://github.com/HeeroYui/ewol.git
cd ewol
git submodule init
git submodule update
sudo pip install lutin
sudo pip install pillow
Compile software and install :
need google repo:
-----------------
For this you might use a priject that create binaies or somting else ...
Show http://github.com/HeeroYui/edn project
see: http://source.android.com/source/downloading.html#installing-repo
License (DSB like)
mkdir ~/.bin
PATH=~/.bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
chmod a+x ~/.bin/repo
download the software:
----------------------
mkdir WORKING_DIRECTORY
cd WORKING_DIRECTORY
repo init -u git://github.com/atria-soft/manifest.git
repo sync -j8
Compile software and test:
--------------------------
lutin ewol-*
Dependency packages
===================
Ubuntu Or Debian:
sudo apt-get install g++ libgl1-mesa-dev zlib1g-dev libasound2-dev
# Compile with Clang:
sudo apt-get install clang
# For andoid compilation (jdk 7 does not work...):
sudo apt-get install javacc openjdk-6-jdk
# Cross compile for windows:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-mingw-w64
# On 64 bits processor for compatibility:
sudo apt-get install ia32-libs
sudo apt-get install g++-multilib libc6-dev-i386
Arch-linux:
# Cross compile for windows:
pacman -S mingw-w64-gcc
# Cross compile for Android:
in /etc/pacman.conf file uncomment:
[multilib]
Include = /etc/pacman.d/mirrorlist
# update the system:
Pacman -Syu
# install lib C:
pacman -S lib32-glibc lib32-zlib lib32-gcc-libs
# install open-jdk 7.0
pacman -S jdk7-openjdk
# connect adb: (and you can do a "android/sdk/platform-tools/adb shell" to enable computer key on device)
pacman -S android-udev
Simple framework overview
=========================
![overview](overview.svg)
License (MPL v2.0)
==================
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
Copyright ewol Edouard DUPIN
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Licensed under the Mozilla Public License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
https://www.mozilla.org/MPL/2.0
3. The name of the author may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
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.

View File

@ -1,2 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(call all-subdir-makefiles)

@ -1 +0,0 @@
Subproject commit d8531a3a7cc0e873b895246d16db9ad6ef15d93b

View File

@ -1,33 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := etk
LOCAL_STATIC_LIBRARIES := libzip
# load the common sources file of the platform
include $(LOCAL_PATH)/file.mk
LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
ifeq ($(DEBUG),1)
LOCAL_CFLAGS := -Wno-write-strings \
-Wall
else
LOCAL_CFLAGS := -Wno-write-strings \
-DMODE_RELEASE
endif
LOCAL_SRC_FILES := $(FILE_LIST)
# Ewol Test Software :
LOCAL_LDLIBS := -lGLESv1_CM -ldl -llog -lz
include $(BUILD_STATIC_LIBRARY)

View File

@ -1,26 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := etk
LOCAL_STATIC_LIBRARIES := libzip
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
ifeq ($(DEBUG),1)
LOCAL_CFLAGS := -Wno-write-strings \
-Wall
else
LOCAL_CFLAGS := -Wno-write-strings \
-DMODE_RELEASE
endif
# load the common sources file of the platform
include $(LOCAL_PATH)/file.mk
LOCAL_SRC_FILES := $(FILE_LIST)
include $(BUILD_STATIC_LIBRARY)

View File

@ -1,609 +0,0 @@
/**
*******************************************************************************
* @file etk/Color.h
* @brief Ewol Tool Kit : basic colors
* @author Edouard DUPIN
* @date 23/04/2012
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <etk/Types.h>
#include <etk/Color.h>
#include <etk/DebugInternal.h>
#include <etk/tool.h>
const etk::Color etk::color::none((uint32_t)0x00000000);
const etk::Color etk::color::aliceBlue((uint32_t)0xF0F8FFFF);
const etk::Color etk::color::antiqueWhite((uint32_t)0xFAEBD7FF);
const etk::Color etk::color::aqua((uint32_t)0x00FFFFFF);
const etk::Color etk::color::aquamarine((uint32_t)0x7FFFD4FF);
const etk::Color etk::color::azure((uint32_t)0xF0FFFFFF);
const etk::Color etk::color::beige((uint32_t)0xF5F5DCFF);
const etk::Color etk::color::bisque((uint32_t)0xFFE4C4FF);
const etk::Color etk::color::black((uint32_t)0x000000FF);
const etk::Color etk::color::blanchedAlmond((uint32_t)0xFFEBCDFF);
const etk::Color etk::color::blue((uint32_t)0x0000FFFF);
const etk::Color etk::color::blueViolet((uint32_t)0x8A2BE2FF);
const etk::Color etk::color::brown((uint32_t)0xA52A2AFF);
const etk::Color etk::color::burlyWood((uint32_t)0xDEB887FF);
const etk::Color etk::color::cadetBlue((uint32_t)0x5F9EA0FF);
const etk::Color etk::color::chartreuse((uint32_t)0x7FFF00FF);
const etk::Color etk::color::chocolate((uint32_t)0xD2691EFF);
const etk::Color etk::color::coral((uint32_t)0xFF7F50FF);
const etk::Color etk::color::cornflowerBlue((uint32_t)0x6495EDFF);
const etk::Color etk::color::cornsilk((uint32_t)0xFFF8DCFF);
const etk::Color etk::color::crimson((uint32_t)0xDC143CFF);
const etk::Color etk::color::cyan((uint32_t)0x00FFFFFF);
const etk::Color etk::color::darkBlue((uint32_t)0x00008BFF);
const etk::Color etk::color::darkCyan((uint32_t)0x008B8BFF);
const etk::Color etk::color::darkGoldenRod((uint32_t)0xB8860BFF);
const etk::Color etk::color::darkGray((uint32_t)0xA9A9A9FF);
const etk::Color etk::color::darkGrey((uint32_t)0xA9A9A9FF);
const etk::Color etk::color::darkGreen((uint32_t)0x006400FF);
const etk::Color etk::color::darkKhaki((uint32_t)0xBDB76BFF);
const etk::Color etk::color::darkMagenta((uint32_t)0x8B008BFF);
const etk::Color etk::color::darkOliveGreen((uint32_t)0x556B2FFF);
const etk::Color etk::color::darkorange((uint32_t)0xFF8C00FF);
const etk::Color etk::color::darkOrchid((uint32_t)0x9932CCFF);
const etk::Color etk::color::darkRed((uint32_t)0x8B0000FF);
const etk::Color etk::color::darkSalmon((uint32_t)0xE9967AFF);
const etk::Color etk::color::darkSeaGreen((uint32_t)0x8FBC8FFF);
const etk::Color etk::color::darkSlateBlue((uint32_t)0x483D8BFF);
const etk::Color etk::color::darkSlateGray((uint32_t)0x2F4F4FFF);
const etk::Color etk::color::darkSlateGrey((uint32_t)0x2F4F4FFF);
const etk::Color etk::color::darkTurquoise((uint32_t)0x00CED1FF);
const etk::Color etk::color::darkViolet((uint32_t)0x9400D3FF);
const etk::Color etk::color::deepPink((uint32_t)0xFF1493FF);
const etk::Color etk::color::deepSkyBlue((uint32_t)0x00BFFFFF);
const etk::Color etk::color::dimGray((uint32_t)0x696969FF);
const etk::Color etk::color::dimGrey((uint32_t)0x696969FF);
const etk::Color etk::color::dodgerBlue((uint32_t)0x1E90FFFF);
const etk::Color etk::color::fireBrick((uint32_t)0xB22222FF);
const etk::Color etk::color::floralWhite((uint32_t)0xFFFAF0FF);
const etk::Color etk::color::forestGreen((uint32_t)0x228B22FF);
const etk::Color etk::color::fuchsia((uint32_t)0xFF00FFFF);
const etk::Color etk::color::gainsboro((uint32_t)0xDCDCDCFF);
const etk::Color etk::color::ghostWhite((uint32_t)0xF8F8FFFF);
const etk::Color etk::color::gold((uint32_t)0xFFD700FF);
const etk::Color etk::color::goldenRod((uint32_t)0xDAA520FF);
const etk::Color etk::color::gray((uint32_t)0x808080FF);
const etk::Color etk::color::grey((uint32_t)0x808080FF);
const etk::Color etk::color::green((uint32_t)0x008000FF);
const etk::Color etk::color::greenYellow((uint32_t)0xADFF2FFF);
const etk::Color etk::color::honeyDew((uint32_t)0xF0FFF0FF);
const etk::Color etk::color::hotPink((uint32_t)0xFF69B4FF);
const etk::Color etk::color::indianRed ((uint32_t)0xCD5C5CFF);
const etk::Color etk::color::indigo ((uint32_t)0x4B0082FF);
const etk::Color etk::color::ivory((uint32_t)0xFFFFF0FF);
const etk::Color etk::color::khaki((uint32_t)0xF0E68CFF);
const etk::Color etk::color::lavender((uint32_t)0xE6E6FAFF);
const etk::Color etk::color::lavenderBlush((uint32_t)0xFFF0F5FF);
const etk::Color etk::color::lawnGreen((uint32_t)0x7CFC00FF);
const etk::Color etk::color::lemonChiffon((uint32_t)0xFFFACDFF);
const etk::Color etk::color::lightBlue((uint32_t)0xADD8E6FF);
const etk::Color etk::color::lightCoral((uint32_t)0xF08080FF);
const etk::Color etk::color::lightCyan((uint32_t)0xE0FFFFFF);
const etk::Color etk::color::lightGoldenRodYellow((uint32_t)0xFAFAD2FF);
const etk::Color etk::color::lightGray((uint32_t)0xD3D3D3FF);
const etk::Color etk::color::lightGrey((uint32_t)0xD3D3D3FF);
const etk::Color etk::color::lightGreen((uint32_t)0x90EE90FF);
const etk::Color etk::color::lightPink((uint32_t)0xFFB6C1FF);
const etk::Color etk::color::lightSalmon((uint32_t)0xFFA07AFF);
const etk::Color etk::color::lightSeaGreen((uint32_t)0x20B2AAFF);
const etk::Color etk::color::lightSkyBlue((uint32_t)0x87CEFAFF);
const etk::Color etk::color::lightSlateGray((uint32_t)0x778899FF);
const etk::Color etk::color::lightSlateGrey((uint32_t)0x778899FF);
const etk::Color etk::color::lightSteelBlue((uint32_t)0xB0C4DEFF);
const etk::Color etk::color::lightYellow((uint32_t)0xFFFFE0FF);
const etk::Color etk::color::lime((uint32_t)0x00FF00FF);
const etk::Color etk::color::limeGreen((uint32_t)0x32CD32FF);
const etk::Color etk::color::linen((uint32_t)0xFAF0E6FF);
const etk::Color etk::color::magenta((uint32_t)0xFF00FFFF);
const etk::Color etk::color::maroon((uint32_t)0x800000FF);
const etk::Color etk::color::mediumAquaMarine((uint32_t)0x66CDAAFF);
const etk::Color etk::color::mediumBlue((uint32_t)0x0000CDFF);
const etk::Color etk::color::mediumOrchid((uint32_t)0xBA55D3FF);
const etk::Color etk::color::mediumPurple((uint32_t)0x9370D8FF);
const etk::Color etk::color::mediumSeaGreen((uint32_t)0x3CB371FF);
const etk::Color etk::color::mediumSlateBlue((uint32_t)0x7B68EEFF);
const etk::Color etk::color::mediumSpringGreen((uint32_t)0x00FA9AFF);
const etk::Color etk::color::mediumTurquoise((uint32_t)0x48D1CCFF);
const etk::Color etk::color::mediumVioletRed((uint32_t)0xC71585FF);
const etk::Color etk::color::midnightBlue((uint32_t)0x191970FF);
const etk::Color etk::color::mintCream((uint32_t)0xF5FFFAFF);
const etk::Color etk::color::mistyRose((uint32_t)0xFFE4E1FF);
const etk::Color etk::color::moccasin((uint32_t)0xFFE4B5FF);
const etk::Color etk::color::navajoWhite((uint32_t)0xFFDEADFF);
const etk::Color etk::color::navy((uint32_t)0x000080FF);
const etk::Color etk::color::oldLace((uint32_t)0xFDF5E6FF);
const etk::Color etk::color::olive((uint32_t)0x808000FF);
const etk::Color etk::color::oliveDrab((uint32_t)0x6B8E23FF);
const etk::Color etk::color::orange((uint32_t)0xFFA500FF);
const etk::Color etk::color::orangeRed((uint32_t)0xFF4500FF);
const etk::Color etk::color::orchid((uint32_t)0xDA70D6FF);
const etk::Color etk::color::paleGoldenRod((uint32_t)0xEEE8AAFF);
const etk::Color etk::color::paleGreen((uint32_t)0x98FB98FF);
const etk::Color etk::color::paleTurquoise((uint32_t)0xAFEEEEFF);
const etk::Color etk::color::paleVioletRed((uint32_t)0xD87093FF);
const etk::Color etk::color::papayaWhip((uint32_t)0xFFEFD5FF);
const etk::Color etk::color::peachPuff((uint32_t)0xFFDAB9FF);
const etk::Color etk::color::peru((uint32_t)0xCD853FFF);
const etk::Color etk::color::pink((uint32_t)0xFFC0CBFF);
const etk::Color etk::color::plum((uint32_t)0xDDA0DDFF);
const etk::Color etk::color::powderBlue((uint32_t)0xB0E0E6FF);
const etk::Color etk::color::purple((uint32_t)0x800080FF);
const etk::Color etk::color::red((uint32_t)0xFF0000FF);
const etk::Color etk::color::rosyBrown((uint32_t)0xBC8F8FFF);
const etk::Color etk::color::royalBlue((uint32_t)0x4169E1FF);
const etk::Color etk::color::saddleBrown((uint32_t)0x8B4513FF);
const etk::Color etk::color::salmon((uint32_t)0xFA8072FF);
const etk::Color etk::color::sandyBrown((uint32_t)0xF4A460FF);
const etk::Color etk::color::seaGreen((uint32_t)0x2E8B57FF);
const etk::Color etk::color::seaShell((uint32_t)0xFFF5EEFF);
const etk::Color etk::color::sienna((uint32_t)0xA0522DFF);
const etk::Color etk::color::silver((uint32_t)0xC0C0C0FF);
const etk::Color etk::color::skyBlue((uint32_t)0x87CEEBFF);
const etk::Color etk::color::slateBlue((uint32_t)0x6A5ACDFF);
const etk::Color etk::color::slateGray((uint32_t)0x708090FF);
const etk::Color etk::color::slateGrey((uint32_t)0x708090FF);
const etk::Color etk::color::snow((uint32_t)0xFFFAFAFF);
const etk::Color etk::color::springGreen((uint32_t)0x00FF7FFF);
const etk::Color etk::color::steelBlue((uint32_t)0x4682B4FF);
const etk::Color etk::color::tan((uint32_t)0xD2B48CFF);
const etk::Color etk::color::teal((uint32_t)0x008080FF);
const etk::Color etk::color::thistle((uint32_t)0xD8BFD8FF);
const etk::Color etk::color::tomato((uint32_t)0xFF6347FF);
const etk::Color etk::color::turquoise((uint32_t)0x40E0D0FF);
const etk::Color etk::color::violet((uint32_t)0xEE82EEFF);
const etk::Color etk::color::wheat((uint32_t)0xF5DEB3FF);
const etk::Color etk::color::white((uint32_t)0xFFFFFFFF);
const etk::Color etk::color::whiteSmoke((uint32_t)0xF5F5F5FF);
const etk::Color etk::color::yellow((uint32_t)0xFFFF00FF);
const etk::Color etk::color::yellowGreen((uint32_t)0x9ACD32FF);
typedef struct {
const char * colorName;
etk::Color color;
} colorList_ts;
static const colorList_ts listOfColor[] = {
{ "none", etk::color::none},
{ "AliceBlue", etk::color::aliceBlue},
{ "AntiqueWhite", etk::color::antiqueWhite},
{ "Aqua", etk::color::aqua},
{ "Aquamarine", etk::color::aquamarine},
{ "Azure", etk::color::azure},
{ "Beige", etk::color::beige},
{ "Bisque", etk::color::bisque},
{ "Black", etk::color::black},
{ "BlanchedAlmond", etk::color::blanchedAlmond},
{ "Blue", etk::color::blue},
{ "BlueViolet", etk::color::blueViolet},
{ "Brown", etk::color::brown},
{ "BurlyWood", etk::color::burlyWood},
{ "CadetBlue", etk::color::cadetBlue},
{ "Chartreuse", etk::color::chartreuse},
{ "Chocolate", etk::color::chocolate},
{ "Coral", etk::color::coral},
{ "CornflowerBlue", etk::color::cornflowerBlue},
{ "Cornsilk", etk::color::cornsilk},
{ "Crimson", etk::color::crimson},
{ "Cyan", etk::color::cyan},
{ "DarkBlue", etk::color::darkBlue},
{ "DarkCyan", etk::color::darkCyan},
{ "DarkGoldenRod", etk::color::darkGoldenRod},
{ "DarkGray", etk::color::darkGray},
{ "DarkGrey", etk::color::darkGrey},
{ "DarkGreen", etk::color::darkGreen},
{ "DarkKhaki", etk::color::darkKhaki},
{ "DarkMagenta", etk::color::darkMagenta},
{ "DarkOliveGreen", etk::color::darkOliveGreen},
{ "Darkorange", etk::color::darkorange},
{ "DarkOrchid", etk::color::darkOrchid},
{ "DarkRed", etk::color::darkRed},
{ "DarkSalmon", etk::color::darkSalmon},
{ "DarkSeaGreen", etk::color::darkSeaGreen},
{ "DarkSlateBlue", etk::color::darkSlateBlue},
{ "DarkSlateGray", etk::color::darkSlateGray},
{ "DarkSlateGrey", etk::color::darkSlateGrey},
{ "DarkTurquoise", etk::color::darkTurquoise},
{ "DarkViolet", etk::color::darkViolet},
{ "DeepPink", etk::color::deepPink},
{ "DeepSkyBlue", etk::color::deepSkyBlue},
{ "DimGray", etk::color::dimGray},
{ "DimGrey", etk::color::dimGrey},
{ "DodgerBlue", etk::color::dodgerBlue},
{ "FireBrick", etk::color::fireBrick},
{ "FloralWhite", etk::color::floralWhite},
{ "ForestGreen", etk::color::forestGreen},
{ "Fuchsia", etk::color::fuchsia},
{ "Gainsboro", etk::color::gainsboro},
{ "GhostWhite", etk::color::ghostWhite},
{ "Gold", etk::color::gold},
{ "GoldenRod", etk::color::goldenRod},
{ "Gray", etk::color::gray},
{ "Grey", etk::color::grey},
{ "Green", etk::color::green},
{ "GreenYellow", etk::color::greenYellow},
{ "HoneyDew", etk::color::honeyDew},
{ "HotPink", etk::color::hotPink},
{ "IndianRed", etk::color::indianRed},
{ "Indigo", etk::color::indigo},
{ "Ivory", etk::color::ivory},
{ "Khaki", etk::color::khaki},
{ "Lavender", etk::color::lavender},
{ "LavenderBlush", etk::color::lavenderBlush},
{ "LawnGreen", etk::color::lawnGreen},
{ "LemonChiffon", etk::color::lemonChiffon},
{ "LightBlue", etk::color::lightBlue},
{ "LightCoral", etk::color::lightCoral},
{ "LightCyan", etk::color::lightCyan},
{ "LightGoldenRodYellow", etk::color::lightGoldenRodYellow},
{ "LightGray", etk::color::lightGray},
{ "LightGrey", etk::color::lightGrey},
{ "LightGreen", etk::color::lightGreen},
{ "LightPink", etk::color::lightPink},
{ "LightSalmon", etk::color::lightSalmon},
{ "LightSeaGreen", etk::color::lightSeaGreen},
{ "LightSkyBlue", etk::color::lightSkyBlue},
{ "LightSlateGray", etk::color::lightSlateGray},
{ "LightSlateGrey", etk::color::lightSlateGrey},
{ "LightSteelBlue", etk::color::lightSteelBlue},
{ "LightYellow", etk::color::lightYellow},
{ "Lime", etk::color::lime},
{ "LimeGreen", etk::color::limeGreen},
{ "Linen", etk::color::linen},
{ "Magenta", etk::color::magenta},
{ "Maroon", etk::color::maroon},
{ "MediumAquaMarine", etk::color::mediumAquaMarine},
{ "MediumBlue", etk::color::mediumBlue},
{ "MediumOrchid", etk::color::mediumOrchid},
{ "MediumPurple", etk::color::mediumPurple},
{ "MediumSeaGreen", etk::color::mediumSeaGreen},
{ "MediumSlateBlue", etk::color::mediumSlateBlue},
{ "MediumSpringGreen", etk::color::mediumSpringGreen},
{ "MediumTurquoise", etk::color::mediumTurquoise},
{ "MediumVioletRed", etk::color::mediumVioletRed},
{ "MidnightBlue", etk::color::midnightBlue},
{ "MintCream", etk::color::mintCream},
{ "MistyRose", etk::color::mistyRose},
{ "Moccasin", etk::color::moccasin},
{ "NavajoWhite", etk::color::navajoWhite},
{ "Navy", etk::color::navy},
{ "OldLace", etk::color::oldLace},
{ "Olive", etk::color::olive},
{ "OliveDrab", etk::color::oliveDrab},
{ "Orange", etk::color::orange},
{ "OrangeRed", etk::color::orangeRed},
{ "Orchid", etk::color::orchid},
{ "PaleGoldenRod", etk::color::paleGoldenRod},
{ "PaleGreen", etk::color::paleGreen},
{ "PaleTurquoise", etk::color::paleTurquoise},
{ "PaleVioletRed", etk::color::paleVioletRed},
{ "PapayaWhip", etk::color::papayaWhip},
{ "PeachPuff", etk::color::peachPuff},
{ "Peru", etk::color::peru},
{ "Pink", etk::color::pink},
{ "Plum", etk::color::plum},
{ "PowderBlue", etk::color::powderBlue},
{ "Purple", etk::color::purple},
{ "Red", etk::color::red},
{ "RosyBrown", etk::color::rosyBrown},
{ "RoyalBlue", etk::color::royalBlue},
{ "SaddleBrown", etk::color::saddleBrown},
{ "Salmon", etk::color::salmon},
{ "SandyBrown", etk::color::sandyBrown},
{ "SeaGreen", etk::color::seaGreen},
{ "SeaShell", etk::color::seaShell},
{ "Sienna", etk::color::sienna},
{ "Silver", etk::color::silver},
{ "SkyBlue", etk::color::skyBlue},
{ "SlateBlue", etk::color::slateBlue},
{ "SlateGray", etk::color::slateGray},
{ "SlateGrey", etk::color::slateGrey},
{ "Snow", etk::color::snow},
{ "SpringGreen", etk::color::springGreen},
{ "SteelBlue", etk::color::steelBlue},
{ "Tan", etk::color::tan},
{ "Teal", etk::color::teal},
{ "Thistle", etk::color::thistle},
{ "Tomato", etk::color::tomato},
{ "Turquoise", etk::color::turquoise},
{ "Violet", etk::color::violet},
{ "Wheat", etk::color::wheat},
{ "White", etk::color::white},
{ "WhiteSmoke", etk::color::whiteSmoke},
{ "Yellow", etk::color::yellow},
{ "YellowGreen", etk::color::yellowGreen}
};
static const int32_t listOfColorSize = sizeof(listOfColor) / sizeof(colorList_ts);
etk::Color::Color(void)
{
red = 0xFF;
green = 0xFF;
blue = 0xFF;
alpha = 0xFF;
}
etk::Color::Color(const uint32_t _input)
{
red = (uint8_t)((_input&0xFF000000)>>24);
green = (uint8_t)((_input&0x00FF0000)>>16);
blue = (uint8_t)((_input&0x0000FF00)>>8);
alpha = (uint8_t)((_input&0x000000FF));
}
uint32_t etk::Color::Get(void) const
{
uint32_t directData = red<<24;
directData += green<<16;
directData += blue<<8;
directData += alpha;
return directData;
};
etk::Color::Color(const etk::Color& data)
{
if( this != &data ) {
red = data.red;
green = data.green;
blue = data.blue;
alpha = data.alpha;
}
}
etk::Color::Color(float _red, float _green, float _blue, float _alpha)
{
_red = etk_avg(0.0, _red, 1.0);
_green = etk_avg(0.0, _green, 1.0);
_blue = etk_avg(0.0, _blue, 1.0);
_alpha = etk_avg(0.0, _alpha, 1.0);
red = (uint8_t)(_red*256.0);
green = (uint8_t)(_green*256.0);
blue = (uint8_t)(_blue*256.0);
alpha = (uint8_t)(_alpha*256.0);
}
etk::Color::Color(uint8_t _red, uint8_t _green, uint8_t _blue, uint8_t _alpha)
{
red = _red;
green = _green;
blue = _blue;
alpha = _alpha;
}
etk::Color::Color(const char * _input)
{
etk::UString tmpVal = _input;
Set(tmpVal);
}
etk::Color::Color(etk::UString _input)
{
Set(_input);
}
void etk::Color::Set(etk::UString _input)
{
const char * inputData = _input.c_str();
*this = etk::color::white;
uint32_t _red, _green, _blue, _alpha;
float fred, fgreen, fblue, falpha;
size_t len = strlen(inputData);
if( len >=1
&& inputData[0] == '#') {
if(len == 4) {
if (sscanf(inputData + 1, "%1x%1x%1x", &red, &green, &blue) == 3) {
red = (red | red << 4);
green= (green | green << 4);
blue = (blue | blue << 4);
} else {
TK_ERROR(" pb in parsing the color : \"" << inputData << "\"");
}
} else if (len==5) {
if (sscanf(inputData + 1, "%1x%1x%1x%1x", &_red, &_green, &_blue, &_alpha) == 4) {
red = (_red | _red << 4);
green = (_green | _green << 4);
blue = (_blue | _blue << 4);
alpha = (_alpha | _alpha << 4);
} else {
TK_ERROR(" pb in parsing the color : \"" << inputData << "\"");
}
} else if (len == 7) {
if (sscanf(inputData + 1, "%2x%2x%2x", &_red, &_green, &_blue) == 3) {
red = _red;
green= _green;
blue = _blue;
} else {
TK_ERROR(" pb in parsing the color : \"" << inputData << "\"");
}
} else if (len == 9) {
if (sscanf(inputData + 1, "%2x%2x%2x%2x", &_red, &_green, &_blue, &_alpha) == 4) {
red = _red;
green= _green;
blue = _blue;
alpha = _alpha;
} else {
TK_ERROR(" pb in parsing the color : \"" << inputData << "\"");
}
} else {
TK_ERROR(" pb in parsing the color : \"" << inputData << "\" ==> unknown methode ...");
}
} else if( 4 <= len
&& inputData[0] == 'r'
&& inputData[1] == 'g'
&& inputData[2] == 'b'
&& inputData[3] == '(' ) {
if (sscanf(inputData + 4, "%u,%u,%u,%u", &_red, &_green, &_blue, &_alpha) == 4) {
red = etk_min(0xFF, _red);
green= etk_min(0xFF, _green);
blue = etk_min(0xFF, _blue);
alpha = etk_min(0xFF, _alpha);
} else if (sscanf(inputData + 4, "%u,%u,%u", &_red, &_green, &_blue) == 3) {
red = etk_min(0xFF, _red);
green= etk_min(0xFF, _green);
blue = etk_min(0xFF, _blue);
} else if (sscanf(inputData + 4, "%f%%,%f%%,%f%%,%f%%", &fred, &fgreen, &fblue, &falpha) == 4) {
fred = etk_avg(0.0, fred, 1.0);
fgreen= etk_avg(0.0, fgreen, 1.0);
fblue = etk_avg(0.0, fblue, 1.0);
falpha = etk_avg(0.0, falpha, 1.0);
red = (uint8_t)(fred * 255.);
green= (uint8_t)(fgreen * 255.);
blue = (uint8_t)(fblue * 255.);
alpha = (uint8_t)(falpha * 255.);
} else if (sscanf(inputData + 4, "%f%%,%f%%,%f%%", &fred, &fgreen, &fblue) == 3) {
fred = etk_avg(0.0, fred, 1.0);
fgreen= etk_avg(0.0, fgreen, 1.0);
fblue = etk_avg(0.0, fblue, 1.0);
red = (uint8_t)(fred * 255.);
green= (uint8_t)(fgreen * 255.);
blue = (uint8_t)(fblue * 255.);
} else {
TK_ERROR(" pb in parsing the color : \"" << inputData << "\" ==> unknown methode ...");
}
} else {
bool findIt = false;
// direct named color ...
for (int32_t iii=0; iii<listOfColorSize; iii++) {
if (etk::tool::strnCmpNoCase(listOfColor[iii].colorName, inputData, strlen(listOfColor[iii].colorName)) == true) {
findIt = true;
*this = listOfColor[iii].color;
// stop searching
break;
}
}
// not find color ...
if (findIt == false) {
TK_ERROR(" pb in parsing the color : \"" << inputData << "\" not find ...");
}
}
TK_VERBOSE("Parse color : \"" << inputData << "\" ==> " << *this);
}
etk::CCout& etk::operator <<(etk::CCout &os, const etk::Color &obj)
{
char tmpData[256];
snprintf(tmpData, 256, "#%02X%02X%02X%02X", obj.red, obj.green, obj.blue, obj.alpha);
os << tmpData;
return os;
}
etk::Color etk::Color::operator *(const etk::Color& _input)
{
etk::Color tmp(*this);
tmp *= _input;
return tmp;
}
etk::Color etk::Color::operator +(const etk::Color& _input)
{
etk::Color tmp(*this);
tmp += _input;
return tmp;
}
etk::Color etk::Color::operator -(const etk::Color& _input)
{
etk::Color tmp(*this);
tmp -= _input;
return tmp;
}
etk::Color& etk::Color::operator *=(const etk::Color& _input)
{
red = (int32_t)red * (int32_t)_input.red / 255;
green = (int32_t)green * (int32_t)_input.green / 255;
blue = (int32_t)blue * (int32_t)_input.blue / 255;
alpha = (int32_t)alpha * (int32_t)_input.alpha / 255;
return *this;
}
etk::Color& etk::Color::operator +=(const etk::Color& _input)
{
red = etk_min((int32_t)red + (int32_t)_input.red, 255);
green = etk_min((int32_t)green + (int32_t)_input.green, 255);
blue = etk_min((int32_t)blue + (int32_t)_input.blue, 255);
alpha = etk_min((int32_t)alpha + (int32_t)_input.alpha, 255);
return *this;
}
etk::Color& etk::Color::operator -=(const etk::Color& _input)
{
red = etk_min((int32_t)red - (int32_t)_input.red, 255);
green = etk_min((int32_t)green - (int32_t)_input.green, 255);
blue = etk_min((int32_t)blue - (int32_t)_input.blue, 255);
alpha = etk_min((int32_t)alpha - (int32_t)_input.alpha, 255);
return *this;
}
etk::Color& etk::Color::operator= (const etk::Color &_input )
{
//TK_INFO("OPERATOR de recopie");
if( this != &_input ) {
red = _input.red;
green = _input.green;
blue = _input.blue;
alpha = _input.alpha;
}
return *this;
}
etk::Color& etk::Color::operator= (const uint32_t _input )
{
red = (uint8_t)((_input&0xFF000000)>>24);
green = (uint8_t)((_input&0x00FF0000)>>16);
blue = (uint8_t)((_input&0x0000FF00)>>8);
alpha = (uint8_t)((_input&0x000000FF));
return *this;
}
bool etk::Color::operator==(const Color& _input) const
{
if( red != _input.red
|| green != _input.green
|| blue != _input.blue
|| alpha != _input.alpha ) {
return false;
}
return true;
}
bool etk::Color::operator!=(const Color& _input) const
{
if( red != _input.red
|| green != _input.green
|| blue != _input.blue
|| alpha != _input.alpha ) {
return true;
}
return false;
}

View File

@ -1,228 +0,0 @@
/**
*******************************************************************************
* @file etk/Color.h
* @brief Ewol Tool Kit : basic colors
* @author Edouard DUPIN
* @date 23/04/2012
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __ETK_COLOR_H__
#define __ETK_COLOR_H__
#include <etk/UString.h>
#ifndef __ETK_USTRING_H__
namespace etk {
class UString;
};
#endif
namespace etk {
class Color {
public:
uint8_t red;
uint8_t green;
uint8_t blue;
uint8_t alpha;
// constructor :
Color(void);
Color(const etk::Color& data);
Color(const uint32_t data);
Color(uint8_t _red, uint8_t _green, uint8_t _blue, uint8_t _alpha = 255);
Color(float _red, float _green, float _blue, float _alpha = 1.0);
Color(etk::UString data);
Color(const char * data);
// operator :
etk::Color operator *(const etk::Color& _input);
etk::Color operator +(const etk::Color& _input);
etk::Color operator -(const etk::Color& _input);
etk::Color& operator *=(const etk::Color& _input);
etk::Color& operator +=(const etk::Color& _input);
etk::Color& operator -=(const etk::Color& _input);
etk::Color& operator=(const uint32_t _input);
etk::Color& operator=(const etk::Color& _input);
bool operator==(const etk::Color& _input) const;
bool operator!=(const etk::Color& _input) const;
// access :
void Set(etk::UString _input);
uint32_t Get(void) const;
/*****************************************************
* Cout << operator
*****************************************************/
friend etk::CCout& operator <<( etk::CCout &os,const etk::Color &obj);
};
etk::CCout& operator <<(etk::CCout &os, const etk::Color &obj);
namespace color {
extern const Color none;
extern const Color aliceBlue;
extern const Color antiqueWhite;
extern const Color aqua;
extern const Color aquamarine;
extern const Color azure;
extern const Color beige;
extern const Color bisque;
extern const Color black;
extern const Color blanchedAlmond;
extern const Color blue;
extern const Color blueViolet;
extern const Color brown;
extern const Color burlyWood;
extern const Color cadetBlue;
extern const Color chartreuse;
extern const Color chocolate;
extern const Color coral;
extern const Color cornflowerBlue;
extern const Color cornsilk;
extern const Color crimson;
extern const Color cyan;
extern const Color darkBlue;
extern const Color darkCyan;
extern const Color darkGoldenRod;
extern const Color darkGray;
extern const Color darkGrey;
extern const Color darkGreen;
extern const Color darkKhaki;
extern const Color darkMagenta;
extern const Color darkOliveGreen;
extern const Color darkorange;
extern const Color darkOrchid;
extern const Color darkRed;
extern const Color darkSalmon;
extern const Color darkSeaGreen;
extern const Color darkSlateBlue;
extern const Color darkSlateGray;
extern const Color darkSlateGrey;
extern const Color darkTurquoise;
extern const Color darkViolet;
extern const Color deepPink;
extern const Color deepSkyBlue;
extern const Color dimGray;
extern const Color dimGrey;
extern const Color dodgerBlue;
extern const Color fireBrick;
extern const Color floralWhite;
extern const Color forestGreen;
extern const Color fuchsia;
extern const Color gainsboro;
extern const Color ghostWhite;
extern const Color gold;
extern const Color goldenRod;
extern const Color gray;
extern const Color grey;
extern const Color green;
extern const Color greenYellow;
extern const Color honeyDew;
extern const Color hotPink;
extern const Color indianRed;
extern const Color indigo;
extern const Color ivory;
extern const Color khaki;
extern const Color lavender;
extern const Color lavenderBlush;
extern const Color lawnGreen;
extern const Color lemonChiffon;
extern const Color lightBlue;
extern const Color lightCoral;
extern const Color lightCyan;
extern const Color lightGoldenRodYellow;
extern const Color lightGray;
extern const Color lightGrey;
extern const Color lightGreen;
extern const Color lightPink;
extern const Color lightSalmon;
extern const Color lightSeaGreen;
extern const Color lightSkyBlue;
extern const Color lightSlateGray;
extern const Color lightSlateGrey;
extern const Color lightSteelBlue;
extern const Color lightYellow;
extern const Color lime;
extern const Color limeGreen;
extern const Color linen;
extern const Color magenta;
extern const Color maroon;
extern const Color mediumAquaMarine;
extern const Color mediumBlue;
extern const Color mediumOrchid;
extern const Color mediumPurple;
extern const Color mediumSeaGreen;
extern const Color mediumSlateBlue;
extern const Color mediumSpringGreen;
extern const Color mediumTurquoise;
extern const Color mediumVioletRed;
extern const Color midnightBlue;
extern const Color mintCream;
extern const Color mistyRose;
extern const Color moccasin;
extern const Color navajoWhite;
extern const Color navy;
extern const Color oldLace;
extern const Color olive;
extern const Color oliveDrab;
extern const Color orange;
extern const Color orangeRed;
extern const Color orchid;
extern const Color paleGoldenRod;
extern const Color paleGreen;
extern const Color paleTurquoise;
extern const Color paleVioletRed;
extern const Color papayaWhip;
extern const Color peachPuff;
extern const Color peru;
extern const Color pink;
extern const Color plum;
extern const Color powderBlue;
extern const Color purple;
extern const Color red;
extern const Color rosyBrown;
extern const Color royalBlue;
extern const Color saddleBrown;
extern const Color salmon;
extern const Color sandyBrown;
extern const Color seaGreen;
extern const Color seaShell;
extern const Color sienna;
extern const Color silver;
extern const Color skyBlue;
extern const Color slateBlue;
extern const Color slateGray;
extern const Color slateGrey;
extern const Color snow;
extern const Color springGreen;
extern const Color steelBlue;
extern const Color tan;
extern const Color teal;
extern const Color thistle;
extern const Color tomato;
extern const Color turquoise;
extern const Color violet;
extern const Color wheat;
extern const Color white;
extern const Color whiteSmoke;
extern const Color yellow;
extern const Color yellowGreen;
};
};
#endif

View File

@ -1,83 +0,0 @@
/**
*******************************************************************************
* @file etk/Debug.h
* @brief Ewol Tool Kit : log implementation
* @author Edouard DUPIN
* @date 08/06/2010
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <etk/Debug.h>
#include <time.h>
// Max string size : (wide screan console nb caractere)
#define EDN_LOG_MAX_LENGTH 250
#define FUNCTION_NAME_SIZE (70)
void TOOLS_DisplayFuncName(int32_t ligne, const char* className, const char* funcName, const char* libName)
{
char tmpName[FUNCTION_NAME_SIZE] = "";
if (NULL == className) {
if (NULL == libName) {
snprintf(tmpName, FUNCTION_NAME_SIZE-1, "???????? | (l=%5d) %s ",ligne, funcName);
} else {
snprintf(tmpName, FUNCTION_NAME_SIZE-1, "%s | (l=%5d) %s ",libName, ligne, funcName);
}
} else {
if (NULL == libName) {
snprintf(tmpName, FUNCTION_NAME_SIZE-1, "???????? | (l=%5d) %s::%s ",ligne, className, funcName);
} else {
snprintf(tmpName, FUNCTION_NAME_SIZE-1, "%s | (l=%5d) %s::%s ", libName, ligne, className, funcName);
}
}
tmpName[FUNCTION_NAME_SIZE-4] = ' ';
tmpName[FUNCTION_NAME_SIZE-3] = '|';
tmpName[FUNCTION_NAME_SIZE-2] = ' ';
tmpName[FUNCTION_NAME_SIZE-1] = '\0';
etk::cout << tmpName;
}
void TOOLS_DisplayTime(void)
{
char tmpdata[50];
#ifdef __TARGET_OS__Android
struct timeval now;
gettimeofday(&now, NULL);
sprintf(tmpdata, " %2dh %2dmin %2ds | ", (int32_t)(now.tv_sec/3600)%24, (int32_t)(now.tv_sec/60)%60, (int32_t)(now.tv_sec%60));
#else
time_t rawtime;
struct tm * timeinfo;
time(&rawtime);
timeinfo = localtime(&rawtime);
sprintf(tmpdata, " %2dh %2dmin %2ds | ", (timeinfo->tm_hour)%24, timeinfo->tm_min, timeinfo->tm_sec);
#endif
etk::cout << tmpdata ;
}
#ifdef __TARGET_OS__Android
etk::logLevel_te g_requestedLevel = etk::LOG_LEVEL_VERBOSE;
#else
etk::logLevel_te g_requestedLevel = etk::LOG_LEVEL_ERROR;
#endif
void GeneralDebugSetLevel(etk::logLevel_te ccc) {
g_requestedLevel = ccc;
}

View File

@ -1,102 +0,0 @@
/**
*******************************************************************************
* @file etk/Debug.h
* @brief Ewol Tool Kit : log implementation
* @author Edouard DUPIN
* @date 08/06/2010
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __ETK_DEBUG_H__
#define __ETK_DEBUG_H__
#include <etk/Stream.h>
#include <etk/Types.h>
// Log Message System For EDN
void TOOLS_DisplayFuncName(int32_t ligne, const char* className, const char* funcName, const char* libName);
void TOOLS_DisplayTime(void);
#undef __class__
#define __class__ (NULL)
extern etk::logLevel_te g_requestedLevel;
void GeneralDebugSetLevel(etk::logLevel_te ccc);
#define ETK_DBG_COMMON(libName, info, data) do { \
if (info <= g_requestedLevel) { \
etk::cout << etk::cstart << info; \
TOOLS_DisplayTime(); \
TOOLS_DisplayFuncName(__LINE__, __class__, __func__, libName); \
etk::cout << data; \
etk::cout <<etk::endl; \
} \
}while(0)
#define ETK_CRITICAL(libName, data) ETK_DBG_COMMON(libName, etk::LOG_LEVEL_CRITICAL, data)
#if DEBUG_LEVEL > 0
# define ETK_WARNING(libName, data) ETK_DBG_COMMON(libName, etk::LOG_LEVEL_WARNING, data)
# define ETK_ERROR(libName, data) ETK_DBG_COMMON(libName, etk::LOG_LEVEL_ERROR, data)
#else
# define ETK_WARNING(libName, data) do {}while(0)
# define ETK_ERROR(libName, data) do {}while(0)
#endif
#if DEBUG_LEVEL > 1
# define ETK_INFO(libName, data) ETK_DBG_COMMON(libName, etk::LOG_LEVEL_INFO, data)
#else
# define ETK_INFO(libName, data) do {}while(0)
#endif
#if DEBUG_LEVEL > 2
# define ETK_DEBUG(libName, data) ETK_DBG_COMMON(libName, etk::LOG_LEVEL_DEBUG, data)
#else
# define ETK_DEBUG(libName, data) do {}while(0)
#endif
#if DEBUG_LEVEL > 3
# define ETK_VERBOSE(libName, data) ETK_DBG_COMMON(libName, etk::LOG_LEVEL_VERBOSE, data)
#else
# define ETK_VERBOSE(libName, data) do {}while(0)
#endif
#define ETK_ASSERT(libName, cond, data) do { \
if (!(cond)) { \
ETK_CRITICAL(libName, data); \
assert(!#cond); \
} \
} while (0)
#if DEBUG_LEVEL > 1
# define ETK_CHECK_INOUT(libName, cond) ETK_ASSERT(libName, (cond), "Internal input error : "#cond)
#elif DEBUG_LEVEL > 0
# define ETK_CHECK_INOUT(libName, cond) do { \
if (!(cond)) { \
ETK_CRITICAL(libName, "Internal input error : "#cond); \
} \
} while (0)
#else
# define ETK_CHECK_INOUT(libName, cond) do { } while (0)
#endif
#define ETK_TODO(libName, data) ETK_INFO(libName, "TODO : " << data)
#endif

View File

@ -1,25 +0,0 @@
/**
*******************************************************************************
* @file etk/DebugInternal.cpp
* @brief Ewol Tool Kit : log wrapper (sources)
* @author Edouard DUPIN
* @date 19/10/2011
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
const char * etkLibName = "Etk ";

View File

@ -1,43 +0,0 @@
/**
*******************************************************************************
* @file etk/DebugInternal.h
* @brief Ewol Tool Kit : log wrapper (header)
* @author Edouard DUPIN
* @date 19/10/2011
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __ETK_DEBUG_INTERNAL_H__
#define __ETK_DEBUG_INTERNAL_H__
#include "etk/Debug.h"
extern const char * etkLibName;
#define TK_CRITICAL(data) ETK_CRITICAL(etkLibName, data)
#define TK_WARNING(data) ETK_WARNING(etkLibName, data)
#define TK_ERROR(data) ETK_ERROR(etkLibName, data)
#define TK_INFO(data) ETK_INFO(etkLibName, data)
#define TK_DEBUG(data) ETK_DEBUG(etkLibName, data)
#define TK_VERBOSE(data) ETK_VERBOSE(etkLibName, data)
#define TK_ASSERT(cond, data) ETK_ASSERT(etkLibName, cond, data)
#define TK_CHECK_INOUT(cond) ETK_CHECK_INOUT(etkLibName, cond)
#define TK_TODO(cond) ETK_TODO(etkLibName, cond)
#endif

View File

@ -1,834 +0,0 @@
/**
*******************************************************************************
* @file etk/File.cpp
* @brief Ewol Tool Kit : File folder and name abstraction (Sources)
* @author Edouard DUPIN
* @date 16/07/2011
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <etk/Types.h>
#include <etk/DebugInternal.h>
#include <etk/File.h>
#include <unistd.h>
#include <stdlib.h>
#ifdef __TARGET_OS__Android
# include <stdio.h>
# include <zip/zip.h>
#endif
// zip file of the apk file for Android ==> set to zip file apk access
static etk::UString s_fileAPK = "";
etk::UString baseApplName = "ewolNoName";
#ifdef __TARGET_OS__Android
etk::UString baseFolderHome = "/sdcard/"; // home folder
etk::UString baseFolderData = "assets/"; // program Data
etk::UString baseFolderDataUser = "/sdcard/.tmp/userData/"; // Data specific user (local modification)
etk::UString baseFolderCache = "/sdcard/.tmp/cache/"; // Temporary data (can be removed the next time)
#else
etk::UString baseFolderHome = "~"; // home folder
etk::UString baseFolderData = "assets/"; // program Data
etk::UString baseFolderDataUser = "~/.tmp/userData/"; // Data specific user (local modification)
etk::UString baseFolderCache = "~/.tmp/cache/"; // Temporary data (can be removed the next time)
#endif
#ifdef __TARGET_OS__Android
static struct zip * s_APKArchive = NULL;
static int32_t s_APKnbFiles = 0;
static void loadAPK(etk::UString& apkPath)
{
TK_DEBUG("Loading APK \"" << apkPath << "\"");
s_APKArchive = zip_open(apkPath.c_str(), 0, NULL);
TK_ASSERT(s_APKArchive != NULL, "Error loading APK ... \"" << apkPath << "\"");
//Just for debug, print APK contents
s_APKnbFiles = zip_get_num_files(s_APKArchive);
TK_INFO("List all files in the APK : " << s_APKnbFiles << " files");
for (int iii=0; iii<s_APKnbFiles; iii++) {
const char* name = zip_get_name(s_APKArchive, iii, 0);
if (name == NULL) {
TK_ERROR("Error reading zip file name at index " << iii << " : \"" << zip_strerror(s_APKArchive) << "\"");
return;
}
TK_INFO(" File " << iii << " : \"" << name << "\"");
}
}
#endif
// for specific device contraint :
void etk::SetBaseFolderData(const char * folder)
{
#ifdef __TARGET_OS__Android
baseFolderData = "assets/";
s_fileAPK = folder;
loadAPK(s_fileAPK);
#else
TK_ERROR("Not Availlable Outside Android");
#endif
}
void etk::SetBaseFolderDataUser(const char * folder)
{
#ifdef __TARGET_OS__Android
baseFolderDataUser = folder;
#else
TK_ERROR("Not Availlable Outside Android");
#endif
}
void etk::SetBaseFolderCache(const char * folder)
{
#ifdef __TARGET_OS__Android
baseFolderCache = folder;
#else
TK_ERROR("Not Availlable Outside Android");
#endif
}
void etk::InitDefaultFolder(const char * applName)
{
baseApplName = applName;
char * basicPath = getenv("HOME");
if (NULL == basicPath) {
TK_ERROR("ERROR while trying to get the path of the home folder");
baseFolderHome = "~";
} else {
baseFolderHome = basicPath;
}
#ifndef __TARGET_OS__Android
#ifdef MODE_RELEASE
baseFolderData = "/usr/share/";
baseFolderData += baseApplName;
baseFolderData += "/";
#else
char cCurrentPath[FILENAME_MAX];
if (!getcwd(cCurrentPath, FILENAME_MAX)) {
baseFolderData = "./assets/";
} else {
cCurrentPath[FILENAME_MAX - 1] = '\0';
baseFolderData = cCurrentPath;
baseFolderData += "/assets/";
}
#endif
baseFolderDataUser = baseFolderHome;
baseFolderDataUser += "/.";
baseFolderDataUser += baseApplName;
baseFolderDataUser += "/";
baseFolderCache = "/tmp/";
baseFolderCache += baseApplName;
baseFolderCache += "/";
#endif
#ifdef MODE_RELEASE
if (strncmp("ewolApplNoName",applName, 256) != 0) {
// start log
}
#endif
TK_ERROR("baseFolderHome : \"" << baseFolderHome << "\"");
TK_ERROR("baseFolderData : \"" << baseFolderData << "\"");
TK_ERROR("baseFolderDataUser : \"" << baseFolderDataUser << "\"");
TK_ERROR("baseFolderCache : \"" << baseFolderCache << "\"");
}
etk::UString etk::GetUserHomeFolder(void)
{
return baseFolderHome;
}
#undef __class__
#define __class__ "File"
etk::CCout& etk::operator <<(etk::CCout &os, const etk::File &obj)
{
os << obj.m_folder;
os << "/";
os << obj.m_shortFilename;
return os;
}
etk::File::File(etk::UString &filename, etk::FileType_te type, int32_t LineNumber)
{
m_lineNumberOpen = LineNumber;
m_PointerFile = NULL;
SetCompleateName(filename, type);
}
etk::File::File(const char *filename, etk::FileType_te type, int32_t LineNumber)
{
etk::UString tmpString = filename;
m_lineNumberOpen = LineNumber;
m_PointerFile = NULL;
SetCompleateName(tmpString, type);
}
etk::File::File(etk::UString &filename, etk::UString &folder, etk::FileType_te type, int32_t lineNumber)
{
etk::UString tmpString = folder;
tmpString += "/";
tmpString += filename;
m_PointerFile = NULL;
SetCompleateName(tmpString, type);
m_lineNumberOpen = lineNumber;
}
etk::File::~File(void)
{
// nothing to do ...
if (NULL != m_PointerFile) {
TK_ERROR("Missing close the file : \"" << GetCompleateName() << "\"");
fClose();
}
}
etk::UString etk::File::GetFolder(void) const
{
return m_folder;
}
etk::UString etk::File::GetShortFilename(void) const
{
return m_shortFilename;
}
etk::UString etk::File::GetCompleateName(void) const
{
etk::UString out;
out = m_folder;
out += "/";
out += m_shortFilename;
return out;
}
const etk::File& etk::File::operator= (const etk::File &etkF )
{
if( this != &etkF ) // avoid copy to itself
{
m_folder = etkF.m_folder;
m_shortFilename = etkF.m_shortFilename;
m_lineNumberOpen = etkF.m_lineNumberOpen;
m_type = etkF.m_type;
if (NULL != m_PointerFile) {
TK_ERROR("Missing close the file : \"" << GetCompleateName() << "\"");
fClose();
}
#ifdef __TARGET_OS__Android
m_idZipFile = etkF.m_idZipFile;
m_zipData = NULL;
m_zipDataSize = 0;
m_zipReadingOffset = 0;
//m_zipPointerFile = NULL;
#endif
}
return *this;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
bool etk::File::operator== (const etk::File &etkF) const
{
if( this != &etkF ) {
if (etkF.GetCompleateName() == GetCompleateName() ) {
return true;
} else {
return false;
}
return true;
}
return true;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
bool etk::File::operator!= (const etk::File &etkF) const
{
return !(*this == etkF);
}
void etk::File::SetCompleateName(etk::UString &newFilename, etk::FileType_te type)
{
char buf[MAX_FILE_NAME];
memset(buf, 0, MAX_FILE_NAME);
char * ok;
#ifdef __TARGET_OS__Android
m_idZipFile = -1;
m_zipData = NULL;
m_zipDataSize = 0;
m_zipReadingOffset = 0;
//m_zipPointerFile = NULL;
#endif
// Reset ALL DATA :
m_folder = "";
m_shortFilename = "";
m_lineNumberOpen = 0;
TK_VERBOSE("1 :Set Name : " << newFilename );
etk::UString destFilename;
if (newFilename.Size() == 0) {
destFilename = "no-name";
} else {
destFilename = newFilename;
}
TK_VERBOSE("2 : Get file Name : " << destFilename << "start with '/'=" << destFilename.StartWith('/'));
if (true == destFilename.StartWith('/')) {
m_type = etk::FILE_TYPE_DIRECT;
if (type != etk::FILE_TYPE_DIRECT) {
TK_VERBOSE("Incompatible type with a file=\"" << newFilename << "\" ==> force it in direct mode ...");
}
} else {
if (type == etk::FILE_TYPE_DIRECT) {
//TK_WARNING("Incompatible type with a file=\"" << newFilename << "\" ==> force it in FILE_TYPE_DATA mode ...");
//m_type = etk::FILE_TYPE_DATA;
m_type = etk::FILE_TYPE_DIRECT;
// add current path :
// Get the command came from the running of the program :
char cCurrentPath[FILENAME_MAX];
if (!getcwd(cCurrentPath, FILENAME_MAX)) {
return;
}
cCurrentPath[FILENAME_MAX - 1] = '\0';
etk::UString tmpFilename = destFilename;
destFilename = cCurrentPath;
destFilename += "/";
destFilename += tmpFilename;
} else {
m_type = type;
}
}
bool needUnpack = false;
#if ETK_DEBUG_LEVEL > 3
char *mode = NULL;
#endif
switch (m_type)
{
case etk::FILE_TYPE_DATA:
{
#if DEBUG_LEVEL > 3
mode = "FILE_TYPE_DATA";
#endif
#ifdef __TARGET_OS__Android
etk::UString tmpFilename = baseFolderData + destFilename;
for (int iii=0; iii<s_APKnbFiles; iii++) {
const char* name = zip_get_name(s_APKArchive, iii, 0);
if (name == NULL) {
return;
}
if (tmpFilename == name) {
m_idZipFile = iii;
break;
}
}
if (-1 == m_idZipFile) {
TK_ERROR("File Does not existed ... in APK : \"" << tmpFilename << "\"");
} else {
TK_VERBOSE("File existed ... in APK : \"" << tmpFilename << "\" ==> id=" << m_idZipFile);
}
#else
//etk::UString tmpFilename = destFilename;
//destFilename = baseFolderData;
//destFilename += tmpFilename;
#endif
}
break;
case etk::FILE_TYPE_USER_DATA:
{
#if DEBUG_LEVEL > 3
mode = "FILE_TYPE_USER_DATA";
#endif
etk::UString tmpFilename = destFilename;
destFilename = baseFolderDataUser;
destFilename += tmpFilename;
}
needUnpack = true;
break;
case etk::FILE_TYPE_CACHE:
{
#if DEBUG_LEVEL > 3
mode = "FILE_TYPE_CACHE";
#endif
etk::UString tmpFilename = destFilename;
destFilename = baseFolderCache;
destFilename += tmpFilename;
}
needUnpack = true;
break;
default:
// nothing to do ...
#if DEBUG_LEVEL > 3
mode = "FILE_TYPE_DIRECT";
#endif
needUnpack = true;
break;
}
TK_VERBOSE("3 : Get file Name : " << destFilename );
if (true == needUnpack) {
// Get the real Path of the current File
ok = realpath(destFilename.c_str(), buf);
if (!ok) {
int32_t lastPos = destFilename.FindBack('/');
if (-1 != lastPos) {
// Get the FileName
etk::UString tmpFilename = destFilename.Extract(lastPos+1);
destFilename.Remove(lastPos, destFilename.Size() - lastPos);
TK_VERBOSE("try to find :\"" << destFilename << "\" / \"" << tmpFilename << "\" ");
ok = realpath(destFilename.c_str(), buf);
if (!ok) {
TK_VERBOSE("Can not find real Path name of \"" << destFilename << "\"");
m_shortFilename = tmpFilename;
m_folder = destFilename;
} else {
// ALL is OK ...
m_shortFilename = tmpFilename;
m_folder = destFilename;
}
} else {
TK_VERBOSE("file : \"" << destFilename << "\" ==> No data???");
// Basic ERROR ...
m_shortFilename = destFilename;
}
} else {
destFilename = buf;
int32_t lastPos = destFilename.FindBack('/');
if (-1 != lastPos) {
m_shortFilename = destFilename.Extract(lastPos+1);
m_folder = destFilename.Extract(0, lastPos);
} else {
// Basic ERROR ...
TK_VERBOSE("file : \"" << destFilename << "\" ==> No data???");
m_shortFilename = destFilename;
}
}
} else {
int32_t lastPos = destFilename.FindBack('/');
if (-1 != lastPos) {
m_shortFilename = destFilename.Extract(lastPos+1);
m_folder = destFilename.Extract(0, lastPos);
} else {
// Basic ERROR ...
TK_VERBOSE("file : \"" << destFilename << "\" ==> No data???");
m_shortFilename = destFilename;
}
}
TK_VERBOSE("Set FileName :\"" << m_folder << "\" / \"" << m_shortFilename << "\" mode=" << mode);
}
int32_t etk::File::GetLineNumber(void)
{
return m_lineNumberOpen;
}
void etk::File::SetLineNumber(int32_t newline)
{
m_lineNumberOpen = newline;
}
bool etk::File::HasExtention(void)
{
int32_t lastPos = m_shortFilename.FindBack('.');
if( -1 != lastPos // not find the .
&& 0 != lastPos // Find a . at the fist position .jdlskjdfklj ==> hiden file
&& m_shortFilename.Size() != lastPos ) // Remove file ended with .
{
return true;
} else {
return false;
}
}
etk::UString etk::File::GetExtention(void)
{
etk::UString tmpExt = "";
int32_t lastPos = m_shortFilename.FindBack('.');
if( -1 != lastPos // not find the .
&& 0 != lastPos // Find a . at the fist position .jdlskjdfklj ==> hiden file
&& m_shortFilename.Size() != lastPos ) // Remove file ended with .
{
// Get the FileName
tmpExt = m_shortFilename.Extract(lastPos+1);
}
return tmpExt;
}
#ifdef __TARGET_OS__Android
bool etk::File::LoadDataZip(void)
{
if (NULL != m_zipData) {
return true;
} else {
struct zip_file * m_zipPointerFile= zip_fopen_index(s_APKArchive, m_idZipFile, 0);
if (NULL == m_zipPointerFile) {
TK_ERROR("Can not find the file name=\"" << GetCompleateName() << "\"");
return false;
}
// get the fileSize .... end read all the data from the zip files
struct zip_stat zipFileProperty;
zip_stat_init(&zipFileProperty);
zip_stat_index(s_APKArchive, m_idZipFile, 0, &zipFileProperty);
TK_VERBOSE("LOAD data from the files : \"" << GetCompleateName() << "\"");
/*
TK_DEBUG(" name=" << zipFileProperty.name);
TK_DEBUG(" index=" << zipFileProperty.index);
TK_DEBUG(" crc=" << zipFileProperty.crc);
TK_DEBUG(" mtime=" << zipFileProperty.mtime);
TK_DEBUG(" size=" << zipFileProperty.size);
TK_DEBUG(" comp_size=" << zipFileProperty.comp_size);
TK_DEBUG(" comp_method=" << zipFileProperty.comp_method);
TK_DEBUG(" encryption_method=" << zipFileProperty.encryption_method);
*/
m_zipDataSize = zipFileProperty.size;
m_zipData = new char[m_zipDataSize +10];
if (NULL == m_zipData) {
TK_ERROR("File allocation ERROR : \"" << GetCompleateName() << "\"");
zip_fclose(m_zipPointerFile);
return false;
}
memset(m_zipData, 0, m_zipDataSize +10);
int32_t sizeTmp = zip_fread(m_zipPointerFile, m_zipData, m_zipDataSize);
if (sizeTmp != m_zipDataSize) {
TK_ERROR("File load data ERROR : \"" << GetCompleateName() << "\"");
zip_fclose(m_zipPointerFile);
delete[] m_zipData;
return false;
}
zip_fclose(m_zipPointerFile);
m_zipPointerFile = NULL;
return true;
}
}
#endif
int32_t etk::File::Size(void)
{
#ifdef __TARGET_OS__Android
if (etk::FILE_TYPE_DATA == m_type) {
if (true == LoadDataZip()) {
return m_zipDataSize;
}
return 0;
}
#endif
FILE *myFile=NULL;
etk::UString myCompleateName;
switch (m_type)
{
case etk::FILE_TYPE_DATA:
myCompleateName = baseFolderData;
break;
case etk::FILE_TYPE_USER_DATA:
myCompleateName = baseFolderDataUser;
break;
case etk::FILE_TYPE_CACHE:
myCompleateName = baseFolderCache;
break;
default:
myCompleateName = "";
break;
}
myCompleateName += GetCompleateName();
myFile=fopen(myCompleateName.c_str(),"rb");
if(NULL == myFile) {
//EWOL_ERROR("Can not find the file name=\"" << m_folder << "\" / \"" << m_shortFilename << "\"");
return -1;
}
int32_t size = 0;
fseek(myFile, 0, SEEK_END);
size = ftell(myFile);
fseek(myFile, 0, SEEK_SET);
fclose(myFile);
return size;
}
bool etk::File::Exist(void)
{
#ifdef __TARGET_OS__Android
if (etk::FILE_TYPE_DATA == m_type) {
if (m_idZipFile >= -1 && m_idZipFile < s_APKnbFiles) {
return true;
}
return false;
}
#endif
FILE *myFile=NULL;
etk::UString myCompleateName;
switch (m_type)
{
case etk::FILE_TYPE_DATA:
myCompleateName = baseFolderData;
break;
case etk::FILE_TYPE_USER_DATA:
myCompleateName = baseFolderDataUser;
break;
case etk::FILE_TYPE_CACHE:
myCompleateName = baseFolderCache;
break;
default:
myCompleateName = "";
break;
}
myCompleateName += GetCompleateName();
myFile=fopen(myCompleateName.c_str(),"rb");
if(NULL == myFile) {
TK_DEBUG("try to open : " << myCompleateName.c_str());
return false;
}
fclose(myFile);
return true;
}
bool etk::File::fOpenRead(void)
{
#ifdef __TARGET_OS__Android
if (etk::FILE_TYPE_DATA == m_type) {
return LoadDataZip();
}
#endif
if (NULL != m_PointerFile) {
TK_CRITICAL("File Already open : \"" << GetCompleateName() << "\"");
return true;
}
etk::UString myCompleateName;
switch (m_type)
{
case etk::FILE_TYPE_DATA:
myCompleateName = baseFolderData;
break;
case etk::FILE_TYPE_USER_DATA:
myCompleateName = baseFolderDataUser;
break;
case etk::FILE_TYPE_CACHE:
myCompleateName = baseFolderCache;
break;
default:
myCompleateName = "";
break;
}
myCompleateName += GetCompleateName();
m_PointerFile=fopen(myCompleateName.c_str(),"rb");
if(NULL == m_PointerFile) {
TK_ERROR("Can not find the file name=\"" << GetCompleateName() << "\"");
return false;
}
return true;
}
bool etk::File::fOpenWrite(void)
{
#ifdef __TARGET_OS__Android
if (etk::FILE_TYPE_DATA == m_type) {
return false;
}
#endif
if (NULL != m_PointerFile) {
TK_CRITICAL("File Already open : \"" << GetCompleateName() << "\"");
return true;
}
etk::UString myCompleateName;
switch (m_type)
{
case etk::FILE_TYPE_DATA:
myCompleateName = baseFolderData;
break;
case etk::FILE_TYPE_USER_DATA:
myCompleateName = baseFolderDataUser;
break;
case etk::FILE_TYPE_CACHE:
myCompleateName = baseFolderCache;
break;
default:
myCompleateName = "";
break;
}
myCompleateName += GetCompleateName();
m_PointerFile=fopen(myCompleateName.c_str(),"wb");
if(NULL == m_PointerFile) {
TK_ERROR("Can not find the file name=\"" << GetCompleateName() << "\"");
return false;
}
return true;
}
bool etk::File::fClose(void)
{
#ifdef __TARGET_OS__Android
if (etk::FILE_TYPE_DATA == m_type) {
if (NULL == m_zipData) {
TK_CRITICAL("File Already closed : \"" << GetCompleateName() << "\"");
return false;
}
delete[] m_zipData;
m_zipData = NULL;
m_zipDataSize = 0;
m_zipReadingOffset = 0;
return true;
}
#endif
if (NULL == m_PointerFile) {
TK_CRITICAL("File Already closed : \"" << GetCompleateName() << "\"");
return false;
}
fclose(m_PointerFile);
m_PointerFile = NULL;
return true;
}
char * etk::File::fGets(char * elementLine, int32_t maxData)
{
memset(elementLine, 0, maxData);
#ifdef __TARGET_OS__Android
char * element = elementLine;
if (etk::FILE_TYPE_DATA == m_type) {//char * tmpData = internalDataFiles[iii].data + m_readingOffset;
if (NULL == m_zipData) {
element[0] = '\0';
return NULL;
}
if (m_zipReadingOffset>m_zipDataSize) {
element[0] = '\0';
return NULL;
}
while (m_zipData[m_zipReadingOffset] != '\0') {
if( m_zipData[m_zipReadingOffset] == '\n'
|| m_zipData[m_zipReadingOffset] == '\r')
{
*element = m_zipData[m_zipReadingOffset];
element++;
m_zipReadingOffset++;
*element = '\0';
return elementLine;
}
*element = m_zipData[m_zipReadingOffset];
element++;
m_zipReadingOffset++;
if (m_zipReadingOffset>m_zipDataSize) {
*element = '\0';
return elementLine;
}
}
return NULL;
}
#endif
return fgets(elementLine, maxData, m_PointerFile);
}
int32_t etk::File::fRead(void * data, int32_t blockSize, int32_t nbBlock)
{
#ifdef __TARGET_OS__Android
if (etk::FILE_TYPE_DATA == m_type) {
if (NULL == m_zipData) {
((char*)data)[0] = '\0';
return 0;
}
int32_t dataToRead = blockSize * nbBlock;
if (dataToRead + m_zipReadingOffset > m_zipDataSize) {
nbBlock = ((m_zipDataSize - m_zipReadingOffset) / blockSize);
dataToRead = blockSize * nbBlock;
}
memcpy(data, &m_zipData[m_zipReadingOffset], dataToRead);
m_zipReadingOffset += dataToRead;
return nbBlock;
}
#endif
return fread(data, blockSize, nbBlock, m_PointerFile);
}
int32_t etk::File::fWrite(void * data, int32_t blockSize, int32_t nbBlock)
{
#ifdef __TARGET_OS__Android
if (etk::FILE_TYPE_DATA == m_type) {
TK_CRITICAL("Can not write on data inside APK : \"" << GetCompleateName() << "\"");
return 0;
}
#endif
return fwrite(data, blockSize, nbBlock, m_PointerFile);
}
bool etk::File::fSeek(long int offset, int origin)
{
#ifdef __TARGET_OS__Android
if (etk::FILE_TYPE_DATA == m_type) {
if (NULL == m_zipData) {
return false;
}
int32_t positionEnd = 0;
switch(origin) {
case SEEK_END:
positionEnd = m_zipDataSize;
break;
case SEEK_CUR:
positionEnd = m_zipReadingOffset;
break;
default:
positionEnd = 0;
break;
}
positionEnd += offset;
if (positionEnd < 0) {
positionEnd = 0;
} else if (positionEnd > m_zipDataSize) {
positionEnd = m_zipDataSize;
}
m_zipReadingOffset = positionEnd;
return true;
}
#endif
fseek(m_PointerFile, offset, origin);
if(ferror(m_PointerFile)) {
return false;
} else {
return true;
}
}
char * etk::File::GetDirectPointer(void)
{
#ifdef __TARGET_OS__Android
if (etk::FILE_TYPE_DATA == m_type) {
if (NULL == m_zipData) {
return NULL;
}
return m_zipData;
}
#endif
return NULL;
}

View File

@ -1,120 +0,0 @@
/**
*******************************************************************************
* @file etk/File.h
* @brief Ewol Tool Kit : File folder and name abstraction (header)
* @author Edouard DUPIN
* @date 16/07/2011
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __ETK_FILE_H__
#define __ETK_FILE_H__
#include <etk/UString.h>
#define MAX_FILE_NAME (10240)
//http://developer.android.com/guide/topics/data/data-storage.html
namespace etk
{
typedef enum {
// user might done abstraction ==> acces of the sdcard when possible ...
FILE_TYPE_DIRECT,
// depend of the case
// - PC : /usr/shared/programName/
// - Android : Internal at the executable file (pointer on static area)
// - Apple : Internal at the executable file
FILE_TYPE_DATA,
// depend on case
// - PC : ~/.programName/
// - Android : /data/data/programName/files/
// - Apple : ????
FILE_TYPE_USER_DATA,
// depend on case
// - PC : ~/.programName/cache/
// - Android : /data/data/programName/cache/
// - Apple : ????
FILE_TYPE_CACHE,
} FileType_te;
class File
{
public:
File(void) { m_lineNumberOpen=0; m_type = etk::FILE_TYPE_DIRECT; m_PointerFile = NULL;}
File(etk::UString &filename, etk::FileType_te type = etk::FILE_TYPE_DIRECT, int32_t LineNumber = 0);
File(const char *filename, etk::FileType_te type = etk::FILE_TYPE_DIRECT, int32_t LineNumber = 0);
File(etk::UString &filename, etk::UString &folder, etk::FileType_te type = etk::FILE_TYPE_DIRECT, int32_t lineNumber = 0);
~File(void);
etk::UString GetFolder(void) const;
etk::UString GetShortFilename(void) const;
etk::UString GetCompleateName(void) const;
bool HasExtention(void);
etk::UString GetExtention(void);
int32_t Size(void);
bool Exist(void);
int32_t GetLineNumber(void);
void SetLineNumber(int32_t newline);
void SetCompleateName(etk::UString &newFilename, etk::FileType_te type);
const etk::File& operator= (const etk::File &etkF );
bool operator== (const etk::File &etkF ) const;
bool operator!= (const etk::File &etkF ) const;
friend etk::CCout& operator <<( etk::CCout &os,const etk::File &obj);
FileType_te GetTypeAccess(void) { return m_type; };
char * GetDirectPointer(void);
// TODO : IO access of the file :
bool fOpenRead(void);
bool fOpenWrite(void);
bool fClose(void);
char * fGets(char * elementLine, int32_t maxData);
int32_t fRead(void * data, int32_t blockSize, int32_t nbBlock);
int32_t fWrite(void * data, int32_t blockSize, int32_t nbBlock);
bool fSeek(long int offset, int origin);
private :
etk::FileType_te m_type;
FILE * m_PointerFile;
#ifdef __TARGET_OS__Android
bool LoadDataZip(void);
int32_t m_idZipFile;
char * m_zipData;
int32_t m_zipDataSize;
int32_t m_zipReadingOffset;
#endif
etk::UString m_folder;
etk::UString m_shortFilename;
int32_t m_lineNumberOpen;
};
etk::CCout& operator <<(etk::CCout &os, const etk::File &obj);
void SetBaseFolderData(const char * folder);
void SetBaseFolderDataUser(const char * folder);
void SetBaseFolderCache(const char * folder);
void InitDefaultFolder(const char * applName);
etk::UString GetUserHomeFolder(void);
}
#endif

View File

@ -1,51 +0,0 @@
/**
*******************************************************************************
* @file etk/Memory.cpp
* @brief Ewol Tool Kit : Memory implementation (Sources)
* @author Edouard DUPIN
* @date 19/10/2011
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <etk/Types.h>
#include <etk/Memory.h>
// General
#if ETK_MEMORY_CHECKER > 0
void etk::MemFree( void * pointerData, const char * variableName, const char * functionName, int32_t line, const char * fileName )
{
TK_CRITICAL(" MEM FREE is not written ==> TODO...");
if (NULL != pointerData) {
free(pointerData);
}
}
void * etk::MemMalloc( size_t num, size_t size, uint8_t init, const char * variableName, const char * functionName, int32_t line, const char * fileName )
{
TK_CRITICAL(" MEM ALLOCATOR is not written ==> TODO...");
return calloc(num, size);
}
void etk::MemShowLogs( void )
{
TK_CRITICAL(" MEM DISPLAY is not written ==> TODO...");
}
#endif

View File

@ -1,96 +0,0 @@
/**
*******************************************************************************
* @file etk/Memory.h
* @brief Ewol Tool Kit : Memory implementation (headers)
* @author Edouard DUPIN
* @date 12/01/2011
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __ETK_TOOLS_MEMORY_H__
#define __ETK_TOOLS_MEMORY_H__
#ifndef ETK_MEMORY_CHECKER
#define ETK_MEMORY_CHECKER 0
#endif
// General
#if ETK_MEMORY_CHECKER > 0
namespace etk {
void MemFree( void * pointerData, const char * variableName, const char * functionName, int32_t line, const char * fileName );
void * MemMalloc( size_t num, size_t size, uint8_t init, const char * variableName, const char * functionName, int32_t line, const char * fileName );
void MemShowLogs( void );
};
# define ETK_MALLOC(pointerData, nbElements, dataType) do { \
pointerData = (dataType *)etk::MemMalloc( (nbElements), sizeof(dataType), 0, #pointerData, __func__, __LINE__, __FILE__); \
}while(0)
# define ETK_MALLOC_CAST(pointerData, nbElements, dataType, cast) do { \
pointerData = (cast)etk::MemMalloc( (nbElements), sizeof(dataType), 0, #pointerData, __func__, __LINE__, __FILE__); \
}while(0)
# define ETK_CALLOC(pointerData, nbElements, dataType) do { \
pointerData = (dataType *)etk::MemMalloc( (nbElements), sizeof(dataType), 1, #pointerData, __func__, __LINE__, __FILE__); \
}while(0)
# define ETK_CALLOC_CAST(pointerData, nbElements, dataType, cast) do { \
pointerData = (cast)etk::MemMalloc( (nbElements), sizeof(dataType), 1, #pointerData, __func__, __LINE__, __FILE__); \
}while(0)
# define ETK_FREE(pointerData) do { \
etk::MemFree( (pointerData) , #pointerData, __func__, __LINE__, __FILE__); \
(pointerData) = NULL; \
}while(0)
# define ETK_MEM_SHOW_LOG() do { \
etk::MemShowLogs(); \
}while(0)
#else
# define ETK_MALLOC(pointerData, nbElements, dataType) do { \
(pointerData) = (dataType *)malloc( (nbElements) * sizeof(dataType) ); \
}while(0)
# define ETK_MALLOC_CAST(pointerData, nbElements, dataType, cast) do { \
(pointerData) = (cast)malloc( (nbElements) * sizeof(dataType) ); \
}while(0)
# define ETK_CALLOC(pointerData, nbElements, dataType) do { \
(pointerData) = (dataType *)calloc( (nbElements), sizeof(dataType) ); \
}while(0)
# define ETK_CALLOC_CAST(pointerData, nbElements, dataType, cast) do { \
(pointerData) = (cast)calloc( (nbElements), sizeof(dataType) ); \
}while(0)
# define ETK_REALLOC(pointerData, nbElements, dataType) do { \
(pointerData) = (dataType *)realloc( (pointerData), (nbElements)* sizeof(dataType) ); \
}while(0)
# define ETK_REALLOC_CAST(pointerData, nbElements, dataType, cast) do { \
(pointerData) = (cast)realloc( (pointerData), (nbElements) * sizeof(dataType) ); \
}while(0)
# define ETK_FREE(pointerData) do { \
free( pointerData ); \
(pointerData) = NULL; \
}while(0)
# define ETK_MEM_SHOW_LOG() do { \
TK_DEBUG("No Memory check availlable"); \
}while(0)
#endif
#endif

View File

@ -1,484 +0,0 @@
/**
*******************************************************************************
* @file etk/RegExp.cpp
* @brief Ewol Tool Kit : Regular expression annalyser (sources)
* @author Edouard DUPIN
* @date 04/04/2011
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <etk/RegExp.h>
const etk::convertionTable_ts etk::constConvertionTable[] = {
// haveBackSlash, inputValue, newValue
{ false , '(' , REGEXP_OPCODE_PTHESE_IN},
{ true , '(' , (int16_t)'('},
{ false , ')' , REGEXP_OPCODE_PTHESE_OUT},
{ true , ')' , (int16_t)')'},
{ false , '[' , REGEXP_OPCODE_BRACKET_IN},
{ true , '[' , (int16_t)'['},
{ false , ']' , REGEXP_OPCODE_BRACKET_OUT},
{ true , ']' , (int16_t)']'},
{ false , '{' , REGEXP_OPCODE_BRACE_IN},
{ true , '{' , (int16_t)'{'},
{ false , '}' , REGEXP_OPCODE_BRACE_OUT},
{ true , '}' , (int16_t)'}'},
{ false , '-' , REGEXP_OPCODE_TO},
{ true , '-' , (int16_t)'-'},
{ false , '*' , REGEXP_OPCODE_STAR},
{ true , '*' , (int16_t)'*'},
{ false , '.' , REGEXP_OPCODE_DOT},
{ true , '.' , (int16_t)'.'},
{ false , '?' , REGEXP_OPCODE_QUESTION},
{ true , '?' , (int16_t)'?'},
{ false , '+' , REGEXP_OPCODE_PLUS},
{ true , '+' , (int16_t)'+'},
{ false , '|' , REGEXP_OPCODE_PIPE},
{ true , '|' , (int16_t)'|'},
{ false , '^' , REGEXP_OPCODE_START_OF_LINE},
{ true , '^' , (int16_t)'^'},
{ false , '$' , REGEXP_OPCODE_END_OF_LINE},
{ true , '$' , (int16_t)'$'},
{ true , 'd' , REGEXP_OPCODE_DIGIT},
{ true , 'D' , REGEXP_OPCODE_DIGIT_NOT},
{ true , 'l' , REGEXP_OPCODE_LETTER},
{ true , 'L' , REGEXP_OPCODE_LETTER_NOT},
{ true , 's' , REGEXP_OPCODE_SPACE},
{ true , 'S' , REGEXP_OPCODE_SPACE_NOT},
{ true , 'w' , REGEXP_OPCODE_WORD},
{ true , 'W' , REGEXP_OPCODE_WORD_NOT},
{ true , 'a' , (int16_t)'\a'},
{ true , 'b' , (int16_t)'\b'},
{ true , 'e' , 0x001B}, // Escape character <Esc>
{ true , 'f' , (int16_t)'\f'},
{ true , 'n' , (int16_t)'\n'},
{ true , 'r' , (int16_t)'\r'},
{ true , 't' , (int16_t)'\t'},
{ true , 'v' , (int16_t)'\v'},
{ true , '\\' , (int16_t)'\\'},
{ true , '&' , (int16_t)'&'},
{ true , '0' , (int16_t)'\0'},
{ true , '@' , REGEXP_OPCODE_NO_CHAR},
};
const int32_t etk::constConvertionTableSize = sizeof(etk::constConvertionTable) / sizeof(etk::convertionTable_ts) ;
/**
* @brief Display the internal data of a node
*
* @param[in] data element do display in the console
*
* @return ---
*
*/
void etk::DisplayData(etk::Vector<char> &data)
{
int32_t i;
for (i=0; i<(int32_t)data.Size() ; i++) {
etk::cout<< (char)(data[i]&0x00FF );
}
}
/**
* @brief Display of a part of the Regexp element
*
* @param[in] data Vector where data is constain
* @param[in] start Position where the display might start
* @param[in] stop Position where the display might stop
*
* @return ---
*
*/
void etk::DisplayElem(etk::Vector<int16_t> &data, int32_t start, int32_t stop)
{
int32_t i;
etk::cout<< ETK_BASH_COLOR_NORMAL;
for (i=start; i<(int32_t)data.Size() && i<stop ; i++) {
switch(data[i])
{
case REGEXP_OPCODE_PTHESE_IN: etk::cout<<ETK_BASH_COLOR_RED << (char*)"(" << ETK_BASH_COLOR_NORMAL; break;
case REGEXP_OPCODE_PTHESE_OUT: etk::cout<<ETK_BASH_COLOR_RED << (char*)")" << ETK_BASH_COLOR_NORMAL; break;
case REGEXP_OPCODE_BRACKET_IN: etk::cout<<ETK_BASH_COLOR_YELLOW << (char*)"[" << ETK_BASH_COLOR_NORMAL; break;
case REGEXP_OPCODE_BRACKET_OUT: etk::cout<<ETK_BASH_COLOR_YELLOW << (char*)"]" << ETK_BASH_COLOR_NORMAL; break;
case REGEXP_OPCODE_TO: etk::cout<<ETK_BASH_COLOR_YELLOW << (char*)"-" << ETK_BASH_COLOR_NORMAL; break;
case REGEXP_OPCODE_BRACE_IN: etk::cout<<ETK_BASH_COLOR_GREEN << (char*)"{" << ETK_BASH_COLOR_NORMAL; break;
case REGEXP_OPCODE_BRACE_OUT: etk::cout<<ETK_BASH_COLOR_GREEN << (char*)"}" << ETK_BASH_COLOR_NORMAL; break;
case REGEXP_OPCODE_STAR: etk::cout<<ETK_BASH_COLOR_BLUE << (char*)"*" << ETK_BASH_COLOR_NORMAL; break;
case REGEXP_OPCODE_DOT: etk::cout<<ETK_BASH_COLOR_BLUE << (char*)"." << ETK_BASH_COLOR_NORMAL; break;
case REGEXP_OPCODE_QUESTION: etk::cout<<ETK_BASH_COLOR_BLUE << (char*)"?" << ETK_BASH_COLOR_NORMAL; break;
case REGEXP_OPCODE_PLUS: etk::cout<<ETK_BASH_COLOR_BLUE << (char*)"+" << ETK_BASH_COLOR_NORMAL; break;
case REGEXP_OPCODE_PIPE: etk::cout<<ETK_BASH_COLOR_BLUE << (char*)"|" << ETK_BASH_COLOR_NORMAL; break;
case REGEXP_OPCODE_NO_CHAR: etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"@" << ETK_BASH_COLOR_NORMAL; break;
case REGEXP_OPCODE_START_OF_LINE: etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"^" << ETK_BASH_COLOR_NORMAL; break;
case REGEXP_OPCODE_END_OF_LINE: etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"$" << ETK_BASH_COLOR_NORMAL; break;
case REGEXP_OPCODE_DIGIT: etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\d" << ETK_BASH_COLOR_NORMAL; break;
case REGEXP_OPCODE_DIGIT_NOT: etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\D" << ETK_BASH_COLOR_NORMAL; break;
case REGEXP_OPCODE_LETTER: etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\l" << ETK_BASH_COLOR_NORMAL; break;
case REGEXP_OPCODE_LETTER_NOT: etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\L" << ETK_BASH_COLOR_NORMAL; break;
case REGEXP_OPCODE_SPACE: etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\s" << ETK_BASH_COLOR_NORMAL; break;
case REGEXP_OPCODE_SPACE_NOT: etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\S" << ETK_BASH_COLOR_NORMAL; break;
case REGEXP_OPCODE_WORD: etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\w" << ETK_BASH_COLOR_NORMAL; break;
case REGEXP_OPCODE_WORD_NOT: etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\W" << ETK_BASH_COLOR_NORMAL; break;
case '\n': etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\n" << ETK_BASH_COLOR_NORMAL; break;
case '\t': etk::cout<<ETK_BASH_COLOR_MAGENTA << (char*)"\\t" << ETK_BASH_COLOR_NORMAL; break;
default: etk::cout<< (char)(data[i]&0x00FF ); break;
}
}
}
char * etk::levelSpace(int32_t level)
{
switch(level)
{
case 0: return (char*)"";
case 1: return (char*)" ";
case 2: return (char*)" ";
case 3: return (char*)" ";
case 4: return (char*)" ";
case 5: return (char*)" ";
case 6: return (char*)" ";
case 7: return (char*)" ";
case 8: return (char*)" ";
case 9: return (char*)" ";
case 10: return (char*)" ";
case 11: return (char*)" ";
case 12: return (char*)" ";
case 13: return (char*)" ";
case 14: return (char*)" ";
case 15: return (char*)" ";
case 16: return (char*)" ";
default: return (char*)" ";
}
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
int32_t etk::GetLenOfPTheseElem(etk::Vector<int16_t> &data, int32_t startPos)
{
int32_t pos = startPos;
int32_t nbOpen = 0;
// special case of the (...) or | ==> we search '|' or ')'
if( REGEXP_OPCODE_PTHESE_OUT == data[pos]
|| REGEXP_OPCODE_PIPE == data[pos]) {
return 0;
}
// find size ...
while (pos < (int32_t)data.Size() ) {
if(REGEXP_OPCODE_PTHESE_IN == data[pos]) {
// find a sub section :
nbOpen++;
} else if(0 < nbOpen) {
if (REGEXP_OPCODE_PTHESE_OUT == data[pos])
{
nbOpen--;
if (0 > nbOpen) {
TK_ERROR("Error in the (...) find element at "<< pos);
return -1;
}
}
} else if( REGEXP_OPCODE_PTHESE_OUT == data[pos]
|| REGEXP_OPCODE_PIPE == data[pos])
{
// Find the end of the (...)
// just return the size inside
int32_t sizeInside = pos - startPos;
if (0 >= sizeInside) {
TK_ERROR("Error in the (...) no data at "<< pos-1);
return -1;
} else {
return sizeInside;
}
}
pos++;
}
return pos - startPos;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
int32_t etk::GetLenOfPThese(etk::Vector<int16_t> &data, int32_t startPos)
{
int32_t pos = startPos;
int32_t nbOpen = 0;
// special case of the (...) or | ==> we search '|' or ')'
if( REGEXP_OPCODE_PTHESE_OUT == data[pos]) {
return 0;
} else if( REGEXP_OPCODE_PTHESE_IN == data[pos])
{
pos++;
// find size ...
while (pos < (int32_t)data.Size() ) {
if(REGEXP_OPCODE_PTHESE_IN == data[pos]) {
// find a sub section :
nbOpen++;
} else if(0 < nbOpen) {
if (REGEXP_OPCODE_PTHESE_OUT == data[pos])
{
nbOpen--;
if (0 > nbOpen) {
TK_ERROR("Error in the (...) find element at "<< pos);
return -1;
}
}
} else if( REGEXP_OPCODE_PTHESE_OUT == data[pos])
{
// Find the end of the (...)
// just return the size inside
int32_t sizeInside = pos - startPos-1;
if (0 >= sizeInside) {
TK_ERROR("Error in the (...) no data at "<< pos-1);
return -1;
} else {
return sizeInside;
}
}
pos++;
}
} else {
return -1;
}
return 0;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
int32_t etk::GetLenOfBracket(etk::Vector<int16_t> &data, int32_t startPos)
{
int32_t pos = startPos;
// special case of the (...) or | ==> we search '|' or ')'
if( REGEXP_OPCODE_BRACKET_OUT == data[pos]) {
return 0;
} else if( REGEXP_OPCODE_BRACKET_IN == data[pos]) {
pos++;
// find size ...
while (pos < (int32_t)data.Size() ) {
if(REGEXP_OPCODE_BRACKET_OUT == data[pos]) {
// Find the end of the [...]
// just return the size inside
int32_t sizeInside = pos - startPos -1 ;
if (0 >= sizeInside) {
TK_ERROR("Error in the [...] no data at "<< pos-1);
return sizeInside;
} else {
return sizeInside;
}
} else if( REGEXP_OPCODE_TO != data[pos]
&& ( 0 > data[pos]
|| 0xFF < data[pos]) )
{
TK_ERROR("Error in the [...] not permited element at "<< pos << " '" << (char)data[pos] << "'");
return false;
}
pos++;
}
} else {
return -1;
}
return 0;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
int32_t etk::GetLenOfBrace(etk::Vector<int16_t> &data, int32_t startPos)
{
int32_t pos = startPos;
// special case of the (...) or | ==> we search '|' or ')'
if( REGEXP_OPCODE_BRACE_OUT == data[pos]) {
return 0;
} else if( REGEXP_OPCODE_BRACE_IN == data[pos]) {
pos++;
// find size ...
while (pos < (int32_t)data.Size() ) {
if(REGEXP_OPCODE_BRACE_OUT == data[pos]) {
// Find the end of the [...]
// just return the size inside
int32_t sizeInside = pos - startPos -1 ;
if (0 >= sizeInside) {
TK_ERROR("Error in the {...} no data at "<< pos-1);
return sizeInside;
} else {
return sizeInside;
}
} else if( ',' != data[pos]
&& ( '0' > data[pos]
|| '9' < data[pos]) )
{
TK_ERROR("Error in the {...} not permited element at "<< pos << " '" << (char)data[pos] << "'");
return false;
}
pos++;
}
} else {
return -1;
}
return 0;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
int32_t etk::GetLenOfNormal(etk::Vector<int16_t> &data, int32_t startPos)
{
int32_t pos = startPos;
// find size ...
while (pos < (int32_t)data.Size() ) {
switch(data[pos])
{
case REGEXP_OPCODE_PTHESE_IN:
case REGEXP_OPCODE_PTHESE_OUT:
case REGEXP_OPCODE_BRACKET_IN:
case REGEXP_OPCODE_BRACKET_OUT:
case REGEXP_OPCODE_BRACE_IN:
case REGEXP_OPCODE_BRACE_OUT:
case REGEXP_OPCODE_TO:
case REGEXP_OPCODE_STAR:
case REGEXP_OPCODE_DOT:
case REGEXP_OPCODE_QUESTION:
case REGEXP_OPCODE_PLUS:
case REGEXP_OPCODE_PIPE:
case REGEXP_OPCODE_START_OF_LINE:
case REGEXP_OPCODE_END_OF_LINE:
case REGEXP_OPCODE_DIGIT:
case REGEXP_OPCODE_DIGIT_NOT:
case REGEXP_OPCODE_LETTER:
case REGEXP_OPCODE_LETTER_NOT:
case REGEXP_OPCODE_SPACE:
case REGEXP_OPCODE_SPACE_NOT:
case REGEXP_OPCODE_WORD:
case REGEXP_OPCODE_WORD_NOT:
{
// just return the size inside
int32_t sizeInside = pos - startPos;
if (0 >= sizeInside) {
TK_ERROR("Error in the normal data : no data ...");
}
return sizeInside;
}
break;
default :
// nothing to do ...
break;
}
pos++;
}
return pos - startPos ;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
bool etk::ParseBrace(etk::Vector<int16_t> &data, int32_t &min, int32_t &max)
{
//TK_INFO("parse {...} in "; DisplayElem(data); );
int32_t k=0;
int32_t firstElement = 0;
int32_t SecondElement = 0;
while(k<data.Size()) {
if (',' == (char)data[k]) {
k++;
break;
} if ('}' == (char)data[k]) {
SecondElement = firstElement;
goto allIsSet;
} else if ('0' <= (char)data[k] && '9' >= (char)data[k]) {
firstElement *=10;
firstElement += (char)data[k] - '0';
} else {
TK_ERROR("Can not parse this element " << (char)data[k] << " at pos " << k);
return false;
}
k++;
}
if (k==data.Size()) {
SecondElement = firstElement;
}
while(k<data.Size()) {
if (',' == (char)data[k]) {
TK_ERROR("Can not find a second , in {} at pos " << k);
return false;
} if ('}' == (char)data[k]) {
goto allIsSet;
} else if ('0' <= (char)data[k] && '9' >= (char)data[k]) {
SecondElement *=10;
SecondElement += (char)data[k] - '0';
} else {
TK_ERROR("Can not parse this element " << (char)data[k] << " at pos " << k);
return false;
}
k++;
}
allIsSet:
if (SecondElement == 0 && firstElement != 0) {
min = 0;
max = firstElement;
} else {
min = firstElement;
max = SecondElement;
}
if (min > max) {
TK_ERROR("Minimum=" << min << " can not be < maximum=" << max );
return false;
}
return true;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,32 +0,0 @@
/**
*******************************************************************************
* @file etk/Stream.cpp
* @brief Ewol Tool Kit : Basic etk::Stream for Log system ... (Sources)
* @author Edouard DUPIN
* @date 02/12/2011
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <etk/Stream.h>
etk::CCout etk::cout;
etk::CEndl etk::endl;
etk::CHex etk::hex;
etk::CStart etk::cstart;

View File

@ -1,252 +0,0 @@
/**
*******************************************************************************
* @file etk/Stream.h
* @brief Ewol Tool Kit : Basic etk::Stream for Log system ... (header)
* @author Edouard DUPIN
* @date 02/12/2011
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __ETK_STREAM_H__
#define __ETK_STREAM_H__
//#include <cstdio>
//#include <typeinfo>
#include <string.h>
#include <pthread.h>
#include <etk/Types.h>
#if defined(__TARGET_OS__Android)
# include <android/log.h>
# define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "EWOL", __VA_ARGS__))
# define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "EWOL", __VA_ARGS__))
# define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, "EWOL", __VA_ARGS__))
#endif
#define MAX_LOG_SIZE (16000)
#define MAX_LOG_SIZE_TMP (512)
//regular colors
#define ETK_BASH_COLOR_BLACK "\e[0;30m"
#define ETK_BASH_COLOR_RED "\e[0;31m"
#define ETK_BASH_COLOR_GREEN "\e[0;32m"
#define ETK_BASH_COLOR_YELLOW "\e[0;33m"
#define ETK_BASH_COLOR_BLUE "\e[0;34m"
#define ETK_BASH_COLOR_MAGENTA "\e[0;35m"
#define ETK_BASH_COLOR_CYAN "\e[0;36m"
#define ETK_BASH_COLOR_WHITE "\e[0;37m"
//emphasized (bolded) colors
#define ETK_BASH_COLOR_BOLD_BLACK "\e[1;30m"
#define ETK_BASH_COLOR_BOLD_RED "\e[1;31m"
#define ETK_BASH_COLOR_BOLD_GREEN "\e[1;32m"
#define ETK_BASH_COLOR_BOLD_YELLOW "\e[1;33m"
#define ETK_BASH_COLOR_BOLD_BLUE "\e[1;34m"
#define ETK_BASH_COLOR_BOLD_MAGENTA "\e[1;35m"
#define ETK_BASH_COLOR_BOLD_CYAN "\e[1;36m"
#define ETK_BASH_COLOR_BOLD_WHITE "\e[1;37m"
//background colors
#define ETK_BASH_COLOR_BG_BLACK "\e[40m"
#define ETK_BASH_COLOR_BG_RED "\e[41m"
#define ETK_BASH_COLOR_BG_GREEN "\e[42m"
#define ETK_BASH_COLOR_BG_YELLOW "\e[43m"
#define ETK_BASH_COLOR_BG_BLUE "\e[44m"
#define ETK_BASH_COLOR_BG_MAGENTA "\e[45m"
#define ETK_BASH_COLOR_BG_CYAN "\e[46m"
#define ETK_BASH_COLOR_BG_WHITE "\e[47m"
// Return to the normal color setings
#define ETK_BASH_COLOR_NORMAL "\e[0m"
//go to the Top of bash
#define ETK_BASH_GO_TOP "\e[0;0f"
namespace etk{
class CEndl{};
class CHex{};
class CStart{};
typedef enum {
LOG_LEVEL_NONE,
LOG_LEVEL_CRITICAL,
LOG_LEVEL_ERROR,
LOG_LEVEL_WARNING,
LOG_LEVEL_INFO,
LOG_LEVEL_DEBUG,
LOG_LEVEL_VERBOSE
} logLevel_te;
class CCout{
private:
bool hex;
char m_tmpChar[MAX_LOG_SIZE+1];
char tmp[MAX_LOG_SIZE_TMP];
pthread_mutex_t m_mutex;
public:
CCout(){
hex=false;
memset(m_tmpChar, 0, (MAX_LOG_SIZE+1)*sizeof(char));
pthread_mutex_init(&m_mutex, NULL);
};
~CCout() {
pthread_mutex_destroy(&m_mutex);
};
CCout& operator << (int t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%d", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
return *this;
}
CCout& operator << (unsigned int t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%u", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
return *this;
}
/*
CCout& operator << (uniChar_t t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%c", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
return *this;
}
*/
CCout& operator << (long t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%ld", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
return *this;
}
CCout& operator << (long long t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%lld", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
return *this;
}
CCout& operator << (double t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%f", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
return *this;
}
CCout& operator << (float t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%f", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
return *this;
}
CCout& operator << (char * t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%s", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
return *this;
}
CCout& operator << (const char * t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%s", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
return *this;
}
CCout& operator << (char t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "%c", t);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
return *this;
}
CCout& operator << (bool t) {
if (t) {
strncat(m_tmpChar, "true", MAX_LOG_SIZE);
} else {
strncat(m_tmpChar, "false", MAX_LOG_SIZE);
}
return *this;
}
CCout& operator << (Vector2D<float> t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "(%f,%f)", t.x, t.y);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
return *this;
}
CCout& operator << (Vector2D<int32_t> t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "(%i,%i)", t.x, t.y);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
return *this;
}
CCout& operator << (Vector3D<float> t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "(%f,%f,%f)", t.x, t.y, t.z);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
return *this;
}
CCout& operator << (Vector3D<int32_t> t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "(%i,%i,%i)", t.x, t.y, t.z);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
return *this;
}
CCout& operator << (clipping_ts t) {
snprintf(tmp, MAX_LOG_SIZE_TMP, "origin=(%f,%f) size=(%f,%f)", t.x, t.y, t.w, t.h);
strncat(m_tmpChar, tmp, MAX_LOG_SIZE);
return *this;
}
CCout& operator << (CStart ccc) {
pthread_mutex_lock(&m_mutex);
return *this;
}
CCout& operator << (logLevel_te ccc) {
switch (ccc)
{
case LOG_LEVEL_CRITICAL:
strncat(m_tmpChar, ETK_BASH_COLOR_BOLD_RED, MAX_LOG_SIZE);
strncat(m_tmpChar, "[C]", MAX_LOG_SIZE);
break;
case LOG_LEVEL_ERROR:
strncat(m_tmpChar, ETK_BASH_COLOR_MAGENTA, MAX_LOG_SIZE);
strncat(m_tmpChar, "[E]", MAX_LOG_SIZE);
break;
case LOG_LEVEL_WARNING:
strncat(m_tmpChar, ETK_BASH_COLOR_BOLD_RED, MAX_LOG_SIZE);
strncat(m_tmpChar, "[W]", MAX_LOG_SIZE);
break;
case LOG_LEVEL_INFO:
strncat(m_tmpChar, ETK_BASH_COLOR_CYAN, MAX_LOG_SIZE);
strncat(m_tmpChar, "[I]", MAX_LOG_SIZE);
break;
case LOG_LEVEL_DEBUG:
strncat(m_tmpChar, ETK_BASH_COLOR_YELLOW, MAX_LOG_SIZE);
strncat(m_tmpChar, "[D]", MAX_LOG_SIZE);
break;
case LOG_LEVEL_VERBOSE:
strncat(m_tmpChar, ETK_BASH_COLOR_WHITE, MAX_LOG_SIZE);
strncat(m_tmpChar, "[V]", MAX_LOG_SIZE);
break;
default:
strncat(m_tmpChar, "[?]", MAX_LOG_SIZE);
break;
}
return *this;
}
CCout& operator << (etk::CEndl t) {
strncat(m_tmpChar, ETK_BASH_COLOR_NORMAL, MAX_LOG_SIZE);
strncat(m_tmpChar, "\n", MAX_LOG_SIZE);
m_tmpChar[MAX_LOG_SIZE] = '\0';
#if defined(__TARGET_OS__Android)
LOGI("%s", m_tmpChar);
#else
printf("%s", m_tmpChar);
#endif
memset(m_tmpChar, 0, (MAX_LOG_SIZE+1)*sizeof(char));
pthread_mutex_unlock(&m_mutex);
return *this;
}
};
extern etk::CCout cout;
extern etk::CEndl endl;
extern etk::CHex hex;
extern etk::CStart cstart;
}
#endif

View File

@ -1,85 +0,0 @@
/**
*******************************************************************************
* @file etk/Types.h
* @brief Ewol Tool Kit : generique define type
* @author Edouard DUPIN
* @date 08/06/2010
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __ETK_TYPES_H__
#define __ETK_TYPES_H__
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <assert.h>
#ifndef __int8_t_defined
# define __int8_t_defined
typedef signed char int8_t;
typedef signed short int int16_t;
typedef int int32_t;
typedef signed long long int int64_t;
#endif
#ifndef __uint8_t_defined
# define __uint8_t_defined
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;
# if __WORDSIZE == 64
typedef unsigned long int uint64_t;
# else
typedef unsigned long long int uint64_t;
# endif
#endif
typedef uint32_t uniChar_t;
typedef enum {
ERR_NONE = 0, //!< No error, luckily everything went fine
ERR_FAIL, //!< Miscellaneous failure
ERR_INVAL, //!< Invalid entry parameter
ERR_MEM, //!< Dynamic memory allocation failure
ERR_TIMEOUT, //!< Request time out
ERR_BUSY, //!< Element curently Busy
}erreurCode_te;
#define etk_min(elemA, elemB) (((elemA)<(elemB)) ? (elemA) : (elemB))
#define etk_max(elemA, elemB) (((elemA)<(elemB)) ? (elemB) : (elemA))
#define etk_avg(minimim, elem, maximum) (((minimim)>(elem)) ? (minimim) : ((maximum)<(elem)) ? (maximum) : (elem))
typedef struct {
float u;
float v;
}texCoord_ts;
typedef struct {
float x;
float y;
float w;
float h;
}clipping_ts;
#endif
#include <etk/TypesCoordonate.h>

View File

@ -1,333 +0,0 @@
/**
*******************************************************************************
* @file etk/TypesCoordonate.h
* @brief Ewol Tool Kit : generique coordonate type abstraction for openGl
* @author Edouard DUPIN
* @date 07/06/2012
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __ETK_TYPES_COORDONATES_H__
#define __ETK_TYPES_COORDONATES_H__
template <typename T> class Vector2D
{
public:
T x;
T y;
public:
/*****************************************************
* Constructor
*****************************************************/
Vector2D(void) : x(0), y(0) { };
Vector2D(double _x, double _y) : x(_x), y(_y) { };
Vector2D(float _x, float _y) : x(_x), y(_y) { };
Vector2D(int32_t _x, int32_t _y) : x(_x), y(_y) { };
Vector2D(const Vector2D<double>& obj) : x((T)obj.x), y((T)obj.y) { };
Vector2D(const Vector2D<float>& obj) : x((T)obj.x), y((T)obj.y) { };
Vector2D(const Vector2D<int32_t>& obj) : x((T)obj.x), y((T)obj.y) { };
~Vector2D(void) { };
/*****************************************************
* = assigment
*****************************************************/
const Vector2D<T>& operator= (const Vector2D<T>& obj ) {
x = (T)obj.x;
y = (T)obj.y;
return *this;
}
/*****************************************************
* == operator
*****************************************************/
bool operator== (const Vector2D<T>& obj) const {
if ((T)obj.x == x && (T)obj.y == y) {
return true;
}
return false;
}
/*****************************************************
* != operator
*****************************************************/
bool operator!= (const Vector2D<T>& obj) const {
if ((T)obj.x == x && (T)obj.y == y) {
return false;
}
return true;
}
/*****************************************************
* += operator
*****************************************************/
const Vector2D<T>& operator+= (const Vector2D<T>& obj) {
x += (T)obj.x;
y += (T)obj.y;
return *this;
}
/*****************************************************
* + operator
*****************************************************/
Vector2D<T> operator+ (const Vector2D<T>& obj) {
Vector2D<T> tmpp(x,y);
tmpp.x += (T)obj.x;
tmpp.y += (T)obj.y;
return tmpp;
}
/*****************************************************
* -= operator
*****************************************************/
const Vector2D<T>& operator-= (const Vector2D<T>& obj) {
x -= (T)obj.x;
y -= (T)obj.y;
return *this;
}
/*****************************************************
* - operator
*****************************************************/
Vector2D<T> operator- (const Vector2D<T>& obj) {
Vector2D<T> tmpp(x,y);
tmpp.x -= (T)obj.x;
tmpp.y -= (T)obj.y;
return *this;
}
/*****************************************************
* /= operator
*****************************************************/
const Vector2D<T>& operator/= (const Vector2D<T>& obj) {
x /= (T)obj.x;
y /= (T)obj.y;
return *this;
}
/*****************************************************
* / operator
*****************************************************/
Vector2D<T> operator/ (const Vector2D<T>& obj) {
Vector2D<T> tmpp(x,y);
tmpp.x /= (T)obj.x;
tmpp.y /= (T)obj.y;
return *this;
}
/*****************************************************
* *= operator
*****************************************************/
const Vector2D<T>& operator*= (const Vector2D<T>& obj) {
x *= (T)obj.x;
y *= (T)obj.y;
return *this;
}
/*****************************************************
* * operator
*****************************************************/
Vector2D<T> operator* (const Vector2D<T>& obj) {
Vector2D<T> tmpp(x,y);
tmpp.x *= (T)obj.x;
tmpp.y *= (T)obj.y;
return *this;
}
/*****************************************************
* ++ operator
*****************************************************/
Vector2D<T>& operator++() // prefix
{
++x;
++y;
return *this;
}
Vector2D<T> operator++(int unused) // postfix
{
Vector2D<T> result = *this;
++(*this);
return result;
}
/*****************************************************
* -- operator
*****************************************************/
Vector2D<T>& operator--() // prefix
{
--x;
--y;
return *this;
}
Vector2D<T> operator--(int unused) // postfix
{
Vector2D<T> result = *this;
--(*this);
return result;
}
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////:
template <typename T> class Vector3D
{
public:
T x;
T y;
T z;
public:
/*****************************************************
* Constructor
*****************************************************/
Vector3D(void) : x(0), y(0), z(0) { };
Vector3D(double _x, double _y, double _z) : x(_x), y(_y), z(_z) { };
Vector3D(float _x, float _y, float _z) : x(_x), y(_y), z(_z) { };
Vector3D(int32_t _x, int32_t _y, int32_t _z) : x(_x), y(_y), z(_z) { };
Vector3D(const Vector3D<double>& obj) : x((T)obj.x), y((T)obj.y), z((T)obj.z) { };
Vector3D(const Vector3D<float>& obj) : x((T)obj.x), y((T)obj.y), z((T)obj.z) { };
Vector3D(const Vector3D<int32_t>& obj) : x((T)obj.x), y((T)obj.y), z((T)obj.z) { };
~Vector3D(void) { };
/*****************************************************
* = assigment
*****************************************************/
const Vector3D<T>& operator= (const Vector3D<T>& obj ) {
x = (T)obj.x;
y = (T)obj.y;
z = (T)obj.z;
return *this;
}
/*****************************************************
* == operator
*****************************************************/
bool operator== (const Vector3D<T>& obj) const {
if ((T)obj.x == x && (T)obj.y == y && (T)obj.z == z) {
return true;
}
return false;
}
/*****************************************************
* != operator
*****************************************************/
bool operator!= (const Vector3D<T>& obj) const {
if ((T)obj.x == x && (T)obj.y == y && (T)obj.z == z) {
return false;
}
return true;
}
/*****************************************************
* += operator
*****************************************************/
const Vector3D<T>& operator+= (const Vector3D<T>& obj) {
x += (T)obj.x;
y += (T)obj.y;
z += (T)obj.z;
return *this;
}
/*****************************************************
* + operator
*****************************************************/
Vector3D<T> operator+ (const Vector3D<T>& obj) {
Vector3D<T> tmpp(x,y,y);
tmpp.x += (T)obj.x;
tmpp.y += (T)obj.y;
tmpp.z += (T)obj.z;
return *this;
}
/*****************************************************
* -= operator
*****************************************************/
const Vector3D<T>& operator-= (const Vector3D<T>& obj) {
x -= (T)obj.x;
y -= (T)obj.y;
z -= (T)obj.z;
return *this;
}
/*****************************************************
* - operator
*****************************************************/
Vector3D<T> operator- (const Vector3D<T>& obj) {
Vector3D<T> tmpp(x,y,y);
tmpp.x -= (T)obj.x;
tmpp.y -= (T)obj.y;
tmpp.z -= (T)obj.z;
return *this;
}
/*****************************************************
* /= operator
*****************************************************/
const Vector3D<T>& operator/= (const Vector3D<T>& obj) {
x /= (T)obj.x;
y /= (T)obj.y;
z /= (T)obj.z;
return *this;
}
/*****************************************************
* / operator
*****************************************************/
Vector3D<T> operator/ (const Vector3D<T>& obj) {
Vector3D<T> tmpp(x,y,y);
tmpp.x /= (T)obj.x;
tmpp.y /= (T)obj.y;
tmpp.z /= (T)obj.z;
return *this;
}
/*****************************************************
* *= operator
*****************************************************/
const Vector3D<T>& operator*= (const Vector3D<T>& obj) {
x *= (T)obj.x;
y *= (T)obj.y;
z *= (T)obj.z;
return *this;
}
/*****************************************************
* * operator
*****************************************************/
Vector3D<T> operator* (const Vector3D<T>& obj) {
Vector3D<T> tmpp(x,y,y);
tmpp.x *= (T)obj.x;
tmpp.y *= (T)obj.y;
tmpp.z *= (T)obj.z;
return *this;
}
/*****************************************************
* ++ operator
*****************************************************/
Vector3D<T>& operator++() // prefix
{
++x;
++y;
++z;
return *this;
}
Vector3D<T> operator++(int unused) // postfix
{
Vector3D<T> result = *this;
++(*this);
return result;
}
/*****************************************************
* -- operator
*****************************************************/
Vector3D<T>& operator--() // prefix
{
--x;
--y;
--z;
return *this;
}
Vector3D<T> operator--(int unused) // postfix
{
Vector3D<T> result = *this;
--(*this);
return result;
}
};
#endif

View File

@ -1,793 +0,0 @@
/**
*******************************************************************************
* @file etk/UString.cpp
* @brief Ewol Tool Kit : normal Unicode string management... (sources)
* @author Edouard DUPIN
* @date 14/02/2012
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <etk/UString.h>
#include <etk/Memory.h>
#include <etk/unicode.h>
int32_t strlen(const uniChar_t * data)
{
if (NULL == data) {
return 0;
}
int32_t iii=0;
while (*data != 0) {
data++;
iii++;
if (iii > 0x7FFFFFF0) {
return iii;
}
}
return iii;
}
#undef __class__
#define __class__ "etk::UString"
etk::CCout& etk::operator <<(etk::CCout &os, const etk::UString &obj)
{
etk::Vector<char> output_UTF8;
unicode::convertUnicodeToUtf8(obj.m_data, output_UTF8);
output_UTF8.PushBack('\0');
os << &output_UTF8[0];
return os;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
etk::UString::~UString(void)
{
m_data.Clear();
m_dataUtf8.Clear();
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
etk::UString::UString(void)
{
//TK_INFO("new etk::UString()");
m_data.Clear();
m_data.PushBack('\0');
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
etk::UString::UString(const char* inputData, int32_t len)
{
m_data.Clear();
m_data.PushBack('\0');
Set(inputData, len);
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
etk::UString::UString(const uniChar_t* inputData, int32_t len)
{
m_data.Clear();
m_data.PushBack('\0');
Set(inputData, len);
}
/*
etk::UString::UString(const uniChar_t inputData)
{
m_data.Clear();
m_data.PushBack('\0');
Set(&inputData, 1);
}
*/
void etk::UString::Set(const char * inputData, int32_t len)
{
if (NULL == inputData) {
// nothing to add ...
return;
}
// overwrite the len if needed :
if ((-1) == len) {
len = strlen(inputData);
}
// convert the string
etk::Vector<char> tmpChar;
for (int32_t iii=0; iii<len; iii++) {
tmpChar.PushBack(inputData[iii]);
}
// add it ...
if (len != 0) {
// remove the last '\0'
m_data.PopBack();
// copy the data ...
unicode::convertUtf8ToUnicode(tmpChar, m_data);
// add the last '\0'
m_data.PushBack('\0');
}
}
void etk::UString::Set(const uniChar_t * inputData, int32_t len)
{
if (NULL == inputData) {
// nothing to add ...
return;
}
// overwrite the len if needed :
if ((-1) == len) {
len = strlen(inputData);
}
if (len != 0) {
// remove the last '\0'
m_data.PopBack();
// copy the data ...
m_data.PushBack(inputData, len);
// add the last '\0'
m_data.PushBack('\0');
}
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
etk::UString::UString(char inputData)
{
char tmpVal[2];
// generate the UString :
sprintf(tmpVal, "%c", inputData);
// set the internal data :
m_data.Clear();
m_data.PushBack('\0');
Set(tmpVal);
}
etk::UString::UString(int inputData)
{
char tmpVal[256];
// generate the UString :
sprintf(tmpVal, "%d", inputData);
// set the internal data :
m_data.Clear();
m_data.PushBack('\0');
Set(tmpVal);
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
etk::UString::UString(unsigned int inputData)
{
char tmpVal[256];
// generate the UString :
sprintf(tmpVal, "%d", inputData);
// set the internal data :
m_data.Clear();
m_data.PushBack('\0');
Set(tmpVal);
}
etk::UString::UString(float inputData)
{
char tmpVal[256];
// generate the UString :
sprintf(tmpVal, "%f", inputData);
// set the internal data :
m_data.Clear();
m_data.PushBack('\0');
Set(tmpVal);
}
etk::UString::UString(double inputData)
{
char tmpVal[256];
// generate the UString :
sprintf(tmpVal, "%lf", inputData);
// set the internal data :
m_data.Clear();
m_data.PushBack('\0');
Set(tmpVal);
}
etk::UString::UString(const etk::UString &etkS)
{
//etk_INFO("Constructeur de recopie");
m_data = etkS.m_data;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
const etk::UString& etk::UString::operator= (const etk::UString &etkS )
{
//TK_INFO("OPERATOR de recopie");
if( this != &etkS ) {
m_data = etkS.m_data;
}
return *this;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
const etk::UString& etk::UString::operator= (etk::Vector<char> inputData)
{
etk::Vector<uniChar_t> output_Unicode;
unicode::convertUtf8ToUnicode(inputData, output_Unicode);
*this = output_Unicode;
return *this;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
const etk::UString& etk::UString::operator= (etk::Vector<int8_t> inputData)
{
etk::Vector<uniChar_t> output_Unicode;
unicode::convertUtf8ToUnicode(inputData, output_Unicode);
*this = output_Unicode;
return *this;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
const etk::UString& etk::UString::operator= (etk::Vector<uniChar_t> inputData)
{
m_data = inputData;
if (m_data.Size()>0) {
if (m_data[m_data.Size()-1] != '\0') {
m_data.PushBack('\0');
}
}
//TK_DEBUG("m_dataLen="<<m_dataLen << " m_dataLenUTF8="<<m_dataLenUTF8 << " description=" << m_data);
return *this;
}
uniChar_t changeOrder(uniChar_t elemA)
{
if (elemA >= 'A' && elemA <= 'Z') {
return (elemA - (uniChar_t)'A')*2 + 'A';
}
if (elemA >= 'a' && elemA <= 'z') {
return (elemA - (uniChar_t)'a')*2 + 'A' + 1;
}
if (elemA >= ':' && elemA <= '@') {
return elemA + 52;
}
if (elemA >= '[' && elemA <= '`') {
return elemA +26;
}
return elemA;
}
bool etk::UString::operator> (const etk::UString& etkS) const
{
if( this != &etkS ) {
for (int32_t iii=0; iii < m_data.Size() && iii < etkS.m_data.Size(); iii++) {
//TK_DEBUG(" compare : '" << (char)m_data[iii] << "'>'" << (char)etkS.m_data[iii] << "' ==> " << changeOrder(m_data[iii]) << ">" << changeOrder(etkS.m_data[iii]) << "");
uniChar_t elemA = changeOrder(m_data[iii]);
uniChar_t elemB = changeOrder(etkS.m_data[iii]);
if (elemA != elemB) {
if (elemA > elemB) {
return true;
}
return false;
}
}
if (m_data.Size() > etkS.m_data.Size()) {
return true;
}
}
return false;
}
bool etk::UString::operator>= (const etk::UString& etkS) const
{
if( this != &etkS ) {
for (int32_t iii=0; iii < m_data.Size() && iii < etkS.m_data.Size(); iii++) {
uniChar_t elemA = changeOrder(m_data[iii]);
uniChar_t elemB = changeOrder(etkS.m_data[iii]);
if (elemA != elemB) {
if (elemA > elemB) {
return true;
}
return false;
}
}
if (m_data.Size() >= etkS.m_data.Size()) {
return true;
}
}
return false;
}
bool etk::UString::operator< (const etk::UString& etkS) const
{
if( this != &etkS ) {
for (int32_t iii=0; iii < m_data.Size() && iii < etkS.m_data.Size(); iii++) {
uniChar_t elemA = changeOrder(m_data[iii]);
uniChar_t elemB = changeOrder(etkS.m_data[iii]);
if (elemA != elemB) {
if (elemA < elemB) {
return true;
}
return false;
}
}
if (m_data.Size() < etkS.m_data.Size()) {
return true;
}
}
return false;
}
bool etk::UString::operator<= (const etk::UString& etkS) const
{
if( this != &etkS ) {
for (int32_t iii=0; iii < m_data.Size() && iii < etkS.m_data.Size(); iii++) {
uniChar_t elemA = changeOrder(m_data[iii]);
uniChar_t elemB = changeOrder(etkS.m_data[iii]);
if (elemA != elemB) {
if (elemA < elemB) {
return true;
}
return false;
}
}
if (m_data.Size() <= etkS.m_data.Size()) {
return true;
}
}
return false;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
bool etk::UString::operator== (const etk::UString& etkS) const
{
if( this != &etkS ) {
if (etkS.m_data.Size() != m_data.Size()) {
//TK_DEBUG(" not the same size : " << etkS.m_data.Size() << "!=" << m_data.Size());
return false;
}
for (int32_t iii= 0; iii<m_data.Size(); iii++) {
//TK_DEBUG(" check : " << etkS.m_data[iii] << "!=" << m_data[iii]);
if (etkS.m_data[iii]!= m_data[iii]){
return false;
}
}
return true;
}
return true;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
bool etk::UString::operator!= (const etk::UString& etkS) const
{
return !(*this == etkS);
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
const etk::UString& etk::UString::operator+= (const etk::UString &etkS)
{
if (0 < etkS.Size()) {
// remove the last '\0'
m_data.PopBack();
// copy the data ...
m_data += etkS.m_data;
// This previous include the \0 in case of the 2 UString are different...
if( this == &etkS ) {
// add the removed end UString
m_data.PushBack('\0');
}
}
return *this;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
etk::UString etk::UString::operator+ (const etk::UString &etkS)
{
etk::UString temp;
//TK_INFO(" UString(arg) : \"" << etkS.m_data << "\"");
//TK_INFO(" UString(direct) : \"" << m_data << "\"");
temp += *this;
temp += etkS;
return temp;
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
bool etk::UString::IsEmpty(void) const
{
if(1 >= m_data.Size() ) {
return true;
} else {
return false;
}
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
int32_t etk::UString::Size(void) const
{
if (m_data.Size() == 0) {
return 0;
} else {
return m_data.Size() - 1;
}
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
void etk::UString::Add(int32_t currentID, const char* inputData)
{
etk::UString tmpString(inputData);
Add(currentID, tmpString.pointer() );
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
void etk::UString::Add(int32_t currentID, const uniChar_t* inputData)
{
// get the input lenght
int32_t len = strlen(inputData);
if (0 == len) {
TK_WARNING("no data to add on the current UString");
return;
} else if (currentID < 0) {
TK_WARNING("Curent ID(" << currentID << ") < 0 ==> Add at the start");
currentID = 0;
} else if (currentID > Size() ) {
TK_ERROR("Curent ID(" << currentID << ") > maxSize ... (" << Size() << ") ==> add at the end ...");
m_data.PushBack(inputData, len);
return;
}
m_data.Insert(currentID, inputData, len);
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
void etk::UString::Add(int32_t currentID, const uniChar_t inputData)
{
uniChar_t data[2];
data[0] = inputData;
data[1] = 0;
Add(currentID, data);
}
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
void etk::UString::Remove(int32_t currentID, int32_t len)
{
if (0 >= len) {
TK_ERROR("no data to remove on the current UString");
return;
}
// TODO : check the size of the data
m_data.EraseLen(currentID, len);
}
/**
* @brief Remove all element in the UString
*
* @param ---
*
* @return ---
*
*/
void etk::UString::Clear(void)
{
m_data.Clear();
m_data.PushBack('\0');
}
/**
* @brief find the first accurence after the position indicated
*
* @param[in] element Element that might be find in the UString
* @param[in] startPos Stert position to begin the search
*
* @return the position of the first occurence or -1 if not find...
*
*/
int32_t etk::UString::FindForward(const char element, int32_t startPos)
{
return FindForward((uniChar_t)element, startPos);
}
int32_t etk::UString::FindForward(const uniChar_t element, int32_t startPos)
{
if (startPos < 0) {
startPos = 0;
} else if (startPos >= Size() ) {
return -1;
}
for (int32_t iii=startPos; iii< Size(); iii++) {
if (m_data[iii] == element) {
return iii;
}
}
return -1;
}
/**
* @brief find the first accurence before the position indicated.
*
* @param[in] element Element that might be find in the UString
* @param[in] startPos Stert position to begin the search
*
* @return the position of the first occurence begining by the end or -1 if not find...
*
*/
int32_t etk::UString::FindBack(const char element, int32_t startPos)
{
return FindBack((uniChar_t)element, startPos);
}
int32_t etk::UString::FindBack(const uniChar_t element, int32_t startPos)
{
if (startPos < 0) {
return -1;
} else if (startPos >= Size() ) {
startPos = Size();
}
for (int32_t iii=startPos; iii>=0; iii--) {
if (m_data[iii] == element) {
return iii;
}
}
return -1;
}
/**
* @brief Extract data from the data between two position
*
* @param[in] posStart Start position where to extract data
* @param[in] posEnd End position where to extract data
*
* @return the extracted UString
*
*/
etk::UString etk::UString::Extract(int32_t posStart, int32_t posEnd)
{
etk::UString out;
if (posStart < 0) {
posStart = 0;
} else if (posStart >= Size() ) {
return out;
}
if (posEnd < 0) {
return out;
} else if (posEnd >= Size() ) {
posEnd = Size();
}
out.m_data = m_data.Extract(posStart, posEnd);
out.m_data.PushBack('\0');
return out;
}
/**
* @brief Get a basic vector in int8 data with no \0 at the end of the UString
*
* @param ---
*
* @return The desired vector with data
*
*/
etk::Vector<uniChar_t> etk::UString::GetVector(void)
{
etk::Vector<uniChar_t> out = m_data;
out.PopBack();
return out;
}
// Start With ...
bool etk::UString::StartWith(const etk::UString& data)
{
if (data.Size() == 0) {
return false;
}
if (data.Size() > Size()) {
return false;
}
for (int32_t iii=0; iii<data.Size(); iii++) {
if (data[iii] != m_data[iii]) {
return false;
}
}
return true;
}
bool etk::UString::EndWith(const etk::UString& data)
{
if (data.Size() == 0) {
return false;
}
if (data.Size() > Size()) {
return false;
}
for( int32_t iii=Size()-1, jjj=data.Size()-1;
iii>=0 && jjj>=0;
iii--, jjj--) {
if (data[jjj] != m_data[iii]) {
return false;
}
}
return true;
}
char * etk::UString::c_str(void)
{
// UTF8 generation :
m_dataUtf8.Clear();
unicode::convertUnicodeToUtf8(m_data, m_dataUtf8);
m_dataUtf8.PushBack('\0');
return &m_dataUtf8[0];
}

View File

@ -1,156 +0,0 @@
/**
*******************************************************************************
* @file etk/String.h
* @brief Ewol Tool Kit : normal sting management... (header)
* @author Edouard DUPIN
* @date 26/01/2011
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __ETK_USTRING_H__
#define __ETK_USTRING_H__
#include <etk/Stream.h>
#include <etk/Vector.h>
namespace etk
{
class UString
{
public:
// Constructeurs
UString(void);
UString(const uniChar_t* inputData, int32_t len = -1);
UString(const char* inputData, int32_t len = -1);
void Set(const uniChar_t* inputData, int32_t len=-1);
void Set(const char* inputData, int32_t len=-1);
// basic convertion integer en string
UString(char inputData);
UString(int inputData);
UString(unsigned int inputData);
UString(float inputData);
UString(double inputData);
UString(const etk::UString &etkS);
//UString(const uniChar_t inputData);
// destructor :
~UString(void);
/*****************************************************
* = assigment
*****************************************************/
const etk::UString& operator= (const etk::UString &etkS );
const etk::UString& operator= (etk::Vector<char> inputData);
const etk::UString& operator= (etk::Vector<int8_t> inputData);
const etk::UString& operator= (etk::Vector<uniChar_t> inputData);
/*****************************************************
* == operator
*****************************************************/
bool operator== (const etk::UString& etkS) const;
/*****************************************************
* != operator
*****************************************************/
bool operator!= (const etk::UString& etkS) const;
/*****************************************************
* > < >= <= operator
*****************************************************/
bool operator> (const etk::UString& etkS) const;
bool operator>= (const etk::UString& etkS) const;
bool operator< (const etk::UString& etkS) const;
bool operator<= (const etk::UString& etkS) const;
/*****************************************************
* += operator
*****************************************************/
const etk::UString& operator+= (const etk::UString &etkS);
/*****************************************************
* + operator
*****************************************************/
etk::UString operator+ (const etk::UString &etkS);
/*****************************************************
* << operator
*****************************************************/
/*
const etk::UString& operator <<= (const char input);
const etk::UString& operator <<= (const int input);
const etk::UString& operator <<= (const unsigned int input);
*/
/*****************************************************
* >> operator
*****************************************************/
/*****************************************************
* Cout << operator
*****************************************************/
friend etk::CCout& operator <<( etk::CCout &os,const etk::UString &obj);
/*****************************************************
* [] operator
*****************************************************/
const uniChar_t& operator[] (int32_t pos) const {
return m_data[pos];
}
uniChar_t& operator[] (int32_t pos) {
return m_data[pos];
}
/*****************************************************
* toolbox
*****************************************************/
// Start With ...
bool StartWith(const etk::UString& data);
// End With ...
bool EndWith(const etk::UString& data);
// Find element
int32_t FindForward(const char data, int32_t startPos=0);
int32_t FindForward(const uniChar_t data, int32_t startPos=0);
int32_t FindBack(const char data, int32_t startPos=0x7FFFFFFF);
int32_t FindBack(const uniChar_t data, int32_t startPos=0x7FFFFFFF);
bool IsEmpty(void) const;
int32_t Size(void) const;
/*****************************************************
* Generic modification function
*****************************************************/
void Add(int32_t currentID, const char* inputData);
void Add(int32_t currentID, const uniChar_t* inputData);
void Add(int32_t currentID, const uniChar_t inputData);
void Remove(int32_t currentID, int32_t len);
void Clear(void);
etk::Vector<uniChar_t> GetVector(void);
uniChar_t * pointer(void) { return &m_data[0]; };
// generate temporary allocation (auto unallocated...)
char * c_str(void);
// Sting operation :
etk::UString Extract(int32_t posStart=0, int32_t posEnd=0x7FFFFFFF);
private :
etk::Vector<uniChar_t> m_data; //!< internal data is stored in the Unicode properties ...
etk::Vector<char> m_dataUtf8; //!< Tmp data for the Utf8Data() function
};
etk::CCout& operator <<(etk::CCout &os, const etk::UString &obj);
}
int32_t strlen(const uniChar_t * data);
#endif

View File

@ -1,726 +0,0 @@
/**
*******************************************************************************
* @file etk/Vector.h
* @brief Ewol Tool Kit : Basic etk::Vector (template)
* @author Edouard DUPIN
* @date 07/04/2011
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __ETK_VECTOR_H__
#define __ETK_VECTOR_H__
#include <etk/Types.h>
#include <etk/DebugInternal.h>
#include <etk/Memory.h>
#undef __class__
#define __class__ "etk::Vector"
namespace etk
{
/**
* @brief Vector classes ...
*
* @tparam[in] SIZE Size of the current element.
*
* m_data
* <------------ m_dataSize ------------>
* ----------------------------------------
* | 0 |
* |--------------------------------------|
* | 1 |
* |--------------------------------------|
* | 2 |
* |--------------------------------------|
* m_size | 3 |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* | x |
* |--------------------------------------|
* m_allocated | x |
* ----------------------------------------
*
*/
template<typename MY_TYPE=int32_t> class Vector
{
public:
class Iterator
{
// Private data :
private:
int32_t m_current; //!< curent Id on the vector
Vector<MY_TYPE> * m_vector; //!< Pointer on the curent element of the vectorBin
public:
/**
* @brief Basic itarator constructor with no link with an etkVector
*/
Iterator():
m_current(-1),
m_vector(NULL)
{
// nothing to do ...
}
/**
* @brief Recopy constructor on a specific etkVector.
* @param[in] otherIterator The Iterator that might be copy
*/
Iterator(const Iterator & otherIterator):
m_current(otherIterator.m_current),
m_vector(otherIterator.m_vector)
{
// nothing to do ...
}
/**
* @brief Asignation operator.
* @param[in] otherIterator The Iterator that might be copy
* @return reference on the curent Iterator
*/
Iterator& operator=(const Iterator & otherIterator)
{
m_current = otherIterator.m_current;
m_vector = otherIterator.m_vector;
return *this;
}
/**
* @brief Basic destructor
*/
~Iterator()
{
m_current = -1;
m_vector = NULL;
}
/**
* @brief basic boolean cast
* @return true if the element is present in the etkVector size
*/
operator bool ()
{
if( 0 <= m_current
&& m_current < m_vector->Size() )
{
return true;
} else {
return false;
}
}
/**
* @brief Incremental operator
* @return Reference on the current iterator incremented
*/
Iterator& operator++ ()
{
if( NULL != m_vector
&& m_current < m_vector->Size() )
{
m_current++;
}
return *this;
}
/**
* @brief Decremental operator
* @return Reference on the current iterator decremented
*/
Iterator& operator-- ()
{
if (m_current >= 0) {
m_current--;
}
return *this;
}
/**
* @brief Incremental operator
* @return Reference on a new iterator and increment the other one
*/
Iterator operator++ (int32_t)
{
Iterator it(*this);
++(*this);
return it;
}
/**
* @brief Decremental operator
* @return Reference on a new iterator and decrement the other one
*/
Iterator operator-- (int32_t)
{
Iterator it(*this);
--(*this);
return it;
}
/**
* @brief Get reference on the current Element
* @return the reference on the current Element
*/
MY_TYPE & operator-> () const
{
TK_CHECK_INOUT(m_current >= 0 && m_current < m_vector->Size());
return &m_vector->Get(m_current);
}
/**
* @brief Get reference on the current Element
* @return the reference on the current Element
*/
MY_TYPE & operator* () const
{
TK_CHECK_INOUT(m_current >= 0 && m_current < m_vector->Size());
return m_vector->Get(m_current);
}
private:
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
Iterator(Vector<MY_TYPE> * Evb, int32_t pos):
m_current(pos),
m_vector(Evb)
{
// nothing to do ...
}
friend class Vector;
};
private:
MY_TYPE * m_data; //!< pointer on the curetn table of Data
int32_t m_size; //!< nb Element in the buffer
int32_t m_allocated; //!< Current allocated size
int32_t m_increment; //!< methode of increment
public:
/**
* @brief Create an empty vector
* @param[in] count Minimum request size of the Buffer
*/
Vector(int32_t count = 0):
m_data(NULL),
m_size(0),
m_allocated(0),
m_increment(1)
{
ChangeAllocation(count);
}
/**
* @brief Re-copy constructor (copy all needed data)
* @param[in] Evb Vector that might be copy
*/
Vector(const etk::Vector<MY_TYPE> & Evb)
{
m_allocated = Evb.m_allocated;
m_size = Evb.m_size;
m_increment = Evb.m_increment;
m_data = NULL;
//TK_DEBUG("USE Specific vector allocator ... Evb.m_size=" << Evb.m_size << " Evb.m_increment=" << Evb.m_increment);
// allocate all same data
ETK_MALLOC(m_data, m_allocated, MY_TYPE);
TK_ASSERT(NULL!=m_data, "Error in data allocation");
// Copy all data ...
memcpy(m_data, Evb.m_data, m_allocated * sizeof(MY_TYPE) );
}
/**
* @brief Destructor of the current Class
*/
~Vector()
{
if (NULL!=m_data) {
ETK_FREE(m_data);
m_data = NULL;
}
m_allocated = 0;
m_size = 0;
m_increment = 0;
}
/**
* @brief Re-copy operator
* @param[in] Evb Vector that might be copy
* @return reference on the curent re-copy vector
*/
Vector& operator=(const etk::Vector<MY_TYPE> & Evb)
{
//TK_DEBUG("USE RECOPY vector ... Evb.m_size=" << Evb.m_size << " Evb.m_increment=" << Evb.m_increment);
if( this != &Evb ) // avoid copy to itself
{
if (NULL!=m_data) {
ETK_FREE(m_data);
m_data = NULL;
}
// Set the new value
m_allocated = Evb.m_allocated;
m_size = Evb.m_size;
m_increment = Evb.m_increment;
// allocate all same data
ETK_MALLOC(m_data, m_allocated, MY_TYPE);
TK_ASSERT(NULL!=m_data, "Error in data allocation");
// Copy all data ...
memcpy(m_data, Evb.m_data, m_allocated * sizeof(MY_TYPE) );
}
// Return the curent pointer
return *this;
}
/**
* @brief Add at the Last position of the Vector
* @param[in] item Element to add at the end of vector
*/
Vector& operator+= (const etk::Vector<MY_TYPE> & Evb) // += operator
{
int32_t nbElememt = Evb.Size();
int32_t idx = m_size;
Resize(m_size+nbElememt);
memcpy(&m_data[idx], &Evb.m_data[0], nbElememt*sizeof(MY_TYPE) );
// Return the curent pointer
return *this;
}
/**
* @brief Set increment mode of this vector (default it match corectly with the number of element inside)
* @param[in] newIncrementNumber methode requested
*/
void SetIncrement(int32_t newIncrementNumber)
{
m_increment = newIncrementNumber;
}
/**
* @brief Get the number of element in the vector
* @return The number requested
*/
int32_t Size() const
{
return m_size;
}
/**
* @brief Get the Allocated size in the vector
* @return The size of allocation
*/
int32_t AllocatedSize() const
{
return m_allocated;
}
/**
* @brief Get a current element in the vector
* @param[in] pos Desired position read
* @return Reference on the Element
*/
MY_TYPE& Get(int32_t pos)
{
return m_data[pos];
}
/**
* @brief Get an copy Element an a special position
* @param[in] pos Position in the vector that might be get [0..Size()]
* @return An reference on the copy of selected element
*/
MY_TYPE& operator[] (int32_t pos)
{
return Get(pos);
}
/**
* @brief Get an Element an a special position
* @param[in] pos Position in the vector that might be get [0..Size()]
* @return An reference on the selected element
*/
const MY_TYPE& operator[] (int32_t pos) const
{
return m_data[pos];
}
/**
* @brief Add at the Last position of the Vector
* @param[in] item Element to add at the end of vector
*/
void PushBack(const MY_TYPE& item)
{
int32_t idx = m_size;
Resize(m_size+1);
m_data[idx] = item;
}
/**
* @brief Add at the Last position of the Vector
* @param[in] item Element to add at the end of vector
*/
void PushBack(const MY_TYPE * item, int32_t nbElement)
{
if (NULL == item) {
return;
}
int32_t idx = m_size;
Resize(m_size+nbElement);
memcpy(&m_data[idx], item, nbElement*sizeof(MY_TYPE) );
}
/**
* @brief Remove the last element of the vector
*/
void PopBack(void)
{
if(m_size>0) {
Resize(m_size-1);
}
}
/**
* @brief Remove all alement in the current vector
*/
void Clear(void)
{
if(m_size>0) {
Resize(0);
}
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void Insert(int32_t pos, const MY_TYPE& item)
{
if (pos>m_size) {
TK_ERROR(" can not insert Element at this position : " << pos << " > " << m_size<< " add it at the end ... ");
PushBack(item);
return;
}
int32_t tmpSize = m_size;
// Request resize of the current buffer
Resize(m_size+1);
// move curent data
int32_t sizeToMove = (tmpSize - pos)*sizeof(MY_TYPE);
if ( 0 < sizeToMove) {
memmove((m_data + pos + 1), (m_data + pos), sizeToMove );
}
// affectation of the current element
m_data[pos] = item;
}
/**
* @brief
*
* @param[in,out] ---
*
* @return ---
*
*/
void Insert(int32_t pos, const MY_TYPE * item, int32_t nbElement)
{
if (pos>m_size) {
TK_WARNING(" can not insert Element at this position : " << pos << " > " << m_size << " add it at the end ... ");
PushBack(item, nbElement);
return;
}
int32_t tmpSize = m_size;
// Request resize of the current buffer
Resize(m_size+nbElement);
// move curent data (after the position)
int32_t sizeToMove = (tmpSize - pos)*sizeof(MY_TYPE);
if ( 0 < sizeToMove) {
memmove((m_data + pos + nbElement), (m_data + pos), sizeToMove );
}
// affectation of all input element
memcpy(&m_data[pos], item, nbElement*sizeof(MY_TYPE) );
}
/**
* @brief Remove one element
*
* @param[in] pos Position to remove the data
*
* @return ---
*
*/
void Erase(int32_t pos)
{
if (pos<0 || (uint32_t)pos>m_size) {
TK_ERROR(" can not Erase Element at this position : " << pos << " > " << m_size);
return;
}
int32_t tmpSize = m_size;
int32_t sizeToMove = (tmpSize - (pos+1))*sizeof(MY_TYPE);
if ( 0 < sizeToMove) {
// move curent data
memmove((m_data + pos), (m_data + pos + 1), sizeToMove );
}
// Request resize of the current buffer
Resize(m_size-1);
}
/**
* @brief Remove N elements
*
* @param[in] pos Position to remove the data
* @param[in] posEnd Last position number
*
* @return ---
*
*/
void Erase(int32_t pos, int32_t posEnd)
{
if (pos>m_size) {
TK_ERROR(" can not Erase Element at this position : " << pos << " > " << m_size);
return;
}
if (posEnd>m_size) {
posEnd = m_size;
}
int32_t nbElement = m_size - pos;
int32_t tmpSize = m_size;
// move curent data
int32_t sizeToMove = (tmpSize - (pos+nbElement))*sizeof(MY_TYPE);
if ( 0 < sizeToMove) {
memmove((m_data + pos), (m_data + pos + nbElement), sizeToMove );
}
// Request resize of the current buffer
Resize(m_size-nbElement);
}
/**
* @brief Remove N element
*
* @param[in] pos Position to remove the data
* @param[in] nbElement number of element to remove
*
* @return ---
*
*/
void EraseLen(int32_t pos, int32_t nbElement)
{
if (pos>m_size) {
TK_ERROR(" can not Erase Len Element at this position : " << pos << " > " << m_size);
return;
}
if (pos+nbElement>m_size) {
nbElement = m_size - pos;
}
int32_t tmpSize = m_size;
// move curent data
int32_t sizeToMove = (tmpSize - (pos+nbElement))*sizeof(MY_TYPE);
if ( 0 < sizeToMove) {
memmove((m_data + pos), (m_data + pos + nbElement), sizeToMove );
}
// Request resize of the current buffer
Resize(m_size-nbElement);
}
/**
* @brief extract data between two point :
* @param[in] posStart start position to extract data
* @param[in] posEnd End position to extract data
* @return the extracted vector
*/
Vector Extract(int32_t posStart = 0, int32_t posEnd=0x7FFFFFFF)
{
Vector<MY_TYPE> out;
if (posStart < 0) {
posStart = 0;
} else if (posStart >= Size() ) {
return out;
}
if (posEnd < 0) {
return out;
} else if (posEnd >= Size() ) {
posEnd = Size();
}
out.PushBack(&m_data[posStart], posEnd-posStart);
return out;
}
/**
* @brief Set the minimum allocation in memory for the curent vector ==> reallocate the
* buffer to fit exactly the mumber of element needed
*/
void Fit(void)
{
if (m_size > m_allocated) {
// Reallocate the curent data to the correct size ...
ETK_REALLOC(m_data, m_size, MY_TYPE);
}
// Check result with assert :
TK_ASSERT(NULL!=m_data, "Error in data Fitting");
m_allocated = m_size;
}
/**
* @brief Get an iterator an an specific position
* @param[in] pos Requested position of the iterator in the vector
* @return The Iterator
*/
Iterator Position(int32_t pos)
{
return Iterator(this, pos);
}
/**
* @brief Get an Iterator on the start position of the Vector
* @return The Iterator
*/
Iterator Begin(void)
{
return Position(0);
}
/**
* @brief Get an Iterator on the end position of the Vector
* @return The Iterator
*/
Iterator End(void)
{
return Position( Size()-1 );
}
private:
/**
* @brief Change the current size of the vector
* @param[in] newSize New requested size of element in the vector
*/
void Resize(int32_t newSize)
{
// Reallocate memory
if (newSize > m_allocated) {
ChangeAllocation(newSize);
}
m_size = newSize;
}
/**
* @brief Change the current allocation to the corect one (depend on the current size)
* @param[in] newSize Minimum number of element needed
*/
void ChangeAllocation(int32_t newSize)
{
// set the minimal size to 1
if(newSize <= 0) {
newSize = 1;
}
int32_t requestSize = m_allocated;
// set the size with the corect chose type :
if (newSize == m_allocated) {
return;
} else if (newSize < requestSize) {
// down the size of the vector:
if (0==m_increment) {
// never down size...
} else {
int32_t devide = m_increment;
if (devide == 0) {
devide = 1;
}
int32_t numberOfStep = m_allocated / devide;
if (newSize< ((numberOfStep-2)*devide + devide/2) ) {
//Allow Reallocation of a new size shorter
requestSize = ((newSize / devide)+1) * devide;
}
}
} else {
while(newSize > requestSize) {
if (0 == requestSize) {
requestSize = 1;
} else if (0==m_increment) {
requestSize = requestSize * 2;
} else {
requestSize = (requestSize + m_increment);
}
}
}
// No reallocation needed :
if (requestSize == m_allocated) {
return;
}
// check if something is allocated :
if (NULL == m_data) {
// no data allocated ==> request an allocation (might be the first)
ETK_MALLOC(m_data, requestSize, MY_TYPE);
} else {
// move datas
ETK_REALLOC(m_data, requestSize, MY_TYPE);
}
// Check result with assert :
TK_ASSERT(NULL!=m_data, "Error in data allocation");
// set the new allocation size
m_allocated = requestSize;
}
};
/**
* @brief VectorP classes ...
*
* @tparam[in] T The type of objects to store.
* @tparam[in] INC Incrementation mode (0 : Exponential to 200 and increment by stemp of 200)
*
* m_data
* ---------- |-----------------------|
* | 0 |-------->| Class Data |
* |--------| |-----------------------|
* | 1 |----|
* |--------| |
* | 2 |====|==============| |-----------------------|
* |--------| | --->| Class Data |
* m_count | 3 |-| | |-----------------------|
* |--------| | |
* | x | | | |-----------------------|
* |--------| | -------->| Class Data |
* | x | | |-----------------------|
* |--------| |
* | x | |
* |--------| | |-----------------------|
* | x | --------------------->| Class Data |
* |--------| |-----------------------|
* | x |
* |--------|
* | x |
* |--------|
* m_size | x |
* ----------
*
*/
/*
template<class MY_CLASS> class VectorP private Vector<MY_CLASS*>
{
};
*/
}
#undef __class__
#define __class__ NULL
#endif

View File

@ -1,84 +0,0 @@
/**
*******************************************************************************
* @file etk/tool.cpp
* @brief Ewol Tool Kit : generique tools (Sources)
* @author Edouard DUPIN
* @date 26/06/2012
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <etk/tool.h>
// for the rand ...
#include <time.h>
#include <math.h>
float etk::tool::frand(float a, float b)
{
return ( rand()/(float)RAND_MAX ) * (b-a) + a;
}
int32_t etk::tool::irand(int32_t a, int32_t b)
{
return (int32_t)(( rand()/(float)RAND_MAX ) * ((float)b-(float)a) + (float)a);
}
void etk::tool::SortList(etk::Vector<etk::UString *> &m_listDirectory)
{
etk::Vector<etk::UString *> tmpList = m_listDirectory;
m_listDirectory.Clear();
for(int32_t iii=0; iii<tmpList.Size(); iii++) {
int32_t findPos = 0;
for(int32_t jjj=0; jjj<m_listDirectory.Size(); jjj++) {
//EWOL_DEBUG("compare : \""<<*tmpList[iii] << "\" and \"" << *m_listDirectory[jjj] << "\"");
if (*tmpList[iii] > *m_listDirectory[jjj]) {
findPos = jjj+1;
}
}
//EWOL_DEBUG("position="<<findPos);
m_listDirectory.Insert(findPos, tmpList[iii]);
}
}
bool etk::tool::strnCmpNoCase(const char * input1, const char * input2, int32_t maxLen)
{
int32_t iii=0;
while ('\0' != *input1 && '\0' != *input2 && iii < maxLen) {
char in1 = *input1;
char in2 = *input2;
if (in1 != in2) {
if (in1 <= 'Z' && in1 >= 'A') {
in1 = in1 - 'A' + 'a';
}
if (in2 <= 'Z' && in2 >= 'A') {
in2 = in2 - 'A' + 'a';
}
if (in1 != in2) {
return false;
}
}
iii++;
input1++;
input2++;
}
return true;
}

View File

@ -1,40 +0,0 @@
/**
*******************************************************************************
* @file etk/tool.h
* @brief Ewol Tool Kit : generique tools (header)
* @author Edouard DUPIN
* @date 26/06/2012
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __ETK_TOOL_H__
#define __ETK_TOOL_H__
#include <etk/Types.h>
#include <etk/UString.h>
namespace etk {
namespace tool {
float frand(float a, float b);
int32_t irand(int32_t a, int32_t b);
void SortList(etk::Vector<etk::UString *> &m_listDirectory);
bool strnCmpNoCase(const char * input1, const char * input2, int32_t maxLen);
};
};
#endif

View File

@ -1,796 +0,0 @@
/**
*******************************************************************************
* @file unicode.cpp
* @brief Editeur De N'ours : Abstraction Charset layer (Sources)
* @author Edouard DUPIN
* @date 18/01/2012
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
// cf : http://unicode.org/fr/charts/symbols.html#CombiningDiacriticalMarks
#include <etk/Types.h>
#include <etk/Debug.h>
#include <etk/unicodeTable.h>
#include <etk/unicode.h>
// transform ISO <==> Unicode
void unicode::convertIsoToUnicode(charset_te inputCharset, char input_ISO, uniChar_t & output_Unicode)
{
switch(inputCharset)
{
case EDN_CHARSET_ISO_8859_1: output_Unicode = TableIso8859_1[(uint32_t)input_ISO&0xFF]; break;
case EDN_CHARSET_ISO_8859_2: output_Unicode = TableIso8859_2[(uint32_t)input_ISO&0xFF]; break;
case EDN_CHARSET_ISO_8859_3: output_Unicode = TableIso8859_3[(uint32_t)input_ISO&0xFF]; break;
case EDN_CHARSET_ISO_8859_4: output_Unicode = TableIso8859_4[(uint32_t)input_ISO&0xFF]; break;
case EDN_CHARSET_ISO_8859_5: output_Unicode = TableIso8859_5[(uint32_t)input_ISO&0xFF]; break;
case EDN_CHARSET_ISO_8859_6: output_Unicode = TableIso8859_6[(uint32_t)input_ISO&0xFF]; break;
case EDN_CHARSET_ISO_8859_7: output_Unicode = TableIso8859_7[(uint32_t)input_ISO&0xFF]; break;
case EDN_CHARSET_ISO_8859_8: output_Unicode = TableIso8859_8[(uint32_t)input_ISO&0xFF]; break;
case EDN_CHARSET_ISO_8859_9: output_Unicode = TableIso8859_9[(uint32_t)input_ISO&0xFF]; break;
case EDN_CHARSET_ISO_8859_10: output_Unicode = TableIso8859_10[(uint32_t)input_ISO&0xFF]; break;
case EDN_CHARSET_ISO_8859_11: output_Unicode = TableIso8859_11[(uint32_t)input_ISO&0xFF]; break;
case EDN_CHARSET_ISO_8859_13: output_Unicode = TableIso8859_13[(uint32_t)input_ISO&0xFF]; break;
case EDN_CHARSET_ISO_8859_14: output_Unicode = TableIso8859_14[(uint32_t)input_ISO&0xFF]; break;
case EDN_CHARSET_ISO_8859_15:
output_Unicode = TableIso8859_15[(uint32_t)input_ISO&0xFF];
#if 0
if ((uint32_t)input_ISO&0xFF == 0xb0) {
printf("Change Element : 0x%02x ==> 0x%08x \n", (uint32_t)input_ISO&0xFF, output_Unicode);
}
#endif
break;
default :
TK_WARNING("Unknow charset ... " << inputCharset);
output_Unicode = '?';
break;
}
}
void unicode::convertUnicodeToIso(charset_te inputCharset, uniChar_t input_Unicode, char & output_ISO)
{
const uniChar_t *tmpTable = NULL;
switch(inputCharset)
{
case EDN_CHARSET_ISO_8859_1: tmpTable = TableIso8859_1; break;
case EDN_CHARSET_ISO_8859_2: tmpTable = TableIso8859_2; break;
case EDN_CHARSET_ISO_8859_3: tmpTable = TableIso8859_3; break;
case EDN_CHARSET_ISO_8859_4: tmpTable = TableIso8859_4; break;
case EDN_CHARSET_ISO_8859_5: tmpTable = TableIso8859_5; break;
case EDN_CHARSET_ISO_8859_6: tmpTable = TableIso8859_6; break;
case EDN_CHARSET_ISO_8859_7: tmpTable = TableIso8859_7; break;
case EDN_CHARSET_ISO_8859_8: tmpTable = TableIso8859_8; break;
case EDN_CHARSET_ISO_8859_9: tmpTable = TableIso8859_9; break;
case EDN_CHARSET_ISO_8859_10: tmpTable = TableIso8859_10; break;
case EDN_CHARSET_ISO_8859_11: tmpTable = TableIso8859_11; break;
case EDN_CHARSET_ISO_8859_13: tmpTable = TableIso8859_13; break;
case EDN_CHARSET_ISO_8859_14: tmpTable = TableIso8859_14; break;
case EDN_CHARSET_ISO_8859_15: tmpTable = TableIso8859_15; break;
default :
TK_WARNING("Unknow charset ... " << inputCharset);
output_ISO = '?';
return;
}
int32_t i;
for (i=0; i<256; i++) {
if (tmpTable[i] == input_Unicode) {
output_ISO = (char)i;
return;
}
}
}
int32_t unicode::convertIsoToUnicode(charset_te inputCharset, etk::Vector<char>& input_ISO, etk::Vector<uniChar_t>& output_Unicode)
{
output_Unicode.Clear();
uniChar_t output;
for(int32_t iii=0; iii<input_ISO.Size(); iii++) {
convertIsoToUnicode(inputCharset, (char)input_ISO[iii], output);
output_Unicode.PushBack(output);
}
if (output_Unicode.Size() == 0) {
output_Unicode.PushBack(0);
} else if (output_Unicode[output_Unicode.Size()-1] != 0) {
output_Unicode.PushBack(0);
}
return output_Unicode.Size();
}
int32_t unicode::convertIsoToUnicode(charset_te inputCharset, etk::Vector<int8_t>& input_ISO, etk::Vector<uniChar_t>& output_Unicode)
{
output_Unicode.Clear();
uniChar_t output;
for(int32_t iii=0; iii<input_ISO.Size(); iii++) {
convertIsoToUnicode(inputCharset, (char)input_ISO[iii], output);
output_Unicode.PushBack(output);
}
if (output_Unicode.Size() == 0) {
output_Unicode.PushBack(0);
} else if (output_Unicode[output_Unicode.Size()-1] != 0) {
output_Unicode.PushBack(0);
}
return output_Unicode.Size();
}
int32_t unicode::convertUnicodeToIso(charset_te inputCharset, etk::Vector<uniChar_t>& input_Unicode, etk::Vector<char>& output_ISO)
{
output_ISO.Clear();
char output[10];
for(int32_t iii=0; iii<input_Unicode.Size(); iii++) {
convertUnicodeToUtf8(input_Unicode[iii], output);
char * tmp = output;
while(*tmp != '\0') {
output_ISO.PushBack(*tmp);
tmp++;
}
}
output_ISO.PushBack(0);
return output_ISO.Size();
}
int32_t unicode::convertUnicodeToIso(charset_te inputCharset, etk::Vector<uniChar_t>& input_Unicode, etk::Vector<int8_t>& output_ISO)
{
output_ISO.Clear();
char output[10];
for(int32_t iii=0; iii<input_Unicode.Size(); iii++) {
convertUnicodeToUtf8(input_Unicode[iii], output);
char * tmp = output;
while(*tmp != '\0') {
output_ISO.PushBack(*tmp);
tmp++;
}
}
output_ISO.PushBack(0);
return output_ISO.Size();
}
static uint32_t unicodeToUtf8(uniChar_t value)
{
uint32_t output = 0;
if (127 >= value) {
output = value;
} else if (2047 >= value) {
// output ==> 00000000 00000000 110xxxxx 10xxxxxx
// input ==> -------- -------- -----222 22111111
output = 0x0000C080;
output+= (value & 0x000007C0)<<2;
output+= value & 0x0000003F;
} else if (65535 >= value) {
// output ==> 00000000 1110xxxx 10xxxxxx 10xxxxxx
// input ==> -------- -------- 33332222 22111111
output = 0x00E08080;
output+= (value & 0x0000F000)<<4;
output+= (value & 0x00000FC0)<<2;
output+= value & 0x0000003F;
} else if (1114111 >= value) {
// output ==> 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
// input ==> -------- ---44433 33332222 22111111
output = 0xF0808080;
output+= (value & 0x001C0000)<<6;
output+= (value & 0x0003F000)<<4;
output+= (value & 0x00000FC0)<<2;
output+= value & 0x0000003F;
} else {
TK_ERROR("NON UTF8 caracter input...");
return 0;
}
//printf("utf8convertion : %d=%08x ==> %08x\n",value, value, output);
return output;
}
// Transform UTF-8 <==> Unicode
void unicode::convertUnicodeToUtf8(uniChar_t input_Unicode, char * output_UTF8)
{
uint32_t value = unicodeToUtf8(input_Unicode);
if (0xFF >= value) {
output_UTF8[0] = (char)value;
output_UTF8[1] = '\0';
} else if (0xFFFF >= value) {
output_UTF8[0] = (char)((value>>8) & 0x000000FF);
output_UTF8[1] = (char)value;
output_UTF8[2] = '\0';
} else if (0xFFFFFF >= value) {
output_UTF8[0] = (char)((value>>16) & 0x000000FF);
output_UTF8[1] = (char)((value>>8) & 0x000000FF);
output_UTF8[2] = (char)value;
output_UTF8[3] = '\0';
} else {
output_UTF8[0] = (char)((value>>24) & 0x000000FF);
output_UTF8[1] = (char)((value>>16) & 0x000000FF);
output_UTF8[2] = (char)((value>>8) & 0x000000FF);
output_UTF8[3] = (char)value;
output_UTF8[4] = '\0';
}
}
void unicode::convertUtf8ToUnicode(char * input_UTF8, uniChar_t &output_Unicode)
{
int32_t len = strlen(input_UTF8);
output_Unicode = 0;
switch (len) {
case 1:
output_Unicode = (uint8_t)(input_UTF8[0]) & 0x7F;
break;
case 2:
output_Unicode = (((uint8_t)input_UTF8[0]) & 0x1F)<< 6;
output_Unicode += ((uint8_t)input_UTF8[1]) & 0x3F;
break;
case 3:
output_Unicode = (((uint8_t)input_UTF8[0]) & 0x0F)<< 12;
output_Unicode += (((uint8_t)input_UTF8[1]) & 0x3F)<< 6;
output_Unicode += ((uint8_t)input_UTF8[2]) & 0x3F;
break;
default:
output_Unicode = (((uint8_t)input_UTF8[0]) & 0x07)<< 18;
output_Unicode += (((uint8_t)input_UTF8[1]) & 0x3F)<< 12;
output_Unicode += (((uint8_t)input_UTF8[2]) & 0x3F)<< 6;
output_Unicode += ((uint8_t)input_UTF8[3]) & 0x3F;
break;
}
}
int32_t unicode::convertUnicodeToUtf8(const etk::Vector<uniChar_t>& input_Unicode, etk::Vector<char>& output_UTF8)
{
char output[10];
for (int32_t iii=0; iii<input_Unicode.Size(); iii++) {
unicode::convertUnicodeToUtf8(input_Unicode[iii], output);
char * tmp = output ;
while (*tmp != '\0') {
output_UTF8.PushBack(*tmp);
tmp++;
}
}
output_UTF8.PushBack('\0');
return output_UTF8.Size()-1;
}
int32_t unicode::convertUnicodeToUtf8(const etk::Vector<uniChar_t>& input_Unicode, etk::Vector<int8_t>& output_UTF8)
{
char output[10];
for (int32_t iii=0; iii<input_Unicode.Size(); iii++) {
unicode::convertUnicodeToUtf8(input_Unicode[iii], output);
char * tmp = output ;
while (*tmp != '\0') {
output_UTF8.PushBack((int8_t)*tmp);
tmp++;
}
}
output_UTF8.PushBack('\0');
return output_UTF8.Size()-1;
}
int32_t unicode::convertUtf8ToUnicode(etk::Vector<char>& input_UTF8, etk::Vector<uniChar_t>& output_Unicode)
{
char tmpData[20];
int32_t pos = 0;
while (pos < input_UTF8.Size()) {
int32_t lenMax = input_UTF8.Size() - pos;
//4 case
if( 1<=lenMax
&& 0x00 == (input_UTF8[pos+0] & 0x80) )
{
tmpData[0] = input_UTF8[pos+0];
tmpData[1] = '\0';
pos += 1;
} else if( 2<=lenMax
&& 0xC0 == (input_UTF8[pos+0] & 0xE0)
&& 0x80 == (input_UTF8[pos+1] & 0xC0) ) {
tmpData[0] = input_UTF8[pos+0];
tmpData[1] = input_UTF8[pos+1];
tmpData[2] = '\0';
pos += 2;
} else if( 3<=lenMax
&& 0xE0 == (input_UTF8[pos+0] & 0xF0)
&& 0x80 == (input_UTF8[pos+1] & 0xC0)
&& 0x80 == (input_UTF8[pos+2] & 0xC0)) {
tmpData[0] = input_UTF8[pos+0];
tmpData[1] = input_UTF8[pos+1];
tmpData[2] = input_UTF8[pos+2];
tmpData[3] = '\0';
pos += 3;
} else if( 4<=lenMax
&& 0xF0 == (input_UTF8[pos+0] & 0xF8)
&& 0x80 == (input_UTF8[pos+1] & 0xC0)
&& 0x80 == (input_UTF8[pos+2] & 0xC0)
&& 0x80 == (input_UTF8[pos+3] & 0xC0)) {
tmpData[0] = input_UTF8[pos+0];
tmpData[1] = input_UTF8[pos+1];
tmpData[2] = input_UTF8[pos+2];
tmpData[3] = input_UTF8[pos+3];
tmpData[4] = '\0';
pos += 4;
} else {
tmpData[0] = '\0';
pos += 1;
}
uniChar_t tmpUnicode;
convertUtf8ToUnicode(tmpData, tmpUnicode);
output_Unicode.PushBack(tmpUnicode);
}
return 0;
}
int32_t unicode::convertUtf8ToUnicode(etk::Vector<int8_t>& input_UTF8, etk::Vector<uniChar_t>& output_Unicode)
{
char tmpData[20];
int32_t pos = 0;
while (pos < input_UTF8.Size()) {
int32_t lenMax = input_UTF8.Size() - pos;
//4 case
if( 1<=lenMax
&& 0x00 == (input_UTF8[pos+0] & 0x80) )
{
tmpData[0] = input_UTF8[pos+0];
tmpData[1] = '\0';
pos += 1;
} else if( 2<=lenMax
&& 0xC0 == (input_UTF8[pos+0] & 0xE0)
&& 0x80 == (input_UTF8[pos+1] & 0xC0) ) {
tmpData[0] = input_UTF8[pos+0];
tmpData[1] = input_UTF8[pos+1];
tmpData[2] = '\0';
pos += 2;
} else if( 3<=lenMax
&& 0xE0 == (input_UTF8[pos+0] & 0xF0)
&& 0x80 == (input_UTF8[pos+1] & 0xC0)
&& 0x80 == (input_UTF8[pos+2] & 0xC0)) {
tmpData[0] = input_UTF8[pos+0];
tmpData[1] = input_UTF8[pos+1];
tmpData[2] = input_UTF8[pos+2];
tmpData[3] = '\0';
pos += 3;
} else if( 4<=lenMax
&& 0xF0 == (input_UTF8[pos+0] & 0xF8)
&& 0x80 == (input_UTF8[pos+1] & 0xC0)
&& 0x80 == (input_UTF8[pos+2] & 0xC0)
&& 0x80 == (input_UTF8[pos+3] & 0xC0)) {
tmpData[0] = input_UTF8[pos+0];
tmpData[1] = input_UTF8[pos+1];
tmpData[2] = input_UTF8[pos+2];
tmpData[3] = input_UTF8[pos+3];
tmpData[4] = '\0';
pos += 4;
} else {
tmpData[0] = '\0';
pos += 1;
}
uniChar_t tmpUnicode;
convertUtf8ToUnicode(tmpData, tmpUnicode);
output_Unicode.PushBack(tmpUnicode);
}
return 0;
}
int32_t unicode::convertUtf8ToUnicode(char * input_UTF8, etk::Vector<uniChar_t>& output_Unicode)
{
char tmpData[20];
int32_t pos = 0;
if (NULL == input_UTF8) {
return 0;
}
int32_t len = strlen(input_UTF8);
while (pos < len) {
int32_t lenMax = len - pos;
//4 case
if( 1<=lenMax
&& 0x00 == (input_UTF8[pos+0] & 0x80) )
{
tmpData[0] = input_UTF8[pos+0];
tmpData[1] = '\0';
pos += 1;
} else if( 2<=lenMax
&& 0xC0 == (input_UTF8[pos+0] & 0xE0)
&& 0x80 == (input_UTF8[pos+1] & 0xC0) ) {
tmpData[0] = input_UTF8[pos+0];
tmpData[1] = input_UTF8[pos+1];
tmpData[2] = '\0';
pos += 2;
} else if( 3<=lenMax
&& 0xE0 == (input_UTF8[pos+0] & 0xF0)
&& 0x80 == (input_UTF8[pos+1] & 0xC0)
&& 0x80 == (input_UTF8[pos+2] & 0xC0)) {
tmpData[0] = input_UTF8[pos+0];
tmpData[1] = input_UTF8[pos+1];
tmpData[2] = input_UTF8[pos+2];
tmpData[3] = '\0';
pos += 3;
} else if( 4<=lenMax
&& 0xF0 == (input_UTF8[pos+0] & 0xF8)
&& 0x80 == (input_UTF8[pos+1] & 0xC0)
&& 0x80 == (input_UTF8[pos+2] & 0xC0)
&& 0x80 == (input_UTF8[pos+3] & 0xC0)) {
tmpData[0] = input_UTF8[pos+0];
tmpData[1] = input_UTF8[pos+1];
tmpData[2] = input_UTF8[pos+2];
tmpData[3] = input_UTF8[pos+3];
tmpData[4] = '\0';
pos += 4;
} else {
tmpData[0] = '\0';
pos += 1;
}
uniChar_t tmpUnicode;
convertUtf8ToUnicode(tmpData, tmpUnicode);
output_Unicode.PushBack(tmpUnicode);
}
return 0;
}
// Transform ISO <==> UTF-8
void unicode::convertIsoToUtf8(charset_te inputCharset, char input_ISO, char * output_UTF8)
{
uniChar_t tmpUnicode;
// concert Iso in UniCode
convertIsoToUnicode(inputCharset, input_ISO, tmpUnicode );
// convert UniCode in Utf-8
convertUnicodeToUtf8(tmpUnicode, output_UTF8);
}
void unicode::convertUtf8ToIso(charset_te inputCharset, char * input_UTF8, char & output_ISO)
{
uniChar_t tmpUnicode;
// convert Utf-8 in UniCode
convertUtf8ToUnicode(input_UTF8, tmpUnicode);
// concert UniCode in Iso
convertUnicodeToIso(inputCharset, tmpUnicode, output_ISO);
}
int32_t unicode::convertIsoToUtf8(charset_te inputCharset, etk::Vector<char>& input_ISO, etk::Vector<char>& output_UTF8)
{
TK_WARNING("TODO : not coded...");
return 0;
}
int32_t unicode::convertUtf8ToIso(charset_te inputCharset, etk::Vector<char>& input_UTF8, etk::Vector<char>& output_ISO)
{
TK_WARNING("TODO : not coded...");
return 0;
}
/**
* @brief Get the number of element of the curent UTF8 char (in the curent Buffer)
*
* @param[in] data pointer on the curent CHAR string (pointer on the allocated buffer)
* @param[out] size Nb of char use in this UTF8 [0..4]
* @param[out] baseValid true : the ase format of the UTF8 is CORRECT
*
* @return ---
*
*/
void unicode::Utf8_SizeElement(const char * data, int32_t lenMax , uint8_t &size, bool &baseValid)
{
TK_ASSERT(0 <= lenMax, "size can not be < 0 ...");
if (0 > lenMax) {
size = 0;
baseValid = false;
return;
}
//4 case
if ( 1<=lenMax
&& 0x00 == (data[0] & 0x80) ) {
// One Char Element
size = 1;
baseValid = true;
} else if( 2<=lenMax
&& 0xC0 == (data[0] & 0xE0)
&& 0x80 == (data[1] & 0xC0) ) {
size = 2;
baseValid = true;
} else if( 3<=lenMax
&& 0xE0 == (data[0] & 0xF0)
&& 0x80 == (data[1] & 0xC0)
&& 0x80 == (data[2] & 0xC0)) {
size = 3;
baseValid = true;
} else if( 4<=lenMax
&& 0xF0 == (data[0] & 0xF8)
&& 0x80 == (data[1] & 0xC0)
&& 0x80 == (data[2] & 0xC0)
&& 0x80 == (data[3] & 0xC0)) {
size = 4;
baseValid = true;
} else {
// return only one error Caracter ...
baseValid = false;
size = 1;
}
}
#if 0 // Remove for the moment ...
/**
* @brief Get the number of element of the previous UTF8 char (in the curent Buffer)
*
* @param[in] data pointer on the curent CHAR string (pointer on the allocated buffer) (the curent char is not check)
* @param[out] size Nb of char use in this UTF8 [0..4]
* @param[out] baseValid true : the ase format of the UTF8 is CORRECT
*
* @return ---
*
*/
static void Utf8_SizePreviousElement(const char * data, int32_t lenMax, uint8_t &size, bool &baseValid)
{
EDN_ASSERT(0 <= lenMax, "size can not be < 0 ...");
if (0 > lenMax) {
size = 0;
baseValid = false;
return;
}
//4 case
if ( 1<=lenMax
&& 0x00 == (data[-1] & 0x80) ) {
// One Char Element
size = 1;
baseValid = true;
} else if( 2<=lenMax
&& 0xC0 == (data[-2] & 0xE0)
&& 0x80 == (data[-1] & 0xC0) ) {
size = 2;
baseValid = true;
} else if( 3<=lenMax
&& 0xE0 == (data[-3] & 0xF0)
&& 0x80 == (data[-2] & 0xC0)
&& 0x80 == (data[-1] & 0xC0)) {
size = 3;
baseValid = true;
} else if( 4<=lenMax
&& 0xF0 == (data[-4] & 0xF8)
&& 0x80 == (data[-3] & 0xC0)
&& 0x80 == (data[-2] & 0xC0)
&& 0x80 == (data[-1] & 0xC0)) {
size = 4;
baseValid = true;
} else {
// return only one error Caracter ...
baseValid = false;
size = 1;
}
}
#endif
/**
* @brief
*
* @param[in,out]
*
* @return
*
*/
/*
static uint32_t Utf8_GetValue(UTF8Element_ts &Element)
{
uint32_t value = 0;
const char * data = m_data + Element.CharPosition;
//4 case
switch(Element.CharSize)
{
case 1:
value = data[0] & 0x7F;
break;
case 2:
value = (data[0] & 0x1F)<< 6;
value += data[1] & 0x3F;
break;
case 3:
value = (data[0] & 0x0F)<< 12;
value += (data[1] & 0x3F)<< 6;
value += data[2] & 0x3F;
break;
case 4:
value = (data[0] & 0x07)<< 18;
value += (data[1] & 0x3F)<< 12;
value += (data[2] & 0x3F)<< 6;
value += data[3] & 0x3F;
break;
default:
// return only one error Caracter ...
EDN_ASSERT(false, "impossible case....");
break;
}
// check the validity of the UTF8 ...
if( ( 0xD800 <= value
&& 0xDFFF >= value )
|| ( 0xFDD0 <= value
&& 0xFDEF >= value )
|| ( 0xFFFE <= value
&& 0xFFFF >= value )
|| ( 0x1FFFE <= value
&& 0x1FFFF >= value )
|| ( 0x2FFFE <= value
&& 0xDFFFF >= value )
|| ( 0xEFFFE <= value
&& 0xEFFFF >= value )
|| ( 0xFFFFE <= value
&& 0xFFFFF >= value )
|| ( 0x10FFFE <= value
&& 0x10FFFF >= value ) )
{
// overwrite the UTF8 validity ==> this is not a diaplayable element
Element.ValidUTF8 = false;
return value;
}
return value;
}
*/
int32_t unicode::strUtf8Len(const char *input_UTF8)
{
int32_t count = 0;
int32_t size = strlen(input_UTF8);
uint8_t tmpSize;
bool baseValid;
while (size > 0) {
Utf8_SizeElement(input_UTF8, size , tmpSize, baseValid);
input_UTF8 += tmpSize;
size -= tmpSize;
count++;
}
return count;
}
// **************************************************************************************************************
// simple convertion optention
// **************************************************************************************************************
#if 0
Procedure de recuperation des charset sans ce casser les ...
// generate the basic file
FILE * mfile = NULL;
mfile = fopen("fichierIsoBase", "wb");
if (NULL == mfile) {
EDN_ERROR("Error to create file");
return false;
}
char newline = '\n';
for(int32_t i=0x20; i<0x100; i++) {
char plop = i;
fwrite(&plop, sizeof(char), 1, mfile);
fwrite(&newline, sizeof(char), 1, mfile);
}
fclose(mfile);
// console script to convert files :
iconv -c --from-code=ISO-8859-1 --to-code=UTF-8 -o fichierUTF8_iso-1 fichierIsoBase
iconv -c --from-code=ISO-8859-2 --to-code=UTF-8 -o fichierUTF8_iso-2 fichierIsoBase
iconv -c --from-code=ISO-8859-3 --to-code=UTF-8 -o fichierUTF8_iso-3 fichierIsoBase
iconv -c --from-code=ISO-8859-4 --to-code=UTF-8 -o fichierUTF8_iso-4 fichierIsoBase
iconv -c --from-code=ISO-8859-5 --to-code=UTF-8 -o fichierUTF8_iso-5 fichierIsoBase
iconv -c --from-code=ISO-8859-6 --to-code=UTF-8 -o fichierUTF8_iso-6 fichierIsoBase
iconv -c --from-code=ISO-8859-7 --to-code=UTF-8 -o fichierUTF8_iso-7 fichierIsoBase
iconv -c --from-code=ISO-8859-8 --to-code=UTF-8 -o fichierUTF8_iso-8 fichierIsoBase
iconv -c --from-code=ISO-8859-9 --to-code=UTF-8 -o fichierUTF8_iso-9 fichierIsoBase
iconv -c --from-code=ISO-8859-10 --to-code=UTF-8 -o fichierUTF8_iso-10 fichierIsoBase
iconv -c --from-code=ISO-8859-11 --to-code=UTF-8 -o fichierUTF8_iso-11 fichierIsoBase
iconv -c --from-code=ISO-8859-12 --to-code=UTF-8 -o fichierUTF8_iso-12 fichierIsoBase
iconv -c --from-code=ISO-8859-13 --to-code=UTF-8 -o fichierUTF8_iso-13 fichierIsoBase
iconv -c --from-code=ISO-8859-14 --to-code=UTF-8 -o fichierUTF8_iso-14 fichierIsoBase
iconv -c --from-code=ISO-8859-15 --to-code=UTF-8 -o fichierUTF8_iso-15 fichierIsoBase
// NOTE : Le format 12 n'existe pas ...
FILE * mfileout = NULL;
mfileout = fopen("outputGeneration.c", "wb");
if (NULL == mfileout) {
EDN_ERROR("Error to create file");
return false;
}
char * inputFileData[] = {
"fichierUTF8_iso-1",
"fichierUTF8_iso-2",
// "fichierUTF8_iso-3",
"fichierUTF8_iso-4",
"fichierUTF8_iso-5",
/* "fichierUTF8_iso-6",
"fichierUTF8_iso-7",
"fichierUTF8_iso-8",
"fichierUTF8_iso-9",
"fichierUTF8_iso-10",
"fichierUTF8_iso-11",
"fichierUTF8_iso-13",
"fichierUTF8_iso-14",
*/
"fichierUTF8_iso-15"
};
for (int32_t k=0; k<5; k++) {
FILE * mfile = NULL;
mfile = fopen(inputFileData[k], "rb");
if (NULL == mfile) {
EDN_ERROR("Error to open file");
return false;
}
char data[255] ;
fprintf(mfileout, "\tTYPESTRUCT_TS %s[] = {\n\t\t", inputFileData[k]);
for(int32_t i=0x0; i<0x10; i++) {
fprintf(mfileout, "0x%08X, ", i);
}
fprintf(mfileout, "\n\t\t");
for(int32_t i=0x10; i<0x20; i++) {
fprintf(mfileout, "0x%08X, ", i);
}
for(int32_t i=0x20; i<0x100; i++) {
if (0==i%16) {
fprintf(mfileout, "\n\t\t");
}
fgets(data, 25, mfile );
data[strlen(data)-1] = '\0';
EDN_INFO("sizeofLine=" << strlen(data) << " data=\"" << data << "\"");
// convert in int :
int32_t valUTF8 = 0;
int32_t valUnicode = 0;
switch (strlen(data)) {
case 1:
valUTF8 = (uint8_t) (data[0]);
valUnicode = (uint8_t)(data[0]) & 0x7F;
break;
case 2:
valUTF8 = (uint8_t) (data[0]) << 8;
valUTF8 += (uint8_t) (data[1]);
valUnicode = (((uint8_t)data[0]) & 0x1F)<< 6;
valUnicode += ((uint8_t)data[1]) & 0x3F;
break;
case 3:
valUTF8 = (uint8_t) (data[0]) << 16;
valUTF8 += (uint8_t) (data[1]) << 8;
valUTF8 += (uint8_t) (data[2]);
valUnicode = (((uint8_t)data[0]) & 0x0F)<< 12;
valUnicode += (((uint8_t)data[1]) & 0x3F)<< 6;
valUnicode += ((uint8_t)data[2]) & 0x3F;
break;
default:
valUTF8 = (uint8_t) (data[0]) <<24;
valUTF8 += (uint8_t) (data[1]) << 16;
valUTF8 += (uint8_t) (data[2]) << 8;
valUTF8 += (uint8_t) (data[3]);
valUnicode = (((uint8_t)data[0]) & 0x07)<< 18;
valUnicode += (((uint8_t)data[1]) & 0x3F)<< 12;
valUnicode += (((uint8_t)data[2]) & 0x3F)<< 6;
valUnicode += ((uint8_t)data[3]) & 0x3F;
break;
}
fprintf(mfileout, "0x%08X, ", valUnicode);
}
fprintf(mfileout, "\n\t};\n\n");
fclose(mfile);
}
fclose(mfileout);
#endif

View File

@ -1,75 +0,0 @@
/**
*******************************************************************************
* @file unicode.h
* @brief Editeur De N'ours : Abstraction Charset layer (header)
* @author Edouard DUPIN
* @date 18/01/2012
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __UNICODE_H__
#define __UNICODE_H__
#include <etk/Types.h>
#include <etk/Vector.h>
namespace unicode {
typedef enum {
EDN_CHARSET_UTF8,
EDN_CHARSET_ISO_8859_1,
EDN_CHARSET_ISO_8859_2,
EDN_CHARSET_ISO_8859_3,
EDN_CHARSET_ISO_8859_4,
EDN_CHARSET_ISO_8859_5,
EDN_CHARSET_ISO_8859_6,
EDN_CHARSET_ISO_8859_7,
EDN_CHARSET_ISO_8859_8,
EDN_CHARSET_ISO_8859_9,
EDN_CHARSET_ISO_8859_10,
EDN_CHARSET_ISO_8859_11,
EDN_CHARSET_ISO_8859_13,
EDN_CHARSET_ISO_8859_14,
EDN_CHARSET_ISO_8859_15,
} charset_te;
// transform ISO <==> Unicode
void convertIsoToUnicode(charset_te inputCharset, char input_ISO, uniChar_t & output_Unicode);
void convertUnicodeToIso(charset_te inputCharset, uniChar_t input_Unicode, char & output_ISO);
int32_t convertIsoToUnicode(charset_te inputCharset, etk::Vector<char>& input_ISO, etk::Vector<uniChar_t>& output_Unicode);
int32_t convertIsoToUnicode(charset_te inputCharset, etk::Vector<int8_t>& input_ISO, etk::Vector<uniChar_t>& output_Unicode);
int32_t convertUnicodeToIso(charset_te inputCharset, etk::Vector<uniChar_t>& input_Unicode, etk::Vector<char>& output_ISO);
int32_t convertUnicodeToIso(charset_te inputCharset, etk::Vector<uniChar_t>& input_Unicode, etk::Vector<int8_t>& output_ISO);
// Transform UTF-8 <==> Unicode
void convertUnicodeToUtf8( uniChar_t input_Unicode, char * output_UTF8);
void convertUtf8ToUnicode( char * input_UTF8, uniChar_t& output_Unicode);
int32_t convertUnicodeToUtf8( const etk::Vector<uniChar_t>& input_Unicode, etk::Vector<char>& output_UTF8);
int32_t convertUnicodeToUtf8( const etk::Vector<uniChar_t>& input_Unicode, etk::Vector<int8_t>& output_UTF8);
int32_t convertUtf8ToUnicode( etk::Vector<char>& input_UTF8, etk::Vector<uniChar_t>& output_Unicode);
int32_t convertUtf8ToUnicode( etk::Vector<int8_t>& input_UTF8, etk::Vector<uniChar_t>& output_Unicode);
int32_t convertUtf8ToUnicode( char * input_UTF8, etk::Vector<uniChar_t>& output_Unicode);
// Transform ISO <==> UTF-8
void convertIsoToUtf8( charset_te inputCharset, char input_ISO, char * output_UTF8);
void convertUtf8ToIso( charset_te inputCharset, char * input_UTF8, char & output_ISO);
int32_t convertIsoToUtf8( charset_te inputCharset, etk::Vector<char>& input_ISO, etk::Vector<char>& output_UTF8);
int32_t convertUtf8ToIso( charset_te inputCharset, etk::Vector<char>& input_UTF8, etk::Vector<char>& output_ISO);
void Utf8_SizeElement(const char * data, int32_t lenMax , uint8_t &size, bool &baseValid);
int32_t strUtf8Len(const char *input_UTF8);
}
#endif

View File

@ -1,299 +0,0 @@
/**
*******************************************************************************
* @file unicodeTable.cpp
* @brief Editeur De N'ours : Table of all charset convertions (Sources)
* @author Edouard DUPIN
* @date 18/01/2012
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <etk/Types.h>
#include <etk/Debug.h>
#include <etk/unicodeTable.h>
extern "C" {
const uniChar_t TableIso8859_1[] = {
0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x0000000E, 0x0000000F,
0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019, 0x0000001A, 0x0000001B, 0x0000001C, 0x0000001D, 0x0000001E, 0x0000001F,
0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x00000028, 0x00000029, 0x0000002A, 0x0000002B, 0x0000002C, 0x0000002D, 0x0000002E, 0x0000002F,
0x00000030, 0x00000031, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000036, 0x00000037, 0x00000038, 0x00000039, 0x0000003A, 0x0000003B, 0x0000003C, 0x0000003D, 0x0000003E, 0x0000003F,
0x00000040, 0x00000041, 0x00000042, 0x00000043, 0x00000044, 0x00000045, 0x00000046, 0x00000047, 0x00000048, 0x00000049, 0x0000004A, 0x0000004B, 0x0000004C, 0x0000004D, 0x0000004E, 0x0000004F,
0x00000050, 0x00000051, 0x00000052, 0x00000053, 0x00000054, 0x00000055, 0x00000056, 0x00000057, 0x00000058, 0x00000059, 0x0000005A, 0x0000005B, 0x0000005C, 0x0000005D, 0x0000005E, 0x0000005F,
0x00000060, 0x00000061, 0x00000062, 0x00000063, 0x00000064, 0x00000065, 0x00000066, 0x00000067, 0x00000068, 0x00000069, 0x0000006A, 0x0000006B, 0x0000006C, 0x0000006D, 0x0000006E, 0x0000006F,
0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, 0x00000075, 0x00000076, 0x00000077, 0x00000078, 0x00000079, 0x0000007A, 0x0000007B, 0x0000007C, 0x0000007D, 0x0000007E, 0x0000007F,
0x00000080, 0x00000081, 0x00000082, 0x00000083, 0x00000084, 0x00000085, 0x00000086, 0x00000087, 0x00000088, 0x00000089, 0x0000008A, 0x0000008B, 0x0000008C, 0x0000008D, 0x0000008E, 0x0000008F,
0x00000090, 0x00000091, 0x00000092, 0x00000093, 0x00000094, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, 0x0000009A, 0x0000009B, 0x0000009C, 0x0000009D, 0x0000009E, 0x0000009F,
0x000000A0, 0x000000A1, 0x000000A2, 0x000000A3, 0x000000A4, 0x000000A5, 0x000000A6, 0x000000A7, 0x000000A8, 0x000000A9, 0x000000AA, 0x000000AB, 0x000000AC, 0x000000AD, 0x000000AE, 0x000000AF,
0x000000B0, 0x000000B1, 0x000000B2, 0x000000B3, 0x000000B4, 0x000000B5, 0x000000B6, 0x000000B7, 0x000000B8, 0x000000B9, 0x000000BA, 0x000000BB, 0x000000BC, 0x000000BD, 0x000000BE, 0x000000BF,
0x000000C0, 0x000000C1, 0x000000C2, 0x000000C3, 0x000000C4, 0x000000C5, 0x000000C6, 0x000000C7, 0x000000C8, 0x000000C9, 0x000000CA, 0x000000CB, 0x000000CC, 0x000000CD, 0x000000CE, 0x000000CF,
0x000000D0, 0x000000D1, 0x000000D2, 0x000000D3, 0x000000D4, 0x000000D5, 0x000000D6, 0x000000D7, 0x000000D8, 0x000000D9, 0x000000DA, 0x000000DB, 0x000000DC, 0x000000DD, 0x000000DE, 0x000000DF,
0x000000E0, 0x000000E1, 0x000000E2, 0x000000E3, 0x000000E4, 0x000000E5, 0x000000E6, 0x000000E7, 0x000000E8, 0x000000E9, 0x000000EA, 0x000000EB, 0x000000EC, 0x000000ED, 0x000000EE, 0x000000EF,
0x000000F0, 0x000000F1, 0x000000F2, 0x000000F3, 0x000000F4, 0x000000F5, 0x000000F6, 0x000000F7, 0x000000F8, 0x000000F9, 0x000000FA, 0x000000FB, 0x000000FC, 0x000000FD, 0x000000FE, 0x000000FF
};
const uniChar_t TableIso8859_2[] = {
0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x0000000E, 0x0000000F,
0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019, 0x0000001A, 0x0000001B, 0x0000001C, 0x0000001D, 0x0000001E, 0x0000001F,
0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x00000028, 0x00000029, 0x0000002A, 0x0000002B, 0x0000002C, 0x0000002D, 0x0000002E, 0x0000002F,
0x00000030, 0x00000031, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000036, 0x00000037, 0x00000038, 0x00000039, 0x0000003A, 0x0000003B, 0x0000003C, 0x0000003D, 0x0000003E, 0x0000003F,
0x00000040, 0x00000041, 0x00000042, 0x00000043, 0x00000044, 0x00000045, 0x00000046, 0x00000047, 0x00000048, 0x00000049, 0x0000004A, 0x0000004B, 0x0000004C, 0x0000004D, 0x0000004E, 0x0000004F,
0x00000050, 0x00000051, 0x00000052, 0x00000053, 0x00000054, 0x00000055, 0x00000056, 0x00000057, 0x00000058, 0x00000059, 0x0000005A, 0x0000005B, 0x0000005C, 0x0000005D, 0x0000005E, 0x0000005F,
0x00000060, 0x00000061, 0x00000062, 0x00000063, 0x00000064, 0x00000065, 0x00000066, 0x00000067, 0x00000068, 0x00000069, 0x0000006A, 0x0000006B, 0x0000006C, 0x0000006D, 0x0000006E, 0x0000006F,
0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, 0x00000075, 0x00000076, 0x00000077, 0x00000078, 0x00000079, 0x0000007A, 0x0000007B, 0x0000007C, 0x0000007D, 0x0000007E, 0x0000007F,
0x00000080, 0x00000081, 0x00000082, 0x00000083, 0x00000084, 0x00000085, 0x00000086, 0x00000087, 0x00000088, 0x00000089, 0x0000008A, 0x0000008B, 0x0000008C, 0x0000008D, 0x0000008E, 0x0000008F,
0x00000090, 0x00000091, 0x00000092, 0x00000093, 0x00000094, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, 0x0000009A, 0x0000009B, 0x0000009C, 0x0000009D, 0x0000009E, 0x0000009F,
0x000000A0, 0x00000104, 0x000002D8, 0x00000141, 0x000000A4, 0x0000013D, 0x0000015A, 0x000000A7, 0x000000A8, 0x00000160, 0x0000015E, 0x00000164, 0x00000179, 0x000000AD, 0x0000017D, 0x0000017B,
0x000000B0, 0x00000105, 0x000002DB, 0x00000142, 0x000000B4, 0x0000013E, 0x0000015B, 0x000002C7, 0x000000B8, 0x00000161, 0x0000015F, 0x00000165, 0x0000017A, 0x000002DD, 0x0000017E, 0x0000017C,
0x00000154, 0x000000C1, 0x000000C2, 0x00000102, 0x000000C4, 0x00000139, 0x00000106, 0x000000C7, 0x0000010C, 0x000000C9, 0x00000118, 0x000000CB, 0x0000011A, 0x000000CD, 0x000000CE, 0x0000010E,
0x00000110, 0x00000143, 0x00000147, 0x000000D3, 0x000000D4, 0x00000150, 0x000000D6, 0x000000D7, 0x00000158, 0x0000016E, 0x000000DA, 0x00000170, 0x000000DC, 0x000000DD, 0x00000162, 0x000000DF,
0x00000155, 0x000000E1, 0x000000E2, 0x00000103, 0x000000E4, 0x0000013A, 0x00000107, 0x000000E7, 0x0000010D, 0x000000E9, 0x00000119, 0x000000EB, 0x0000011B, 0x000000ED, 0x000000EE, 0x0000010F,
0x00000111, 0x00000144, 0x00000148, 0x000000F3, 0x000000F4, 0x00000151, 0x000000F6, 0x000000F7, 0x00000159, 0x0000016F, 0x000000FA, 0x00000171, 0x000000FC, 0x000000FD, 0x00000163, 0x000002D9
};
const uniChar_t TableIso8859_3[] = {
0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x0000000E, 0x0000000F,
0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019, 0x0000001A, 0x0000001B, 0x0000001C, 0x0000001D, 0x0000001E, 0x0000001F,
0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x00000028, 0x00000029, 0x0000002A, 0x0000002B, 0x0000002C, 0x0000002D, 0x0000002E, 0x0000002F,
0x00000030, 0x00000031, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000036, 0x00000037, 0x00000038, 0x00000039, 0x0000003A, 0x0000003B, 0x0000003C, 0x0000003D, 0x0000003E, 0x0000003F,
0x00000040, 0x00000041, 0x00000042, 0x00000043, 0x00000044, 0x00000045, 0x00000046, 0x00000047, 0x00000048, 0x00000049, 0x0000004A, 0x0000004B, 0x0000004C, 0x0000004D, 0x0000004E, 0x0000004F,
0x00000050, 0x00000051, 0x00000052, 0x00000053, 0x00000054, 0x00000055, 0x00000056, 0x00000057, 0x00000058, 0x00000059, 0x0000005A, 0x0000005B, 0x0000005C, 0x0000005D, 0x0000005E, 0x0000005F,
0x00000060, 0x00000061, 0x00000062, 0x00000063, 0x00000064, 0x00000065, 0x00000066, 0x00000067, 0x00000068, 0x00000069, 0x0000006A, 0x0000006B, 0x0000006C, 0x0000006D, 0x0000006E, 0x0000006F,
0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, 0x00000075, 0x00000076, 0x00000077, 0x00000078, 0x00000079, 0x0000007A, 0x0000007B, 0x0000007C, 0x0000007D, 0x0000007E, 0x0000007F,
0x00000080, 0x00000081, 0x00000082, 0x00000083, 0x00000084, 0x00000085, 0x00000086, 0x00000087, 0x00000088, 0x00000089, 0x0000008A, 0x0000008B, 0x0000008C, 0x0000008D, 0x0000008E, 0x0000008F,
0x00000090, 0x00000091, 0x00000092, 0x00000093, 0x00000094, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, 0x0000009A, 0x0000009B, 0x0000009C, 0x0000009D, 0x0000009E, 0x0000009F,
0x000000A0, 0x00000126, 0x000002D8, 0x000000A3, 0x000000A4, 0x00000000, 0x00000124, 0x000000A7, 0x000000A8, 0x00000130, 0x0000015E, 0x0000011E, 0x00000134, 0x000000AD, 0x00000000, 0x0000017B,
0x000000B0, 0x00000127, 0x000000B2, 0x000000B3, 0x000000B4, 0x000000B5, 0x00000125, 0x000000B7, 0x000000B8, 0x00000131, 0x0000015F, 0x0000011F, 0x00000135, 0x000000BD, 0x00000000, 0x0000017C,
0x000000C0, 0x000000C1, 0x000000C2, 0x00000000, 0x000000C4, 0x0000010A, 0x00000108, 0x000000C7, 0x000000C8, 0x000000C9, 0x000000CA, 0x000000CB, 0x000000CC, 0x000000CD, 0x000000CE, 0x000000CF,
0x00000000, 0x000000D1, 0x000000D2, 0x000000D3, 0x000000D4, 0x00000120, 0x000000D6, 0x000000D7, 0x0000011C, 0x000000D9, 0x000000DA, 0x000000DB, 0x000000DC, 0x0000016C, 0x0000015C, 0x000000DF,
0x000000E0, 0x000000E1, 0x000000E2, 0x00000000, 0x000000E4, 0x0000010B, 0x00000109, 0x000000E7, 0x000000E8, 0x000000E9, 0x000000EA, 0x000000EB, 0x000000EC, 0x000000ED, 0x000000EE, 0x000000EF,
0x00000000, 0x000000F1, 0x000000F2, 0x000000F3, 0x000000F4, 0x00000121, 0x000000F6, 0x000000F7, 0x0000011D, 0x000000F9, 0x000000FA, 0x000000FB, 0x000000FC, 0x0000016D, 0x0000015D, 0x000002D9
};
const uniChar_t TableIso8859_4[] = {
0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x0000000E, 0x0000000F,
0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019, 0x0000001A, 0x0000001B, 0x0000001C, 0x0000001D, 0x0000001E, 0x0000001F,
0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x00000028, 0x00000029, 0x0000002A, 0x0000002B, 0x0000002C, 0x0000002D, 0x0000002E, 0x0000002F,
0x00000030, 0x00000031, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000036, 0x00000037, 0x00000038, 0x00000039, 0x0000003A, 0x0000003B, 0x0000003C, 0x0000003D, 0x0000003E, 0x0000003F,
0x00000040, 0x00000041, 0x00000042, 0x00000043, 0x00000044, 0x00000045, 0x00000046, 0x00000047, 0x00000048, 0x00000049, 0x0000004A, 0x0000004B, 0x0000004C, 0x0000004D, 0x0000004E, 0x0000004F,
0x00000050, 0x00000051, 0x00000052, 0x00000053, 0x00000054, 0x00000055, 0x00000056, 0x00000057, 0x00000058, 0x00000059, 0x0000005A, 0x0000005B, 0x0000005C, 0x0000005D, 0x0000005E, 0x0000005F,
0x00000060, 0x00000061, 0x00000062, 0x00000063, 0x00000064, 0x00000065, 0x00000066, 0x00000067, 0x00000068, 0x00000069, 0x0000006A, 0x0000006B, 0x0000006C, 0x0000006D, 0x0000006E, 0x0000006F,
0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, 0x00000075, 0x00000076, 0x00000077, 0x00000078, 0x00000079, 0x0000007A, 0x0000007B, 0x0000007C, 0x0000007D, 0x0000007E, 0x0000007F,
0x00000080, 0x00000081, 0x00000082, 0x00000083, 0x00000084, 0x00000085, 0x00000086, 0x00000087, 0x00000088, 0x00000089, 0x0000008A, 0x0000008B, 0x0000008C, 0x0000008D, 0x0000008E, 0x0000008F,
0x00000090, 0x00000091, 0x00000092, 0x00000093, 0x00000094, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, 0x0000009A, 0x0000009B, 0x0000009C, 0x0000009D, 0x0000009E, 0x0000009F,
0x000000A0, 0x00000104, 0x00000138, 0x00000156, 0x000000A4, 0x00000128, 0x0000013B, 0x000000A7, 0x000000A8, 0x00000160, 0x00000112, 0x00000122, 0x00000166, 0x000000AD, 0x0000017D, 0x000000AF,
0x000000B0, 0x00000105, 0x000002DB, 0x00000157, 0x000000B4, 0x00000129, 0x0000013C, 0x000002C7, 0x000000B8, 0x00000161, 0x00000113, 0x00000123, 0x00000167, 0x0000014A, 0x0000017E, 0x0000014B,
0x00000100, 0x000000C1, 0x000000C2, 0x000000C3, 0x000000C4, 0x000000C5, 0x000000C6, 0x0000012E, 0x0000010C, 0x000000C9, 0x00000118, 0x000000CB, 0x00000116, 0x000000CD, 0x000000CE, 0x0000012A,
0x00000110, 0x00000145, 0x0000014C, 0x00000136, 0x000000D4, 0x000000D5, 0x000000D6, 0x000000D7, 0x000000D8, 0x00000172, 0x000000DA, 0x000000DB, 0x000000DC, 0x00000168, 0x0000016A, 0x000000DF,
0x00000101, 0x000000E1, 0x000000E2, 0x000000E3, 0x000000E4, 0x000000E5, 0x000000E6, 0x0000012F, 0x0000010D, 0x000000E9, 0x00000119, 0x000000EB, 0x00000117, 0x000000ED, 0x000000EE, 0x0000012B,
0x00000111, 0x00000146, 0x0000014D, 0x00000137, 0x000000F4, 0x000000F5, 0x000000F6, 0x000000F7, 0x000000F8, 0x00000173, 0x000000FA, 0x000000FB, 0x000000FC, 0x00000169, 0x0000016B, 0x000002D9
};
const uniChar_t TableIso8859_5[] = {
0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x0000000E, 0x0000000F,
0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019, 0x0000001A, 0x0000001B, 0x0000001C, 0x0000001D, 0x0000001E, 0x0000001F,
0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x00000028, 0x00000029, 0x0000002A, 0x0000002B, 0x0000002C, 0x0000002D, 0x0000002E, 0x0000002F,
0x00000030, 0x00000031, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000036, 0x00000037, 0x00000038, 0x00000039, 0x0000003A, 0x0000003B, 0x0000003C, 0x0000003D, 0x0000003E, 0x0000003F,
0x00000040, 0x00000041, 0x00000042, 0x00000043, 0x00000044, 0x00000045, 0x00000046, 0x00000047, 0x00000048, 0x00000049, 0x0000004A, 0x0000004B, 0x0000004C, 0x0000004D, 0x0000004E, 0x0000004F,
0x00000050, 0x00000051, 0x00000052, 0x00000053, 0x00000054, 0x00000055, 0x00000056, 0x00000057, 0x00000058, 0x00000059, 0x0000005A, 0x0000005B, 0x0000005C, 0x0000005D, 0x0000005E, 0x0000005F,
0x00000060, 0x00000061, 0x00000062, 0x00000063, 0x00000064, 0x00000065, 0x00000066, 0x00000067, 0x00000068, 0x00000069, 0x0000006A, 0x0000006B, 0x0000006C, 0x0000006D, 0x0000006E, 0x0000006F,
0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, 0x00000075, 0x00000076, 0x00000077, 0x00000078, 0x00000079, 0x0000007A, 0x0000007B, 0x0000007C, 0x0000007D, 0x0000007E, 0x0000007F,
0x00000080, 0x00000081, 0x00000082, 0x00000083, 0x00000084, 0x00000085, 0x00000086, 0x00000087, 0x00000088, 0x00000089, 0x0000008A, 0x0000008B, 0x0000008C, 0x0000008D, 0x0000008E, 0x0000008F,
0x00000090, 0x00000091, 0x00000092, 0x00000093, 0x00000094, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, 0x0000009A, 0x0000009B, 0x0000009C, 0x0000009D, 0x0000009E, 0x0000009F,
0x000000A0, 0x00000401, 0x00000402, 0x00000403, 0x00000404, 0x00000405, 0x00000406, 0x00000407, 0x00000408, 0x00000409, 0x0000040A, 0x0000040B, 0x0000040C, 0x000000AD, 0x0000040E, 0x0000040F,
0x00000410, 0x00000411, 0x00000412, 0x00000413, 0x00000414, 0x00000415, 0x00000416, 0x00000417, 0x00000418, 0x00000419, 0x0000041A, 0x0000041B, 0x0000041C, 0x0000041D, 0x0000041E, 0x0000041F,
0x00000420, 0x00000421, 0x00000422, 0x00000423, 0x00000424, 0x00000425, 0x00000426, 0x00000427, 0x00000428, 0x00000429, 0x0000042A, 0x0000042B, 0x0000042C, 0x0000042D, 0x0000042E, 0x0000042F,
0x00000430, 0x00000431, 0x00000432, 0x00000433, 0x00000434, 0x00000435, 0x00000436, 0x00000437, 0x00000438, 0x00000439, 0x0000043A, 0x0000043B, 0x0000043C, 0x0000043D, 0x0000043E, 0x0000043F,
0x00000440, 0x00000441, 0x00000442, 0x00000443, 0x00000444, 0x00000445, 0x00000446, 0x00000447, 0x00000448, 0x00000449, 0x0000044A, 0x0000044B, 0x0000044C, 0x0000044D, 0x0000044E, 0x0000044F,
0x00002116, 0x00000451, 0x00000452, 0x00000453, 0x00000454, 0x00000455, 0x00000456, 0x00000457, 0x00000458, 0x00000459, 0x0000045A, 0x0000045B, 0x0000045C, 0x000000A7, 0x0000045E, 0x0000045F
};
const uniChar_t TableIso8859_6[] = {
0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x0000000E, 0x0000000F,
0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019, 0x0000001A, 0x0000001B, 0x0000001C, 0x0000001D, 0x0000001E, 0x0000001F,
0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x00000028, 0x00000029, 0x0000002A, 0x0000002B, 0x0000002C, 0x0000002D, 0x0000002E, 0x0000002F,
0x00000030, 0x00000031, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000036, 0x00000037, 0x00000038, 0x00000039, 0x0000003A, 0x0000003B, 0x0000003C, 0x0000003D, 0x0000003E, 0x0000003F,
0x00000040, 0x00000041, 0x00000042, 0x00000043, 0x00000044, 0x00000045, 0x00000046, 0x00000047, 0x00000048, 0x00000049, 0x0000004A, 0x0000004B, 0x0000004C, 0x0000004D, 0x0000004E, 0x0000004F,
0x00000050, 0x00000051, 0x00000052, 0x00000053, 0x00000054, 0x00000055, 0x00000056, 0x00000057, 0x00000058, 0x00000059, 0x0000005A, 0x0000005B, 0x0000005C, 0x0000005D, 0x0000005E, 0x0000005F,
0x00000060, 0x00000061, 0x00000062, 0x00000063, 0x00000064, 0x00000065, 0x00000066, 0x00000067, 0x00000068, 0x00000069, 0x0000006A, 0x0000006B, 0x0000006C, 0x0000006D, 0x0000006E, 0x0000006F,
0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, 0x00000075, 0x00000076, 0x00000077, 0x00000078, 0x00000079, 0x0000007A, 0x0000007B, 0x0000007C, 0x0000007D, 0x0000007E, 0x0000007F,
0x00000080, 0x00000081, 0x00000082, 0x00000083, 0x00000084, 0x00000085, 0x00000086, 0x00000087, 0x00000088, 0x00000089, 0x0000008A, 0x0000008B, 0x0000008C, 0x0000008D, 0x0000008E, 0x0000008F,
0x00000090, 0x00000091, 0x00000092, 0x00000093, 0x00000094, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, 0x0000009A, 0x0000009B, 0x0000009C, 0x0000009D, 0x0000009E, 0x0000009F,
0x000000A0, 0x00000000, 0x00000000, 0x00000000, 0x000000A4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000060C, 0x000000AD, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000061B, 0x00000000, 0x00000000, 0x00000000, 0x0000061F,
0x00000000, 0x00000621, 0x00000622, 0x00000623, 0x00000624, 0x00000625, 0x00000626, 0x00000627, 0x00000628, 0x00000629, 0x0000062A, 0x0000062B, 0x0000062C, 0x0000062D, 0x0000062E, 0x0000062F,
0x00000630, 0x00000631, 0x00000632, 0x00000633, 0x00000634, 0x00000635, 0x00000636, 0x00000637, 0x00000638, 0x00000639, 0x0000063A, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000640, 0x00000641, 0x00000642, 0x00000643, 0x00000644, 0x00000645, 0x00000646, 0x00000647, 0x00000648, 0x00000649, 0x0000064A, 0x0000064B, 0x0000064C, 0x0000064D, 0x0000064E, 0x0000064F,
0x00000650, 0x00000651, 0x00000652, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000
};
const uniChar_t TableIso8859_7[] = {
0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x0000000E, 0x0000000F,
0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019, 0x0000001A, 0x0000001B, 0x0000001C, 0x0000001D, 0x0000001E, 0x0000001F,
0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x00000028, 0x00000029, 0x0000002A, 0x0000002B, 0x0000002C, 0x0000002D, 0x0000002E, 0x0000002F,
0x00000030, 0x00000031, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000036, 0x00000037, 0x00000038, 0x00000039, 0x0000003A, 0x0000003B, 0x0000003C, 0x0000003D, 0x0000003E, 0x0000003F,
0x00000040, 0x00000041, 0x00000042, 0x00000043, 0x00000044, 0x00000045, 0x00000046, 0x00000047, 0x00000048, 0x00000049, 0x0000004A, 0x0000004B, 0x0000004C, 0x0000004D, 0x0000004E, 0x0000004F,
0x00000050, 0x00000051, 0x00000052, 0x00000053, 0x00000054, 0x00000055, 0x00000056, 0x00000057, 0x00000058, 0x00000059, 0x0000005A, 0x0000005B, 0x0000005C, 0x0000005D, 0x0000005E, 0x0000005F,
0x00000060, 0x00000061, 0x00000062, 0x00000063, 0x00000064, 0x00000065, 0x00000066, 0x00000067, 0x00000068, 0x00000069, 0x0000006A, 0x0000006B, 0x0000006C, 0x0000006D, 0x0000006E, 0x0000006F,
0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, 0x00000075, 0x00000076, 0x00000077, 0x00000078, 0x00000079, 0x0000007A, 0x0000007B, 0x0000007C, 0x0000007D, 0x0000007E, 0x0000007F,
0x00000080, 0x00000081, 0x00000082, 0x00000083, 0x00000084, 0x00000085, 0x00000086, 0x00000087, 0x00000088, 0x00000089, 0x0000008A, 0x0000008B, 0x0000008C, 0x0000008D, 0x0000008E, 0x0000008F,
0x00000090, 0x00000091, 0x00000092, 0x00000093, 0x00000094, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, 0x0000009A, 0x0000009B, 0x0000009C, 0x0000009D, 0x0000009E, 0x0000009F,
0x000000A0, 0x00002018, 0x00002019, 0x000000A3, 0x000020AC, 0x000020AF, 0x000000A6, 0x000000A7, 0x000000A8, 0x000000A9, 0x0000037A, 0x000000AB, 0x000000AC, 0x000000AD, 0x00000000, 0x00002015,
0x000000B0, 0x000000B1, 0x000000B2, 0x000000B3, 0x00000384, 0x00000385, 0x00000386, 0x000000B7, 0x00000388, 0x00000389, 0x0000038A, 0x000000BB, 0x0000038C, 0x000000BD, 0x0000038E, 0x0000038F,
0x00000390, 0x00000391, 0x00000392, 0x00000393, 0x00000394, 0x00000395, 0x00000396, 0x00000397, 0x00000398, 0x00000399, 0x0000039A, 0x0000039B, 0x0000039C, 0x0000039D, 0x0000039E, 0x0000039F,
0x000003A0, 0x000003A1, 0x00000000, 0x000003A3, 0x000003A4, 0x000003A5, 0x000003A6, 0x000003A7, 0x000003A8, 0x000003A9, 0x000003AA, 0x000003AB, 0x000003AC, 0x000003AD, 0x000003AE, 0x000003AF,
0x000003B0, 0x000003B1, 0x000003B2, 0x000003B3, 0x000003B4, 0x000003B5, 0x000003B6, 0x000003B7, 0x000003B8, 0x000003B9, 0x000003BA, 0x000003BB, 0x000003BC, 0x000003BD, 0x000003BE, 0x000003BF,
0x000003C0, 0x000003C1, 0x000003C2, 0x000003C3, 0x000003C4, 0x000003C5, 0x000003C6, 0x000003C7, 0x000003C8, 0x000003C9, 0x000003CA, 0x000003CB, 0x000003CC, 0x000003CD, 0x000003CE, 0x00000000
};
const uniChar_t TableIso8859_8[] = {
0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x0000000E, 0x0000000F,
0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019, 0x0000001A, 0x0000001B, 0x0000001C, 0x0000001D, 0x0000001E, 0x0000001F,
0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x00000028, 0x00000029, 0x0000002A, 0x0000002B, 0x0000002C, 0x0000002D, 0x0000002E, 0x0000002F,
0x00000030, 0x00000031, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000036, 0x00000037, 0x00000038, 0x00000039, 0x0000003A, 0x0000003B, 0x0000003C, 0x0000003D, 0x0000003E, 0x0000003F,
0x00000040, 0x00000041, 0x00000042, 0x00000043, 0x00000044, 0x00000045, 0x00000046, 0x00000047, 0x00000048, 0x00000049, 0x0000004A, 0x0000004B, 0x0000004C, 0x0000004D, 0x0000004E, 0x0000004F,
0x00000050, 0x00000051, 0x00000052, 0x00000053, 0x00000054, 0x00000055, 0x00000056, 0x00000057, 0x00000058, 0x00000059, 0x0000005A, 0x0000005B, 0x0000005C, 0x0000005D, 0x0000005E, 0x0000005F,
0x00000060, 0x00000061, 0x00000062, 0x00000063, 0x00000064, 0x00000065, 0x00000066, 0x00000067, 0x00000068, 0x00000069, 0x0000006A, 0x0000006B, 0x0000006C, 0x0000006D, 0x0000006E, 0x0000006F,
0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, 0x00000075, 0x00000076, 0x00000077, 0x00000078, 0x00000079, 0x0000007A, 0x0000007B, 0x0000007C, 0x0000007D, 0x0000007E, 0x0000007F,
0x00000080, 0x00000081, 0x00000082, 0x00000083, 0x00000084, 0x00000085, 0x00000086, 0x00000087, 0x00000088, 0x00000089, 0x0000008A, 0x0000008B, 0x0000008C, 0x0000008D, 0x0000008E, 0x0000008F,
0x00000090, 0x00000091, 0x00000092, 0x00000093, 0x00000094, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, 0x0000009A, 0x0000009B, 0x0000009C, 0x0000009D, 0x0000009E, 0x0000009F,
0x000000A0, 0x00000000, 0x000000A2, 0x000000A3, 0x000000A4, 0x000000A5, 0x000000A6, 0x000000A7, 0x000000A8, 0x000000A9, 0x000000D7, 0x000000AB, 0x000000AC, 0x000000AD, 0x000000AE, 0x000000AF,
0x000000B0, 0x000000B1, 0x000000B2, 0x000000B3, 0x000000B4, 0x000000B5, 0x000000B6, 0x000000B7, 0x000000B8, 0x000000B9, 0x000000F7, 0x000000BB, 0x000000BC, 0x000000BD, 0x000000BE, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00002017,
0x000005D0, 0x000005D1, 0x000005D2, 0x000005D3, 0x000005D4, 0x000005D5, 0x000005D6, 0x000005D7, 0x000005D8, 0x000005D9, 0x000005DA, 0x000005DB, 0x000005DC, 0x000005DD, 0x000005DE, 0x000005DF,
0x000005E0, 0x000005E1, 0x000005E2, 0x000005E3, 0x000005E4, 0x000005E5, 0x000005E6, 0x000005E7, 0x000005E8, 0x000005E9, 0x000005EA, 0x00000000, 0x00000000, 0x0000200E, 0x0000200F, 0x000003C0
};
const uniChar_t TableIso8859_9[] = {
0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x0000000E, 0x0000000F,
0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019, 0x0000001A, 0x0000001B, 0x0000001C, 0x0000001D, 0x0000001E, 0x0000001F,
0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x00000028, 0x00000029, 0x0000002A, 0x0000002B, 0x0000002C, 0x0000002D, 0x0000002E, 0x0000002F,
0x00000030, 0x00000031, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000036, 0x00000037, 0x00000038, 0x00000039, 0x0000003A, 0x0000003B, 0x0000003C, 0x0000003D, 0x0000003E, 0x0000003F,
0x00000040, 0x00000041, 0x00000042, 0x00000043, 0x00000044, 0x00000045, 0x00000046, 0x00000047, 0x00000048, 0x00000049, 0x0000004A, 0x0000004B, 0x0000004C, 0x0000004D, 0x0000004E, 0x0000004F,
0x00000050, 0x00000051, 0x00000052, 0x00000053, 0x00000054, 0x00000055, 0x00000056, 0x00000057, 0x00000058, 0x00000059, 0x0000005A, 0x0000005B, 0x0000005C, 0x0000005D, 0x0000005E, 0x0000005F,
0x00000060, 0x00000061, 0x00000062, 0x00000063, 0x00000064, 0x00000065, 0x00000066, 0x00000067, 0x00000068, 0x00000069, 0x0000006A, 0x0000006B, 0x0000006C, 0x0000006D, 0x0000006E, 0x0000006F,
0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, 0x00000075, 0x00000076, 0x00000077, 0x00000078, 0x00000079, 0x0000007A, 0x0000007B, 0x0000007C, 0x0000007D, 0x0000007E, 0x0000007F,
0x00000080, 0x00000081, 0x00000082, 0x00000083, 0x00000084, 0x00000085, 0x00000086, 0x00000087, 0x00000088, 0x00000089, 0x0000008A, 0x0000008B, 0x0000008C, 0x0000008D, 0x0000008E, 0x0000008F,
0x00000090, 0x00000091, 0x00000092, 0x00000093, 0x00000094, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, 0x0000009A, 0x0000009B, 0x0000009C, 0x0000009D, 0x0000009E, 0x0000009F,
0x000000A0, 0x000000A1, 0x000000A2, 0x000000A3, 0x000000A4, 0x000000A5, 0x000000A6, 0x000000A7, 0x000000A8, 0x000000A9, 0x000000AA, 0x000000AB, 0x000000AC, 0x000000AD, 0x000000AE, 0x000000AF,
0x000000B0, 0x000000B1, 0x000000B2, 0x000000B3, 0x000000B4, 0x000000B5, 0x000000B6, 0x000000B7, 0x000000B8, 0x000000B9, 0x000000BA, 0x000000BB, 0x000000BC, 0x000000BD, 0x000000BE, 0x000000BF,
0x000000C0, 0x000000C1, 0x000000C2, 0x000000C3, 0x000000C4, 0x000000C5, 0x000000C6, 0x000000C7, 0x000000C8, 0x000000C9, 0x000000CA, 0x000000CB, 0x000000CC, 0x000000CD, 0x000000CE, 0x000000CF,
0x0000011E, 0x000000D1, 0x000000D2, 0x000000D3, 0x000000D4, 0x000000D5, 0x000000D6, 0x000000D7, 0x000000D8, 0x000000D9, 0x000000DA, 0x000000DB, 0x000000DC, 0x00000130, 0x0000015E, 0x000000DF,
0x000000E0, 0x000000E1, 0x000000E2, 0x000000E3, 0x000000E4, 0x000000E5, 0x000000E6, 0x000000E7, 0x000000E8, 0x000000E9, 0x000000EA, 0x000000EB, 0x000000EC, 0x000000ED, 0x000000EE, 0x000000EF,
0x0000011F, 0x000000F1, 0x000000F2, 0x000000F3, 0x000000F4, 0x000000F5, 0x000000F6, 0x000000F7, 0x000000F8, 0x000000F9, 0x000000FA, 0x000000FB, 0x000000FC, 0x00000131, 0x0000015F, 0x000000FF
};
const uniChar_t TableIso8859_10[] = {
0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x0000000E, 0x0000000F,
0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019, 0x0000001A, 0x0000001B, 0x0000001C, 0x0000001D, 0x0000001E, 0x0000001F,
0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x00000028, 0x00000029, 0x0000002A, 0x0000002B, 0x0000002C, 0x0000002D, 0x0000002E, 0x0000002F,
0x00000030, 0x00000031, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000036, 0x00000037, 0x00000038, 0x00000039, 0x0000003A, 0x0000003B, 0x0000003C, 0x0000003D, 0x0000003E, 0x0000003F,
0x00000040, 0x00000041, 0x00000042, 0x00000043, 0x00000044, 0x00000045, 0x00000046, 0x00000047, 0x00000048, 0x00000049, 0x0000004A, 0x0000004B, 0x0000004C, 0x0000004D, 0x0000004E, 0x0000004F,
0x00000050, 0x00000051, 0x00000052, 0x00000053, 0x00000054, 0x00000055, 0x00000056, 0x00000057, 0x00000058, 0x00000059, 0x0000005A, 0x0000005B, 0x0000005C, 0x0000005D, 0x0000005E, 0x0000005F,
0x00000060, 0x00000061, 0x00000062, 0x00000063, 0x00000064, 0x00000065, 0x00000066, 0x00000067, 0x00000068, 0x00000069, 0x0000006A, 0x0000006B, 0x0000006C, 0x0000006D, 0x0000006E, 0x0000006F,
0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, 0x00000075, 0x00000076, 0x00000077, 0x00000078, 0x00000079, 0x0000007A, 0x0000007B, 0x0000007C, 0x0000007D, 0x0000007E, 0x0000007F,
0x00000080, 0x00000081, 0x00000082, 0x00000083, 0x00000084, 0x00000085, 0x00000086, 0x00000087, 0x00000088, 0x00000089, 0x0000008A, 0x0000008B, 0x0000008C, 0x0000008D, 0x0000008E, 0x0000008F,
0x00000090, 0x00000091, 0x00000092, 0x00000093, 0x00000094, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, 0x0000009A, 0x0000009B, 0x0000009C, 0x0000009D, 0x0000009E, 0x0000009F,
0x000000A0, 0x00000104, 0x00000112, 0x00000122, 0x0000012A, 0x00000128, 0x00000136, 0x000000A7, 0x0000013B, 0x00000110, 0x00000160, 0x00000166, 0x0000017D, 0x000000AD, 0x0000016A, 0x0000014A,
0x000000B0, 0x00000105, 0x00000113, 0x00000123, 0x0000012B, 0x00000129, 0x00000137, 0x000000B7, 0x0000013C, 0x00000111, 0x00000161, 0x00000167, 0x0000017E, 0x00002015, 0x0000016B, 0x0000014B,
0x00000100, 0x000000C1, 0x000000C2, 0x000000C3, 0x000000C4, 0x000000C5, 0x000000C6, 0x0000012E, 0x0000010C, 0x000000C9, 0x00000118, 0x000000CB, 0x00000116, 0x000000CD, 0x000000CE, 0x000000CF,
0x000000D0, 0x00000145, 0x0000014C, 0x000000D3, 0x000000D4, 0x000000D5, 0x000000D6, 0x00000168, 0x000000D8, 0x00000172, 0x000000DA, 0x000000DB, 0x000000DC, 0x000000DD, 0x000000DE, 0x000000DF,
0x00000101, 0x000000E1, 0x000000E2, 0x000000E3, 0x000000E4, 0x000000E5, 0x000000E6, 0x0000012F, 0x0000010D, 0x000000E9, 0x00000119, 0x000000EB, 0x00000117, 0x000000ED, 0x000000EE, 0x000000EF,
0x000000F0, 0x00000146, 0x0000014D, 0x000000F3, 0x000000F4, 0x000000F5, 0x000000F6, 0x00000169, 0x000000F8, 0x00000173, 0x000000FA, 0x000000FB, 0x000000FC, 0x000000FD, 0x000000FE, 0x00000138
};
const uniChar_t TableIso8859_11[] = {
0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x0000000E, 0x0000000F,
0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019, 0x0000001A, 0x0000001B, 0x0000001C, 0x0000001D, 0x0000001E, 0x0000001F,
0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x00000028, 0x00000029, 0x0000002A, 0x0000002B, 0x0000002C, 0x0000002D, 0x0000002E, 0x0000002F,
0x00000030, 0x00000031, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000036, 0x00000037, 0x00000038, 0x00000039, 0x0000003A, 0x0000003B, 0x0000003C, 0x0000003D, 0x0000003E, 0x0000003F,
0x00000040, 0x00000041, 0x00000042, 0x00000043, 0x00000044, 0x00000045, 0x00000046, 0x00000047, 0x00000048, 0x00000049, 0x0000004A, 0x0000004B, 0x0000004C, 0x0000004D, 0x0000004E, 0x0000004F,
0x00000050, 0x00000051, 0x00000052, 0x00000053, 0x00000054, 0x00000055, 0x00000056, 0x00000057, 0x00000058, 0x00000059, 0x0000005A, 0x0000005B, 0x0000005C, 0x0000005D, 0x0000005E, 0x0000005F,
0x00000060, 0x00000061, 0x00000062, 0x00000063, 0x00000064, 0x00000065, 0x00000066, 0x00000067, 0x00000068, 0x00000069, 0x0000006A, 0x0000006B, 0x0000006C, 0x0000006D, 0x0000006E, 0x0000006F,
0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, 0x00000075, 0x00000076, 0x00000077, 0x00000078, 0x00000079, 0x0000007A, 0x0000007B, 0x0000007C, 0x0000007D, 0x0000007E, 0x0000007F,
0x00000080, 0x00000081, 0x00000082, 0x00000083, 0x00000084, 0x00000085, 0x00000086, 0x00000087, 0x00000088, 0x00000089, 0x0000008A, 0x0000008B, 0x0000008C, 0x0000008D, 0x0000008E, 0x0000008F,
0x00000090, 0x00000091, 0x00000092, 0x00000093, 0x00000094, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, 0x0000009A, 0x0000009B, 0x0000009C, 0x0000009D, 0x0000009E, 0x0000009F,
0x000000A0, 0x00000E01, 0x00000E02, 0x00000E03, 0x00000E04, 0x00000E05, 0x00000E06, 0x00000E07, 0x00000E08, 0x00000E09, 0x00000E0A, 0x00000E0B, 0x00000E0C, 0x00000E0D, 0x00000E0E, 0x00000E0F,
0x00000E10, 0x00000E11, 0x00000E12, 0x00000E13, 0x00000E14, 0x00000E15, 0x00000E16, 0x00000E17, 0x00000E18, 0x00000E19, 0x00000E1A, 0x00000E1B, 0x00000E1C, 0x00000E1D, 0x00000E1E, 0x00000E1F,
0x00000E20, 0x00000E21, 0x00000E22, 0x00000E23, 0x00000E24, 0x00000E25, 0x00000E26, 0x00000E27, 0x00000E28, 0x00000E29, 0x00000E2A, 0x00000E2B, 0x00000E2C, 0x00000E2D, 0x00000E2E, 0x00000E2F,
0x00000E30, 0x00000E31, 0x00000E32, 0x00000E33, 0x00000E34, 0x00000E35, 0x00000E36, 0x00000E37, 0x00000E38, 0x00000E39, 0x00000E3A, 0x00000E80, 0x00000E80, 0x00000E80, 0x00000E80, 0x00000E3F,
0x00000E40, 0x00000E41, 0x00000E42, 0x00000E43, 0x00000E44, 0x00000E45, 0x00000E46, 0x00000E47, 0x00000E48, 0x00000E49, 0x00000E4A, 0x00000E4B, 0x00000E4C, 0x00000E4D, 0x00000E4E, 0x00000E4F,
0x00000E50, 0x00000E51, 0x00000E52, 0x00000E53, 0x00000E54, 0x00000E55, 0x00000E56, 0x00000E57, 0x00000E58, 0x00000E59, 0x00000E5A, 0x00000E5B, 0x000006C0, 0x000006C0, 0x000006C0, 0x000006C0
};
const uniChar_t TableIso8859_13[] = {
0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x0000000E, 0x0000000F,
0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019, 0x0000001A, 0x0000001B, 0x0000001C, 0x0000001D, 0x0000001E, 0x0000001F,
0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x00000028, 0x00000029, 0x0000002A, 0x0000002B, 0x0000002C, 0x0000002D, 0x0000002E, 0x0000002F,
0x00000030, 0x00000031, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000036, 0x00000037, 0x00000038, 0x00000039, 0x0000003A, 0x0000003B, 0x0000003C, 0x0000003D, 0x0000003E, 0x0000003F,
0x00000040, 0x00000041, 0x00000042, 0x00000043, 0x00000044, 0x00000045, 0x00000046, 0x00000047, 0x00000048, 0x00000049, 0x0000004A, 0x0000004B, 0x0000004C, 0x0000004D, 0x0000004E, 0x0000004F,
0x00000050, 0x00000051, 0x00000052, 0x00000053, 0x00000054, 0x00000055, 0x00000056, 0x00000057, 0x00000058, 0x00000059, 0x0000005A, 0x0000005B, 0x0000005C, 0x0000005D, 0x0000005E, 0x0000005F,
0x00000060, 0x00000061, 0x00000062, 0x00000063, 0x00000064, 0x00000065, 0x00000066, 0x00000067, 0x00000068, 0x00000069, 0x0000006A, 0x0000006B, 0x0000006C, 0x0000006D, 0x0000006E, 0x0000006F,
0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, 0x00000075, 0x00000076, 0x00000077, 0x00000078, 0x00000079, 0x0000007A, 0x0000007B, 0x0000007C, 0x0000007D, 0x0000007E, 0x0000007F,
0x00000080, 0x00000081, 0x00000082, 0x00000083, 0x00000084, 0x00000085, 0x00000086, 0x00000087, 0x00000088, 0x00000089, 0x0000008A, 0x0000008B, 0x0000008C, 0x0000008D, 0x0000008E, 0x0000008F,
0x00000090, 0x00000091, 0x00000092, 0x00000093, 0x00000094, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, 0x0000009A, 0x0000009B, 0x0000009C, 0x0000009D, 0x0000009E, 0x0000009F,
0x000000A0, 0x0000201D, 0x000000A2, 0x000000A3, 0x000000A4, 0x0000201E, 0x000000A6, 0x000000A7, 0x000000D8, 0x000000A9, 0x00000156, 0x000000AB, 0x000000AC, 0x000000AD, 0x000000AE, 0x000000C6,
0x000000B0, 0x000000B1, 0x000000B2, 0x000000B3, 0x0000201C, 0x000000B5, 0x000000B6, 0x000000B7, 0x000000F8, 0x000000B9, 0x00000157, 0x000000BB, 0x000000BC, 0x000000BD, 0x000000BE, 0x000000E6,
0x00000104, 0x0000012E, 0x00000100, 0x00000106, 0x000000C4, 0x000000C5, 0x00000118, 0x00000112, 0x0000010C, 0x000000C9, 0x00000179, 0x00000116, 0x00000122, 0x00000136, 0x0000012A, 0x0000013B,
0x00000160, 0x00000143, 0x00000145, 0x000000D3, 0x0000014C, 0x000000D5, 0x000000D6, 0x000000D7, 0x00000172, 0x00000141, 0x0000015A, 0x0000016A, 0x000000DC, 0x0000017B, 0x0000017D, 0x000000DF,
0x00000105, 0x0000012F, 0x00000101, 0x00000107, 0x000000E4, 0x000000E5, 0x00000119, 0x00000113, 0x0000010D, 0x000000E9, 0x0000017A, 0x00000117, 0x00000123, 0x00000137, 0x0000012B, 0x0000013C,
0x00000161, 0x00000144, 0x00000146, 0x000000F3, 0x0000014D, 0x000000F5, 0x000000F6, 0x000000F7, 0x00000173, 0x00000142, 0x0000015B, 0x0000016B, 0x000000FC, 0x0000017C, 0x0000017E, 0x00002019
};
const uniChar_t TableIso8859_14[] = {
0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x0000000E, 0x0000000F,
0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019, 0x0000001A, 0x0000001B, 0x0000001C, 0x0000001D, 0x0000001E, 0x0000001F,
0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x00000028, 0x00000029, 0x0000002A, 0x0000002B, 0x0000002C, 0x0000002D, 0x0000002E, 0x0000002F,
0x00000030, 0x00000031, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000036, 0x00000037, 0x00000038, 0x00000039, 0x0000003A, 0x0000003B, 0x0000003C, 0x0000003D, 0x0000003E, 0x0000003F,
0x00000040, 0x00000041, 0x00000042, 0x00000043, 0x00000044, 0x00000045, 0x00000046, 0x00000047, 0x00000048, 0x00000049, 0x0000004A, 0x0000004B, 0x0000004C, 0x0000004D, 0x0000004E, 0x0000004F,
0x00000050, 0x00000051, 0x00000052, 0x00000053, 0x00000054, 0x00000055, 0x00000056, 0x00000057, 0x00000058, 0x00000059, 0x0000005A, 0x0000005B, 0x0000005C, 0x0000005D, 0x0000005E, 0x0000005F,
0x00000060, 0x00000061, 0x00000062, 0x00000063, 0x00000064, 0x00000065, 0x00000066, 0x00000067, 0x00000068, 0x00000069, 0x0000006A, 0x0000006B, 0x0000006C, 0x0000006D, 0x0000006E, 0x0000006F,
0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, 0x00000075, 0x00000076, 0x00000077, 0x00000078, 0x00000079, 0x0000007A, 0x0000007B, 0x0000007C, 0x0000007D, 0x0000007E, 0x0000007F,
0x00000080, 0x00000081, 0x00000082, 0x00000083, 0x00000084, 0x00000085, 0x00000086, 0x00000087, 0x00000088, 0x00000089, 0x0000008A, 0x0000008B, 0x0000008C, 0x0000008D, 0x0000008E, 0x0000008F,
0x00000090, 0x00000091, 0x00000092, 0x00000093, 0x00000094, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, 0x0000009A, 0x0000009B, 0x0000009C, 0x0000009D, 0x0000009E, 0x0000009F,
0x000000A0, 0x00001E02, 0x00001E03, 0x000000A3, 0x0000010A, 0x0000010B, 0x00001E0A, 0x000000A7, 0x00001E80, 0x000000A9, 0x00001E82, 0x00001E0B, 0x00001EF2, 0x000000AD, 0x000000AE, 0x00000178,
0x00001E1E, 0x00001E1F, 0x00000120, 0x00000121, 0x00001E40, 0x00001E41, 0x000000B6, 0x00001E56, 0x00001E81, 0x00001E57, 0x00001E83, 0x00001E60, 0x00001EF3, 0x00001E84, 0x00001E85, 0x00001E61,
0x000000C0, 0x000000C1, 0x000000C2, 0x000000C3, 0x000000C4, 0x000000C5, 0x000000C6, 0x000000C7, 0x000000C8, 0x000000C9, 0x000000CA, 0x000000CB, 0x000000CC, 0x000000CD, 0x000000CE, 0x000000CF,
0x00000174, 0x000000D1, 0x000000D2, 0x000000D3, 0x000000D4, 0x000000D5, 0x000000D6, 0x00001E6A, 0x000000D8, 0x000000D9, 0x000000DA, 0x000000DB, 0x000000DC, 0x000000DD, 0x00000176, 0x000000DF,
0x000000E0, 0x000000E1, 0x000000E2, 0x000000E3, 0x000000E4, 0x000000E5, 0x000000E6, 0x000000E7, 0x000000E8, 0x000000E9, 0x000000EA, 0x000000EB, 0x000000EC, 0x000000ED, 0x000000EE, 0x000000EF,
0x00000175, 0x000000F1, 0x000000F2, 0x000000F3, 0x000000F4, 0x000000F5, 0x000000F6, 0x00001E6B, 0x000000F8, 0x000000F9, 0x000000FA, 0x000000FB, 0x000000FC, 0x000000FD, 0x00000177, 0x000000FF
};
const uniChar_t TableIso8859_15[] = {
0x00000000, 0x00000001, 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000006, 0x00000007, 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x0000000E, 0x0000000F,
0x00000010, 0x00000011, 0x00000012, 0x00000013, 0x00000014, 0x00000015, 0x00000016, 0x00000017, 0x00000018, 0x00000019, 0x0000001A, 0x0000001B, 0x0000001C, 0x0000001D, 0x0000001E, 0x0000001F,
0x00000020, 0x00000021, 0x00000022, 0x00000023, 0x00000024, 0x00000025, 0x00000026, 0x00000027, 0x00000028, 0x00000029, 0x0000002A, 0x0000002B, 0x0000002C, 0x0000002D, 0x0000002E, 0x0000002F,
0x00000030, 0x00000031, 0x00000032, 0x00000033, 0x00000034, 0x00000035, 0x00000036, 0x00000037, 0x00000038, 0x00000039, 0x0000003A, 0x0000003B, 0x0000003C, 0x0000003D, 0x0000003E, 0x0000003F,
0x00000040, 0x00000041, 0x00000042, 0x00000043, 0x00000044, 0x00000045, 0x00000046, 0x00000047, 0x00000048, 0x00000049, 0x0000004A, 0x0000004B, 0x0000004C, 0x0000004D, 0x0000004E, 0x0000004F,
0x00000050, 0x00000051, 0x00000052, 0x00000053, 0x00000054, 0x00000055, 0x00000056, 0x00000057, 0x00000058, 0x00000059, 0x0000005A, 0x0000005B, 0x0000005C, 0x0000005D, 0x0000005E, 0x0000005F,
0x00000060, 0x00000061, 0x00000062, 0x00000063, 0x00000064, 0x00000065, 0x00000066, 0x00000067, 0x00000068, 0x00000069, 0x0000006A, 0x0000006B, 0x0000006C, 0x0000006D, 0x0000006E, 0x0000006F,
0x00000070, 0x00000071, 0x00000072, 0x00000073, 0x00000074, 0x00000075, 0x00000076, 0x00000077, 0x00000078, 0x00000079, 0x0000007A, 0x0000007B, 0x0000007C, 0x0000007D, 0x0000007E, 0x0000007F,
0x00000080, 0x00000081, 0x00000082, 0x00000083, 0x00000084, 0x00000085, 0x00000086, 0x00000087, 0x00000088, 0x00000089, 0x0000008A, 0x0000008B, 0x0000008C, 0x0000008D, 0x0000008E, 0x0000008F,
0x00000090, 0x00000091, 0x00000092, 0x00000093, 0x00000094, 0x00000095, 0x00000096, 0x00000097, 0x00000098, 0x00000099, 0x0000009A, 0x0000009B, 0x0000009C, 0x0000009D, 0x0000009E, 0x0000009F,
0x000000A0, 0x000000A1, 0x000000A2, 0x000000A3, 0x000020AC, 0x000000A5, 0x00000160, 0x000000A7, 0x00000161, 0x000000A9, 0x000000AA, 0x000000AB, 0x000000AC, 0x000000AD, 0x000000AE, 0x000000AF,
0x000000B0, 0x000000B1, 0x000000B2, 0x000000B3, 0x0000017D, 0x000000B5, 0x000000B6, 0x000000B7, 0x0000017E, 0x000000B9, 0x000000BA, 0x000000BB, 0x00000152, 0x00000153, 0x00000178, 0x000000BF,
0x000000C0, 0x000000C1, 0x000000C2, 0x000000C3, 0x000000C4, 0x000000C5, 0x000000C6, 0x000000C7, 0x000000C8, 0x000000C9, 0x000000CA, 0x000000CB, 0x000000CC, 0x000000CD, 0x000000CE, 0x000000CF,
0x000000D0, 0x000000D1, 0x000000D2, 0x000000D3, 0x000000D4, 0x000000D5, 0x000000D6, 0x000000D7, 0x000000D8, 0x000000D9, 0x000000DA, 0x000000DB, 0x000000DC, 0x000000DD, 0x000000DE, 0x000000DF,
0x000000E0, 0x000000E1, 0x000000E2, 0x000000E3, 0x000000E4, 0x000000E5, 0x000000E6, 0x000000E7, 0x000000E8, 0x000000E9, 0x000000EA, 0x000000EB, 0x000000EC, 0x000000ED, 0x000000EE, 0x000000EF,
0x000000F0, 0x000000F1, 0x000000F2, 0x000000F3, 0x000000F4, 0x000000F5, 0x000000F6, 0x000000F7, 0x000000F8, 0x000000F9, 0x000000FA, 0x000000FB, 0x000000FC, 0x000000FD, 0x000000FE, 0x000000FF
};
}

View File

@ -1,50 +0,0 @@
/**
*******************************************************************************
* @file unicodeTable.h
* @brief ETK : Table of all charset convertions (Header)
* @author Edouard DUPIN
* @date 18/01/2012
* @par Project
* Ewol TK
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __UNICODE_TABLE_H__
#define __UNICODE_TABLE_H__
extern "C" {
extern const uniChar_t TableIso8859_1[];
extern const uniChar_t TableIso8859_2[];
extern const uniChar_t TableIso8859_3[];
extern const uniChar_t TableIso8859_4[];
extern const uniChar_t TableIso8859_5[];
extern const uniChar_t TableIso8859_6[];
extern const uniChar_t TableIso8859_7[];
extern const uniChar_t TableIso8859_8[];
extern const uniChar_t TableIso8859_9[];
extern const uniChar_t TableIso8859_10[];
extern const uniChar_t TableIso8859_11[];
extern const uniChar_t TableIso8859_13[];
extern const uniChar_t TableIso8859_14[];
extern const uniChar_t TableIso8859_15[];
;
}
#endif

View File

@ -1,16 +0,0 @@
FILE_LIST = \
etk/Debug.cpp \
etk/DebugInternal.cpp \
etk/Memory.cpp \
etk/unicode.cpp \
etk/unicodeTable.cpp \
etk/UString.cpp \
etk/Stream.cpp \
etk/File.cpp \
etk/RegExp.cpp \
etk/Color.cpp \
etk/tool.cpp

View File

@ -1,36 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# name of the librairy
LOCAL_MODULE := ewol
# get the tag of the current project :
LOCAL_VERSION_TAG=$(shell cd $(LOCAL_PATH) ; git describe --tags)
LOCAL_VERSION_TAG_SHORT=$(shell cd $(LOCAL_PATH) ; git describe --tags --abbrev=0)
$(info $(LOCAL_MODULE) version TAG : $(LOCAL_VERSION_TAG))
# name of the dependency
LOCAL_STATIC_LIBRARIES := etk freetype tinyxml libzip libpng agg parsersvg lua
LOCAL_C_INCLUDES :=
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
LOCAL_EXPORT_LDLIBS := -lGLESv1_CM -ldl -llog -lz
LOCAL_CFLAGS := -Wno-write-strings \
-DEWOL_VERSION_TAG_NAME="\"$(LOCAL_VERSION_TAG_SHORT)-$(BUILD_DIRECTORY_MODE)\"" \
-DDATA_IN_APK \
-DLUA_COMPAT_ALL
# load the common sources file of the platform
include $(LOCAL_PATH)/file.mk
LOCAL_SRC_FILES := ewol/base/guiAndroid.cpp $(FILE_LIST)
# Ewol Test Software :
LOCAL_LDLIBS := -lGLESv1_CM -ldl -llog -lz
include $(BUILD_STATIC_LIBRARY)

View File

@ -1,38 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# name of the librairy
LOCAL_MODULE := ewol
# get the tag of the current project :
LOCAL_VERSION_TAG=$(shell cd $(LOCAL_PATH) ; git describe --tags)
LOCAL_VERSION_TAG_SHORT=$(shell cd $(LOCAL_PATH) ; git describe --tags --abbrev=0)
$(info $(LOCAL_MODULE) version TAG : $(LOCAL_VERSION_TAG))
# name of the dependency
LOCAL_STATIC_LIBRARIES := etk freetype tinyxml libzip libpng agg parsersvg lua portaudio
LOCAL_C_INCLUDES :=
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
LOCAL_EXPORT_LDLIBS := -lGL -lGLU -lz -lX11
LOCAL_CFLAGS := -Wno-write-strings \
-DEWOL_VERSION_TAG_NAME="\"$(LOCAL_VERSION_TAG_SHORT)-$(BUILD_DIRECTORY_MODE)\"" \
-DLUA_COMPAT_ALL \
-Wall
# load the common sources file of the platform
include $(LOCAL_PATH)/file.mk
LOCAL_SRC_FILES := \
ewol/base/guiX11.cpp \
ewol/Audio/interfacePortAudio.cpp \
$(FILE_LIST)
# Ewol Test Software :
LOCAL_LDLIBS := -lGL -lGLU -lz -lX11
include $(BUILD_STATIC_LIBRARY)

View File

@ -1,438 +0,0 @@
/**
*******************************************************************************
* @file ewol/Audio/audio.c
* @brief basic ewol Audio interface (Sources)
* @author Edouard DUPIN
* @date 02/05/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <etk/Types.h>
#include <ewol/Audio/audio.h>
#include <ewol/Audio/decWav.h>
#include <ewol/Debug.h>
#include <math.h>
static int64_t currentTimePlaying = 0;
static bool musicMute = false;
static float musicVolume = 0;
static int32_t musicVolumeApply = 1<<16;
static int32_t musicFadingTime = 0;
static bool effectsMute = false;
static float effectsVolume = 0;
static int32_t effectsVolumeApply = 1<<16;
static bool isInit = false;
#ifdef __TARGET_OS__Linux
# include <ewol/Audio/interfacePortAudio.h>
#endif
void ewol::audio::Init(void)
{
if (isInit == true) {
EWOL_ERROR("multiple init requested ... at the audio system ...");
}
ewol::audio::effects::VolumeSet(0);
ewol::audio::effects::MuteSet(false);
ewol::audio::music::VolumeSet(0);
ewol::audio::music::MuteSet(false);
musicFadingTime = 100;
isInit = true;
#ifdef __TARGET_OS__Linux
ewol::portAudio::Init();
#endif
}
void ewol::audio::UnInit(void)
{
if (false == isInit) {
EWOL_ERROR("multiple un-init requested ... at the audio system ...");
return;
}
#ifdef __TARGET_OS__Linux
ewol::portAudio::UnInit();
#endif
musicMute = true;
musicVolume = -5000;
effectsMute = true;
effectsVolume = -5000;
musicFadingTime = 0;
}
static ewol::audio::AudioCallback userLocalCallback = NULL;
void ewol::audio::GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels)
{
// TODO : set the real playing time ...
currentTimePlaying += 10;
if (nbChannels != 2) {
EWOL_ERROR("TODO : Support the signal mono or more tha stereo ...");
return;
}
// reset the current buffer
memset(bufferInterlace, 0, nbSample*sizeof(int16_t)*nbChannels);
// get user data ...
if (NULL != userLocalCallback) {
(*userLocalCallback)(bufferInterlace, nbSample, nbChannels);
}
// get background music :
ewol::audio::music::GetData(bufferInterlace, nbSample, nbChannels);
// add effects :
ewol::audio::effects::GetData(bufferInterlace, nbSample, nbChannels);
static FILE * plop = fopen("/home/edupin/testFile48khzstereo.raw", "w");
if (plop!=NULL) {
fwrite(bufferInterlace, sizeof(int16_t), nbSample*nbChannels, plop);
}
}
void ewol::audio::AddCallbackOutput(ewol::audio::AudioCallback userCallback)
{
userLocalCallback = userCallback;
}
void ewol::audio::music::Fading(int32_t timeMs)
{
musicFadingTime = timeMs;
musicFadingTime = etk_avg(-100, musicFadingTime, 20);
EWOL_INFO("Set music fading time at " << timeMs << "ms ==> " << musicFadingTime << "ms");
}
erreurCode_te ewol::audio::music::ListAdd(etk::UString file)
{
return ERR_FAIL;
}
erreurCode_te ewol::audio::music::ListRm(etk::UString file)
{
return ERR_FAIL;
}
erreurCode_te ewol::audio::music::ListClean(void)
{
return ERR_FAIL;
}
erreurCode_te ewol::audio::music::ListPrevious(void)
{
return ERR_FAIL;
}
erreurCode_te ewol::audio::music::ListNext(void)
{
return ERR_FAIL;
}
erreurCode_te ewol::audio::music::ListFirst(void)
{
return ERR_FAIL;
}
erreurCode_te ewol::audio::music::ListLast(void)
{
return ERR_FAIL;
}
erreurCode_te ewol::audio::music::ListPlay(void)
{
return ERR_FAIL;
}
erreurCode_te ewol::audio::music::ListStop(void)
{
return ERR_FAIL;
}
erreurCode_te ewol::audio::music::Play(etk::UString file)
{
return ERR_FAIL;
}
erreurCode_te ewol::audio::music::Stop(void)
{
return ERR_FAIL;
}
float ewol::audio::music::VolumeGet(void)
{
return musicVolume;
}
static void uptateMusicVolume(void)
{
if (musicMute==true) {
musicVolumeApply = 0;
} else {
// Convert in an fixpoint value
// V2 = V1*10^(db/20)
double coef = pow(10, (musicVolume/20) );
musicVolumeApply = (int32_t)(coef * (double)(1<<16));
}
}
void ewol::audio::music::VolumeSet(float newVolume)
{
musicVolume = newVolume;
musicVolume = etk_avg(-1000, musicVolume, 40);
EWOL_INFO("Set music Volume at " << newVolume << "dB ==> " << musicVolume << "dB");
uptateMusicVolume();
}
bool ewol::audio::music::MuteGet(void)
{
return musicMute;
}
void ewol::audio::music::MuteSet(bool newMute)
{
musicMute = newMute;
EWOL_INFO("Set music Mute at " << newMute);
uptateMusicVolume();
}
void ewol::audio::music::GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels)
{
/*static int32_t maxValue = 0;
static float angle = 0;
maxValue +=10;
if (maxValue > 16000) {
maxValue = 0;
}
for (int iii = 0; iii<nbSample ; iii++) {
bufferInterlace[iii*2] = (float)maxValue * sin(angle/180.0 * M_PI);
bufferInterlace[iii*2+1] = bufferInterlace[iii*2];
angle+=0.9;
if (angle>=360) {
angle -= 360.0;
}
}*/
}
//----------------------------------------------------------------------------------------------------------
// Effects ...
//----------------------------------------------------------------------------------------------------------
//liste d'effet
class EffectsLoaded {
public :
EffectsLoaded(etk::UString file)
{
m_file = file;
m_requestedTime = 1;
m_data = ewol::audio::wav::LoadData(file, 1, 48000, m_nbSamples);
if (m_data == NULL) {
// write an error ...
}
}
etk::UString m_file;
int32_t m_nbSamples;
int32_t m_requestedTime;
int16_t* m_data;
};
class RequestPlay {
private:
bool m_freeSlot;
EffectsLoaded * m_effect; // reference to the effects
int32_t m_playTime; // position in sample playing in the audio effects
public :
RequestPlay(EffectsLoaded * effect) : m_freeSlot(false), m_effect(effect), m_playTime(0) { };
void Reset(EffectsLoaded * effect) { m_effect=effect; m_playTime=0; m_freeSlot=false; };
bool IsFree(void) { return m_freeSlot; };
void Play(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels)
{
if (true==m_freeSlot) {
return;
}
if (m_effect->m_data == NULL) {
m_freeSlot = true;
return;
}
int32_t processTimeMax = etk_min(nbSample, m_effect->m_nbSamples - m_playTime);
processTimeMax = etk_max(0, processTimeMax);
int16_t * pointer = bufferInterlace;
int16_t * newData = &m_effect->m_data[m_playTime];
//EWOL_DEBUG("AUDIO : Play slot... nb sample : " << processTimeMax << " playTime=" <<m_playTime << " nbCannels=" << nbChannels);
for (int32_t iii=0; iii<processTimeMax; iii++) {
// TODO : Set volume and spacialisation ...
for (int32_t jjj=0; jjj<nbChannels; jjj++) {
int32_t tmppp = *pointer + ((((int32_t)*newData)*effectsVolumeApply)>>16);
*pointer = etk_avg(-32767, tmppp, 32766);
//EWOL_DEBUG("AUDIO : element : " << *pointer);
pointer++;
}
newData++;
}
m_playTime += processTimeMax;
// check end of playing ...
if (m_effect->m_nbSamples<=m_playTime) {
m_freeSlot=true;
}
}
};
#include <etk/Vector.h>
etk::Vector<EffectsLoaded*> ListEffects;
etk::Vector<RequestPlay*> ListEffectsPlaying;
int32_t ewol::audio::effects::Add(etk::UString file)
{
for (int32_t iii=0; iii<ListEffects.Size(); iii++) {
if (NULL != ListEffects[iii]) {
if (ListEffects[iii]->m_file == file) {
ListEffects[iii]->m_requestedTime++;
return iii;
}
}
}
// effect does not exist ... create a new one ...
EffectsLoaded * tmpEffect = new EffectsLoaded(file);
if (NULL == tmpEffect) {
EWOL_ERROR("Error to load the effects : \"" << file << "\"");
return -1;
}
ListEffects.PushBack(tmpEffect);
return ListEffects.Size()-1;
}
void ewol::audio::effects::Rm(int32_t effectId)
{
// find element ...
if (effectId <0 || effectId >= ListEffects.Size()) {
EWOL_ERROR("Wrong effect ID : " << effectId << " != [0.." << ListEffects.Size()-1 << "] ==> can not remove it ...");
return;
}
if (ListEffects[effectId] == NULL) {
EWOL_ERROR("effect ID : " << effectId << " ==> has already been removed");
return;
}
// check number of requested
if (ListEffects[effectId]->m_requestedTime <=0) {
EWOL_ERROR("effect ID : " << effectId << " ==> request more than predicted a removed of an effects");
return;
}
ListEffects[effectId]->m_requestedTime--;
// mark to be removed ... TODO : Really removed it when no other element readed it ...
// TODO : ...
}
void ewol::audio::effects::Play(int32_t effectId, float xxx, float yyy)
{
if (effectId <0 || effectId >= ListEffects.Size()) {
EWOL_ERROR("Wrong effect ID : " << effectId << " != [0.." << ListEffects.Size()-1 << "] ==> can not play it ...");
return;
}
if (ListEffects[effectId] == NULL) {
EWOL_ERROR("effect ID : " << effectId << " ==> has been removed");
return;
}
EWOL_VERBOSE("effect play : " << effectId );
// try to find an empty slot :
for (int32_t iii=0; iii<ListEffectsPlaying.Size(); iii++) {
if (ListEffectsPlaying[iii]->IsFree()) {
ListEffectsPlaying[iii]->Reset(ListEffects[effectId]);
return;
}
}
RequestPlay* newPlay = new RequestPlay(ListEffects[effectId]);
if (NULL == newPlay) {
EWOL_CRITICAL("Allocation error of a playing element : " << effectId);
return;
}
ListEffectsPlaying.PushBack(newPlay);
}
float ewol::audio::effects::VolumeGet(void)
{
return effectsVolume;
}
static void uptateEffectVolume(void)
{
if (effectsMute==true) {
effectsVolumeApply = 0;
} else {
// Convert in an fixpoint value
// V2 = V1*10^(db/20)
double coef = pow(10, (effectsVolume/20) );
effectsVolumeApply = (int32_t)(coef * (double)(1<<16));
}
}
void ewol::audio::effects::VolumeSet(float newVolume)
{
effectsVolume = newVolume;
effectsVolume = etk_avg(-100, effectsVolume, 20);
EWOL_INFO("Set music Volume at " << newVolume << "dB ==> " << effectsVolume << "dB");
uptateEffectVolume();
}
bool ewol::audio::effects::MuteGet(void)
{
return effectsMute;
}
void ewol::audio::effects::MuteSet(bool newMute)
{
effectsMute = newMute;
EWOL_INFO("Set effects Mute at " << newMute);
}
void ewol::audio::effects::GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels)
{
for (int32_t iii=0; iii<ListEffectsPlaying.Size(); iii++) {
if (ListEffectsPlaying[iii]!= NULL) {
ListEffectsPlaying[iii]->Play(bufferInterlace, nbSample, nbChannels);
}
}
}

View File

@ -1,84 +0,0 @@
/**
*******************************************************************************
* @file ewol/Audio/audio.h
* @brief basic ewol Audio interface (header)
* @author Edouard DUPIN
* @date 02/05/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_AUDIO_H__
#define __EWOL_AUDIO_H__
#include <etk/Types.h>
#include <etk/UString.h>
namespace ewol {
namespace audio {
void Init(void);
void UnInit(void);
typedef void (*AudioCallback)(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels);
void AddCallbackOutput(AudioCallback userCallback);
void GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels);
namespace music {
void Fading(int32_t timeMs);
// list playing system : is cyclic ...
erreurCode_te ListAdd(etk::UString file);
erreurCode_te ListRm(etk::UString file);
erreurCode_te ListClean(void);
erreurCode_te ListPrevious(void);
erreurCode_te ListNext(void);
erreurCode_te ListFirst(void);
erreurCode_te ListLast(void);
erreurCode_te ListPlay(void); // List playing
erreurCode_te ListStop(void); // List stopping
erreurCode_te Play(etk::UString file); // play specific file ... pause the list element;
erreurCode_te Stop(void);
// in db
float VolumeGet(void);
void VolumeSet(float newVolume);
bool MuteGet(void);
void MuteSet(bool newMute);
void GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels);
};
// note effect is loaded in memory (then don't create long effect) and unload only when requested
namespace effects {
// note : support file (Mono, 16bit, 48kHz) : .raw or .wav (no encodage) or .ogg (decoded with tremor lib)
int32_t Add(etk::UString file);
void Rm(int32_t effectId);
void Play(int32_t effectId, float xxx, float yyy);
// in db
float VolumeGet(void);
void VolumeSet(float newVolume);
bool MuteGet(void);
void MuteSet(bool newMute);
void GetData(int16_t * bufferInterlace, int32_t nbSample, int32_t nbChannels);
};
};
};
#endif

View File

@ -1,311 +0,0 @@
/**
*******************************************************************************
* @file ewol/Audio/decWav.cpp
* @brief basic ewol Wav decoder (sources)
* @author Edouard DUPIN
* @date 28/06/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <etk/Types.h>
#include <etk/UString.h>
#include <etk/File.h>
#include <ewol/Audio/decWav.h>
#include <ewol/Debug.h>
typedef struct {
char riffTag[4]; //!< 00-03
uint32_t size; //!< 04-07
char waveTag[4]; //!< 08-0b
char fmtTag[4]; //!< 0c-0f
uint32_t waveFormatSize; //!< 10-13
struct {
uint16_t type; //!< 00-01
uint16_t channelCount; //!< 02-03
uint32_t samplesPerSec; //!< 04-07
uint32_t bytesPerSec; //!< 08-0b
uint16_t bytesPerFrame; //!< 0c-0d
uint16_t bitsPerSample; //!< 0e-0f
}waveFormat; //!< 14-23
char dataTag[4]; //!< 24-27
uint32_t dataSize; //!< 28-2b
}waveHeader;
#define CONVERT_UINT32(littleEndien,data) (littleEndien)?(((uint32_t)((uint8_t*)data)[0] | (uint32_t)((uint8_t*)data)[1] << 8 | (uint32_t)((uint8_t*)data)[2] << 16 | (uint32_t)((uint8_t*)data)[3] << 24)): \
(((uint32_t)((uint8_t*)data)[3] | (uint32_t)((uint8_t*)data)[2] << 8 | (uint32_t)((uint8_t*)data)[1] << 16 | (uint32_t)((uint8_t*)data)[0] << 24))
#define CONVERT_INT32(littleEndien,data) (littleEndien)?(((int32_t)((uint8_t*)data)[0] | (int32_t)((uint8_t*)data)[1] << 8 | (int32_t)((uint8_t*)data)[2] << 16 | (int32_t)((int8_t*)data)[3] << 24)): \
(((int32_t)((uint8_t*)data)[3] | (int32_t)((uint8_t*)data)[2] << 8 | (int32_t)((uint8_t*)data)[1] << 16 | (int32_t)((int8_t*)data)[0] << 24))
#define CONVERT_UINT24(littleEndien,data) (littleEndien)?(((uint32_t)((uint8_t*)data)[0]<<8 | (uint32_t)((uint8_t*)data)[1] << 16 | (uint32_t)((uint8_t*)data)[2] << 24)): \
(((uint32_t)((uint8_t*)data)[2]<<8 | (uint32_t)((uint8_t*)data)[1] << 16 | (uint32_t)((uint8_t*)data)[0] << 24))
#define CONVERT_INT24(littleEndien,data) (littleEndien)?(((int32_t)((uint8_t*)data)[0]<<8 | (int32_t)((uint8_t*)data)[1] << 16 | (int32_t)((int8_t*)data)[2] << 24)): \
(((int32_t)((uint8_t*)data)[2]<<8 | (int32_t)((uint8_t*)data)[1] << 16 | (int32_t)((int8_t*)data)[0] << 24))
#define CONVERT_UINT16(littleEndien,data) (littleEndien)?(((uint16_t)((uint8_t*)data)[0] | (uint16_t)((uint8_t*)data)[1] << 8)): \
(((uint16_t)((uint8_t*)data)[1] | (uint16_t)((uint8_t*)data)[0] << 8))
#define CONVERT_INT16(littleEndien,data) (littleEndien)?(((int16_t)((uint8_t*)data)[0] | (int16_t)((int8_t*)data)[1] << 8)): \
(((int16_t)((uint8_t*)data)[1] | (int16_t)((int8_t*)data)[0] << 8))
#define COMPR_PCM (1)
#define COMPR_MADPCM (2)
#define COMPR_ALAW (6)
#define COMPR_MULAW (7)
#define COMPR_ADPCM (17)
#define COMPR_YADPCM (20)
#define COMPR_GSM (49)
#define COMPR_G721 (64)
#define COMPR_MPEG (80)
int16_t * ewol::audio::wav::LoadData(etk::UString filename, int8_t nbChan, int32_t frequency, int32_t & nbSampleOut)
{
nbSampleOut = 0;
waveHeader myHeader;
memset(&myHeader, 0, sizeof(waveHeader));
etk::File fileAccess(filename, etk::FILE_TYPE_DATA);
// Start loading the XML :
EWOL_DEBUG("open file (WAV) \"" << fileAccess << "\"");
if (false == fileAccess.Exist()) {
EWOL_ERROR("File Does not exist : \"" << fileAccess << "\"");
return NULL;
}
int32_t fileSize = fileAccess.Size();
if (0==fileSize) {
EWOL_ERROR("This file is empty : \"" << fileAccess << "\"");
return NULL;
}
if (false == fileAccess.fOpenRead()) {
EWOL_ERROR("Can not open the file : \"" << fileAccess << "\"");
return NULL;
}
// try to find endienness :
if (fileSize < sizeof(waveHeader)) {
EWOL_ERROR("File : \"" << fileAccess << "\" ==> has not enouth data inside might be minumum of " << (int32_t)(sizeof(waveHeader)));
return NULL;
}
// ----------------------------------------------
// read the header :
// ----------------------------------------------
if (fileAccess.fRead(&myHeader.riffTag, 1, 4)!=4) {
EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL;
}
bool littleEndien = false;
if( myHeader.riffTag[0] == 'R'
&& myHeader.riffTag[1] == 'I'
&& myHeader.riffTag[2] == 'F'
&& (myHeader.riffTag[3] == 'F' || myHeader.riffTag[3] == 'X') ) {
if (myHeader.riffTag[3] == 'F' ) {
littleEndien = true;
}
} else {
EWOL_ERROR("file: \"" << fileAccess << "\" Does not start with \"RIF\" " );
return NULL;
}
// get the data size :
unsigned char tmpData[32];
if (fileAccess.fRead(tmpData, 1, 4)!=4) {
EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL;
}
myHeader.size = CONVERT_UINT32(littleEndien, tmpData);
// get the data size :
if (fileAccess.fRead(&myHeader.waveTag, 1, 4)!=4) {
EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL;
}
if( myHeader.waveTag[0] != 'W'
|| myHeader.waveTag[1] != 'A'
|| myHeader.waveTag[2] != 'V'
|| myHeader.waveTag[3] != 'E' ) {
EWOL_ERROR("file: \"" << fileAccess << "\" This is not a wave file " << myHeader.waveTag[0] << myHeader.waveTag[1] << myHeader.waveTag[2] << myHeader.waveTag[3] );
return NULL;
}
// get the data size :
if (fileAccess.fRead(&myHeader.fmtTag, 1, 4)!=4) {
EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL;
}
if( myHeader.fmtTag[0] != 'f'
|| myHeader.fmtTag[1] != 'm'
|| myHeader.fmtTag[2] != 't'
|| myHeader.fmtTag[3] != ' ' ) {
EWOL_ERROR("file: \"" << fileAccess << "\" header error ..." << myHeader.fmtTag[0] << myHeader.fmtTag[1] << myHeader.fmtTag[2] << myHeader.fmtTag[3]);
return NULL;
}
// get the data size :
if (fileAccess.fRead(tmpData, 1, 4)!=4) {
EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL;
}
myHeader.waveFormatSize = CONVERT_UINT32(littleEndien, tmpData);
if (myHeader.waveFormatSize != 16) {
EWOL_ERROR("file : \"" << fileAccess << "\" ==> header error ...");
return NULL;
}
if (fileAccess.fRead(tmpData, 1, 16)!=16) {
EWOL_ERROR("Can not 16 element in the file : \"" << fileAccess << "\"");
return NULL;
}
unsigned char * tmppp = tmpData;
myHeader.waveFormat.type = CONVERT_UINT16(littleEndien, tmppp);
tmppp += 2;
myHeader.waveFormat.channelCount = CONVERT_UINT16(littleEndien, tmppp);
tmppp += 2;
myHeader.waveFormat.samplesPerSec = CONVERT_UINT32(littleEndien, tmppp);
tmppp += 4;
myHeader.waveFormat.bytesPerSec = CONVERT_UINT32(littleEndien, tmppp);
tmppp += 4;
myHeader.waveFormat.bytesPerFrame = CONVERT_UINT16(littleEndien, tmppp);
tmppp += 2;
myHeader.waveFormat.bitsPerSample = CONVERT_UINT16(littleEndien, tmppp);
EWOL_DEBUG("audio properties : ");
EWOL_DEBUG(" type : " << myHeader.waveFormat.type);
EWOL_DEBUG(" channelCount : " << myHeader.waveFormat.channelCount);
EWOL_DEBUG(" samplesPerSec : " << myHeader.waveFormat.samplesPerSec);
EWOL_DEBUG(" bytesPerSec : " << myHeader.waveFormat.bytesPerSec);
EWOL_DEBUG(" bytesPerFrame : " << myHeader.waveFormat.bytesPerFrame);
EWOL_DEBUG(" bitsPerSample : " << myHeader.waveFormat.bitsPerSample);
// get the data size :
if (fileAccess.fRead(&myHeader.dataTag, 1, 4)!=4) {
EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL;
}
if( myHeader.dataTag[0] != 'd'
|| myHeader.dataTag[1] != 'a'
|| myHeader.dataTag[2] != 't'
|| myHeader.dataTag[3] != 'a' ) {
EWOL_ERROR("file: \"" << fileAccess << "\" header error ..." << myHeader.dataTag[0] << myHeader.dataTag[1] << myHeader.dataTag[2] << myHeader.dataTag[3]);
return NULL;
}
// get the data size :
if (fileAccess.fRead(tmpData, 1, 4)!=4) {
EWOL_ERROR("Can not 4 element in the file : \"" << fileAccess << "\"");
return NULL;
}
myHeader.dataSize = CONVERT_UINT32(littleEndien, tmpData);
// ----------------------------------------------
// end of the header reading done ...
// ----------------------------------------------
//Parse the data and transform it if needed ...
if (COMPR_PCM != myHeader.waveFormat.type) {
EWOL_ERROR("File : \"" << fileAccess << "\" ==> support only PCM compression ...");
return NULL;
}
if (myHeader.waveFormat.channelCount==0 || myHeader.waveFormat.channelCount>2) {
EWOL_ERROR("File : \"" << fileAccess << "\" ==> support only mono or stereo ..." << myHeader.waveFormat.channelCount);
return NULL;
}
if ( ! ( myHeader.waveFormat.bitsPerSample==16
|| myHeader.waveFormat.bitsPerSample==24
|| myHeader.waveFormat.bitsPerSample==32 ) ) {
EWOL_ERROR("File : \"" << fileAccess << "\" ==> not supported bit/sample ..." << myHeader.waveFormat.bitsPerSample);
return NULL;
}
if( ! ( 44100 == myHeader.waveFormat.samplesPerSec
|| 48000 == myHeader.waveFormat.samplesPerSec) ) {
EWOL_ERROR("File : \"" << fileAccess << "\" ==> not supported frequency " << myHeader.waveFormat.samplesPerSec << " != 48000");
return NULL;
}
EWOL_DEBUG(" dataSize : " << myHeader.dataSize);
//int32_t globalDataSize = myHeader.dataSize;
int32_t nbSample = (myHeader.dataSize/((myHeader.waveFormat.bitsPerSample/8)*myHeader.waveFormat.channelCount));
int32_t outputSize = nbChan*nbSample;
int16_t * outputData = (int16_t*)malloc(outputSize*sizeof(int16_t));
if (NULL == outputData) {
EWOL_ERROR("Allocation ERROR try to allocate " << (int32_t)(outputSize*sizeof(int16_t) ) << "bytes");
return NULL;
}
int16_t * tmpOut = outputData;
for( int32_t iii=0; iii<nbSample; iii++) {
int32_t left;
int32_t right;
char audioSample[8];
if (myHeader.waveFormat.bitsPerSample == 16) {
if (myHeader.waveFormat.channelCount == 1) {
if (fileAccess.fRead(audioSample, 1, 2)!=2) {
EWOL_ERROR("Read Error at position : " << iii);
return NULL;
}
left = ((int32_t)((int16_t)CONVERT_INT16(littleEndien, audioSample))) << 16;
right = left;
} else {
if (fileAccess.fRead(audioSample, 1, 4)!=4) {
EWOL_ERROR("Read Error at position : " << iii);
return NULL;
}
left = (int32_t)((int16_t)CONVERT_INT16(littleEndien, audioSample)) << 16;
right = (int32_t)((int16_t)CONVERT_INT16(littleEndien, audioSample+2)) << 16;
}
} else if (myHeader.waveFormat.bitsPerSample == 24) {
if (myHeader.waveFormat.channelCount == 1) {
if (fileAccess.fRead(audioSample, 1, 3)!=3) {
EWOL_ERROR("Read Error at position : " << iii);
return NULL;
}
left = CONVERT_INT24(littleEndien, audioSample);
right = left;
} else {
if (fileAccess.fRead(audioSample, 1, 6)!=6) {
EWOL_ERROR("Read Error at position : " << iii);
return NULL;
}
left = CONVERT_INT24(littleEndien, audioSample);
right = CONVERT_INT24(littleEndien, audioSample+3);
}
} else if (myHeader.waveFormat.bitsPerSample == 32) {
if (myHeader.waveFormat.channelCount == 1) {
if (fileAccess.fRead(audioSample, 1, 4)!=4) {
EWOL_ERROR("Read Error at position : " << iii);
return NULL;
}
left = CONVERT_INT32(littleEndien, audioSample);
right = left;
} else {
if (fileAccess.fRead(audioSample, 1, 8)!=8) {
EWOL_ERROR("Read Error at position : " << iii);
return NULL;
}
left = CONVERT_INT32(littleEndien, audioSample);
right = CONVERT_INT32(littleEndien, audioSample+4);
}
}
if (nbChan == 1) {
*tmpOut++ = (int16_t)((left>>1 + right>>1)>>16);
} else {
*tmpOut++ = (int16_t)(left>>16);
*tmpOut++ = (int16_t)(left>>16);
}
}
// close the file:
fileAccess.fClose();
nbSampleOut = nbSample;
return outputData;
}

View File

@ -1,40 +0,0 @@
/**
*******************************************************************************
* @file ewol/Audio/decWav.h
* @brief basic ewol Wav decoder (header)
* @author Edouard DUPIN
* @date 28/06/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_AUDIO_DEC_WAV_H__
#define __EWOL_AUDIO_DEC_WAV_H__
#include <etk/Types.h>
#include <etk/UString.h>
namespace ewol {
namespace audio {
namespace wav {
int16_t * LoadData(etk::UString filename, int8_t nbChan, int32_t frequency, int32_t & nbSampleOut);
};
};
};
#endif

View File

@ -1,123 +0,0 @@
/**
*******************************************************************************
* @file ewol/Audio/intefacePortAudio.cpp
* @brief poratudio ewol Audio interface (Sources)
* @author Edouard DUPIN
* @date 28/06/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <etk/Types.h>
#include <etk/UString.h>
#include <ewol/Debug.h>
#include <ewol/Audio/interfacePortAudio.h>
#include <ewol/Audio/audio.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <poll.h>
#include <math.h>
extern "C" {
#include <portaudio/portaudio.h>
}
typedef struct
{
int32_t sampleRate;
int32_t nbChanelsInput;
int32_t nbChanelsOutput;
int32_t frameSize;
} userOutputData;
userOutputData data;
PaStream *stream;
/* This routine will be called by the PortAudio engine when audio is needed.
It may called at interrupt level on some machines so don't do anything
that could mess up the system like calling malloc() or free().
*/
static int patestCallback( const void *inputBuffer, void *outputBuffer,
unsigned long framesPerBuffer,
const PaStreamCallbackTimeInfo* timeInfo,
PaStreamCallbackFlags statusFlags,
void *userData )
{
/* Cast data passed through stream to our structure. */
userOutputData *data = (userOutputData*)userData;
// no use of the input buffer ... (mightt be NULL)
(void) inputBuffer;
ewol::audio::GetData((int16_t*)outputBuffer, framesPerBuffer, data->nbChanelsOutput);
return 0;
}
#define SAMPLE_RATE (44100)
void ewol::portAudio::Init(void)
{
PaError err;
EWOL_DEBUG("Create Audio Thread...");
err = Pa_Initialize();
if( err != paNoError ) {
EWOL_ERROR("PortAudio error: " << (char*)Pa_GetErrorText(err) );
return;
}
data.sampleRate = 48000;
data.nbChanelsInput = 0;
data.nbChanelsOutput = 2;
data.frameSize = 256;
/* Open an audio I/O stream. */
err = Pa_OpenDefaultStream( &stream, data.nbChanelsInput, data.nbChanelsOutput,
paInt16, data.sampleRate, data.frameSize,
patestCallback, &data );
if( err != paNoError ) {
EWOL_ERROR("PortAudio error: " << (char*)Pa_GetErrorText(err) );
return;
}
err = Pa_StartStream( stream );
if( err != paNoError ) {
EWOL_ERROR("PortAudio error: " << (char*)Pa_GetErrorText(err) );
return;
}
EWOL_DEBUG("Create Audio Thread ... might have start");
}
void ewol::portAudio::UnInit(void)
{
PaError err;
// destroy the thread ...
EWOL_DEBUG("Wait end of the thread ...");
err = Pa_StopStream( stream );
if( err != paNoError ) {
EWOL_ERROR("PortAudio error: " << (char*)Pa_GetErrorText(err) );
return;
}
err = Pa_CloseStream( stream );
if( err != paNoError ) {
EWOL_ERROR("PortAudio error: " << (char*)Pa_GetErrorText(err) );
return;
}
err = Pa_Terminate();
if( err != paNoError ) {
EWOL_ERROR("PortAudio error: " << (char*)Pa_GetErrorText(err) );
return;
}
EWOL_DEBUG("Create Audio Thread ... might have stop");
}

View File

@ -1,37 +0,0 @@
/**
*******************************************************************************
* @file ewol/Audio/intefacePortAudio.h
* @brief poratudio ewol Audio interface (header)
* @author Edouard DUPIN
* @date 28/06/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_PORT_AUDIO_H__
#define __EWOL_PORT_AUDIO_H__
#include <etk/Types.h>
namespace ewol {
namespace portAudio {
void Init(void);
void UnInit(void);
};
};
#endif

View File

@ -1,99 +0,0 @@
/**
*******************************************************************************
* @file ClipBoard.cpp
* @brief ewol : copy / past main system (sources)
* @author Edouard DUPIN
* @date 04/04/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewol/Debug.h>
#include <ewol/ClipBoard.h>
#include <ewol/base/gui.h>
#undef __class__
#define __class__ "ClipBoard"
/*
note: la copy dans le :
0 : copy standard
[1..9] : copy interne
10 : bouton du milieux
*/
static etk::UString mesCopy[ewol::clipBoard::TOTAL_OF_CLICKBOARD];
void ewol::clipBoard::Init(void)
{
EWOL_INFO("Initialyse ClipBoards");
for(int32_t i=0; i<ewol::clipBoard::TOTAL_OF_CLICKBOARD; i++) {
mesCopy[i].Clear();
}
}
void ewol::clipBoard::UnInit(void)
{
EWOL_INFO("Initialyse ClipBoards");
for(int32_t i=0; i<ewol::clipBoard::TOTAL_OF_CLICKBOARD; i++) {
mesCopy[i].Clear();
}
}
void ewol::clipBoard::Set(uint8_t clipboardID, etk::UString &data)
{
// check if ID is correct
if(0 == data.Size()) {
EWOL_INFO("request a copy of nothing");
return;
} else if (ewol::clipBoard::CLIPBOARD_STD == clipboardID) {
guiAbstraction::ClipBoardSet(data, guiAbstraction::CLIPBOARD_MODE_STD);
return;
} else if (ewol::clipBoard::CLIPBOARD_SELECTION == clipboardID) {
guiAbstraction::ClipBoardSet(data, guiAbstraction::CLIPBOARD_MODE_PRIMARY);
return;
}else if(clipboardID >= ewol::clipBoard::TOTAL_OF_CLICKBOARD) {
EWOL_WARNING("request ClickBoard id error");
return;
}
// Copy datas ...
mesCopy[clipboardID] = data;
}
void ewol::clipBoard::Get(uint8_t clipboardID, etk::UString &data)
{
if (ewol::clipBoard::CLIPBOARD_STD == clipboardID) {
guiAbstraction::ClipBoardGet(data, guiAbstraction::CLIPBOARD_MODE_STD);
return;
} else if (ewol::clipBoard::CLIPBOARD_SELECTION == clipboardID) {
guiAbstraction::ClipBoardGet(data, guiAbstraction::CLIPBOARD_MODE_PRIMARY);
return;
} else if(clipboardID >= ewol::clipBoard::TOTAL_OF_CLICKBOARD) {
EWOL_WARNING("request ClickBoard id error");
return;
}
// Copy datas ...
data = mesCopy[clipboardID];
}

View File

@ -1,59 +0,0 @@
/**
*******************************************************************************
* @file ClipBoard.h
* @brief ewol : copy / past main system (header)
* @author Edouard DUPIN
* @date 04/04/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_CLIPBOARD_H__
#define __EWOL_CLIPBOARD_H__
#include <ewol/Debug.h>
#include <etk/UString.h>
namespace ewol {
namespace clipBoard
{
enum {
CLIPBOARD_0,
CLIPBOARD_1,
CLIPBOARD_2,
CLIPBOARD_3,
CLIPBOARD_4,
CLIPBOARD_5,
CLIPBOARD_6,
CLIPBOARD_7,
CLIPBOARD_8,
CLIPBOARD_9,
CLIPBOARD_STD,
CLIPBOARD_SELECTION,
TOTAL_OF_CLICKBOARD,
};
void Init(void);
void UnInit(void);
void Set(uint8_t clipboardID, etk::UString &data);
void Get(uint8_t clipboardID, etk::UString &data);
};
};
#endif

View File

@ -1,28 +0,0 @@
/**
*******************************************************************************
* @file ewol/Debug.h
* @brief Ewol : log wrapper (Sources)
* @author Edouard DUPIN
* @date 19/10/2010
* @par Project
* Ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewol/Debug.h>
const char * ewolLibName = "ewol ";

View File

@ -1,44 +0,0 @@
/**
*******************************************************************************
* @file ewol/Debug.h
* @brief Ewol : log wrapper (header)
* @author Edouard DUPIN
* @date 19/10/2010
* @par Project
* Ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_DEBUG_H__
#define __EWOL_DEBUG_H__
#include <etk/Types.h>
#include <etk/Debug.h>
extern const char * ewolLibName;
#define EWOL_CRITICAL(data) ETK_CRITICAL(ewolLibName, data)
#define EWOL_WARNING(data) ETK_WARNING(ewolLibName, data)
#define EWOL_ERROR(data) ETK_ERROR(ewolLibName, data)
#define EWOL_INFO(data) ETK_INFO(ewolLibName, data)
#define EWOL_DEBUG(data) ETK_DEBUG(ewolLibName, data)
#define EWOL_VERBOSE(data) ETK_VERBOSE(ewolLibName, data)
#define EWOL_ASSERT(cond, data) ETK_ASSERT(ewolLibName, cond, data)
#define EWOL_CHECK_INOUT(cond) ETK_CHECK_INOUT(ewolLibName, cond)
#define EWOL_TODO(cond) ETK_TODO(ewolLibName, cond)
#endif

View File

@ -1,301 +0,0 @@
/**
*******************************************************************************
* @file ewol/EObject.cpp
* @brief basic ewol object (Sources)
* @author Edouard DUPIN
* @date 24/02/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewol/EObject.h>
#include <ewol/EObjectManager.h>
#include <ewol/Debug.h>
#undef __class__
#define __class__ "EObjectMessageMultiCast"
extern "C" {
typedef struct {
const char* message;
ewol::EObject* object;
} messageList_ts;
};
// internal element of the widget manager :
static etk::Vector<messageList_ts> m_messageList; // all widget allocated ==> all time increment ... never removed ...
void ewol::EObjectMessageMultiCast::Init(void)
{
EWOL_INFO("EObject message Multi-Cast");
m_messageList.Clear();
}
void ewol::EObjectMessageMultiCast::UnInit(void)
{
EWOL_INFO("EObject message Multi-Cast");
m_messageList.Clear();
}
static void MultiCastAdd(ewol::EObject* object, const char* const message)
{
if (NULL == object) {
EWOL_ERROR("Add with NULL object");
return;
}
if (NULL == message) {
EWOL_ERROR("Add with NULL Message");
return;
}
messageList_ts tmpMessage;
tmpMessage.object = object;
tmpMessage.message = message;
m_messageList.PushBack(tmpMessage);
EWOL_DEBUG("SendMulticast ADD listener :" << object->GetId() << " on \"" << message << "\"" );
}
static void MultiCastRm(ewol::EObject* object)
{
if (NULL == object) {
EWOL_ERROR("Rm with NULL object");
return;
}
// send the message at all registered widget ...
for (int32_t iii=m_messageList.Size()-1; iii>=0; iii--) {
if(m_messageList[iii].object == object) {
EWOL_DEBUG("SendMulticast RM listener :" << object->GetId());
m_messageList[iii].message = NULL;
m_messageList[iii].object = NULL;
m_messageList.Erase(iii);
}
}
}
static void MultiCastSend(ewol::EObject* object, const char* const message, etk::UString& data)
{
EWOL_VERBOSE("SendMulticast message \"" << message << "\" data=\"" << data << "\" to :");
// send the message at all registered widget ...
for (int32_t iii=0; iii<m_messageList.Size(); iii++) {
if( m_messageList[iii].message == message
&& m_messageList[iii].object != object)
{
if (NULL != m_messageList[iii].object) {
EWOL_VERBOSE(" id = " << m_messageList[iii].object->GetId() << " type=" << m_messageList[iii].object->GetObjectType());
// generate event ...
m_messageList[iii].object->OnReceiveMessage(object, m_messageList[iii].message, data);
}
}
}
}
void ewol::EObjectMessageMultiCast::AnonymousSend(const char* const messageId, etk::UString& data)
{
MultiCastSend(NULL, messageId, data);
}
#undef __class__
#define __class__ "ewol::EObject"
/**
* @brief Constructor
*/
ewol::EObject::EObject(void)
{
static int32_t ss_globalUniqueId = 0;
// note this is nearly atomic ... (but it is enough)
m_uniqueId = ss_globalUniqueId++;
EWOL_DEBUG("new EObject : [" << m_uniqueId << "]");
ewol::EObjectManager::Add(this);
}
/**
* @brief Destructor
*/
ewol::EObject::~EObject(void)
{
EWOL_DEBUG("delete EObject : [" << m_uniqueId << "]");
ewol::EObjectManager::Rm(this);
MultiCastRm(this);
for (int32_t iii=0; iii<m_externEvent.Size(); iii++) {
if (NULL!=m_externEvent[iii]) {
delete(m_externEvent[iii]);
m_externEvent[iii] = NULL;
}
}
m_externEvent.Clear();
m_availlableEventId.Clear();
m_uniqueId = -1;
}
/**
* @brief Auto-destroy the object
* @param ---
* @return ---
*/
void ewol::EObject::AutoDestroy(void)
{
ewol::EObjectManager::AutoRemove(this);
}
/**
* @brief Get the UniqueId of the EObject
* @param ---
* @return the requested ID
*/
int32_t ewol::EObject::GetId(void)
{
return m_uniqueId;
};
/**
* @brief Add a specific event Id in the list to prevent wrong link on a EObject
* @param[in] generateEventId event Id to add
* @return ---
*/
void ewol::EObject::AddEventId(const char * generateEventId)
{
if (NULL != generateEventId) {
m_availlableEventId.PushBack(generateEventId);
}
}
/**
* @brief Generate event on all registered EObject
* @param[in] generateEventId event Id that is curetly generated
* @param[in] data data associated with the event
* @return ---
*/
void ewol::EObject::GenerateEventId(const char * generateEventId, const etk::UString data)
{
// for every element registered ...
for (int32_t iii=0; iii<m_externEvent.Size(); iii++) {
if (NULL!=m_externEvent[iii]) {
// if we find the event ...
if (m_externEvent[iii]->localEventId == generateEventId) {
if (NULL != m_externEvent[iii]->destEObject) {
m_externEvent[iii]->destEObject->OnReceiveMessage(this, m_externEvent[iii]->destEventId, data);
}
}
}
}
}
/**
* @brief Generate Multicast event on all EObject requested the event
* @param[in] messageId Event Id that is generated
* @param[in] data String that is send at all the destinations
* @return ---
*/
void ewol::EObject::SendMultiCast(const char* const messageId, etk::UString data)
{
MultiCastSend(this, messageId, data);
}
/**
* @brief Register of the arrival of a Multicast message
* @param[in] messageId Event Id waiting for...
* @return ---
*/
void ewol::EObject::RegisterMultiCast(const char* const messageId)
{
MultiCastAdd(this, messageId);
}
/**
* @brief Register an EObject over an other to get event on the second...
* @param[in] destinationObject pointer on the object that might be call when an event is generated
* @param[in] eventId Event generate inside the object
* @param[in] eventIdgenerated event generated when call the distant EObject.OnReceiveMessage(...)
* @return true if register corectly done
*/
void ewol::EObject::RegisterOnEvent(ewol::EObject * destinationObject, const char * eventId, const char * eventIdgenerated)
{
if (NULL == destinationObject) {
EWOL_ERROR("Input ERROR NULL pointer EObject ...");
return;
}
if (NULL == eventId) {
EWOL_ERROR("Input ERROR NULL pointer Event Id...");
return;
}
// check if event existed :
bool findIt = false;
for(int32_t iii=0; iii<m_availlableEventId.Size(); iii++) {
if (m_availlableEventId[iii] == eventId) {
findIt = true;
break;
}
}
if (false == findIt) {
EWOL_DEBUG("Try to register with a NON direct string name");
for(int32_t iii=0; iii<m_availlableEventId.Size(); iii++) {
if (0 == strncmp(m_availlableEventId[iii], eventId, 1024)) {
findIt = true;
eventIdgenerated = m_availlableEventId[iii];
break;
}
}
}
if (false == findIt) {
EWOL_ERROR("Can not register event on this WidgetType=" << GetObjectType() << " event=\"" << eventId << "\" ==> unknow event");
return;
}
ewol::EventExtGen * tmpEvent = new ewol::EventExtGen();
if (NULL == tmpEvent) {
EWOL_ERROR("Allocation error in Register Event...");
return;
}
tmpEvent->localEventId = eventId;
tmpEvent->destEObject = destinationObject;
if (NULL != eventIdgenerated) {
tmpEvent->destEventId = eventIdgenerated;
} else {
tmpEvent->destEventId = eventId;
}
m_externEvent.PushBack(tmpEvent);
}
/**
* @brief Inform object that an other object is removed ...
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
* @return ---
*/
void ewol::EObject::OnObjectRemove(ewol::EObject * removeObject)
{
for(int32_t iii=m_externEvent.Size()-1; iii>=0; iii--) {
if (NULL==m_externEvent[iii]) {
m_externEvent.Erase(iii);
} else if (m_externEvent[iii]->destEObject == removeObject) {
m_externEvent.Erase(iii);
}
}
}

View File

@ -1,153 +0,0 @@
/**
*******************************************************************************
* @file ewol/EObject.h
* @brief basic ewol object (header)
* @author Edouard DUPIN
* @date 24/02/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_E_OBJECT_H__
#define __EWOL_E_OBJECT_H__
#include <etk/Types.h>
#include <etk/UString.h>
#include <etk/Vector.h>
namespace ewol {
namespace EObjectMessageMultiCast {
void Init( void);
void UnInit(void);
void AnonymousSend(const char* const messageId, etk::UString& data);
};
class EObject;
/**
* local class for event generation
*/
class EventExtGen {
public:
const char* localEventId; //!< local event Id generation
ewol::EObject* destEObject; //!< destination widget that might be call
const char* destEventId; //!< Generated event ID on the distant widget
};
/**
* @brief Basic message classes for ewol system
*
* this class mermit at every EObject to communicate between them.
*/
class EObject {
private:
int32_t m_uniqueId; //!< Object UniqueID ==> TODO : Check if it use is needed
etk::Vector<EventExtGen*> m_externEvent; //!< Generic list of event generation for output link
etk::Vector<const char*> m_availlableEventId; //!< List of all event availlable for this widget
public:
/**
* @brief Constructor
*/
EObject(void);
/**
* @brief Destructor
*/
virtual ~EObject(void);
/**
* @brief Get the UniqueId of the EObject
* @param ---
* @return the requested ID
*/
int32_t GetId(void);
/**
* @brief Auto-destroy the object
* @param ---
* @return ---
*/
void AutoDestroy(void);
/**
* @brief Get the current Object type of the EObject
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type description
* @return true if the object is compatible, otherwise false
*/
virtual const char * const GetObjectType(void) { return "EObject"; };
protected:
/**
* @brief Add a specific event Id in the list to prevent wrong link on a EObject
* @param[in] generateEventId event Id to add
* @return ---
*/
void AddEventId(const char * generateEventId);
/**
* @brief Generate event on all registered EObject
* @param[in] generateEventId event Id that is curetly generated
* @param[in] data data associated with the event
* @return ---
*/
void GenerateEventId(const char * generateEventId, const etk::UString data = "");
/**
* @brief Generate Multicast event on all EObject requested the event
* @param[in] messageId Event Id that is generated
* @param[in] data String that is send at all the destinations
* @return ---
*/
void SendMultiCast(const char* const messageId, etk::UString data = "");
/**
* @brief Register of the arrival of a Multicast message
* @param[in] messageId Event Id waiting for...
* @return ---
*/
void RegisterMultiCast(const char* const messageId);
public:
/**
* @brief Register an EObject over an other to get event on the second...
* @param[in] destinationObject pointer on the object that might be call when an event is generated
* @param[in] eventId Event generate inside the object
* @param[in] eventIdgenerated event generated when call the distant EObject.OnReceiveMessage(...)
* @return ---
*/
void RegisterOnEvent(ewol::EObject * destinationObject, const char * eventId, const char * eventIdgenerated = NULL);
/**
* @brief Inform object that an other object is removed ...
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
* @note : Sub classes must call this class
* @return ---
*/
virtual void OnObjectRemove(ewol::EObject * removeObject);
/**
* @brief Receive a message from an other EObject with a specific eventId and data
* @param[in] CallerObject Pointer on the EObject that information came from
* @param[in] eventId Message registered by this class
* @param[in] data Data registered by this class
* @return ---
*/
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data) { };
};
};
#endif

View File

@ -1,135 +0,0 @@
/**
*******************************************************************************
* @file ewol/EObjectManager.cpp
* @brief basic ewol Object Manager (Sources)
* @author Edouard DUPIN
* @date 27/02/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewol/EObjectManager.h>
#include <ewol/base/eventInputManagement.h>
#undef __class__
#define __class__ "EObjectManager"
static bool IsInit = false;
// internal element of the widget manager :
static etk::Vector<ewol::EObject*> m_eObjectList; // all widget allocated ==> all time increment ... never removed ...
static etk::Vector<ewol::EObject*> m_eObjectAutoRemoveList; // all widget allocated
void ewol::EObjectManager::Init(void)
{
EWOL_DEBUG("==> Init EObject-Manager");
// Can create mlemory leak ... ==> but not predictable comportement otherwise ...
m_eObjectAutoRemoveList.Clear();
m_eObjectList.Clear();
IsInit = true;
}
void ewol::EObjectManager::UnInit(void)
{
EWOL_DEBUG("==> Un-Init EObject-Manager");
RemoveAllAutoRemove();
EWOL_INFO(" Remove missing user widget");
while(0<m_eObjectList.Size()) {
if (m_eObjectList[0]!=NULL) {
delete(m_eObjectList[0]);
m_eObjectList[0] = NULL;
} else {
m_eObjectList.Erase(0);
}
}
IsInit = false;
}
void ewol::EObjectManager::Add(ewol::EObject* object)
{
if (NULL != object) {
m_eObjectList.PushBack(object);
} else {
EWOL_ERROR("try to add an inexistant EObject in manager");
}
}
void informOneObjectIsRemoved(ewol::EObject* object)
{
for (int32_t iii=0; iii<m_eObjectList.Size(); iii++) {
if (m_eObjectList[iii] != NULL) {
m_eObjectList[iii]->OnObjectRemove(object);
}
}
// call input event manager to remove linked widget ...
ewol::eventInput::OnObjectRemove(object);
}
void ewol::EObjectManager::Rm(ewol::EObject* object)
{
if (NULL == object) {
EWOL_ERROR("Try to remove (NULL) EObject");
return;
}
for (int32_t iii=0; iii<m_eObjectList.Size(); iii++) {
if (m_eObjectList[iii] == object) {
// Remove Element
m_eObjectList[iii] = NULL;
m_eObjectList.Erase(iii);
informOneObjectIsRemoved(object);
return;
}
}
EWOL_ERROR("Try to remove EObject that is not referenced ...");
}
void ewol::EObjectManager::AutoRemove(ewol::EObject* object)
{
if (NULL == object) {
EWOL_ERROR("Try to Auto-Remove (NULL) EObject");
return;
}
for (int32_t iii=0; iii<m_eObjectList.Size(); iii++) {
if (m_eObjectList[iii] == object) {
// Remove Element
m_eObjectList[iii] = NULL;
m_eObjectList.Erase(iii);
EWOL_DEBUG("Auto-Remove EObject : [" << object->GetId() << "]");
informOneObjectIsRemoved(object);
m_eObjectAutoRemoveList.PushBack(object);
return;
}
}
EWOL_ERROR("Try to Auto-Remove EObject that is not referenced ...");
}
// clean all EObject that request an autoRemove ...
void ewol::EObjectManager::RemoveAllAutoRemove(void)
{
while(0<m_eObjectAutoRemoveList.Size()) {
if (m_eObjectAutoRemoveList[0]!=NULL) {
delete(m_eObjectAutoRemoveList[0]);
m_eObjectAutoRemoveList[0] = NULL;
} else {
m_eObjectAutoRemoveList.Erase(0);
}
}
m_eObjectAutoRemoveList.Clear();
}

View File

@ -1,45 +0,0 @@
/**
*******************************************************************************
* @file ewol/EObjectManager.h
* @brief basic ewol Object Manager (Header)
* @author Edouard DUPIN
* @date 27/02/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_E_OBJECT_MANAGER_H__
#define __EWOL_E_OBJECT_MANAGER_H__
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <ewol/EObject.h>
namespace ewol {
namespace EObjectManager {
void Init( void);
void UnInit( void);
void Add( ewol::EObject* object);
void Rm( ewol::EObject* object);
void AutoRemove( ewol::EObject* object);
void RemoveAllAutoRemove(void);
};
};
#endif

View File

@ -1,85 +0,0 @@
/**
*******************************************************************************
* @file ewol/Font.h
* @brief ewol Font system (header)
* @author Edouard DUPIN
* @date 29/10/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_FONT_H__
#define __EWOL_FONT_H__
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <etk/File.h>
namespace ewol
{
// TODO : Create a subNameSpace:
/*
namespace font {
...
};
*/
// set default folder name of the font :
void SetFontFolder(etk::UString folderName);
void SetDefaultFont(etk::UString fontName, int32_t size);
// unload all font loaded
void InitFont(void);
void UnInitFont(void);
// load the fonts...
int32_t LoadFont(etk::UString fontName, int32_t size); // return ID of font
int32_t GetDefaultFontId(void);
void UnloadFont(int32_t id);
// get the size of a long string in UTF8 (note that \n and \r represent unknown char...)
int32_t GetWidth(int32_t fontID, const etk::UString& unicodeString);
int32_t GetHeight(int32_t fontID);
int32_t DrawText(int32_t fontID,
Vector2D<float> textPos,
clipping_ts & drawClipping,
const etk::UString & unicodeString,
int32_t & fontTextureId,
etk::Vector<Vector2D<float> > & coord,
etk::Vector<texCoord_ts> & coordTex);
int32_t DrawText(int32_t fontID,
Vector2D<float> textPos,
clipping_ts & drawClipping,
const uniChar_t unicodeChar,
int32_t & fontTextureId,
etk::Vector<Vector2D<float> > & coord,
etk::Vector<texCoord_ts> & coordTex);
int32_t DrawText(int32_t fontID,
Vector2D<float> textPos,
const etk::UString & unicodeString,
int32_t & fontTextureId,
etk::Vector<Vector2D<float> > & coord,
etk::Vector<texCoord_ts> & coordTex);
int32_t DrawText(int32_t fontID,
Vector2D<float> textPos,
const uniChar_t unicodeChar,
int32_t & fontTextureId,
etk::Vector<Vector2D<float> > & coord,
etk::Vector<texCoord_ts> & coordTex);
int32_t LoadFont(etk::File fontFileName);
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,85 +0,0 @@
/**
*******************************************************************************
* @file ewol/Game/GameElement.cpp
* @brief ewol game element system (Sources)
* @author Edouard DUPIN
* @date 06/04/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewol/Game/GameElement.h>
#undef __class__
#define __class__ "GameElement"
/**
* @brief Constructor : here are requested all the needed sprite and effect that can be used in the game
* @param ---
* @return ---
*/
ewol::GameElement::GameElement(SceneElement & sceneElement, etk::UString& tmpName) : m_fileNameConfig(tmpName), m_sceneElement(sceneElement)
{
m_uniqueId = sceneElement.GetUniqueId();
m_group = -1;
m_type = -1;
m_visible = true;
m_position.x = 0.0;
m_position.y = 0.0;
m_speed = 0.0;
m_size = 64.0;
m_sizeDisplay = 64.0;
m_angle = 0.0;
m_mass = 0.0;
m_fileNameConfig = tmpName;
m_canBeCibled = false;
m_canHaveImpact = true;
m_life = 0;
}
float quadDist(Vector2D<float> pos1, Vector2D<float> pos2)
{
float tmpVal1 = pos1.x - pos2.x;
float tmpVal2 = pos1.y - pos2.y;
return tmpVal1*tmpVal1 + tmpVal2*tmpVal2;
}
bool ewol::GameElement::HaveImpact(int32_t group, int32_t type, Vector2D<float> position, float size)
{
if (true != m_canHaveImpact) {
return false;
}
// check if it was in the same group
if (group == m_group) {
return false;
}
float quadDistance = quadDist(m_position, position);
float radiusElement = m_size * m_size;
if (radiusElement < quadDistance) {
//distance is greten than expected
return false;
}
return true;
}

View File

@ -1,156 +0,0 @@
/**
*******************************************************************************
* @file ewol/Game/GameElement.h
* @brief ewol game element system (header)
* @author Edouard DUPIN
* @date 06/04/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_GAME_ELEMENT_H__
#define __EWOL_GAME_ELEMENT_H__
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <ewol/OObject/Sprite.h>
#include <ewol/Widget.h>
#include <ewol/Game/SceneElement.h>
#include <math.h>
#define CYCLIC_CALL_PERIODE_US (10000)
#define NB_SPECIAL_PARAM (5)
namespace ewol {
class GameElement
{
private:
etk::UString m_fileNameConfig;
protected:
SceneElement & m_sceneElement; //!< All element neede in the scene
uint16_t m_uniqueId; //!< General element ID (uint16_t, because all is reference with the groupId like this only a uint32_t reference an element)
uint16_t m_group; //!< General group Id More than 65000 group can be really interesting to create supid game ...
float m_life; //!< Current life of the element
int32_t m_type; //!<
float m_power; //!< Current power of the element
bool m_visible; //!< This is to know if the element is displayed or not ==> TODO : check if usefull ...
Vector2D<float> m_position; //!< Current position of the element
float m_speed; //!< Speed of the element (only one value, the angle is generated by the m_angle
float m_angle; //!< Angle of the speed
float m_mass; //!< Current element Mass ==> for the physical calculation
float m_size; //!< Current size of the element more specific size can be done in the under class => this is for simplify calculation ==> all is consider like sphere...
float m_sizeDisplay; //!< Current diplay size of the element
bool m_canBeCibled; //!< This is for automatic finding on an ennemy
bool m_canHaveImpact; //!< detection of impact is done with this ...
float m_specialParam[NB_SPECIAL_PARAM]; //!< specific game user parameter
public:
/**
* @brief Constructor : here are requested all the needed sprite and effect that can be used in the game
* @param ---
* @return ---
*/
GameElement(SceneElement & sceneElement, etk::UString& tmpName);
/**
* @brief Destructor : This does not remove the sprite requested, they will be supressed when the scene is removed ...
* @param ---
* @return ---
*/
virtual ~GameElement(void) { };
virtual void Init(void) { };
virtual void UnInit(void) { };
uint16_t GetUniqueId(void) { return m_uniqueId; };
bool HasName(etk::UString tmpName) { return (tmpName == m_fileNameConfig); };
bool IsVisible(void) { return m_visible; };
void SetVisible(bool state) { m_visible = state; };
Vector2D<float> PositionGet(void) { return m_position; };
void PositionSet(Vector2D<float> state) { m_position = state; };
void PositionSet(float xxx, float yyy) { m_position.x = xxx; m_position.y = yyy; };
float SpeedGet(void) { return m_speed; };
void SpeedSet(float state) { m_speed = state; };
float MassGet(void) { return m_mass; };
void MassSet(float state) { m_mass = state; };
float SizeGet(void) { return m_size; };
void SizeSet(float state) { m_size = state; };
float DisplaySizeGet(void) { return m_sizeDisplay; };
void DisplaySizeSet(float state) { m_sizeDisplay = state; };
float AngleGet(void) { return m_angle; };
void AngleSet(float state)
{
m_angle = state;
while (m_angle > M_PI) {
m_angle -= 2.0*M_PI;
}
while (m_angle < -M_PI) {
m_angle += 2.0*M_PI;
}
};
float PowerGet(void) { return m_power; };
void PowerSet(float state) { m_power = state; };
bool CanBeCibledGet(void) { return m_canBeCibled; };
void CanBeCibledSet(bool state) { m_canBeCibled = state; };
bool CanHaveImpactGet(void) { return m_canHaveImpact; };
void CanHaveImpactSet(bool state) { m_canHaveImpact = state; };
int32_t GetType(void) { return m_type; }; // TODO : DEPRECATED ...
int32_t TypeGet(void) { return m_type; };
uint16_t GroupGet(void) { return m_group; };
void GroupSet(uint16_t state) { m_group = state; };
float SpecialParamGet(int32_t id) { if (id<0 || id>=NB_SPECIAL_PARAM) {return 0.0;} return m_specialParam[id]; };
void SpecialParamSet(int32_t id, float state) { if (id<0 || id>=NB_SPECIAL_PARAM) {return;} m_specialParam[id]=state; };
/**
* @brief Periodicly this fuction will be call tu change property of all the dynamic obbjects
* @param[in] time Current game time (start at 0)
* @param[in] deltaTime delta time before the previous call
* @param[in,out] listOfSprite Reference on the list where the display must be done for every sprite
* @param[in,out] listOfEffects Reference on the list where the display must be done for every effects
* @return true if the object must be remove
* @return false if the object must be keep
*/
virtual bool Process(int64_t time, int32_t deltaTime) { return false; };
/**
* @brief Requuest the draw of the current element, it will be done on the current Sprite list
* @param[in,out] listOfSprite Reference on the list where the display must be done for every sprite
* @param[in,out] listOfEffects Reference on the list where the display must be done for every effects
* @return ---
*/
virtual void Draw(void) { };
/**
* @brief an element has been remove, just remove reference on it or ID on IT, it can be replace whith an other that have no link
* @param[in] idOfElement Id of the element that has been removed
* @return ---
*/
virtual void RemoveElement(int32_t idOfElement) { };
virtual bool HaveImpact(int32_t group, int32_t type, Vector2D<float> position, float size);
virtual bool Explosion(int32_t group, int32_t type, Vector2D<float> position, float pxAtenuation, float power) { return false; } ;
virtual void Message(etk::UString control, etk::UString message) { } ;
};
};
#include <ewol/widget/Scene.h>
float quadDist(Vector2D<float> pos1, Vector2D<float> pos2);
#endif

View File

@ -1,944 +0,0 @@
/**
*******************************************************************************
* @file ewol/Game/GameElementLua.cpp
* @brief ewol game lua element system (Sources)
* @author Edouard DUPIN
* @date 30/05/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewol/Game/GameElementLua.h>
/*******************************************************************************
** Lua abstraction (START)
******************************************************************************* */
#include <lua/lua.hpp>
//For every acces :
static ewol::GameElementLua * tmpObj = NULL;
static etk::Vector<ewol::Sprite*> * tmpSprite = NULL;
static ewol::SceneElement * tmpScene = NULL;
template <typename T> int index(lua_State* L);
template <> int index<bool>(lua_State* L)
{
bool* ptr = (bool*)lua_touserdata(L, 1);
lua_pushboolean(L, *ptr ? 1 : 0);
return 1;
}
template <> int index<float>(lua_State* L)
{
float* ptr = (float*)lua_touserdata(L, 1);
lua_pushnumber(L, *ptr);
return 1;
}
template <typename T> int newindex(lua_State* L);
template <> int newindex<bool>(lua_State* L)
{
bool* ptr = (bool*)lua_touserdata(L, 1);
*ptr = lua_toboolean(L, 3)!=0;
return 0;
}
template <> int newindex<float>(lua_State* L)
{
float* ptr = (float*)lua_touserdata(L, 1);
if (!lua_isnumber(L, 3)) {
return luaL_error(L, "new value must be a number");
}
*ptr = (float)lua_tonumber(L, 3);
return 1;
}
template <typename T> class LuaValue
{
private:
lua_State* L;
etk::UString name;
T* ptr;
public:
LuaValue(lua_State* _L, etk::UString _name)
: L(_L), name(_name), ptr(0)
{
ptr = (T*)lua_newuserdata(L, sizeof(T));
*ptr = T();
lua_createtable(L, 0, 2);
lua_pushcfunction(L, index<T>);
lua_setfield(L, -2, "__index");
lua_pushcfunction(L, newindex<T>);
lua_setfield(L, -2, "__newindex");
lua_setmetatable(L, -2);
lua_setglobal(L, name.c_str());
}
virtual ~LuaValue(void)
{
lua_pushnil(L);
lua_setglobal(L, name.c_str());
ptr = 0;
L = 0;
}
LuaValue<T>& operator=(const T& value) { *ptr = value; return *this; }
operator T() { return *ptr; }
};
/*
template <> int lua_Set<float>(lua_State* L)
{
if (NULL==tmpObj) {
EWOL_ERROR("NULL obj...");
lua_pushnumber(L, 0 );
return 1;
}
float value = luaL_checknumber(L, 1);
tmpObj->AngleSet(value);
// return number of parameters
return 1;
}
template <> int lua_Get<float>(lua_State* L)
{
if (NULL==tmpObj) {
EWOL_ERROR("NULL obj...");
lua_pushnumber(L, 0 );
return 1;
}
float value = tmpObj->AngleGet();
lua_pushnumber(L, value );
// return number of parameters
return 1;
}
*/
LUAMOD_API int lua_GetPos(lua_State *L)
{
if (NULL==tmpObj) {
EWOL_ERROR("NULL obj...");
lua_pushnumber(L, (lua_Number)0 );
lua_pushnumber(L, (lua_Number)0 );
return 2;
}
Vector2D<float> tmpPos = tmpObj->PositionGet();
lua_pushnumber(L, (lua_Number)tmpPos.x );
lua_pushnumber(L, (lua_Number)tmpPos.y );
// return number of parameters
return 2;
}
LUAMOD_API int lua_SetPos(lua_State *L)
{
if (NULL==tmpObj) {
EWOL_ERROR("NULL obj...");
return 0;
}
float x = luaL_checknumber(L, 1);
float y = luaL_checknumber(L, 2);
Vector2D<float> tmpPos;
tmpPos.x = x;
tmpPos.y = y;
tmpObj->PositionSet(tmpPos);
// return number of parameters
return 0;
}
LUAMOD_API int lua_GetSpeed(lua_State *L)
{
if (NULL==tmpObj) {
EWOL_ERROR("NULL obj...");
lua_pushnumber(L, (lua_Number)0 );
return 1;
}
float tmpPos = tmpObj->SpeedGet();
lua_pushnumber(L, (lua_Number)tmpPos );
// return number of parameters
return 1;
}
LUAMOD_API int lua_SetSpeed(lua_State *L)
{
if (NULL==tmpObj) {
EWOL_ERROR("NULL obj...");
return 0;
}
float x = luaL_checknumber(L, 1);
tmpObj->SpeedSet(x);
// return number of parameters
return 0;
}
LUAMOD_API int lua_GetPower(lua_State *L)
{
if (NULL==tmpObj) {
EWOL_ERROR("NULL obj...");
lua_pushnumber(L, 0 );
return 1;
}
float value = tmpObj->PowerGet();
lua_pushnumber(L, (lua_Number)value );
// return number of parameters
return 1;
}
LUAMOD_API int lua_SetPower(lua_State *L)
{
if (NULL==tmpObj) {
EWOL_ERROR("NULL obj...");
lua_pushnumber(L, 0 );
return 1;
}
float value = luaL_checknumber(L, 1);
tmpObj->PowerSet(value);
// return number of parameters
return 1;
}
LUAMOD_API int lua_GetGroup(lua_State *L)
{
if (NULL==tmpObj) {
EWOL_ERROR("NULL obj...");
lua_pushnumber(L, 0 );
return 1;
}
int32_t value = tmpObj->GroupGet();
lua_pushinteger(L, value );
// return number of parameters
return 1;
}
LUAMOD_API int lua_SetGroup(lua_State *L)
{
if (NULL==tmpObj) {
EWOL_ERROR("NULL obj...");
lua_pushnumber(L, 0 );
return 1;
}
int32_t value = luaL_checkint(L, 1);
tmpObj->GroupSet(value);
// return number of parameters
return 1;
}
LUAMOD_API int lua_GetAngle(lua_State *L)
{
if (NULL==tmpObj) {
EWOL_ERROR("NULL obj...");
lua_pushnumber(L, 0 );
return 1;
}
float value = tmpObj->AngleGet();
lua_pushnumber(L, value );
// return number of parameters
return 1;
}
LUAMOD_API int lua_SetAngle(lua_State *L)
{
if (NULL==tmpObj) {
EWOL_ERROR("NULL obj...");
lua_pushnumber(L, 0 );
return 1;
}
float value = luaL_checknumber(L, 1);
tmpObj->AngleSet(value);
// return number of parameters
return 1;
}
LUAMOD_API int lua_GetSize(lua_State *L)
{
if (NULL==tmpObj) {
EWOL_ERROR("NULL obj...");
lua_pushnumber(L, 0 );
return 1;
}
float value = tmpObj->SizeGet();
lua_pushnumber(L, value );
// return number of parameters
return 1;
}
LUAMOD_API int lua_SetSize(lua_State *L)
{
if (NULL==tmpObj) {
EWOL_ERROR("NULL obj...");
lua_pushnumber(L, 0 );
return 0;
}
float value = luaL_checknumber(L, 1);
tmpObj->SizeSet(value);
// return number of parameters
return 0;
}
LUAMOD_API int lua_GetCanBeCibled(lua_State *L)
{
if (NULL==tmpObj) {
EWOL_ERROR("NULL obj...");
lua_pushboolean(L, false );
return 1;
}
float value = tmpObj->CanBeCibledGet();
lua_pushboolean(L, value );
// return number of parameters
return 1;
}
LUAMOD_API int lua_SetCanBeCibled(lua_State *L)
{
if (NULL==tmpObj) {
EWOL_ERROR("NULL obj...");
return 0;
}
bool value = false;
if ( lua_isboolean( L, 1 ) ) {
value = lua_toboolean( L, 1 );
}
tmpObj->CanBeCibledSet(value);
// return number of parameters
return 0;
}
LUAMOD_API int lua_SpriteLoad(lua_State *L)
{
//LUA : int SpriteLoad("fileName", maxSize); => -1 in error ...
if (NULL==tmpScene || NULL==tmpObj) {
EWOL_ERROR("NULL obj...");
lua_pushnumber(L, (lua_Number)-1 );
return 1;
}
const char *filename = luaL_checkstring(L, 1);
int32_t maxSize = luaL_checkint(L, 2);
int32_t spriteID = tmpScene->LoadSprite( filename, maxSize);
if (spriteID < 0) {
EWOL_ERROR("Error to load the sprite : " << filename);
}
lua_pushnumber(L, (lua_Number)spriteID );
// return number of parameters
return 1;
}
LUAMOD_API int lua_SpriteUnLoad(lua_State *L)
{
// TODO : when supported ...
/*
//LUA : SpriteUnLoad(int);
if (NULL==tmpScene) {
return 1;
}
float a = luaL_checkint(L, 1);
Vector2D<float> tmpPos = tmpObj->PositionGet();
tmpPos.y = a;
tmpObj->PositionSet(tmpPos);
*/
// return number of parameters
return 0;
}
LUAMOD_API int lua_SpriteDraw(lua_State *L)
{
//LUA : SpriteDraw(int id, posX, posY, angle, size)
if (NULL==tmpSprite) {
return 0;
}
float spriteID = luaL_checknumber(L, 1);
Vector2D<float> tmpPos;
tmpPos.x = luaL_checknumber(L, 2);
tmpPos.y = luaL_checknumber(L, 3);
float angle = luaL_checknumber(L, 4);
float size = luaL_checknumber(L, 5);
if (spriteID < 0) {
EWOL_ERROR("Can not Draw the sprite : " << spriteID);
return 0;
}
//EWOL_INFO("Draw the sprite : " << spriteID << " pos=" << tmpPos << " angle=" << angle);
(*tmpSprite)[spriteID]->Element(tmpPos, size, angle);
// return number of parameters
return 0;
}
LUAMOD_API int lua_ElementAdd(lua_State *L)
{
//LUA : int ElementAdd("Bullet", group)
if (NULL==tmpScene) {
EWOL_ERROR("NULL obj...");
lua_pushinteger(L, 0 );
return 1;
}
etk::UString elementName = luaL_checkstring(L, 1);
int32_t group = luaL_checkint(L, 2);
// TODO : Remove this when find an other way do do it ...
ewol::GameElementLua * ttmpObj = tmpObj;
etk::Vector<ewol::Sprite*> * ttmpSprite = tmpSprite;
ewol::SceneElement * ttmpScene = tmpScene;
uint32_t elementId = tmpScene->AddElementNamed(group, elementName);
tmpObj = ttmpObj;
tmpSprite = ttmpSprite;
tmpScene = ttmpScene;
if (0==elementId) {
EWOL_ERROR("Error creating element : " << elementName);
}
lua_pushinteger(L, elementId );
// return number of parameters
return 1;
}
LUAMOD_API int lua_ElementSetPos(lua_State *L)
{
//LUA : ElementSetPos(newElementId, posX, posY);
if (NULL==tmpScene) {
EWOL_ERROR("ploppp ");
return 0;
}
int32_t idElement = luaL_checkint(L, 1);
ewol::GameElement* tmpElem = tmpScene->GetElement(idElement);
if (NULL != tmpElem) {
Vector2D<float> tmpPos;
tmpPos.x = luaL_checknumber(L, 2);
tmpPos.y = luaL_checknumber(L, 3);
tmpElem->PositionSet(tmpPos);
} else {
EWOL_ERROR("Get element unique ID : " << idElement);
}
// return number of parameters
return 0;
}
LUAMOD_API int lua_ElementGetPos(lua_State *L)
{
//LUA : ElementSetPos(newElementId, posX, posY);
if (NULL==tmpScene) {
EWOL_ERROR("ploppp ");
lua_pushnumber(L, (lua_Number)0 );
lua_pushnumber(L, (lua_Number)0 );
return 2;
}
int32_t idElement = luaL_checkint(L, 1);
ewol::GameElement* tmpElem = tmpScene->GetElement(idElement);
if (NULL != tmpElem) {
Vector2D<float> tmpPos = tmpElem->PositionGet();
lua_pushnumber(L, (lua_Number)tmpPos.x );
lua_pushnumber(L, (lua_Number)tmpPos.y );
} else {
lua_pushnumber(L, (lua_Number)0.0 );
lua_pushnumber(L, (lua_Number)0.0 );
EWOL_ERROR("Get element unique ID : " << idElement);
}
// return number of parameters
return 2;
}
LUAMOD_API int lua_ElementSetPower(lua_State *L)
{
//LUA : ElementSetPower(newElementId, 1);
if (NULL==tmpScene) {
return 0;
}
int32_t idElement = luaL_checkint(L, 1);
ewol::GameElement* tmpElem = tmpScene->GetElement(idElement);
if (NULL != tmpElem) {
int32_t power = luaL_checkint(L, 2);
tmpElem->PowerSet(power);
}
// return number of parameters
return 0;
}
LUAMOD_API int lua_ElementSetAngle(lua_State *L)
{
//LUA : ElementSetAngle(newElementId, m_angle);
if (NULL==tmpScene) {
return 0;
}
int32_t idElement = luaL_checkint(L, 1);
ewol::GameElement* tmpElem = tmpScene->GetElement(idElement);
if (NULL != tmpElem) {
float angle = luaL_checknumber(L, 2);
tmpElem->AngleSet(angle);
}
// return number of parameters
return 1;
}
LUAMOD_API int lua_GetNearestEnemy(lua_State *L)
{
//LUA : int GetNearestEnemy()
if (NULL==tmpScene || NULL==tmpObj) {
EWOL_ERROR("NULL obj...");
lua_pushinteger(L, 0 );
return 1;
}
uint32_t elementId = tmpScene->GetNearestEnemy(tmpObj->PositionGet(), tmpObj->GroupGet());
lua_pushinteger(L, elementId );
// return number of parameters
return 1;
}
LUAMOD_API int lua_ElmentExisted(lua_State *L)
{
//LUA : ElementSetPos(newElementId, posX, posY);
if (NULL==tmpScene) {
EWOL_ERROR("NULL obj...");
lua_pushboolean(L, false );
return 1;
}
int32_t idElement = luaL_checkint(L, 1);
if (0 != idElement) {
ewol::GameElement* tmpElem = tmpScene->GetElement(idElement);
if (NULL != tmpElem) {
lua_pushboolean(L, true );
} else {
lua_pushboolean(L, false );
}
} else {
lua_pushboolean(L, false );
}
// return number of parameters
return 1;
}
LUAMOD_API int lua_HaveImpact(lua_State *L)
{
//LUA : ElementSetPos(newElementId, posX, posY);
if (NULL==tmpScene || NULL==tmpObj) {
EWOL_ERROR("NULL obj...");
lua_pushboolean(L, false );
return 1;
}
// TODO : Remove this when find an other way do do it ...
ewol::GameElementLua * ttmpObj = tmpObj;
etk::Vector<ewol::Sprite*> * ttmpSprite = tmpSprite;
ewol::SceneElement * ttmpScene = tmpScene;
bool result = tmpScene->HaveImpact(tmpObj->GroupGet(), tmpObj->TypeGet(), tmpObj->PositionGet(), tmpObj->SizeGet());
tmpObj = ttmpObj;
tmpSprite = ttmpSprite;
tmpScene = ttmpScene;
lua_pushboolean(L, result );
// return number of parameters
return 1;
}
LUAMOD_API int lua_Explosion(lua_State *L)
{
//LUA : ElementSetPos(newElementId, posX, posY);
if (NULL==tmpScene || NULL==tmpObj) {
EWOL_ERROR("NULL obj...");
return 0;
}
// TODO : Remove this when find an other way do do it ...
ewol::GameElementLua * ttmpObj = tmpObj;
etk::Vector<ewol::Sprite*> * ttmpSprite = tmpSprite;
ewol::SceneElement * ttmpScene = tmpScene;
tmpScene->Explosion(tmpObj->GroupGet(), tmpObj->TypeGet(), tmpObj->PositionGet(), 0.01, tmpObj->PowerGet());
tmpObj = ttmpObj;
tmpSprite = ttmpSprite;
tmpScene = ttmpScene;
// return number of parameters
return 0;
}
static const luaL_Reg functionsTable[] = {
// local element section
{ "GetPos", lua_GetPos },
{ "SetPos", lua_SetPos },
{ "GetSpeed", lua_GetSpeed },
{ "SetSpeed", lua_SetSpeed },
{ "GetAngle", lua_GetAngle },
{ "SetAngle", lua_SetAngle },
{ "GetSize", lua_GetSize },
{ "SetSize", lua_SetSize },
{ "GetPower", lua_GetPower },
{ "SetPower", lua_SetPower },
{ "GetGroup", lua_GetGroup },
{ "SetGroup", lua_SetGroup },
{ "GetCanBeCibled", lua_GetCanBeCibled },
{ "SetCanBeCibled", lua_SetCanBeCibled },
// other element section
{ "ElementAdd", lua_ElementAdd },
{ "ElementExisted", lua_ElmentExisted },
{ "ElementSetPos", lua_ElementSetPos },
{ "ElementGetPos", lua_ElementGetPos },
{ "ElementSetPower", lua_ElementSetPower },
{ "ElementSetAngle", lua_ElementSetAngle },
{ "GetNearestEnemy", lua_GetNearestEnemy },
{ "HaveImpact", lua_HaveImpact },
{ "Explosion", lua_Explosion },
// Sprite section
{ "SpriteLoad", lua_SpriteLoad },
{ "SpriteUnLoad", lua_SpriteUnLoad },
{ "SpriteDraw", lua_SpriteDraw },
{ NULL, NULL }
};
//http://www.swig.org/Doc1.3/Lua.html#Lua_nn13
//http://stackoverflow.com/questions/2521244/how-to-wrap-a-c-function-whose-parameters-are-pointer-to-structs-so-that-it-can
LUAMOD_API int luaopen_myLib(lua_State *L) {
luaL_register(L, "GameElement", functionsTable);
lua_pop(L, 1);
return 1;
}
/*******************************************************************************
** Lua abstraction (END)
******************************************************************************* */
#undef __class__
#define __class__ "GameElementLua"
ewol::GameElementLua::GameElementLua(ewol::SceneElement & sceneElement, etk::UString& tmpName) :
ewol::GameElement(sceneElement, tmpName),
m_luaState(NULL)
{
tmpObj = this;
tmpScene = &m_sceneElement;
etk::File fileElement(tmpName, etk::FILE_TYPE_DATA);
etk::UString tmpCompleatName = fileElement.GetCompleateName();
// create state
m_luaState = luaL_newstate();
if (m_luaState == NULL) {
EWOL_ERROR("LUA: cannot create state: not enough memory");
return;
}
luaL_openlibs(m_luaState);
// open internal specific elements ...
luaopen_myLib(m_luaState);
/*
LuaValue<bool> *myBool = new LuaValue<bool>(m_luaState, "m_testBool");
LuaValue<float> *myValue = new LuaValue<float>(m_luaState, "m_testFloat");
*myBool = false;
*myValue = 18;
*/
int32_t fileSize = fileElement.Size();
if (0==fileSize) {
EWOL_ERROR("This file is empty : " << fileElement);
return;
}
if (false == fileElement.fOpenRead()) {
EWOL_ERROR("Can not open the file : " << fileElement);
return;
}
// allocate data
char * fileBuffer = new char[fileSize+5];
if (NULL == fileBuffer) {
EWOL_ERROR("Error Memory allocation size=" << fileSize);
return;
}
memset(fileBuffer, 0, (fileSize+5)*sizeof(char));
// load data from the file :
fileElement.fRead(fileBuffer, 1, fileSize);
// close the file:
fileElement.fClose();
if (luaL_loadbuffer(m_luaState, fileBuffer, fileSize, tmpName.c_str())) {
//if (luaL_loadfile(m_luaState, "/home/heero/dev/perso/TethysDefender/assets/elementGame/Cube.lua" ) ) {
EWOL_ERROR("LUA: " << lua_tostring(m_luaState, -1));
return;
}
if (NULL != fileBuffer) {
delete[] fileBuffer;
}
// Call the basic for initialise all the element defined by the user...
if (lua_pcall(m_luaState, 0, 0, 0)) {
EWOL_ERROR("LUA: " << lua_tostring(m_luaState, -1));
return;
}
/*
EWOL_INFO("retreave element : " << *myValue << " and : " << *myBool);
*/
tmpObj = NULL;
tmpScene = NULL;
Init();
}
ewol::GameElementLua::~GameElementLua(void)
{
UnInit();
if (NULL != m_luaState) {
lua_close(m_luaState);
m_luaState = NULL;
}
}
void ewol::GameElementLua::Init(void)
{
tmpObj = this;
tmpScene = &m_sceneElement;
if (NULL != m_luaState) {
// call the init function
lua_getglobal(m_luaState, "Init");
if(!lua_isfunction(m_luaState,-1)) {
EWOL_WARNING("LUA: Not Find Init function ");
lua_pop(m_luaState,1);
} else {
// do the call (0 arguments, 0 result)
if (lua_pcall(m_luaState, 0, 0, 0) != 0) {
EWOL_ERROR("LUA: error running function 'Init':" << lua_tostring(m_luaState, -1));
return;
}
}
}
tmpObj = NULL;
tmpScene = NULL;
}
void ewol::GameElementLua::UnInit(void)
{
tmpObj = this;
tmpScene = &m_sceneElement;
if (NULL != m_luaState) {
// call the init function
lua_getglobal(m_luaState, "UnInit");
if(!lua_isfunction(m_luaState,-1)) {
EWOL_WARNING("LUA: Not Find 'UnInit' function ");
lua_pop(m_luaState,1);
} else {
// do the call (0 arguments, 0 result)
if (lua_pcall(m_luaState, 0, 0, 0) != 0) {
EWOL_ERROR("LUA: error running function 'UnInit':" << lua_tostring(m_luaState, -1));
}
}
}
tmpObj = NULL;
tmpScene = NULL;
}
bool ewol::GameElementLua::Process(int64_t time, int32_t deltaTime)
{
tmpObj = this;
tmpScene = &m_sceneElement;
bool retVal = false;
if (NULL != m_luaState) {
// call the init function
lua_getglobal(m_luaState, "Process");
if(!lua_isfunction(m_luaState,-1)) {
EWOL_WARNING("LUA: Not Find 'Process' function ");
lua_pop(m_luaState,1);
} else {
lua_pushnumber(m_luaState, (int32_t)time); // push 1st argument
lua_pushnumber(m_luaState, (int32_t)deltaTime); // push 2nd argument
// do the call (2 arguments, 1 result)
if (lua_pcall(m_luaState, 2, 1, 0) != 0) {
EWOL_ERROR("LUA: error running function 'Process':" << lua_tostring(m_luaState, -1));
} else {
// retrieve result
if (!lua_isboolean(m_luaState, -1)) {
EWOL_ERROR("LUA: function 'Process' must return a boolean");
} else {
retVal = lua_toboolean(m_luaState, -1);
lua_pop(m_luaState, 1);
}
}
}
}
tmpObj = NULL;
tmpScene = NULL;
return retVal;
}
void ewol::GameElementLua::Draw(void)
{
tmpObj = this;
tmpSprite = &m_sceneElement.animated;
if (NULL != m_luaState) {
// call the Draw function
lua_getglobal(m_luaState, "Draw");
if(!lua_isfunction(m_luaState,-1)) {
EWOL_WARNING("LUA: Not Find 'Draw' function ");
lua_pop(m_luaState,1);
} else {
// do the call (0 arguments, 0 result)
if (lua_pcall(m_luaState, 0, 0, 0) != 0) {
EWOL_ERROR("LUA: error running function 'Draw':" << lua_tostring(m_luaState, -1));
}
}
}
tmpObj = NULL;
tmpSprite = NULL;
}
bool ewol::GameElementLua::HaveImpact(int32_t group, int32_t type, Vector2D<float> position, float size)
{
// todo set a flag that permit lua to direct control of this ...
if (false == ewol::GameElement::HaveImpact(group, type, position, size) ) {
return false;
}
//HaveImpact(group, type, posX, posY, size, quadDistance)
tmpObj = this;
bool retVal = true;
if (NULL != m_luaState) {
// call the init function
lua_getglobal(m_luaState, "HaveImpact");
if(!lua_isfunction(m_luaState,-1)) {
EWOL_VERBOSE("LUA: Not Find 'HaveImpact' function ");
lua_pop(m_luaState,1);
} else {
lua_pushnumber(m_luaState, group);
lua_pushnumber(m_luaState, type);
lua_pushnumber(m_luaState, position.x);
lua_pushnumber(m_luaState, position.y);
lua_pushnumber(m_luaState, size);
float quadDistance = quadDist(m_position, position);
lua_pushnumber(m_luaState, quadDistance);
// do the call (6 arguments, 1 result)
if (lua_pcall(m_luaState, 6, 1, 0) != 0) {
EWOL_ERROR("LUA: error running function 'Process':" << lua_tostring(m_luaState, -1));
} else {
// retrieve result
if (!lua_isboolean(m_luaState, -1)) {
EWOL_ERROR("LUA: function 'Process' must return a boolean");
} else {
retVal = lua_toboolean(m_luaState, -1);
lua_pop(m_luaState, 1);
}
}
}
}
tmpObj = NULL;
return retVal;
}
bool ewol::GameElementLua::Explosion(int32_t group, int32_t type, Vector2D<float> position, float pxAtenuation, float power)
{
tmpObj = this;
bool retVal = false;
if (NULL != m_luaState) {
// call the init function
lua_getglobal(m_luaState, "Explosion");
if(!lua_isfunction(m_luaState,-1)) {
EWOL_VERBOSE("LUA: Not Find 'Explosion' function ");
lua_pop(m_luaState,1);
} else {
lua_pushnumber(m_luaState, group);
lua_pushnumber(m_luaState, type);
lua_pushnumber(m_luaState, position.x);
lua_pushnumber(m_luaState, position.y);
lua_pushnumber(m_luaState, pxAtenuation);
lua_pushnumber(m_luaState, power);
float quadDistance = quadDist(m_position, position);
lua_pushnumber(m_luaState, quadDistance);
// do the call (7 arguments, 1 result)
if (lua_pcall(m_luaState, 7, 1, 0) != 0) {
EWOL_ERROR("LUA: error running function 'Explosion':" << lua_tostring(m_luaState, -1));
} else {
// retrieve result
if (!lua_isboolean(m_luaState, -1)) {
EWOL_ERROR("LUA: function 'Process' must return a boolean");
} else {
retVal = lua_toboolean(m_luaState, -1);
lua_pop(m_luaState, 1);
}
}
}
}
tmpObj = NULL;
return retVal;
}
void ewol::GameElementLua::Message(etk::UString control, etk::UString message)
{
tmpObj = this;
if (NULL != m_luaState) {
// call the init function
lua_getglobal(m_luaState, "Message");
if(!lua_isfunction(m_luaState,-1)) {
lua_pop(m_luaState,1);
} else {
lua_pushstring(m_luaState, control.c_str());
lua_pushstring(m_luaState, message.c_str());
// do the call (2 arguments, 0 result)
if (lua_pcall(m_luaState, 2, 0, 0) != 0) {
EWOL_ERROR("LUA: error running function 'Message':" << lua_tostring(m_luaState, -1));
}
}
}
tmpObj = NULL;
}
static ewol::GameElement* LoadSceneElement_lua(ewol::SceneElement & sceneElement, etk::UString& elementName, etk::UString& userString)
{
// try to find the file :
etk::UString tmpName = userString;
tmpName += elementName;
tmpName += ".lua";
// added a new element :
etk::File fileElement(tmpName, etk::FILE_TYPE_DATA);
if (false == fileElement.Exist()) {
EWOL_ERROR("Can not find Game element : " << elementName << " ==> " << tmpName);
return NULL;
}
EWOL_VERBOSE("We find Game element : " << elementName << " ==> " << tmpName);
ewol::GameElementLua * tmpElement = new ewol::GameElementLua(sceneElement, tmpName);
if (NULL == tmpElement) {
EWOL_ERROR("Can not Allocat : " << elementName);
return NULL;
}
return tmpElement;
}
void ewol::RegisterLuaElementInFolder(ewol::SceneElement & sceneElement, etk::UString folder)
{
// TODO : parsing the folder ...
sceneElement.RegisterElementType("??????", &LoadSceneElement_lua, folder);
}
void ewol::RegisterLuaElementSpecify(ewol::SceneElement & sceneElement, etk::UString folder, etk::UString name)
{
sceneElement.RegisterElementType(name, &LoadSceneElement_lua, folder);
}

View File

@ -1,58 +0,0 @@
/**
*******************************************************************************
* @file ewol/Game/GameElementLua.h
* @brief ewol game lua element system (header)
* @author Edouard DUPIN
* @date 30/05/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_GAME_ELEMENT_LUA_H__
#define __EWOL_GAME_ELEMENT_LUA_H__
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <ewol/OObject/Sprite.h>
#include <ewol/Widget.h>
#include <ewol/Game/SceneElement.h>
#include <ewol/Game/GameElement.h>
#include <lua/lua.hpp>
namespace ewol {
class GameElementLua : public ewol::GameElement
{
private:
lua_State *m_luaState; // internal Lua state
public:
GameElementLua(ewol::SceneElement & sceneElement, etk::UString& tmpName);
~GameElementLua(void);
virtual void Init(void);
virtual void UnInit(void);
virtual bool Process(int64_t time, int32_t deltaTime);
virtual void Draw(void);
virtual bool HaveImpact(int32_t group, int32_t type, Vector2D<float> position, float size);
virtual bool Explosion(int32_t group, int32_t type, Vector2D<float> position, float pxAtenuation, float power);
virtual void Message(etk::UString control, etk::UString message);
};
void RegisterLuaElementInFolder(ewol::SceneElement & sceneElement, etk::UString folder);
void RegisterLuaElementSpecify(ewol::SceneElement & sceneElement, etk::UString folder, etk::UString name);
};
#endif

View File

@ -1,364 +0,0 @@
/**
*******************************************************************************
* @file ewol/Game/SceneElement.cpp
* @brief ewol Scene widget system (Sources)
* @author Edouard DUPIN
* @date 17/04/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewol/ewol.h>
#include <ewol/Debug.h>
#include <ewol/Game/GameElement.h>
#include <ewol/Game/GameElementLua.h>
#include <ewol/Game/SceneElement.h>
static uint32_t createUniqueId(uint16_t uniqueID, uint16_t position)
{
return ((uint32_t)uniqueID<< 16) + (uint32_t)position;
}
ewol::SceneElement::SceneElement(void)
{
m_id = 1;
numberOfGroup = MAX_GROUP_NUMBER;
for (int32_t iii=0; iii<MAX_GROUP_NUMBER; iii++) {
int32_t kkk = 0;
for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER-1; jjj++) {
if (iii == kkk) {
kkk++;
}
groupEnemy[iii][jjj] = kkk;
kkk++;
}
groupEnemy[iii][MAX_GROUP_NUMBER-1] = -1;
}
retreviveElement = 0;
allocatedElements = 0;
}
ewol::SceneElement::~SceneElement(void)
{
EWOL_DEBUG("Remove sceane, allocated element : " << allocatedElements << " and retreive : " << retreviveElement);
// clean all element allocated :
for (int32_t jjj=0; jjj<listGarbage.Size(); jjj++) {
if (NULL != listGarbage[jjj]) {
delete(listGarbage[jjj]);
listGarbage[jjj] = NULL;
}
}
listGarbage.Clear();
for (int32_t jjj=0; jjj<listCreatorElement.Size(); jjj++) {
if (NULL != listCreatorElement[jjj]) {
delete(listCreatorElement[jjj]);
listCreatorElement[jjj] = NULL;
}
}
listCreatorElement.Clear();
for (int32_t iii=0; iii<MAX_GROUP_NUMBER; iii++) {
for (int32_t jjj=0; jjj<listAnimatedElements[iii].Size(); jjj++) {
if (NULL != listAnimatedElements[iii][jjj]) {
delete(listAnimatedElements[iii][jjj]);
listAnimatedElements[iii][jjj] = NULL;
}
}
listAnimatedElements[iii].Clear();
}
for (int32_t jjj=0; jjj<animated.Size(); jjj++) {
if (NULL != animated[jjj]) {
delete(animated[jjj]);
animated[jjj] = NULL;
}
}
animated.Clear();
}
void ewol::SceneElement::RegisterElementType(etk::UString name, creatorElement_tf * loadElement, etk::UString userString)
{
// TODO : Check if the element already existed
ewol::listRegisteElement * tmpElement = new listRegisteElement();
if (NULL == tmpElement) {
EWOL_ERROR("Memory error in allocation registered element");
return;
}
tmpElement->name = name;
tmpElement->userString = userString;
tmpElement->loadElement = loadElement;
listCreatorElement.PushBack(tmpElement);
}
void ewol::SceneElement::RmElement(int32_t group, int32_t idElement)
{
if (group < 0 || group >= MAX_GROUP_NUMBER) {
EWOL_ERROR("group is wrong " << group << "!=[0," << MAX_GROUP_NUMBER << "]==> not rm at the system ...");
return;
}
if (idElement < 0 || idElement >= listAnimatedElements[group].Size()) {
EWOL_ERROR("idElement is wrong " << idElement << "!=[0," << listAnimatedElements[group].Size() << "]==> not rm at the system ...");
return;
}
if (NULL == listAnimatedElements[group][idElement]) {
return;
}
// try to find an empty slot :
for (int32_t iii=0; iii<listGarbage.Size(); iii++) {
if (NULL == listGarbage[iii]) {
// find an empty slot ...
listGarbage[iii] = listAnimatedElements[group][idElement];
listAnimatedElements[group][idElement] = NULL;
return;
}
}
listAnimatedElements[group][idElement]->UnInit();
listGarbage.PushBack(listAnimatedElements[group][idElement]);
listAnimatedElements[group][idElement] = NULL;
return;
}
uint32_t ewol::SceneElement::AddElement(int32_t group, ewol::GameElement* newElement)
{
if (NULL == newElement) {
EWOL_ERROR("newElement is empty ==> not added at the system ...");
return 0;
}
if (group < 0 || group >= MAX_GROUP_NUMBER) {
EWOL_ERROR("group is wrong " << group << "!=[0," << MAX_GROUP_NUMBER << "]==> not added at the system ...");
return 0;
}
// for statistic
newElement->Init();
newElement->GroupSet(group);
for (int32_t iii=0; iii<listAnimatedElements[group].Size(); iii++) {
if (NULL == listAnimatedElements[group][iii]) {
// find an empty slot ...
listAnimatedElements[group][iii] = newElement;
return createUniqueId(newElement->GetUniqueId(), iii);
}
}
//did not find empty slot :
listAnimatedElements[group].PushBack(newElement);
if (listAnimatedElements[group].Size()>0) {
return createUniqueId(newElement->GetUniqueId(), listAnimatedElements[group].Size()-1);
} else {
return 0;
}
}
uint32_t ewol::SceneElement::AddElementNamed(int32_t group, etk::UString &elementName)
{
// try to fined it in the garbase :
for (int32_t iii=0; iii<listGarbage.Size(); iii++) {
if (NULL != listGarbage[iii]) {
// check his name :
if (true == listGarbage[iii]->HasName(elementName)) {
// we find a previous element loaded ==> retreve it
int32_t idElementBackAdded = AddElement(group, listGarbage[iii]);
listGarbage[iii] = NULL;
retreviveElement++;
return idElementBackAdded;
}
}
}
ewol::GameElement* newElement=NULL;
// find in registered element
for (int32_t iii=0; iii<listCreatorElement.Size(); iii++) {
if (NULL != listCreatorElement[iii]) {
// check his name :
if (listCreatorElement[iii]->name == elementName) {
// create a new element :
allocatedElements ++;
newElement = (*listCreatorElement[iii]->loadElement)(*this, elementName, listCreatorElement[iii]->userString);
// we find a previous element loaded ==> retreve it
return AddElement(group, newElement);
}
}
}
allocatedElements++;
return AddElement(group, newElement);
}
ewol::GameElement* ewol::SceneElement::GetElement(uint32_t idElement)
{
if (0 == idElement) {
return NULL;
}
uint16_t realUniqueId = (uint16_t)((idElement >> 16 ) & 0x0000FFFF);
uint16_t posInList = (uint16_t)(idElement & 0x0000FFFF);
for (int32_t iii=0; iii<numberOfGroup; iii++) {
if( posInList < listAnimatedElements[iii].Size()
&& NULL != listAnimatedElements[iii][posInList]
&& realUniqueId == listAnimatedElements[iii][posInList]->GetUniqueId()) {
return listAnimatedElements[iii][posInList];
}
}
return NULL;
}
uint32_t ewol::SceneElement::GetNearestEnemy(Vector2D<float> position, int32_t groupId)
{
uint32_t result = 0;
float lastQuadDistance = 9999999999999999.0;
int32_t jjj=0;
if (groupId <0 || groupId >= MAX_GROUP_NUMBER) {
EWOL_ERROR("incorect group number : " << groupId);
return 0;
}
while (groupEnemy[groupId][jjj] != -1) {
int32_t gId = groupEnemy[groupId][jjj];
if (gId == groupId) {
EWOL_ERROR("groupId=" << gId << " is ennemy of groupId:" << groupId);
}
for (int32_t iii=0; iii<listAnimatedElements[gId].Size(); iii++) {
if (NULL != listAnimatedElements[gId][iii]) {
if (true == listAnimatedElements[gId][iii]->CanBeCibledGet()) {
Vector2D<float> tmpPos = listAnimatedElements[gId][iii]->PositionGet();
float distance = quadDist(position, tmpPos);
if (distance <= lastQuadDistance) {
lastQuadDistance = distance;
result = createUniqueId(listAnimatedElements[gId][iii]->GetUniqueId(), iii);
}
}
}
}
jjj++;
}
return result;
}
bool ewol::SceneElement::HaveImpact(int32_t group, int32_t type, Vector2D<float> position, float size)
{
for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER; jjj++) {
if (group != jjj) {
for (int32_t iii=0; iii<listAnimatedElements[jjj].Size(); iii++) {
if (NULL != listAnimatedElements[jjj][iii]) {
if (true == listAnimatedElements[jjj][iii]->HaveImpact(group, type, position, size )) {
return true;
}
}
}
}
}
return false;
}
void ewol::SceneElement::Explosion(int32_t group, int32_t type, Vector2D<float> position, float pxAtenuation, float power)
{
for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER; jjj++) {
for (int32_t iii=0; iii<listAnimatedElements[jjj].Size(); iii++) {
if (NULL != listAnimatedElements[jjj][iii]) {
if (true == listAnimatedElements[jjj][iii]->Explosion(group, type, position, pxAtenuation, power) ) {
RmElement(jjj, iii);
}
}
}
}
}
uint32_t ewol::SceneElement::GetElementAtPos(Vector2D<float> position, int32_t maxDistanceDetection)
{
uint32_t result = 0;
float lastQuadDistance = 9999999999999999.0;
for (int32_t jjj=0; jjj<MAX_GROUP_NUMBER; jjj++) {
for (int32_t iii=0; iii<listAnimatedElements[jjj].Size(); iii++) {
if (NULL != listAnimatedElements[jjj][iii]) {
Vector2D<float> tmpPos = listAnimatedElements[jjj][iii]->PositionGet();
float distance = quadDist(position, tmpPos);
if (distance <= lastQuadDistance) {
lastQuadDistance = distance;
result = createUniqueId(listAnimatedElements[jjj][iii]->GetUniqueId(), iii);
}
}
}
}
if (lastQuadDistance > maxDistanceDetection*maxDistanceDetection) {
return 0;
}
return result;
}
void ewol::SceneElement::SetEventInput(uint32_t id, Vector2D<float> position)
{
EWOL_TODO("but when ...");
}
void ewol::SceneElement::SetEventExternButton(uint32_t id, int32_t btId, int32_t state)
{
EWOL_TODO("but when ...");
}
void ewol::SceneElement::SetEventExternJoystick(uint32_t id, int32_t joyId, float angle, float distance, int32_t state)
{
EWOL_TODO("but when ...");
}
/**
* @brief Load or get a previous loaded sprite, it will be done on the current Sprite list
* @param[in,out] listOfElement Reference on the list of sprite that we need to find if it exist or added a new one
* @param[in] fileName Sprite name
* @param[in] maxSize maximum size of the sprite
* @return the id of the sprite requested or -1 if it does not existed
*/
int32_t ewol::SceneElement::LoadSprite(etk::UString fileName, float maxSize)
{
for (int32_t iii=0; iii<animated.Size(); iii++) {
if (animated[iii] != NULL) {
if (animated[iii]->HasName(fileName) == true) {
// count the number of element registered ...
animated[iii]->IncreaseLoadedTime();
return iii;
}
}
}
// we did not find the sprite ==> created it ...
ewol::Sprite* tmpSprite = new ewol::Sprite(fileName, maxSize, maxSize);
if (NULL == tmpSprite) {
EWOL_ERROR("Allocation error on the sprite : " << fileName);
return -1;
}
// add it :
animated.PushBack(tmpSprite);
return animated.Size() -1;
}
/**
* @brief UnLoad or not(if needed) the sprite selected, it will be done on the current Sprite list
* @param[in,out] listOfElement Reference on the list of sprite that we need to find if it exist or added a new one
* @param[in] spriteId Sprite registered id
* @return ---
*/
void ewol::SceneElement::UnLoadSprite(int32_t spriteId)
{
if (spriteId >= 0 && spriteId < animated.Size()) {
if (animated[spriteId] != NULL) {
// count the number of element registered ...
if (true == animated[spriteId]->DecreaseLoadedTime() ) {
// must remove the sprite ==> pb with the double buffer ...
delete(animated[spriteId]);
animated[spriteId] = NULL;
}
}
}
}

View File

@ -1,92 +0,0 @@
/**
*******************************************************************************
* @file ewol/Game/SceneElement.h
* @brief ewol Scene widget system (header)
* @author Edouard DUPIN
* @date 01/04/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_SCENE_ELEMENT_H__
#define __EWOL_SCENE_ELEMENT_H__
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <ewol/OObject/Sprite.h>
namespace ewol {
class GameElement;
class SceneElement;
typedef ewol::GameElement* (creatorElement_tf)(SceneElement & sceneElement, etk::UString& tmpName, etk::UString& userString);
class listRegisteElement {
public:
etk::UString name; //!< name of an element
etk::UString userString; //!< additionnal sting defined by the user
creatorElement_tf * loadElement; //!< callback function to create it
};
#define MAX_GROUP_NUMBER (32)
class SceneElement {
private:
int16_t m_id; //!< Unique element ID ==> to reference the element unicly
int32_t retreviveElement;
int32_t allocatedElements;
public:
SceneElement(void);
~SceneElement(void);
int32_t numberOfGroup; //!< curent scene number of group
etk::UString groupDescription[MAX_GROUP_NUMBER]; //!< name of all the groups
int32_t groupEnemy[MAX_GROUP_NUMBER][MAX_GROUP_NUMBER]; //!< list of the ennemy
etk::Vector<ewol::Sprite*> animated; //!< element that must be display the second
etk::Vector<ewol::GameElement*> listAnimatedElements[MAX_GROUP_NUMBER]; //!< generic element to display order in the diffferent group
etk::Vector<ewol::GameElement*> listGarbage; //!< garbage of the old element allocated ==> prevent multiple alloc and free
etk::Vector<listRegisteElement*> listCreatorElement; //!< list of all creatable elements
int16_t GetUniqueId(void) { int16_t iddd = m_id; m_id++; return iddd; };
void RegisterElementType(etk::UString name, creatorElement_tf * loadElement, etk::UString userString);
void RmElement(int32_t group, int32_t idElement);
uint32_t AddElement(int32_t group, ewol::GameElement* newElement);
uint32_t AddElementNamed(int32_t group, etk::UString &elementName);
ewol::GameElement* GetElement(uint32_t idElement);
uint32_t GetNearestEnemy(Vector2D<float> position, int32_t groupId);
bool HaveImpact(int32_t group, int32_t type, Vector2D<float> position, float size);
void Explosion(int32_t group, int32_t type, Vector2D<float> position, float pxAtenuation, float power);
uint32_t GetElementAtPos(Vector2D<float> position, int32_t maxDistanceDetection);
void SetEventInput(uint32_t id, Vector2D<float> position);
void SetEventExternButton(uint32_t id, int32_t btId, int32_t state);
void SetEventExternJoystick(uint32_t id, int32_t joyId, float angle, float distance, int32_t state);
/**
* @brief Load or get a previous loaded sprite, it will be done on the current Sprite list
* @param[in] fileName Sprite name
* @param[in] maxSize maximum size of the sprite
* @return the id of the sprite requested or -1 if it does not existed
*/
int32_t LoadSprite(etk::UString fileName, float maxSize);
/**
* @brief UnLoad or not(if needed) the sprite selected, it will be done on the current Sprite list
* @param[in,out] listOfElement Reference on the list of sprite that we need to find if it exist or added a new one
* @param[in] spriteId Sprite registered id
* @return ---
*/
void UnLoadSprite(int32_t spriteId);
};
};
#endif

View File

@ -1,48 +0,0 @@
/**
*******************************************************************************
* @file ewol/OObject.cpp
* @brief ewol OpenGl Object system (Sources)
* @author Edouard DUPIN
* @date 24/10/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <etk/Types.h>
#include <etk/UString.h>
#include <ewol/OObject.h>
#include <ewol/importgl.h>
#undef __class__
#define __class__ "ewol::OObject"
ewol::OObject::OObject(void)
{
m_hasClipping = false;
m_scaling.x = 1.0;
m_scaling.y = 1.0;
m_nbLoadedTime = 1;
}
ewol::OObject::~OObject(void)
{
}

View File

@ -1,78 +0,0 @@
/**
*******************************************************************************
* @file ewol/OObject.h
* @brief ewol OpenGl Object system (header)
* @author Edouard DUPIN
* @date 24/10/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_O_OBJECT_H__
#define __EWOL_O_OBJECT_H__
#include <etk/Types.h>
#include <etk/Color.h>
#include <etk/File.h>
#include <ewol/Debug.h>
#include <ewol/Font.h>
#include <etk/Vector.h>
namespace ewol {
extern "C" {
typedef struct {
int32_t f;
int32_t s;
int32_t t;
}linkCoord_ts;
};
class OObject
{
protected:
int32_t m_nbLoadedTime; //!< specific in case of non multiple allocation
bool m_hasClipping;
clipping_ts m_clipping;
Vector2D<float> m_scaling; //!< scaling ol the object
public:
OObject(void);
virtual ~OObject(void);
void clippingSet(clipping_ts clip) {m_clipping = clip; m_hasClipping = true;};
void clippingDisable(void) {m_hasClipping = false;};
void clippingEnable(void) {m_hasClipping = true;};
void scalingSet(Vector2D<float> scale) {m_scaling = scale;};
virtual void Draw(void) = 0;
/**
* @brief Increase the number of element registered on this class ==> this is specific to decrese the memory usage in special case (scene)
*/
void IncreaseLoadedTime(void) { m_nbLoadedTime++;};
/**
* @brief Decrease the number of element registered on this class ==> this is specific to decrese the memory usage in special case (scene)
* @return true, if no more element registered on it ...
*/
bool DecreaseLoadedTime(void) { m_nbLoadedTime--; if (m_nbLoadedTime <= 0) { return true;} else { return false;} };
};
};
#endif
#include <ewol/OObject/2DTextured.h>
#include <ewol/OObject/2DColored.h>
#include <ewol/OObject/2DText.h>
#include <ewol/OObject/2DTextColored.h>

View File

@ -1,592 +0,0 @@
/**
*******************************************************************************
* @file ewol/OObject/2DColored.cpp
* @brief ewol OpenGl Object system (Sources)
* @author Edouard DUPIN
* @date 09/11/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewol/OObject/2DColored.h>
#include <ewol/importgl.h>
#include <math.h>
#undef __class__
#define __class__ "ewol::OObject2DColored"
ewol::OObject2DColored::OObject2DColored(void)
{
m_triElement = 0;
SetColor(1.0, 1.0, 1.0, 1.0);
}
ewol::OObject2DColored::~OObject2DColored(void)
{
m_coord.Clear();
m_coordColor.Clear();
}
void ewol::OObject2DColored::Draw(void)
{
if (m_coord.Size()<=0) {
return;
}
glPushMatrix();
// Enable Pointers
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_COLOR_ARRAY );
glScalef(m_scaling.x, m_scaling.y, 1.0);
// Set the vertex pointer to our vertex data
glVertexPointer(2, GL_FLOAT, 0, &m_coord[0] );
//glColorPointer(4, oglTypeFloat_t, 0, &m_coordColor[0] );
glColorPointer(4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] );
// Render : draw all of the triangles at once
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
//glDrawElements( GL_TRIANGLES, 0, m_coord.Size());
//EWOL_DEBUG("Draw ..." << m_coord.Size()/3 << " triangle(s)");
// Disable Pointers
glDisableClientState( GL_COLOR_ARRAY );
glDisableClientState( GL_VERTEX_ARRAY );
glPopMatrix();
}
void ewol::OObject2DColored::Clear(void)
{
m_coord.Clear();
m_coordColor.Clear();
}
void generatePolyGone(etk::Vector<Vector2D<float> > & input, etk::Vector<Vector2D<float> > & output )
{
if (input.Size()<3) {
return;
}
// TODO : Regenerate a linear poligone generation
for (int32_t iii=1; iii<input.Size()-1; iii++) {
output.PushBack(input[0]);
output.PushBack(input[iii]);
output.PushBack(input[iii+1]);
}
//EWOL_DEBUG("generate Plygone : " << input.Size() << " ==> " << output.Size() );
}
void SutherlandHodgman(etk::Vector<Vector2D<float> > & input, etk::Vector<Vector2D<float> > & output, float sx, float sy, float ex, float ey)
{
// with Sutherland-Hodgman-Algorithm
if (input.Size() <0) {
return;
}
//int32_t sizeInit=input.Size();
// last element :
Vector2D<float> destPoint;
Vector2D<float> lastElement = input[input.Size()-1];
bool inside = true;
if (lastElement.x < sx) {
inside = false;
}
//EWOL_DEBUG("generate an crop : ");
for(int32_t iii=0; iii<input.Size(); iii++) {
if(input[iii].x < sx) {
if(true == inside) {
//EWOL_DEBUG("element IN ==> OUT ");
//new point intersection ...
//y=aaax+bbb
float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x);
float bbb = lastElement.y - (aaa*lastElement.x);
destPoint.y = aaa*sx + bbb;
destPoint.x = sx;
output.PushBack(destPoint);
} else {
//EWOL_DEBUG("element OUT ==> OUT ");
}
inside = false;
} else {
if(true == inside) {
//EWOL_DEBUG("element IN ==> IN ");
output.PushBack(input[iii]);
} else {
//EWOL_DEBUG("element OUT ==> IN ");
//new point intersection ...
//y=aaax+bbb
float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x);
float bbb = lastElement.y - (aaa*lastElement.x);
destPoint.y = aaa*sx + bbb;
destPoint.x = sx;
output.PushBack(destPoint);
output.PushBack(input[iii]);
}
inside = true;
}
// update the last point position :
lastElement.x = input[iii].x;
lastElement.y = input[iii].y;
}
//EWOL_DEBUG("generate an crop on element : " << sizeInit << " ==> " << output.Size() << "intermediate (1)");
input = output;
output.Clear();
lastElement = input[input.Size()-1];
inside = true;
if (lastElement.y < sy) {
inside = false;
}
for(int32_t iii=0; iii<input.Size(); iii++) {
if(input[iii].y < sy) {
if(true == inside) {
//EWOL_DEBUG("element IN ==> OUT ");
//new point intersection ...
//x=aaay+bbb
float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y);
float bbb = lastElement.x - (aaa*lastElement.y);
destPoint.y = sy;
destPoint.x = sy*aaa + bbb;
output.PushBack(destPoint);
} else {
//EWOL_DEBUG("element OUT ==> OUT ");
}
inside = false;
} else {
if(true == inside) {
//EWOL_DEBUG("element IN ==> IN ");
output.PushBack(input[iii]);
} else {
//EWOL_DEBUG("element OUT ==> IN ");
//new point intersection ...
//y=aaax+bbb
float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y);
float bbb = lastElement.x - (aaa*lastElement.y);
destPoint.y = sy;
destPoint.x = sy*aaa + bbb;
output.PushBack(destPoint);
output.PushBack(input[iii]);
}
inside = true;
}
// update the last point position :
lastElement.x = input[iii].x;
lastElement.y = input[iii].y;
}
input = output;
output.Clear();
lastElement = input[input.Size()-1];
inside = true;
if (lastElement.x > ex) {
inside = false;
}
//EWOL_DEBUG("generate an crop : ");
for(int32_t iii=0; iii<input.Size(); iii++) {
if(input[iii].x > ex) {
if(true == inside) {
//EWOL_DEBUG("element IN ==> OUT ");
//new point intersection ...
//y=aaax+bbb
float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x);
float bbb = lastElement.y - (aaa*lastElement.x);
destPoint.y = aaa*ex + bbb;
destPoint.x = ex;
output.PushBack(destPoint);
} else {
//EWOL_DEBUG("element OUT ==> OUT ");
}
inside = false;
} else {
if(true == inside) {
//EWOL_DEBUG("element IN ==> IN ");
output.PushBack(input[iii]);
} else {
//EWOL_DEBUG("element OUT ==> IN ");
//new point intersection ...
//y=aaax+bbb
float aaa = (lastElement.y-input[iii].y) / (lastElement.x-input[iii].x);
float bbb = lastElement.y - (aaa*lastElement.x);
destPoint.y = aaa*ex + bbb;
destPoint.x = ex;
output.PushBack(destPoint);
output.PushBack(input[iii]);
}
inside = true;
}
// update the last point position :
lastElement.x = input[iii].x;
lastElement.y = input[iii].y;
}
input = output;
output.Clear();
lastElement = input[input.Size()-1];
inside = true;
if (lastElement.y > ey) {
inside = false;
}
for(int32_t iii=0; iii<input.Size(); iii++) {
if(input[iii].y > ey) {
if(true == inside) {
//EWOL_DEBUG("element IN ==> OUT ");
//new point intersection ...
//x=aaay+bbb
float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y);
float bbb = lastElement.x - (aaa*lastElement.y);
destPoint.y = ey;
destPoint.x = ey*aaa + bbb;
output.PushBack(destPoint);
} else {
//EWOL_DEBUG("element OUT ==> OUT ");
}
inside = false;
} else {
if(true == inside) {
//EWOL_DEBUG("element IN ==> IN ");
output.PushBack(input[iii]);
} else {
//EWOL_DEBUG("element OUT ==> IN ");
//new point intersection ...
//y=aaax+bbb
float aaa = (lastElement.x-input[iii].x) / (lastElement.y-input[iii].y);
float bbb = lastElement.x - (aaa*lastElement.y);
destPoint.y = ey;
destPoint.x = ey*aaa + bbb;
output.PushBack(destPoint);
output.PushBack(input[iii]);
}
inside = true;
}
// update the last point position :
lastElement.x = input[iii].x;
lastElement.y = input[iii].y;
}
//EWOL_DEBUG("generate an crop on element : " << sizeInit << " ==> " << output.Size() );
}
void ewol::OObject2DColored::GenerateTriangle(void)
{
m_triElement = 0;
m_coord.PushBack(m_triangle[0]);
m_coordColor.PushBack(m_color[0]);
m_coord.PushBack(m_triangle[1]);
m_coordColor.PushBack(m_color[1]);
m_coord.PushBack(m_triangle[2]);
m_coordColor.PushBack(m_color[2]);
}
void ewol::OObject2DColored::SetColor(etk::Color color)
{
if (m_triElement < 1) {
m_color[0] = color;
}
if (m_triElement < 2) {
m_color[1] = color;
}
if (m_triElement < 3) {
m_color[2] = color;
}
}
void ewol::OObject2DColored::SetColor(float red, float green, float blue, float alpha)
{
if (m_triElement < 1) {
m_color[0] = etk::Color(red, green, blue, alpha);
}
if (m_triElement < 2) {
m_color[1] = etk::Color(red, green, blue, alpha);
}
if (m_triElement < 3) {
m_color[2] = etk::Color(red, green, blue, alpha);
}
}
void ewol::OObject2DColored::SetPoint(Vector2D<float> point)
{
// TODO : Clean this :
Vector2D<float> tmpElement;
tmpElement.x = point.x;
tmpElement.y = point.y;
m_triangle[m_triElement] = tmpElement;
m_triElement++;
if (m_triElement>=3) {
GenerateTriangle();
}
}
void ewol::OObject2DColored::SetPoint(float x, float y)
{
m_triangle[m_triElement].x = x;
m_triangle[m_triElement].y = y;
m_triElement++;
if (m_triElement>=3) {
GenerateTriangle();
}
}
void ewol::OObject2DColored::ResetCount(void)
{
m_triElement = 0;
m_color[1] = m_color[0];
m_color[2] = m_color[0];
}
void ewol::OObject2DColored::Line(float sx, float sy, float ex, float ey, float thickness)
{
ResetCount();
if (sx == ex && sy == ey) {
EWOL_WARNING("Try to draw an line width 0");
return;
}
//teta = tan-1(oposer/adjacent)
float teta = 0;
if (sx <= ex) {
teta = atan((ey-sy)/(ex-sx));
} else {
teta = M_PI + atan((ey-sy)/(ex-sx));
}
if (teta < 0) {
teta += 2*M_PI;
} else if (teta > 2*M_PI) {
teta -= 2*M_PI;
}
//EWOL_DEBUG("teta = " << (teta*180/(M_PI)) << " deg." );
float offsety = sin(teta-M_PI/2) * (thickness/2);
float offsetx = cos(teta-M_PI/2) * (thickness/2);
SetPoint(sx - offsetx, sy - offsety);
SetPoint(sx + offsetx, sy + offsety);
SetPoint(ex + offsetx, ey + offsety);
SetPoint(ex + offsetx, ey + offsety);
SetPoint(ex - offsetx, ey - offsety);
SetPoint(sx - offsetx, sy - offsety);
}
void ewol::OObject2DColored::Rectangle(float x, float y, float w, float h)
{
ResetCount();
/* Bitmap position
* xA xB
* yC *------*
* | |
* | |
* yD *------*
*/
float dxA = x;
float dxB = x + w;
float dyC = y;
float dyD = y + h;
if (true == m_hasClipping) {
if (dxA < m_clipping.x) {
dxA = m_clipping.x;
}
if (dxB > m_clipping.x + m_clipping.w) {
dxB = m_clipping.x + m_clipping.w;
}
if (dyC < m_clipping.y) {
dyC = m_clipping.y;
}
if (dyD > m_clipping.y + m_clipping.h) {
dyD = m_clipping.y + m_clipping.h;
}
}
if( dyC >= dyD
|| dxA >= dxB) {
return;
}
SetPoint(dxA, dyD);
SetPoint(dxA, dyC);
SetPoint(dxB, dyC);
SetPoint(dxB, dyC);
SetPoint(dxB, dyD);
SetPoint(dxA, dyD);
}
void ewol::OObject2DColored::RectangleBorder(float x, float y, float w, float h, float thickness)
{
// TODO : This did not manage the thickness of the line ...
Line(x, y, x+w, y, thickness);
Line(x+w, y, x+w, y+h, thickness);
Line(x+w, y+h, x, y+h, thickness);
Line(x, y+h, x, y, thickness);
}
void ewol::OObject2DColored::Circle(float x, float y, float radius, float thickness)
{
ResetCount();
if (radius<0) {
radius *= -1;
}
if (radius < thickness/2) {
Disc(x, y, thickness/2 + radius);
}
int32_t nbOcurence = radius;
if (nbOcurence < 10)
{
nbOcurence = 10;
}
for (int32_t iii=0; iii<nbOcurence; iii++) {
float angleOne = 2*M_PI* iii / nbOcurence ;
float offsetExty = sin(angleOne) * (radius+thickness/2);
float offsetExtx = cos(angleOne) * (radius+thickness/2);
float offsetInty = sin(angleOne) * (radius-thickness/2);
float offsetIntx = cos(angleOne) * (radius-thickness/2);
float angleTwo = 2*M_PI* (iii+1) / nbOcurence ;
float offsetExt2y = sin(angleTwo) * (radius+thickness/2);
float offsetExt2x = cos(angleTwo) * (radius+thickness/2);
float offsetInt2y = sin(angleTwo) * (radius-thickness/2);
float offsetInt2x = cos(angleTwo) * (radius-thickness/2);
SetPoint(x + offsetIntx, y + offsetInty);
SetPoint(x + offsetExtx, y + offsetExty);
SetPoint(x + offsetExt2x, y + offsetExt2y);
SetPoint(x + offsetExt2x, y + offsetExt2y);
SetPoint(x + offsetInt2x, y + offsetInt2y);
SetPoint(x + offsetIntx, y + offsetInty);
}
}
void ewol::OObject2DColored::CirclePart(float x, float y, float radius, float thickness, float angleStart, float angleStop)
{
ResetCount();
if (radius<0) {
radius *= -1;
}
if (radius < thickness/2) {
Disc(x, y, thickness/2 + radius);
}
angleStart -= 90;
angleStop -= 90;
float AStart = angleStart * (M_PI)/180;
//float AStop = angleStop * (M_PI)/180;
float angleLinear = (angleStop-angleStart)* (M_PI)/180;
int32_t nbOcurence = radius;
if (nbOcurence < 10)
{
nbOcurence = 10;
}
for (int32_t iii=0; iii<nbOcurence; iii++) {
float angleOne = AStart + (angleLinear* iii / nbOcurence) ;
float offsetExty = sin(angleOne) * (radius+thickness/2);
float offsetExtx = cos(angleOne) * (radius+thickness/2);
float offsetInty = sin(angleOne) * (radius-thickness/2);
float offsetIntx = cos(angleOne) * (radius-thickness/2);
float angleTwo = AStart + (angleLinear* (iii+1) / nbOcurence );
float offsetExt2y = sin(angleTwo) * (radius+thickness/2);
float offsetExt2x = cos(angleTwo) * (radius+thickness/2);
float offsetInt2y = sin(angleTwo) * (radius-thickness/2);
float offsetInt2x = cos(angleTwo) * (radius-thickness/2);
SetPoint(x + offsetIntx, y + offsetInty);
SetPoint(x + offsetExtx, y + offsetExty);
SetPoint(x + offsetExt2x, y + offsetExt2y);
SetPoint(x + offsetExt2x, y + offsetExt2y);
SetPoint(x + offsetInt2x, y + offsetInt2y);
SetPoint(x + offsetIntx, y + offsetInty);
}
}
void ewol::OObject2DColored::Disc(float x, float y, float radius)
{
ResetCount();
if (radius<0) {
radius *= -1;
}
int32_t nbOcurence = radius*0.50;
if (nbOcurence < 15)
{
nbOcurence = 15;
}
// TODO : Generate a poligone instead if this ...
for (int32_t iii=0; iii<nbOcurence; iii++) {
SetPoint(x, y);
float angleOne = 2*M_PI* iii / nbOcurence ;
float offsety = sin(angleOne) * radius;
float offsetx = cos(angleOne) * radius;
SetPoint(x + offsetx, y + offsety);
float angleTwo = 2*M_PI* (iii+1) / nbOcurence ;
offsety = sin(angleTwo) * radius;
offsetx = cos(angleTwo) * radius;
SetPoint(x + offsetx, y + offsety);
}
}
void ewol::OObject2DColored::DiscPart(float x, float y, float radius, float angleStart, float angleStop)
{
ResetCount();
if (radius<0) {
radius *= -1;
}
angleStart -= 90;
angleStop -= 90;
float AStart = angleStart * (M_PI)/180;
//float AStop = angleStop * (M_PI)/180;
float angleLinear = (angleStop-angleStart)* (M_PI)/180;
//EWOL_DEBUG("Write a part of disk " << angleStart << " -> " << angleStop << " ocurence=" << (angleLinear*180/(M_PI)) );
int32_t nbOcurence = radius*0.50;
if (nbOcurence < 15)
{
nbOcurence = 15;
}
// TODO : Generate a poligone instead if this ...
for (int32_t iii=0; iii<nbOcurence; iii++) {
SetPoint(x, y);
float angleOne = AStart + (angleLinear* iii / nbOcurence) ;
float offsety = sin(angleOne) * radius;
float offsetx = cos(angleOne) * radius;
SetPoint(x + offsetx, y + offsety);
float angleTwo = AStart + (angleLinear* (iii+1) / nbOcurence) ;
offsety = sin(angleTwo) * radius;
offsetx = cos(angleTwo) * radius;
SetPoint(x + offsetx, y + offsety);
}
}

View File

@ -1,64 +0,0 @@
/**
*******************************************************************************
* @file ewol/OObject/2DColored.h
* @brief ewol OpenGl Object system (header)
* @author Edouard DUPIN
* @date 09/11/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_O_OBJECT_2D_COLORED_H__
#define __EWOL_O_OBJECT_2D_COLORED_H__
#include <ewol/OObject.h>
namespace ewol {
class OObject2DColored :public ewol::OObject
{
public:
OObject2DColored(void);
virtual ~OObject2DColored(void);
public:
virtual void Draw(void);
protected:
etk::Vector<Vector2D<float> > m_coord; //!< internal coord of the object
etk::Vector<etk::Color> m_coordColor; //!< internal color of the different point
//etk::Vector<linkCoord_ts> m_linkCoord; //!< internal link between point to generate triangle
int32_t m_triElement;
etk::Color m_color[3];
Vector2D<float> m_triangle[3];
void GenerateTriangle(void);
void ResetCount(void);
public:
void Clear(void);
void SetColor(float red, float green, float blue, float alpha = 1.0);
void SetColor(etk::Color color);
void SetPoint(Vector2D<float> point);
void SetPoint(float x, float y);
void Line(float sx, float sy, float ex, float ey, float thickness);
void Rectangle(float x, float y, float w, float h);
void RectangleBorder(float x, float y, float w, float h, float thickness);
void Circle(float x, float y, float radius, float thickness);
void CirclePart(float x, float y, float radius, float thickness, float angleStart, float angleStop);
void Disc(float x, float y, float radius);
void DiscPart(float x, float y, float radius, float angleStart, float angleStop);
};
};
#endif

View File

@ -1,105 +0,0 @@
/**
*******************************************************************************
* @file ewol/OObject/2DText.cpp
* @brief ewol OpenGl Object system (Sources)
* @author Edouard DUPIN
* @date 09/11/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewol/OObject/2DText.h>
#include <ewol/importgl.h>
#include <ewol/Texture.h>
#undef __class__
#define __class__ "ewol::OObject2DText"
ewol::OObject2DText::OObject2DText(etk::UString FontName, int32_t size, etk::Color textColorFg)
{
m_textColorFg = textColorFg;
if (FontName == "") {
m_FontId = GetDefaultFontId();
} else {
EWOL_TODO("pas encore fait...");
//m_FontId = GetFontIdWithName(FontName);
m_FontId = -1;
return;
}
}
// open with default font ...
ewol::OObject2DText::OObject2DText(void)
{
m_textColorFg = 0x000000FF;
m_FontId = GetDefaultFontId();
}
ewol::OObject2DText::~OObject2DText(void)
{
}
void ewol::OObject2DText::Draw(void)
{
if (m_coord.Size()<=0) {
// TODO : a remètre ...
//EWOL_WARNING("Nothink to draw...");
return;
}
glColor4ub(m_textColorFg.red, m_textColorFg.green, m_textColorFg.blue, m_textColorFg.alpha);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, ewol::texture::GetGLID(m_FontTextureId));
glEnableClientState( GL_VERTEX_ARRAY ); // Enable Vertex Arrays
glEnableClientState( GL_TEXTURE_COORD_ARRAY ); // Enable Texture Coord Arrays
glVertexPointer( 2, GL_FLOAT, 0, &m_coord[0] );
glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] );
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
//EWOL_DEBUG("request draw of " << m_coord.Size() << " elements");
glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays
glDisableClientState( GL_TEXTURE_COORD_ARRAY ); // Disable Texture Coord Arrays
glDisable(GL_TEXTURE_2D);
}
void ewol::OObject2DText::Clear(void)
{
m_coord.Clear();
m_coordTex.Clear();
}
int32_t ewol::OObject2DText::Text(Vector2D<float> textPos, clipping_ts drawClipping, const etk::UString& unicodeString)
{
m_FontTextureId = 0;
if (m_FontId == -1) {
EWOL_ERROR("Font Id is not corectly defined");
return 0;
}
return ewol::DrawText(m_FontId, textPos, drawClipping, unicodeString, m_FontTextureId, m_coord, m_coordTex);
}
int32_t ewol::OObject2DText::Text(Vector2D<float> textPos, clipping_ts drawClipping, const uniChar_t unicodeChar)
{
m_FontTextureId = 0;
if (m_FontId == -1) {
EWOL_ERROR("Font Id is not corectly defined");
return 0;
}
return ewol::DrawText(m_FontId, textPos, drawClipping, unicodeChar, m_FontTextureId, m_coord, m_coordTex);
}

View File

@ -1,54 +0,0 @@
/**
*******************************************************************************
* @file ewol/OObject/2DText.h
* @brief ewol OpenGl Object system (header)
* @author Edouard DUPIN
* @date 09/11/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_O_OBJECT_2D_TEXT_H__
#define __EWOL_O_OBJECT_2D_TEXT_H__
#include <ewol/OObject.h>
#include <etk/UString.h>
namespace ewol {
class OObject2DText :public ewol::OObject
{
public:
OObject2DText(etk::UString FontName, int32_t size, etk::Color textColorFg);
OObject2DText(void);
virtual ~OObject2DText(void);
public:
virtual void Draw(void);
// set a specific text
void Clear(void);
int32_t Text(Vector2D<float> textPos, clipping_ts drawClipping, const etk::UString& unicodeString);
int32_t Text(Vector2D<float> textPos, clipping_ts drawClipping, const uniChar_t unicodeChar);
protected:
int32_t m_FontId; //!< font internal ID
etk::Color m_textColorFg; //!< text color ...
int32_t m_FontTextureId; //!< font internal Texture ID
etk::Vector<Vector2D<float> > m_coord; //!< internal coord of the object
etk::Vector<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
};
};
#endif

View File

@ -1,154 +0,0 @@
/**
*******************************************************************************
* @file ewol/OObject/2DTextColored.cpp
* @brief ewol OpenGl Object system (Sources)
* @author Edouard DUPIN
* @date 16/01/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewol/OObject/2DTextColored.h>
#include <ewol/importgl.h>
#include <ewol/Texture.h>
#undef __class__
#define __class__ "ewol::OObject2DTextColored"
ewol::OObject2DTextColored::OObject2DTextColored(etk::UString FontName, int32_t size)
{
m_color = etk::color::black;
if (FontName == "") {
m_FontId = GetDefaultFontId();
} else {
EWOL_TODO("pas encore fait...");
//m_FontId = GetFontIdWithName(FontName);
m_FontId = -1;
}
/*
m_coord.SetIncrement(50000);
m_coordTex.SetIncrement(50000);
m_coordColor.SetIncrement(50000);
*/
}
ewol::OObject2DTextColored::OObject2DTextColored(int32_t fontID)
{
m_color = etk::color::black;
if (fontID < 0) {
m_FontId = GetDefaultFontId();
} else {
m_FontId = fontID;
}
}
// open with default font ...
ewol::OObject2DTextColored::OObject2DTextColored(void)
{
m_color = etk::color::black;
m_FontId = GetDefaultFontId();
}
ewol::OObject2DTextColored::~OObject2DTextColored(void)
{
}
void ewol::OObject2DTextColored::Draw(void)
{
if (m_coord.Size()<=0) {
// TODO : a remètre ...
//EWOL_WARNING("Nothink to draw...");
return;
}
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, ewol::texture::GetGLID(m_FontTextureId));
glEnableClientState( GL_VERTEX_ARRAY ); // Enable Vertex Arrays
glEnableClientState( GL_TEXTURE_COORD_ARRAY ); // Enable Texture Coord Arrays
glEnableClientState( GL_COLOR_ARRAY ); // Enable Color Arrays
glVertexPointer( 2, GL_FLOAT, 0, &m_coord[0] );
glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] );
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] );
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
//EWOL_DEBUG("request draw of " << m_coord.Size() << " elements");
glDisableClientState( GL_COLOR_ARRAY ); // Disable Color Arrays
glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays
glDisableClientState( GL_TEXTURE_COORD_ARRAY ); // Disable Texture Coord Arrays
glDisable(GL_TEXTURE_2D);
}
void ewol::OObject2DTextColored::Clear(void)
{
m_coord.Clear();
m_coordTex.Clear();
m_coordColor.Clear();
}
int32_t ewol::OObject2DTextColored::Text(Vector2D<float> textPos, const etk::UString& unicodeString)
{
m_FontTextureId = 0;
if (m_FontId == -1) {
EWOL_ERROR("Font Id is not corectly defined");
return 0;
}
int32_t nbElementInTheArray = m_coord.Size();
int32_t size = 0;
if (true==m_hasClipping) {
size = ewol::DrawText(m_FontId, textPos, m_clipping, unicodeString, m_FontTextureId, m_coord, m_coordTex);
} else {
size = ewol::DrawText(m_FontId, textPos, unicodeString, m_FontTextureId, m_coord, m_coordTex);
}
for (int32_t iii=nbElementInTheArray; iii<m_coord.Size(); iii++) {
m_coordColor.PushBack(m_color);
}
return size;
}
int32_t ewol::OObject2DTextColored::Text(Vector2D<float> textPos, const uniChar_t unicodeChar)
{
m_FontTextureId = 0;
if (m_FontId == -1) {
EWOL_ERROR("Font Id is not corectly defined");
return 0;
}
int32_t nbElementInTheArray = m_coord.Size();
int32_t size = 0;
if (true==m_hasClipping) {
size = ewol::DrawText(m_FontId, textPos, m_clipping, unicodeChar, m_FontTextureId, m_coord, m_coordTex);
} else {
size = ewol::DrawText(m_FontId, textPos, unicodeChar, m_FontTextureId, m_coord, m_coordTex);
}
for (int32_t iii=nbElementInTheArray; iii<m_coord.Size(); iii++) {
m_coordColor.PushBack(m_color);
}
return size;
}
void ewol::OObject2DTextColored::SetColor(etk::Color color)
{
m_color = color;
}
void ewol::OObject2DTextColored::SetColor(float red, float green, float blue, float alpha)
{
m_color = etk::Color(red, green, blue, alpha);
}

View File

@ -1,60 +0,0 @@
/**
*******************************************************************************
* @file ewol/OObject/2DTextColored.h
* @brief ewol OpenGl Object system (header)
* @author Edouard DUPIN
* @date 16/01/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_O_OBJECT_2D_TEXT_COLORED_H__
#define __EWOL_O_OBJECT_2D_TEXT_COLORED_H__
#include <ewol/OObject.h>
namespace ewol {
class OObject2DTextColored :public ewol::OObject
{
public:
OObject2DTextColored(etk::UString FontName, int32_t size);
OObject2DTextColored(int32_t fontID);
OObject2DTextColored(void);
virtual ~OObject2DTextColored(void);
public:
virtual void Draw(void);
void SetColor(float red, float green, float blue, float alpha = 1.0);
void SetColor(etk::Color color);
// set a specific text
void Clear(void);
int32_t Text(Vector2D<float> textPos, const etk::UString& unicodeString);
int32_t Text(Vector2D<float> textPos, const uniChar_t unicodeChar);
protected:
int32_t m_FontId; //!< font internal ID
etk::Color m_color; //!< tmp text color ...
int32_t m_FontTextureId; //!< font internal Texture ID
etk::Vector<Vector2D<float> > m_coord; //!< internal coord of the object
etk::Vector<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
etk::Vector<etk::Color> m_coordColor; //!< internal color of the different point
public:
void SetFontID(int32_t fontID) { m_FontId = fontID; };
int32_t GetFontID(void) { return m_FontId; };
};
};
#endif

View File

@ -1,143 +0,0 @@
/**
*******************************************************************************
* @file ewol/OObject/2DTextured.cpp
* @brief ewol OpenGl Object system (Sources)
* @author Edouard DUPIN
* @date 09/11/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewol/OObject/2DTextured.h>
#include <ewol/Texture.h>
#include <ewol/importgl.h>
#undef __class__
#define __class__ "ewol::OObject2DTextured"
ewol::OObject2DTextured::OObject2DTextured(etk::UString textureName)
{
EWOL_VERBOSE("Create OObject textured : \"" << textureName << "\"");
m_textureId = ewol::texture::Load(textureName);
}
ewol::OObject2DTextured::OObject2DTextured(etk::UString textureName, float sizeX, float sizeY)
{
EWOL_VERBOSE("Create OObject textured : \"" << textureName << "\"");
m_textureId = ewol::texture::Load(textureName, sizeX);
}
ewol::OObject2DTextured::~OObject2DTextured(void)
{
if (-1 != m_textureId) {
ewol::texture::UnLoad(m_textureId);
}
}
void ewol::OObject2DTextured::Draw(void)
{
if (m_coord.Size()<=0) {
return;
}
if (m_textureId == -1) {
EWOL_WARNING("Texture does not exist ...");
return;
}
glColor4f(1.0, 1.0, 1.0, 1.0);
glEnable(GL_TEXTURE_2D);
//EWOL_WARNING("Draw with texture : " << m_textureId << " ==> ogl=" << ewol::texture::GetGLID(m_textureId));
glBindTexture(GL_TEXTURE_2D, ewol::texture::GetGLID(m_textureId));
glEnableClientState( GL_VERTEX_ARRAY ); // Enable Vertex Arrays
glEnableClientState( GL_TEXTURE_COORD_ARRAY ); // Enable Texture Coord Arrays
glEnableClientState( GL_COLOR_ARRAY ); // Enable Color Arrays
glVertexPointer( 2, GL_FLOAT, 0, &m_coord[0] );
glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] );
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] );
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
//EWOL_DEBUG("request draw of " << m_coord.Size() << " elements");
glDisableClientState( GL_COLOR_ARRAY ); // Disable Color Arrays
glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays
glDisableClientState( GL_TEXTURE_COORD_ARRAY ); // Disable Texture Coord Arrays
glDisable(GL_TEXTURE_2D);
}
void ewol::OObject2DTextured::Clear(void)
{
m_coord.Clear();
m_coordTex.Clear();
m_coordColor.Clear();
}
void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, etk::Color tmpColor)
{
Rectangle(x, y, w, h, 0.0, 0.0, 1.0, 1.0, tmpColor);
}
void ewol::OObject2DTextured::Rectangle(float x, float y, float w, float h, float texX, float texY, float texSX, float texSY, etk::Color tmpColor)
{
//EWOL_DEBUG("Add rectangle : ...");
Vector2D<float> point;
texCoord_ts tex;
tex.u = texX;
tex.v = texSY;
point.x = x;
point.y = y;
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(tmpColor);
tex.u = texSX;
tex.v = texSY;
point.x = x + w;
point.y = y;
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(tmpColor);
tex.u = texSX;
tex.v = texY;
point.x = x + w;
point.y = y + h;
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(tmpColor);
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(tmpColor);
tex.u = texX;
tex.v = texY;
point.x = x;
point.y = y + h;
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(tmpColor);
tex.u = texX;
tex.v = texSY;
point.x = x;
point.y = y;
m_coord.PushBack(point);
m_coordTex.PushBack(tex);
m_coordColor.PushBack(tmpColor);
}

View File

@ -1,51 +0,0 @@
/**
*******************************************************************************
* @file ewol/OObject/2DTextured.h
* @brief ewol OpenGl Object system (header)
* @author Edouard DUPIN
* @date 09/11/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_O_OBJECT_2D_TEXTURED_H__
#define __EWOL_O_OBJECT_2D_TEXTURED_H__
#include <ewol/OObject.h>
namespace ewol {
class OObject2DTextured :public ewol::OObject
{
public:
OObject2DTextured(etk::UString textureName);
OObject2DTextured(etk::UString textureName, float sizeX, float sizeY);
virtual ~OObject2DTextured(void);
public:
virtual void Draw(void);
void Clear(void);
void Rectangle(float x, float y, float w, float h, float texX=0.0, float texY=0.0, float texSX=1.0, float texSY=1.0, etk::Color tmpColor=etk::color::white);
void Rectangle(float x, float y, float w, float h, etk::Color tmpColor);
protected:
int32_t m_textureId; //!< texture internal ID
etk::Vector<Vector2D<float> > m_coord; //!< internal coord of the object
etk::Vector<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
etk::Vector<etk::Color> m_coordColor; //!< internal color of the different point
};
};
#endif

View File

@ -1,169 +0,0 @@
/**
*******************************************************************************
* @file ewol/OObject/Sprite.cpp
* @brief ewol OpenGl Object system (Sources)
* @author Edouard DUPIN
* @date 04/04/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewol/OObject/Sprite.h>
#include <ewol/Texture.h>
#include <ewol/importgl.h>
#include <math.h>
#undef __class__
#define __class__ "Sprite"
ewol::Sprite::Sprite(etk::UString spriteName)
{
m_name = spriteName;
EWOL_VERBOSE("Create Sprite : \"" << m_name << "\"");
m_textureId = ewol::texture::Load(m_name);
}
ewol::Sprite::Sprite(etk::UString spriteName, float sizeX, float sizeY)
{
m_name = spriteName;
EWOL_VERBOSE("Create Sprite : \"" << m_name << "\"");
m_textureId = ewol::texture::Load(m_name, sizeX);
}
ewol::Sprite::~Sprite(void)
{
if (-1 != m_textureId) {
ewol::texture::UnLoad(m_textureId);
}
}
void ewol::Sprite::Draw(void)
{
if (m_coord.Size()<=0) {
//EWOL_WARNING("Nothink to draw...");
return;
}
if (m_textureId == -1) {
EWOL_WARNING("Texture does not exist ...");
return;
}
glEnable(GL_TEXTURE_2D);
//EWOL_WARNING("Draw with texture : " << m_textureId << " ==> ogl=" << ewol::texture::GetGLID(m_textureId));
glBindTexture(GL_TEXTURE_2D, ewol::texture::GetGLID(m_textureId));
glEnableClientState( GL_VERTEX_ARRAY ); // Enable Vertex Arrays
glEnableClientState( GL_TEXTURE_COORD_ARRAY ); // Enable Texture Coord Arrays
glEnableClientState( GL_COLOR_ARRAY ); // Enable Color Arrays
glVertexPointer( 3, GL_FLOAT, 0, &m_coord[0] );
glTexCoordPointer( 2, GL_FLOAT, 0, &m_coordTex[0] );
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, &m_coordColor[0] );
glDrawArrays( GL_TRIANGLES, 0, m_coord.Size());
//EWOL_DEBUG("request draw of " << m_coord.Size() << " elements");
glDisableClientState( GL_COLOR_ARRAY ); // Disable Color Arrays
glDisableClientState( GL_VERTEX_ARRAY ); // Disable Vertex Arrays
glDisableClientState( GL_TEXTURE_COORD_ARRAY ); // Disable Texture Coord Arrays
glDisable(GL_TEXTURE_2D);
}
void ewol::Sprite::Clear(void)
{
m_coord.Clear();
m_coordTex.Clear();
m_coordColor.Clear();
}
void ewol::Sprite::Element(Vector2D<float> pos, float size, float angle)
{
etk::Color tmpColor(0xFFFFFFFF);
Vector3D<float> pos2;
pos2.x = pos.x;
pos2.y = pos.y;
pos2.z = 0.0;
Element(pos2, size, angle, tmpColor);
}
void ewol::Sprite::Element(Vector3D<float> pos, float size, float angle)
{
etk::Color tmpColor(0xFFFFFFFF);
Element(pos, size, angle, tmpColor);
}
void ewol::Sprite::Element(Vector2D<float> pos, float size, float angle, etk::Color tmpColor)
{
Vector3D<float> pos2;
pos2.x = pos.x;
pos2.y = pos.y;
pos2.z = 0.0;
Element(pos2, size, angle, tmpColor);
}
void ewol::Sprite::Element(Vector3D<float> pos, float size, float angle, etk::Color tmpColor)
{
angle -= M_PI/4;
size *= 0.7;
texCoord_ts texA, texB, texC, texD;
texA.u = 0.0;
texA.v = 0.0;
texB.u = 0.0;
texB.v = 1.0;
texC.u = 1.0;
texC.v = 1.0;
texD.u = 1.0;
texD.v = 0.0;
Vector3D<float> point = pos;
float yyySin = sin(angle) * size;
float xxxCos = cos(angle) * size;
point.x = xxxCos + pos.x;
point.y = yyySin + pos.y;
m_coord.PushBack(point);
m_coordTex.PushBack(texB);
m_coordColor.PushBack(tmpColor);
point.x = yyySin + pos.x;
point.y = -xxxCos + pos.y;
m_coord.PushBack(point);
m_coordTex.PushBack(texC);
m_coordColor.PushBack(tmpColor);
point.x = -xxxCos + pos.x;
point.y = -yyySin + pos.y;
m_coord.PushBack(point);
m_coordTex.PushBack(texD);
m_coordColor.PushBack(tmpColor);
m_coord.PushBack(point);
m_coordTex.PushBack(texD);
m_coordColor.PushBack(tmpColor);
point.x = -yyySin + pos.x;
point.y = xxxCos + pos.y;
m_coord.PushBack(point);
m_coordTex.PushBack(texA);
m_coordColor.PushBack(tmpColor);
point.x = xxxCos + pos.x;
point.y = yyySin + pos.y;
m_coord.PushBack(point);
m_coordTex.PushBack(texB);
m_coordColor.PushBack(tmpColor);
}

View File

@ -1,55 +0,0 @@
/**
*******************************************************************************
* @file ewol/OObject/Sprite.h
* @brief ewol OpenGl Object system (header)
* @author Edouard DUPIN
* @date 04/04/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_O_OBJECT_SPRITE_H__
#define __EWOL_O_OBJECT_SPRITE_H__
#include <ewol/OObject.h>
namespace ewol {
class Sprite :public ewol::OObject
{
private:
etk::UString m_name;
public:
Sprite(etk::UString spriteName);
Sprite(etk::UString spriteName, float sizeX, float sizeY);
virtual ~Sprite(void);
virtual void Draw(void);
void Clear(void);
void Element(Vector2D<float> pos, float size, float angle);
void Element(Vector3D<float> pos, float size, float angle);
void Element(Vector2D<float> pos, float size, float angle, etk::Color tmpColor);
void Element(Vector3D<float> pos, float size, float angle, etk::Color tmpColor);
bool HasName(etk::UString& name) { return name == m_name; };
protected:
int32_t m_textureId; //!< texture internal ID
etk::Vector<Vector3D<float> > m_coord; //!< internal coord of the object
etk::Vector<texCoord_ts> m_coordTex; //!< internal texture coordinate for every point
etk::Vector<etk::Color> m_coordColor; //!< internal color of the different point
};
};
#endif

View File

@ -1,148 +0,0 @@
/**
*******************************************************************************
* @file ewol/ShortCutManager.cpp
* @brief ewol shortCut manager (Sources)
* @author Edouard DUPIN
* @date 22/02/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewol/ShortCutManager.h>
#include <ewol/EObject.h>
#include <ewol/ewol.h>
class EventShortCut {
public:
const char * generateEventId; // event generate ID (to be unique it was pointer on the string name)
etk::UString eventData;
bool shift;
bool control;
bool alt;
bool meta;
uniChar_t UnicodeValue;
};
static etk::Vector<EventShortCut *> l_inputShortCutEvent; //!< generic short-cut event
void ewol::shortCut::Add(bool shift, bool control, bool alt, bool meta, uniChar_t unicodeValue, const char * generateEventId, etk::UString data)
{
EventShortCut * newEvent = new EventShortCut();
if (NULL == newEvent) {
EWOL_ERROR("Allocation Error on the shortcut ...");
return;
}
newEvent->generateEventId = generateEventId;
newEvent->shift = shift;
newEvent->control = control;
newEvent->alt = alt;
newEvent->meta = meta;
newEvent->UnicodeValue = unicodeValue;
newEvent->eventData = data;
l_inputShortCutEvent.PushBack(newEvent);
return;
}
void ewol::shortCut::Add(const char * descriptiveString, const char * generateEventId, etk::UString data)
{
if( NULL==descriptiveString
|| 0==strlen(descriptiveString))
{
return;
}
bool shift = false;
bool control = false;
bool alt = false;
bool meta = false;
uint32_t UnicodeValue = 0;
// parsing of the string :
//"ctrl+shift+alt+meta+s"
const char * tmp = strstr(descriptiveString, "ctrl");
if(NULL != tmp) {
control = true;
}
tmp = strstr(descriptiveString, "shift");
if(NULL != tmp) {
shift = true;
}
tmp = strstr(descriptiveString, "alt");
if(NULL != tmp) {
alt = true;
}
tmp = strstr(descriptiveString, "meta");
if(NULL != tmp) {
meta = true;
}
UnicodeValue = descriptiveString[strlen(descriptiveString) -1];
// add with generic Adding function ...
ewol::shortCut::Add(shift, control, alt, meta, UnicodeValue, generateEventId, data);
}
void ewol::shortCut::Init(void)
{
if (l_inputShortCutEvent.Size()>0) {
EWOL_WARNING("Old element error in the shortCut system");
for(int32_t iii=0; iii< l_inputShortCutEvent.Size(); iii++) {
delete(l_inputShortCutEvent[iii]);
l_inputShortCutEvent[iii] = NULL;
}
}
l_inputShortCutEvent.Clear();
}
void ewol::shortCut::UnInit(void)
{
if (l_inputShortCutEvent.Size()>0) {
for(int32_t iii=0; iii< l_inputShortCutEvent.Size(); iii++) {
delete(l_inputShortCutEvent[iii]);
l_inputShortCutEvent[iii] = NULL;
}
}
l_inputShortCutEvent.Clear();
}
bool ewol::shortCut::Process(bool shift, bool control, bool alt, bool meta, uniChar_t unicodeValue, bool isDown)
{
if (unicodeValue >= 'A' && unicodeValue <='Z') {
unicodeValue += 'a' - 'A';
}
//EWOL_INFO("Try to find generic shortcut ...");
for(int32_t iii=l_inputShortCutEvent.Size()-1; iii>=0; iii--) {
if( l_inputShortCutEvent[iii]->shift == shift
&& l_inputShortCutEvent[iii]->control == control
&& l_inputShortCutEvent[iii]->alt == alt
&& l_inputShortCutEvent[iii]->meta == meta
&& l_inputShortCutEvent[iii]->UnicodeValue == unicodeValue)
{
if (isDown) {
ewol::EObjectMessageMultiCast::AnonymousSend(l_inputShortCutEvent[iii]->generateEventId, l_inputShortCutEvent[iii]->eventData);
} // no else
return true;
}
}
return false;
}

View File

@ -1,42 +0,0 @@
/**
*******************************************************************************
* @file ewol/ShortCutManager.h
* @brief ewol shortCut manager (Header)
* @author Edouard DUPIN
* @date 22/02/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_SHORT_CUT_MANAGER_H__
#define __EWOL_SHORT_CUT_MANAGER_H__
#include <etk/Types.h>
#include <etk/UString.h>
namespace ewol {
namespace shortCut {
void Init(void);
void UnInit(void);
bool Process(bool shift, bool control, bool alt, bool meta, uniChar_t unicodeValue, bool isDown);
};
};
#endif

View File

@ -1,394 +0,0 @@
/**
*******************************************************************************
* @file ewol/Texture.cpp
* @brief ewol Texture loading system (sources)
* @author Edouard DUPIN
* @date 28/10/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewol/Texture.h>
#include <ewol/importgl.h>
#include <ewol/ewol.h>
#include <ewol/Texture/TextureBMP.h>
#include <ewol/Texture/TextureSVG.h>
#include <ewol/Texture/TexturePNG.h>
//! One Texture element
class LoadedTexture
{
public:
etk::UString m_filename;
int32_t m_nbTimeLoaded;
// openGl configuration :
uint32_t m_openGlTextureID;
int32_t m_target;
int32_t m_level;
int32_t m_internalFormat;
int32_t m_width;
int32_t m_height;
int32_t m_border;
int32_t m_format;
int32_t m_type;
char* m_data;
int32_t m_nbBytes;
bool m_loaded;
bool m_destroy;
};
//! List of all Texture loaded ...
etk::Vector<LoadedTexture*> l_listLoadedTexture;
#undef __class__
#define __class__ "texture"
/**
* @brief Initialise the texture namespace (init a mutex)
* @param ---
* @return ---
*/
void ewol::texture::Init(void)
{
EWOL_DEBUG("==> Init Texture-Manager");
}
/**
* @brief Un-Initialise the Texture namespace (Remove all loaded texture and temporary data and remove Mutex)
* @param ---
* @return ---
*/
void ewol::texture::UnInit(void)
{
EWOL_DEBUG("==> Un-Init Texture-Manager");
for (int32_t iii=0; iii<l_listLoadedTexture.Size(); iii++) {
if (l_listLoadedTexture[iii] != NULL) {
delete(l_listLoadedTexture[iii]);
}
l_listLoadedTexture[iii] = NULL;
}
l_listLoadedTexture.Clear();
}
/**
* @brief Specific for Android, some configuration restart openGl context when the screen is rotate, then,
* Android inform us that the openGl context has been destroy. We mark all the texture like not loaded
* To load it again when a new context will be enable (@ref UpdateContext)
* @param ---
* @return ---
*/
void ewol::texture::UpdateContextIsDestroy(void)
{
for (int32_t iii=0; iii < l_listLoadedTexture.Size(); iii++) {
if( NULL != l_listLoadedTexture[iii]
&& NULL != l_listLoadedTexture[iii]->m_data)
{
l_listLoadedTexture[iii]->m_loaded = false;
EWOL_INFO("TEXTURE: Disable [" << iii << "]=(" << l_listLoadedTexture[iii]->m_width << "px," <<
l_listLoadedTexture[iii]->m_height << "px) in file:" <<
l_listLoadedTexture[iii]->m_filename << " OGl_Id=" <<l_listLoadedTexture[iii]->m_openGlTextureID);
// note : the context might be destroy... we can not remove the textures ...
//glDeleteTextures(1, &l_listLoadedTexture[iii]->m_openGlTextureID);
}
}
}
/**
* @brief Check all texture and load/Remove/Reload all texture that has been Add/Remove/Change from the previous display cycle
* @param ---
* @return ---
*/
void ewol::texture::UpdateContext(void)
{
bool needRedraw = false;
for (int32_t iii=0; iii < l_listLoadedTexture.Size(); iii++) {
if( NULL != l_listLoadedTexture[iii]
&& NULL != l_listLoadedTexture[iii]->m_data)
{
if( false == l_listLoadedTexture[iii]->m_destroy
&& false == l_listLoadedTexture[iii]->m_loaded)
{
GLuint textureid;
glGenTextures(1, &textureid);
glBindTexture(l_listLoadedTexture[iii]->m_target, textureid);
//glTexParameteri(tmpTex->m_target, GL_TEXTURE_WRAP_S, GL_REPEAT);
//glTexParameteri(tmpTex->m_target, GL_TEXTURE_WRAP_T, GL_REPEAT);
//--- mode nearest
//glTexParameteri(tmpTex->m_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//glTexParameteri(tmpTex->m_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//--- Mode linear
glTexParameteri(l_listLoadedTexture[iii]->m_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(l_listLoadedTexture[iii]->m_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
EWOL_INFO("TEXTURE: Add [" << iii << "]=(" << l_listLoadedTexture[iii]->m_width << "px," <<
l_listLoadedTexture[iii]->m_height << "px) in file:" <<
l_listLoadedTexture[iii]->m_filename << " OGl_Id=" <<textureid);
glTexImage2D(l_listLoadedTexture[iii]->m_target,
l_listLoadedTexture[iii]->m_level,
l_listLoadedTexture[iii]->m_internalFormat,
l_listLoadedTexture[iii]->m_width,
l_listLoadedTexture[iii]->m_height,
l_listLoadedTexture[iii]->m_border,
l_listLoadedTexture[iii]->m_format,
l_listLoadedTexture[iii]->m_type,
l_listLoadedTexture[iii]->m_data);
l_listLoadedTexture[iii]->m_openGlTextureID = textureid;
l_listLoadedTexture[iii]->m_loaded = true;
needRedraw = true;
} else if ( true == l_listLoadedTexture[iii]->m_destroy
&& true == l_listLoadedTexture[iii]->m_loaded)
{
// Request remove texture ...
EWOL_INFO("TEXTURE: Rm [" << iii << "] file:" << l_listLoadedTexture[iii]->m_filename);
glDeleteTextures(1, &l_listLoadedTexture[iii]->m_openGlTextureID);
l_listLoadedTexture[iii]->m_loaded = false;
l_listLoadedTexture[iii]->m_openGlTextureID = -1;
if (NULL != l_listLoadedTexture[iii]->m_data) {
delete[] l_listLoadedTexture[iii]->m_data;
l_listLoadedTexture[iii]->m_data = NULL;
}
delete(l_listLoadedTexture[iii]);
l_listLoadedTexture[iii] = NULL;
}
}
}
if (true == needRedraw) {
ewol::ForceRedrawAll();
}
}
/**
* @brief Register a texture in the automatic system to load and reload
* @param[in] target Standard element of OpenGL target
* @param[in] level Standard element of OpenGL level
* @param[in] internalFormat Standard element of OpenGL internalFormat
* @param[in] width Standard element of OpenGL width
* @param[in] height Standard element of OpenGL height
* @param[in] border Standard element of OpenGL border
* @param[in] format Standard element of OpenGL format
* @param[in] type Standard element of OpenGL type
* @param[in] data Pointer on the buffer where are contain the data (a copy is done automaticly)
* @param[in] nbBytes Number of byte in the buffer
* @param[in] filename File Name of the texture or "---" if it is an internal loaded texture
* @return The Internal ID of the texture, or -1 if an error occured ...
*/
int32_t ewol::texture::Load(int32_t target, int32_t level, int32_t internalFormat, int32_t width, int32_t height,
int32_t border, int32_t format, int32_t type,
const void* data, int32_t nbBytes, etk::UString filename)
{
LoadedTexture *tmpTex = new LoadedTexture();
int32_t outTextureID = -1;
if (NULL == tmpTex){
EWOL_ERROR("Texture : Allocation ERROR... " << filename);
return -1;
}
if (NULL == data){
EWOL_ERROR("Texture : Input pointer of the data texture =NULL... " << filename);
return -1;
}
tmpTex->m_filename = filename;
tmpTex->m_nbTimeLoaded = 1;
tmpTex->m_openGlTextureID = -1;
tmpTex->m_target = target;
tmpTex->m_level = level;
tmpTex->m_internalFormat = internalFormat;
tmpTex->m_width = width;
tmpTex->m_height = height;
tmpTex->m_border = border;
tmpTex->m_format = format;
tmpTex->m_type = type;
tmpTex->m_nbBytes = nbBytes;
tmpTex->m_data = new char[tmpTex->m_nbBytes+4096];
tmpTex->m_loaded = false;
tmpTex->m_destroy = false;
if (NULL == tmpTex->m_data) {
EWOL_ERROR("Texture : Data Allocation ERROR... " << filename);
return -1;
}
memcpy(tmpTex->m_data, data, sizeof(char) * tmpTex->m_nbBytes);
l_listLoadedTexture.PushBack(tmpTex);
outTextureID = l_listLoadedTexture.Size()-1;
return outTextureID;
}
/**
* @brief get the next power 2 if the input
* @param[in] value Value that we want the next power of 2
* @return result value
*/
static int32_t nextP2(int32_t value)
{
int32_t val=1;
for (int32_t iii=1; iii<31; iii++) {
if (value <= val) {
return val;
}
val *=2;
}
EWOL_CRITICAL("impossible CASE....");
return val;
}
/**
* @brief Load a specific file texture
* @note : dimention must be a power of 2, otherwise, the display can be wrong... For the SVG, the texture automaticly generate the power of 2 dimention ...
* @param[in] fileName File that might be open
* @param[in] requestedWidth Requested size of the file we desire (if we can not resize it, we load it whit his normal size)
* @return The Internal ID of the texture, or -1 if an error occured ...
*/
// TODO : Load non square texture ...
// TODO : Check the size to regenerate the texture if the size change
int32_t ewol::texture::Load(etk::UString tmpfileName, int32_t requestedWidth)
{
int32_t outTextureID = -1;
if (l_listLoadedTexture.Size()!=0) {
for (int32_t iii=0; iii<l_listLoadedTexture.Size(); iii++) {
if (NULL != l_listLoadedTexture[iii]) {
if (l_listLoadedTexture[iii]->m_filename == tmpfileName) {
l_listLoadedTexture[iii]->m_nbTimeLoaded++;
// this prevent the removing of the texture while the cycle is not ended ...
l_listLoadedTexture[iii]->m_destroy = false;
return iii;
}
}
}
}
etk::File fileName(tmpfileName, etk::FILE_TYPE_DATA);
if (false == fileName.Exist()) {
EWOL_ERROR("File does not Exist ... " << fileName);
} else {
// get the upper paw2 ot the size requested...
requestedWidth = nextP2(requestedWidth);
etk::UString fileExtention = fileName.GetExtention();
if (fileExtention == "bmp") {
// create the bitmap texture
ewol::texture::TextureBMP * myBitmap = new ewol::texture::TextureBMP(fileName);
// draw bitmap properties
//myBitmap->Display();
// check if all is OK
if (myBitmap->LoadOK() == true) {
if (myBitmap->Width() != nextP2(myBitmap->Width()) ) {
EWOL_ERROR("Texture has not the good dimention power of 2 : Width=" << myBitmap->Width() << "px ==> maybe not drawable ...");
}
if (myBitmap->Width() != myBitmap->Height()) {
EWOL_ERROR("Texture can not have Width=" << myBitmap->Width() << "px different of height=" << myBitmap->Height() << "px in file:" << fileName);
return -1;
}
outTextureID = ewol::texture::Load(GL_TEXTURE_2D, 0, GL_RGBA, myBitmap->Width(), myBitmap->Height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, myBitmap->Data(), myBitmap->DataSize(), tmpfileName);
}
// removet the bitmap handle
delete (myBitmap);
} else if (fileExtention == "svg") {
/*if (requestedWidth < 32) {
requestedWidth = 32;
}*/
// create the bitmap texture
ewol::texture::TextureSVG * mySvg = new ewol::texture::TextureSVG(fileName, requestedWidth, requestedWidth);
// draw bitmap properties
//mySvg->Display();
// check if all is OK
if (mySvg->LoadOK() == true) {
if (mySvg->Width() != mySvg->Height()) {
EWOL_ERROR("Texture can not have Width=" << mySvg->Width() << "px different of height=" << mySvg->Height() << "px in file:" << fileName);
return -1;
}
outTextureID = ewol::texture::Load(GL_TEXTURE_2D, 0, GL_RGBA, mySvg->Width(), mySvg->Height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, mySvg->Data(), mySvg->DataSize(), tmpfileName);
}
// removet the bitmap handle
delete (mySvg);
} else if (fileExtention == "png") {
EWOL_ERROR("Extention not supported now, but soon " << fileName );
} else {
EWOL_ERROR("Extention not managed " << fileName << " Sopported extention : .bmp / .svg / .png");
}
}
return outTextureID;
}
/**
* @brief Remove a specific texture ID from the system
* @note A texture can be loaded as many time we want, the texture will be destroy only when nobody want the texture anymore
* @param[in] textureID The internal texture ID that might be remove
* @return ---
*/
void ewol::texture::UnLoad(uint32_t textureID)
{
//EWOL_INFO("Unload a specific tecture ID=" << textureID);
if ((int32_t)textureID<l_listLoadedTexture.Size()) {
if (NULL == l_listLoadedTexture[textureID]) {
EWOL_ERROR("Texture : " << textureID << " does not existe anymore...");
return;
}
l_listLoadedTexture[textureID]->m_nbTimeLoaded--;
if (0 == l_listLoadedTexture[textureID]->m_nbTimeLoaded) {
EWOL_DEBUG("Remove openGL texture ID=" << textureID << " file:" << l_listLoadedTexture[textureID]->m_filename);
l_listLoadedTexture[textureID]->m_destroy = true;
}
return;
}
EWOL_CRITICAL("Can not find TextureId=" << (int)textureID << " in the list of texture loaded...==> to remove it ...");
}
/**
* @brief Get the openGL texture ID whith the internal ID
* @param textureID the internal texture ID
* @return the OpenGl texture ID (or 0 if an error occured...)
*/
uint32_t ewol::texture::GetGLID(uint32_t textureID)
{
if ((int32_t)textureID<l_listLoadedTexture.Size()) {
if (l_listLoadedTexture[textureID]!=NULL) {
return l_listLoadedTexture[textureID]->m_openGlTextureID;
} else {
EWOL_ERROR("Texture has been removed previously : " << textureID);
}
}
return 0;
}
/**
* @brief Get the size of the specific texture
* @param[in] textureID the internal texture ID
* @return the width of the texture
*/
int32_t ewol::texture::GetSize(uint32_t textureID)
{
for (int32_t iii=0; iii<l_listLoadedTexture.Size(); iii++) {
if (l_listLoadedTexture[textureID]!=NULL) {
if (l_listLoadedTexture[iii]->m_openGlTextureID == textureID) {
return l_listLoadedTexture[iii]->m_width;
}
} else {
EWOL_ERROR("Texture has been removed previously : " << textureID);
}
}
EWOL_ERROR("Can not find TextureId=" << textureID << " in the list of texture loaded...");
return -1;
}

View File

@ -1,49 +0,0 @@
/**
*******************************************************************************
* @file ewol/Texture.h
* @brief ewol Texture loading system (header)
* @author Edouard DUPIN
* @date 28/10/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_TEXTURE_H__
#define __EWOL_TEXTURE_H__
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <etk/File.h>
namespace ewol
{
namespace texture {
void Init(void);
void UnInit(void);
int32_t Load(etk::UString fileName, int32_t requestedWidth=-1);
int32_t Load(int32_t target, int32_t level, int32_t internalFormat, int32_t width, int32_t height, int32_t border, int32_t format, int32_t type, const void* data, int32_t nbBytes, etk::UString filename);
void UnLoad(uint32_t textureID);
int32_t GetSize(uint32_t textureID);
uint32_t GetGLID(uint32_t textureID);
void UpdateContext(void);
void UpdateContextIsDestroy(void);
void OGLContext(bool enable);
};
};
#endif

View File

@ -1,286 +0,0 @@
/**
*******************************************************************************
* @file ewol/Texture/TextureBMP.cpp
* @brief ewol Texture Bitmap abstraction (sources)
* @author Edouard DUPIN
* @date 28/03/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewol/Texture/TextureBMP.h>
#undef __class__
#define __class__ "texture::TextureBMP"
ewol::texture::TextureBMP::TextureBMP(etk::File & fileName) : m_data(NULL), m_dataGenerate(NULL)
{
m_dataMode = BITS_16_R5G6B5;
m_width = 0;
m_height = 0;
m_size = 0;
// Get the fileSize ...
/*if (fileName.Size() < (int32_t)(sizeof(bitmapFileHeader_ts) + sizeof(bitmapInfoHeader_ts) ) ) {
EWOL_ERROR("not enought data in the file named=\"" << fileName << "\"");
return;
}*/
if(false == fileName.fOpenRead() ) {
EWOL_ERROR("Can not find the file name=\"" << fileName << "\"");
return;
}
// get the data :
if (fileName.fRead(&m_FileHeader,sizeof(bitmapFileHeader_ts),1) != 1) {
EWOL_ERROR("error loading file header");
fileName.fClose();
return;
}
if (fileName.fRead(&m_InfoHeader,sizeof(bitmapInfoHeader_ts),1) != 1) {
EWOL_ERROR("error loading file header");
fileName.fClose();
return;
}
if(false == fileName.fSeek(m_FileHeader.bfOffBits, SEEK_SET)) {
EWOL_ERROR("error with the 'bfOffBits' in the file named=\"" << fileName << "\"");
fileName.fClose();
return;
}
// Check the header error :
if (m_FileHeader.bfType != 0x4D42) {
EWOL_ERROR("the file=\"" << fileName << "\" is not a bitmap file ...");
fileName.fClose();
return;
}
if (m_FileHeader.bfReserved != 0x00000000) {
EWOL_ERROR("the bfReserved feald is not at 0 ==> not supported format ...");
fileName.fClose();
return;
}
if( m_InfoHeader.biBitCount == 16
&& m_InfoHeader.biCompression == 0)
{
m_dataMode = BITS_16_X1R5G5B5;
} else if( m_InfoHeader.biBitCount == 16
&& m_InfoHeader.biCompression == 3)
{
m_dataMode = BITS_16_R5G6B5;
} else if( m_InfoHeader.biBitCount == 24
&& m_InfoHeader.biCompression == 0)
{
m_dataMode = BITS_24_R8G8B8;
} else if( m_InfoHeader.biBitCount == 32
&& m_InfoHeader.biCompression == 3)
{
m_dataMode = BITS_32_X8R8G8B8;
} else if( m_InfoHeader.biBitCount == 32
&& m_InfoHeader.biCompression == 0)
{
m_dataMode = BITS_32_A8R8G8B8;
} else {
EWOL_ERROR("the biBitCount & biCompression fealds are unknow ==> not supported format ...");
fileName.fClose();;
return;
}
m_width = m_InfoHeader.biWidth;
m_height = m_InfoHeader.biHeight;
if(0 != m_InfoHeader.biSizeImage)
{
m_data=new uint8_t[m_InfoHeader.biSizeImage];
if (fileName.fRead(m_data,m_InfoHeader.biSizeImage,1) != 1){
EWOL_CRITICAL("Can not read the file with the good size...");
}
// allocate the destination data ...
m_dataGenerate=new uint8_t[m_width*m_height*4];
}
fileName.fClose();
// need now to generate RGBA data ...
switch(m_dataMode)
{
case BITS_16_R5G6B5:
{
uint16_t * pointer = (uint16_t*)m_data;
for(int32_t yyy=0; yyy<m_height; yyy++) {
for(int32_t xxx=0; xxx<m_width; xxx++) {
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 0] = (int8_t)((*pointer & 0xF800) >> 8);
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 1] = (int8_t)((*pointer & 0x07E0) >> 3);
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 2] = (int8_t)(*pointer << 3);
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 3] = 0xFF;
pointer++;
}
}
}
break;
case BITS_16_X1R5G5B5:
{
uint16_t * pointer = (uint16_t*)m_data;
for(int32_t yyy=0; yyy<m_height; yyy++) {
for(int32_t xxx=0; xxx<m_width; xxx++) {
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 0] = (int8_t)((*pointer & 0x7C00) >> 7);
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 1] = (int8_t)((*pointer & 0x03E0) >> 2);
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 2] = (int8_t)(*pointer << 3);
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 3] = 0xFF;
pointer++;
}
}
}
break;
case BITS_24_R8G8B8:
{
uint8_t * pointer = m_data;
for(int32_t yyy=0; yyy<m_height; yyy++) {
for(int32_t xxx=0; xxx<m_width; xxx++) {
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 0] = *pointer++;
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 1] = *pointer++;
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 2] = *pointer++;
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 3] = 0xFF;
}
}
}
break;
case BITS_32_X8R8G8B8:
{
uint8_t * pointer = m_data;
for(int32_t yyy=0; yyy<m_height; yyy++) {
for(int32_t xxx=0; xxx<m_width; xxx++) {
pointer++;
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 0] = *pointer++;
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 1] = *pointer++;
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 2] = *pointer++;
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 3] = 0xFF;
}
}
}
break;
case BITS_32_A8R8G8B8:
{
uint8_t * pointer = m_data;
for(int32_t yyy=0; yyy<m_height; yyy++) {
for(int32_t xxx=0; xxx<m_width; xxx++) {
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 0] = *pointer++;
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 1] = *pointer++;
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 2] = *pointer++;
m_dataGenerate[4*((m_height-yyy-1) * m_width + xxx ) + 3] = *pointer++;
}
}
}
break;
default:
EWOL_DEBUG(" mode = ERROR");
break;
}
}
ewol::texture::TextureBMP::~TextureBMP(void)
{
if (NULL != m_data) {
delete(m_data);
}
if (NULL != m_dataGenerate) {
delete(m_dataGenerate);
}
}
bool ewol::texture::TextureBMP::LoadOK(void)
{
if (NULL != m_dataGenerate) {
return true;
} else {
return false;
}
};
int32_t ewol::texture::TextureBMP::Width(void)
{
return m_width;
}
int32_t ewol::texture::TextureBMP::Height(void)
{
return m_height;
}
uint8_t * ewol::texture::TextureBMP::Data(void)
{
return m_dataGenerate;
};
uint8_t * ewol::texture::TextureBMP::RawData(void)
{
return m_data;
};
uint32_t ewol::texture::TextureBMP::DataSize(void)
{
if (NULL == m_dataGenerate) {
return 0;
}
return m_width*m_height*4;
}
void ewol::texture::TextureBMP::Display(void)
{
if (NULL == m_data) {
EWOL_ERROR("Might loading error of this Bitmap ...");
return;
}
EWOL_DEBUG(" -----------------------------------------------------------");
if (false) {
EWOL_DEBUG("Display caracteristic of the bitmap : ");
EWOL_DEBUG(" Header of file :");
EWOL_DEBUG(" bfType =" << m_FileHeader.bfType << " 19778 : must always be set to 'BM' to declare that this is a .bmp-file.");
EWOL_DEBUG(" bfSize =" << m_FileHeader.bfSize << " specifies the size of the file in bytes.");
EWOL_DEBUG(" bfReserved=" << m_FileHeader.bfReserved << " must always be set to zero.");
EWOL_DEBUG(" bfOffBits =" << m_FileHeader.bfOffBits << " 1078 : specifies the offset from the beginning of the file to the bitmap data.");
EWOL_DEBUG(" info header of file :");
EWOL_DEBUG(" biSize =" << m_InfoHeader.biSize << " specifies the size of the BITMAPINFOHEADER structure, in bytes.");
EWOL_DEBUG(" biWidth =" << m_InfoHeader.biWidth << " specifies the width of the image, in pixels.");
EWOL_DEBUG(" biHeight =" << m_InfoHeader.biHeight << " specifies the height of the image, in pixels.");
EWOL_DEBUG(" biPlanes =" << m_InfoHeader.biPlanes << " specifies the number of planes of the target device, must be set to zero.");
EWOL_DEBUG(" biBitCount =" << m_InfoHeader.biBitCount << " specifies the number of bits per pixel.");
EWOL_DEBUG(" biCompression =" << m_InfoHeader.biCompression << " Specifies the type of compression, usually set to zero (no compression).");
EWOL_DEBUG(" biSizeImage =" << m_InfoHeader.biSizeImage << " specifies the size of the image data, in bytes. If there is no compression, it is valid to set this member to zero.");
EWOL_DEBUG(" biXPelsPerMeter=" << m_InfoHeader.biXPelsPerMeter << " specifies the the horizontal pixels per meter on the designated targer device, usually set to zero.");
EWOL_DEBUG(" biYPelsPerMeter=" << m_InfoHeader.biYPelsPerMeter << " specifies the the vertical pixels per meter on the designated targer device, usually set to zero.");
EWOL_DEBUG(" biClrUsed =" << m_InfoHeader.biClrUsed << " speglTexImage2Dcifies the number of colors used in the bitmap, if set to zero the number of colors is calculated using the biBitCount member.");
EWOL_DEBUG(" biClrImportant =" << m_InfoHeader.biClrImportant << " specifies the number of color that are 'important' for the bitmap, if set to zero, all colors are important.");
}
EWOL_DEBUG("Bitmap : " << m_width << "x" << m_height);
switch(m_dataMode)
{
case BITS_16_R5G6B5:
EWOL_DEBUG(" mode = 16 bits R5G6B5");
break;
case BITS_16_X1R5G5B5:
EWOL_DEBUG(" mode = 16 bits X1R5G5B5");
break;
case BITS_24_R8G8B8:
EWOL_DEBUG(" mode = 24 bits R8G8B8");
break;
case BITS_32_X8R8G8B8:
EWOL_DEBUG(" mode = 32 bits X8R8G8B8");
break;
case BITS_32_A8R8G8B8:
EWOL_DEBUG(" mode = 32 bits A8R8G8B8");
break;
default:
EWOL_DEBUG(" mode = ERROR");
break;
}
}

View File

@ -1,94 +0,0 @@
/**
*******************************************************************************
* @file ewol/Texture/TextureBMP.h
* @brief ewol Texture Bitmap abstraction (header)
* @author Edouard DUPIN
* @date 28/03/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_TEXTURE_BITMAP_H__
#define __EWOL_TEXTURE_BITMAP_H__
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <etk/File.h>
namespace ewol
{
namespace texture {
#pragma pack(push,1)
typedef struct
{
int16_t bfType;
int32_t bfSize;
int32_t bfReserved;
int32_t bfOffBits;
} bitmapFileHeader_ts;
typedef struct
{
int32_t biSize;
int32_t biWidth;
int32_t biHeight;
int16_t biPlanes;
int16_t biBitCount;
int32_t biCompression;
int32_t biSizeImage;
int32_t biXPelsPerMeter;
int32_t biYPelsPerMeter;
int32_t biClrUsed;
int32_t biClrImportant;
} bitmapInfoHeader_ts;
#pragma pack(pop)
typedef enum {
BITS_16_R5G6B5,
BITS_16_X1R5G5B5,
BITS_24_R8G8B8,
BITS_32_X8R8G8B8,
BITS_32_A8R8G8B8
} modeBitmap_te;
class TextureBMP
{
private:
modeBitmap_te m_dataMode;
int32_t m_width;
int32_t m_height;
int32_t m_size;
uint8_t * m_data;
uint8_t * m_dataGenerate;
bitmapFileHeader_ts m_FileHeader;
bitmapInfoHeader_ts m_InfoHeader;
public:
TextureBMP(etk::File & fileName);
~TextureBMP(void);
bool LoadOK(void);
int32_t Width(void);
int32_t Height(void);
uint8_t * Data(void);
uint8_t * RawData(void);
uint32_t DataSize(void);
void Display(void);
};
};
};
#endif

View File

@ -1,86 +0,0 @@
/**
*******************************************************************************
* @file ewol/Texture/TextureSVG.cpp
* @brief ewol Texture SVG abstraction (Sources)
* @author Edouard DUPIN
* @date 28/03/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewol/Texture/TextureSVG.h>
#undef __class__
#define __class__ "texture::TextureSVG"
ewol::texture::TextureSVG::TextureSVG(etk::File & fileName, int32_t width, int32_t height) : m_elementParsed(fileName)
{
m_loadOK = false;
if (false == m_elementParsed.IsLoadOk()) {
EWOL_ERROR("Error To load SVG file " << fileName.GetCompleateName() );
} else {
m_elementParsed.GenerateAnImage(width, height);
m_loadOK = true;
}
if (width == -1) {
Vector2D<float> elementSize = m_elementParsed.GetDefinedSize();
m_width = elementSize.x;
m_height = elementSize.y;
} else {
m_width = width;
m_height = height;
}
}
ewol::texture::TextureSVG::~TextureSVG(void)
{
}
bool ewol::texture::TextureSVG::LoadOK(void)
{
return m_loadOK;
}
int32_t ewol::texture::TextureSVG::Width(void)
{
return m_width;
}
int32_t ewol::texture::TextureSVG::Height(void)
{
return m_height;
}
uint8_t * ewol::texture::TextureSVG::Data(void)
{
return m_elementParsed.GetPointerOnData();
}
uint32_t ewol::texture::TextureSVG::DataSize(void)
{
return m_elementParsed.GetSizeOnData();
}
void ewol::texture::TextureSVG::Display(void)
{
EWOL_DEBUG("SVG Texture : (" << m_width << "," << m_height << ") loadedOK=" << m_loadOK);
}

View File

@ -1,59 +0,0 @@
/**
*******************************************************************************
* @file ewol/Texture/TextureSVG.h
* @brief ewol Texture SVG abstraction (header)
* @author Edouard DUPIN
* @date 28/03/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_TEXTURE_SVG_H__
#define __EWOL_TEXTURE_SVG_H__
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <etk/File.h>
#include <parserSVG/parserSVG.h>
namespace ewol
{
namespace texture {
class TextureSVG
{
private:
svg::Parser m_elementParsed;
int32_t m_width;
int32_t m_height;
int32_t m_size;
uint8_t * m_data;
bool m_loadOK;
public:
TextureSVG(etk::File & fileName, int32_t width, int32_t height);
~TextureSVG(void);
bool LoadOK(void);
int32_t Width(void);
int32_t Height(void);
uint8_t * Data(void);
uint32_t DataSize(void);
void Display(void);
};
};
};
#endif

View File

@ -1,304 +0,0 @@
/**
*******************************************************************************
* @file ewol/Widget.cpp
* @brief basic ewol Widget (Sources)
* @author Edouard DUPIN
* @date 18/10/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewol/Widget.h>
#include <ewol/EObjectManager.h>
#include <ewol/WidgetManager.h>
#include <ewol/ewol.h>
#include <ewol/importgl.h>
char* ewol::GetCharTypeMoveEvent(eventKbMoveType_te type)
{
char * returnValue = "?";
switch(type) {
case ewol::EVENT_KB_MOVE_TYPE_LEFT: returnValue = "LEFT"; break;
case ewol::EVENT_KB_MOVE_TYPE_RIGHT: returnValue = "RIGHT"; break;
case ewol::EVENT_KB_MOVE_TYPE_UP: returnValue = "UP"; break;
case ewol::EVENT_KB_MOVE_TYPE_DOWN: returnValue = "DOWN"; break;
case ewol::EVENT_KB_MOVE_TYPE_PAGE_UP: returnValue = "PAGE_UP"; break;
case ewol::EVENT_KB_MOVE_TYPE_PAGE_DOWN: returnValue = "PAGE_DOWN"; break;
case ewol::EVENT_KB_MOVE_TYPE_START: returnValue = "START"; break;
case ewol::EVENT_KB_MOVE_TYPE_END: returnValue = "END"; break;
case ewol::EVENT_KB_MOVE_TYPE_CENTER: returnValue = "CENTER"; break;
case ewol::EVENT_KB_MOVE_TYPE_ARRET_DEFIL: returnValue = "ARRET_DEFIL"; break;
case ewol::EVENT_KB_MOVE_TYPE_WAIT: returnValue = "WAIT"; break;
case ewol::EVENT_KB_MOVE_TYPE_INSERT: returnValue = "INSERT"; break;
case ewol::EVENT_KB_MOVE_TYPE_F1: returnValue = "F1"; break;
case ewol::EVENT_KB_MOVE_TYPE_F2: returnValue = "F2"; break;
case ewol::EVENT_KB_MOVE_TYPE_F3: returnValue = "F3"; break;
case ewol::EVENT_KB_MOVE_TYPE_F4: returnValue = "F4"; break;
case ewol::EVENT_KB_MOVE_TYPE_F5: returnValue = "F5"; break;
case ewol::EVENT_KB_MOVE_TYPE_F6: returnValue = "F6"; break;
case ewol::EVENT_KB_MOVE_TYPE_F7: returnValue = "F7"; break;
case ewol::EVENT_KB_MOVE_TYPE_F8: returnValue = "F8"; break;
case ewol::EVENT_KB_MOVE_TYPE_F9: returnValue = "F9"; break;
case ewol::EVENT_KB_MOVE_TYPE_F10: returnValue = "F10"; break;
case ewol::EVENT_KB_MOVE_TYPE_F11: returnValue = "F11"; break;
case ewol::EVENT_KB_MOVE_TYPE_F12: returnValue = "F12"; break;
case ewol::EVENT_KB_MOVE_TYPE_CAPLOCK: returnValue = "CAPLOCK"; break;
case ewol::EVENT_KB_MOVE_TYPE_SHIFT_LEFT: returnValue = "SHIFT_LEFT"; break;
case ewol::EVENT_KB_MOVE_TYPE_SHIFT_RIGHT: returnValue = "SHIFT_RIGHT"; break;
case ewol::EVENT_KB_MOVE_TYPE_CTRL_LEFT: returnValue = "CTRL_LEFT"; break;
case ewol::EVENT_KB_MOVE_TYPE_CTRL_RIGHT: returnValue = "CTRL_RIGHT"; break;
case ewol::EVENT_KB_MOVE_TYPE_META_LEFT: returnValue = "META_LEFT"; break;
case ewol::EVENT_KB_MOVE_TYPE_META_RIGHT: returnValue = "META_RIGHT"; break;
case ewol::EVENT_KB_MOVE_TYPE_ALT: returnValue = "ALT"; break;
case ewol::EVENT_KB_MOVE_TYPE_ALT_GR: returnValue = "ALT_GR"; break;
case ewol::EVENT_KB_MOVE_TYPE_CONTEXT_MENU: returnValue = "CONTEXT_MENU"; break;
case ewol::EVENT_KB_MOVE_TYPE_VER_NUM: returnValue = "VER_NUM"; break;
}
return returnValue;
}
#undef __class__
#define __class__ "Widget"
/**
* @brief Constructor of the widget classes
* @param ---
* @return (no execption generated (not managed in embended platform))
*/
ewol::Widget::Widget(void)
{
m_limitMouseEvent = 3;
m_needRegenerateDisplay = true;
m_origin.x = 0.0;
m_origin.y = 0.0;
m_size.x = 10.0;
m_size.y = 10.0;
m_minSize.x = -1.0;
m_minSize.y = -1.0;
// user settings :
m_userMinSize.x = -1.0;
m_userMinSize.y = -1.0;
SetExpendX();
SetExpendY();
SetFillX();
SetFillY();
m_canFocus = false;
m_hasFocus = false;
m_hide = false;
}
/**
* @brief Destructor of the widget classes
* @param ---
* @return (no execption generated (not managed in embended platform))
*/
ewol::Widget::~Widget(void)
{
// Remove his own focus...
ewol::widgetManager::Rm(this);
}
/**
* @brief Set the widget hidden
* @param ---
* @return ---
*/
void ewol::Widget::Hide(void)
{
m_hide = true;
MarkToRedraw();
ewol::RequestUpdateSize();
}
/**
* @brief Set the widget visible
* @param ---
* @return ---
*/
void ewol::Widget::Show(void)
{
m_hide = false;
MarkToRedraw();
ewol::RequestUpdateSize();
}
/**
* @brief Parrent set the possible diplay size of the current widget whith his own possibilities
* By default this save the widget availlable size in the widget size
* @param[in] availlableX Availlable horisantal pixel size
* @param[in] availlableY Availlable vertical pixel size
* @return ---
*/
bool ewol::Widget::CalculateSize(float availlableX, float availlableY)
{
m_size.x = availlableX;
m_size.y = availlableY;
MarkToRedraw();
return true;
}
/**
* @brief Set focus on this widget
* @param ---
* @return return true if the widget keep the focus
*/
bool ewol::Widget::SetFocus(void)
{
if (true == m_canFocus) {
m_hasFocus = true;
OnGetFocus();
return true;
}
return false;
}
/**
* @brief Remove the focus on this widget
* @param ---
* @return return true if the widget have release his focus (if he has it)
*/
bool ewol::Widget::RmFocus(void)
{
if (true == m_canFocus) {
m_hasFocus = false;
OnLostFocus();
return true;
}
return false;
}
/**
* @brief Set the capability to have the focus
* @param[in] canFocusState new focus capability
* @return ---
*/
void ewol::Widget::SetCanHaveFocus(bool canFocusState)
{
m_canFocus = canFocusState;
if (true == m_hasFocus) {
(void)RmFocus();
}
}
/**
* @brief Keep the focus on this widget ==> this remove the previous focus on all other widget
* @param ---
* @return ---
*/
void ewol::Widget::KeepFocus(void)
{
ewol::widgetManager::FocusKeep(this);
}
/**
* @brief extern interface to request a draw ... (called by the drawing thread [Android, X11, ...])
* This function generate a clipping with the viewport openGL system. Like this a widget draw can not draw over an other widget
* @note This function is virtual for the scrolled widget, and the more complicated OpenGl widget
* @param[in] displayProp properties of the current display
* @return ---
*/
void ewol::Widget::GenDraw(DrawProperty displayProp)
{
if (true==m_hide){
// widget is hidden ...
return;
}
glPushMatrix();
if( (displayProp.m_origin.x > m_origin.x)
|| (displayProp.m_origin.x + displayProp.m_size.x < m_size.x + m_origin.x) ) {
// here we invert the reference of the standard OpenGl view because the reference in the common display is Top left and not buttom left
int32_t tmpOriginX = etk_max(displayProp.m_origin.x, m_origin.x);
int32_t tmppp1 = displayProp.m_origin.x + displayProp.m_size.x;
int32_t tmppp2 = m_origin.x + m_size.x;
int32_t tmpclipX = etk_min(tmppp1, tmppp2) - tmpOriginX;
int32_t tmpOriginY = etk_max(displayProp.m_origin.y, m_origin.y);
tmppp1 = displayProp.m_origin.y + displayProp.m_size.y;
tmppp2 = m_origin.y + m_size.y;
//int32_t tmpclipY = etk_min(tmppp1, tmppp2) - tmpOriginX;
glViewport( tmpOriginX,
tmpOriginY,
tmpclipX,
m_size.y);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthoEwol(-tmpclipX/2, tmpclipX/2, -m_size.y/2, m_size.y/2, -1, 1);
//glOrthoEwol(0., m_size.x, 0., -m_size.y, 1., 20.);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(-tmpclipX/2 - (tmpOriginX-m_origin.x), -m_size.y/2, -1.0);
// Call the widget drawing methode
displayProp.m_origin.x = tmpOriginX;
displayProp.m_origin.y = tmpOriginY;
displayProp.m_size.x = tmpclipX;
displayProp.m_size.y = m_size.y;
OnDraw(displayProp);
} else {
glViewport( m_origin.x,
m_origin.y,
m_size.x,
m_size.y);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthoEwol(-m_size.x/2, m_size.x/2, -m_size.y/2, m_size.y/2, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(-m_size.x/2, -m_size.y/2, -1.0);
// Call the widget drawing methode
displayProp.m_origin = m_origin;
displayProp.m_size = m_size;
OnDraw(displayProp);
}
glPopMatrix();
return;
}
/**
* @brief Request that the current widegt have a periodic call
* @param statusToSet true if the periodic call is needed
* @return ---
*/
void ewol::Widget::PeriodicCallSet(bool statusToSet)
{
if (true == statusToSet) {
ewol::widgetManager::PeriodicCallAdd(this);
} else {
ewol::widgetManager::PeriodicCallRm(this);
}
}
/**
* @brief The widget mark itself that it need to regenerate the nest time.
* @param ---
* @return ---
*/
void ewol::Widget::MarkToRedraw(void)
{
m_needRegenerateDisplay = true;
ewol::widgetManager::MarkDrawingIsNeeded();
};

View File

@ -1,455 +0,0 @@
/**
*******************************************************************************
* @file ewol/Widget.h
* @brief basic ewol Widget (header)
* @author Edouard DUPIN
* @date 18/10/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_WIDGET_H__
#define __EWOL_WIDGET_H__
#include <ewol/EObject.h>
namespace ewol {
class Widget;
};
#include <etk/Types.h>
#include <etk/Vector.h>
#include <ewol/Debug.h>
#include <ewol/OObject.h>
#include <ewol/base/eventInputManagement.h>
namespace ewol {
typedef enum {
EVENT_INPUT_TYPE_DOWN,
EVENT_INPUT_TYPE_MOVE,
EVENT_INPUT_TYPE_SINGLE,
EVENT_INPUT_TYPE_DOUBLE,
EVENT_INPUT_TYPE_TRIPLE,
EVENT_INPUT_TYPE_QUAD,
EVENT_INPUT_TYPE_QUINTE,
EVENT_INPUT_TYPE_UP,
EVENT_INPUT_TYPE_ENTER,
EVENT_INPUT_TYPE_LEAVE,
EVENT_INPUT_TYPE_ABORT, // SPecial event generate when an upper classes get an event ... (TBD)
} eventInputType_te;
typedef enum {
EVENT_KB_TYPE_DOWN,
EVENT_KB_TYPE_UP,
} eventKbType_te;
typedef enum {
EVENT_KB_MOVE_TYPE_LEFT,
EVENT_KB_MOVE_TYPE_RIGHT,
EVENT_KB_MOVE_TYPE_UP,
EVENT_KB_MOVE_TYPE_DOWN,
EVENT_KB_MOVE_TYPE_PAGE_UP,
EVENT_KB_MOVE_TYPE_PAGE_DOWN,
EVENT_KB_MOVE_TYPE_START,
EVENT_KB_MOVE_TYPE_END,
EVENT_KB_MOVE_TYPE_CENTER,
EVENT_KB_MOVE_TYPE_ARRET_DEFIL,
EVENT_KB_MOVE_TYPE_WAIT,
EVENT_KB_MOVE_TYPE_INSERT,
EVENT_KB_MOVE_TYPE_F1,
EVENT_KB_MOVE_TYPE_F2,
EVENT_KB_MOVE_TYPE_F3,
EVENT_KB_MOVE_TYPE_F4,
EVENT_KB_MOVE_TYPE_F5,
EVENT_KB_MOVE_TYPE_F6,
EVENT_KB_MOVE_TYPE_F7,
EVENT_KB_MOVE_TYPE_F8,
EVENT_KB_MOVE_TYPE_F9,
EVENT_KB_MOVE_TYPE_F10,
EVENT_KB_MOVE_TYPE_F11,
EVENT_KB_MOVE_TYPE_F12,
EVENT_KB_MOVE_TYPE_CAPLOCK,
EVENT_KB_MOVE_TYPE_SHIFT_LEFT,
EVENT_KB_MOVE_TYPE_SHIFT_RIGHT,
EVENT_KB_MOVE_TYPE_CTRL_LEFT,
EVENT_KB_MOVE_TYPE_CTRL_RIGHT,
EVENT_KB_MOVE_TYPE_META_LEFT,
EVENT_KB_MOVE_TYPE_META_RIGHT,
EVENT_KB_MOVE_TYPE_ALT,
EVENT_KB_MOVE_TYPE_ALT_GR,
EVENT_KB_MOVE_TYPE_CONTEXT_MENU,
EVENT_KB_MOVE_TYPE_VER_NUM,
} eventKbMoveType_te;
char* GetCharTypeMoveEvent(eventKbMoveType_te type);
class DrawProperty{
public :
Vector2D<int32_t> m_windowsSize;
Vector2D<int32_t> m_origin;
Vector2D<int32_t> m_size;
};
class Widget : public EObject {
public:
/**
* @brief Constructor of the widget classes
* @param ---
* @return (no execption generated (not managed in embended platform))
*/
Widget(void);
/**
* @brief Destructor of the widget classes
* @param ---
* @return ---
*/
virtual ~Widget(void);
/**
* @brief Get the current Object type of the EObject
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type description
* @return true if the object is compatible, otherwise false
*/
virtual const char * const GetObjectType(void) { return "EwolWidget"; };
// ----------------------------------------------------------------------------------------------------------------
// -- Widget Size:
// ----------------------------------------------------------------------------------------------------------------
private:
bool m_hide; //!< hide a widget on the display
protected:
// internal element calculated by the system
Vector2D<float> m_origin; //!< internal ... I do not really known how i can use it ...
Vector2D<float> m_size; //!< internal : current size of the widget
Vector2D<float> m_minSize; //!< user define the minimum size of the widget
// user configuaration
Vector2D<float> m_userMinSize; //!< user define the minimum size of the widget
bool m_userExpendX;
bool m_userExpendY;
bool m_userFillX;
bool m_userFillY;
public:
/**
* @brief Set origin at the widget (must be an parrent widget that set this parameter).
* This represent the absolute origin in the program windows
* @param[in] x Position ot hte horizantal origin
* @param[in] y Position ot hte vertical origin
* @return ---
*/
void SetOrigin(float x, float y) { m_origin.x=x; m_origin.y=y;};
/**
* @brief Get the origin (obsolute position in the windows)
* @param ---
* @return coordonate of the origin requested
*/
Vector2D<float> GetOrigin(void) { return m_origin; };
/**
* @brief Convert the absolute position in the local Position (Relative)
* @param[in] pos Absolute position that you request convertion
* @return the relative position
*/
virtual Vector2D<float> RelativePosition(Vector2D<float> pos) { pos.x -= m_origin.x; pos.y -= m_origin.y; return pos; };
/**
* @brief Parrent set the possible diplay size of the current widget whith his own possibilities
* By default this save the widget availlable size in the widget size
* @param[in] availlableX Availlable horisantal pixel size
* @param[in] availlableY Availlable vertical pixel size
* @return ---
*/
// TODO : Remove bool ==> deprecated ...
// TODO : Rename in SetSize()
virtual bool CalculateSize(float availlableX, float availlableY);
//update the min Size ... and the expend parameters for the sizer
/**
* @brief Calculate the minimum size of the widget that is needed to display or the user requested)
* @param ---
* @return ---
*/
// TODO : Remove bool ==> deprecated ...
virtual bool CalculateMinSize(void) {m_minSize.x = m_userMinSize.x; m_minSize.y = m_userMinSize.y; MarkToRedraw(); return true; };
/**
* @brief User set the minimum size he want to set the display
* @param[in] x Set minimum horizontal size (-1 : no requested)
* @param[in] y Set minimum vertical size (-1 : no requested)
* @return ---
*/
virtual void SetMinSize(float x=-1, float y=-1) { m_userMinSize.x = x; m_userMinSize.y = y; };
/**
* @brief Get the current calculated min size
* @param ---
* @return re size requested
*/
Vector2D<float> GetMinSize(void) { if (false==IsHide()) { return m_minSize; } return Vector2D<float>(0,0); };
/**
* @brief Get the widget size
* @param ---
* @return Requested size
*/
Vector2D<float> GetSize(void) { if (false==IsHide()) { return m_size; } return Vector2D<float>(0,0); };
/**
* @brief Set the horizontal expend capacity
* @param[in] newExpend new Expend state
* @return ---
*/
virtual void SetExpendX(bool newExpend=false) { m_userExpendX = newExpend; };
/**
* @brief Get the horizontal expend capabilities
* @param ---
* @return boolean repensent the capacity to expend
*/
virtual bool CanExpentX(void) { if (false==IsHide()) { return m_userExpendX; } return false; };
/**
* @brief Set the vertical expend capacity
* @param[in] newExpend new Expend state
* @return ---
*/
virtual void SetExpendY(bool newExpend=false) { m_userExpendY = newExpend; };
/**
* @brief Get the vertical expend capabilities
* @param ---
* @return boolean repensent the capacity to expend
*/
virtual bool CanExpentY(void) { if (false==IsHide()) { return m_userExpendY; } return false; };
/**
* @brief Set the horizontal filling capacity
* @param[in] newFill new fill state
* @return ---
*/
virtual void SetFillX(bool newFill=false) { m_userFillX = newFill; };
/**
* @brief Get the horizontal filling capabilities
* @param ---
* @return boolean repensent the capacity to horizontal filling
*/
bool CanFillX(void) { return m_userFillX; };
/**
* @brief Set the vertical filling capacity
* @param[in] newFill new fill state
* @return ---
*/
virtual void SetFillY(bool newFill=false) { m_userFillY = newFill; };
/**
* @brief Get the vertical filling capabilities
* @param ---
* @return boolean repensent the capacity to vertical filling
*/
bool CanFillY(void) { return m_userFillY; };
/**
* @brief Set the widget hidden
* @param ---
* @return ---
*/
void Hide(void);
/**
* @brief Set the widget visible
* @param ---
* @return ---
*/
void Show(void);
/**
* @brief Get the visibility of the widget
* @param ---
* @return true: if the widget is hiden, false: it is visible
*/
bool IsHide(void) { return m_hide; };
// ----------------------------------------------------------------------------------------------------------------
// -- Focus Area
// ----------------------------------------------------------------------------------------------------------------
private:
bool m_hasFocus; //!< set the focus on this widget
bool m_canFocus; //!< the focus can be done on this widget
public:
/**
* @brief Get the focus state of the widget
* @param ---
* @return Focus state
*/
bool GetFocus(void) { return m_hasFocus;};
/**
* @brief Get the capability to have focus
* @param ---
* @return State capability to have focus
*/
bool CanHaveFocus(void) { return m_canFocus;};
/**
* @brief Set focus on this widget
* @param ---
* @return return true if the widget keep the focus
*/
bool SetFocus(void);
/**
* @brief Remove the focus on this widget
* @param ---
* @return return true if the widget have release his focus (if he has it)
*/
bool RmFocus(void);
/**
* @brief Set the capability to have the focus
* @param[in] canFocusState new focus capability
* @return ---
*/
void SetCanHaveFocus(bool canFocusState);
/**
* @brief Keep the focus on this widget ==> this remove the previous focus on all other widget
* @param ---
* @return ---
*/
void KeepFocus(void);
protected:
/**
* @brief Event of the focus has been grep by the current widget
* @param ---
* @return ---
*/
virtual void OnGetFocus(void) {};
/**
* @brief Event of the focus has been lost by the current widget
* @param ---
* @return ---
*/
virtual void OnLostFocus(void) {};
// ----------------------------------------------------------------------------------------------------------------
// -- Mouse event properties Area
// ----------------------------------------------------------------------------------------------------------------
private:
int32_t m_limitMouseEvent; //!< this is to limit the number of mouse event that the widget can supported
public:
/**
* @brief Get the number of mouse event supported
* @param ---
* @return return the number of event that the mouse supported [0..3]
*/
int32_t GetMouseLimit(void) { return m_limitMouseEvent; };
/**
* @brief Get the number of mouse event supported
* @param[in] numberState The number of event that the mouse supported [0..3]
* @return ---
*/
void SetMouseLimit(int32_t numberState) { m_limitMouseEvent = numberState; };
// ----------------------------------------------------------------------------------------------------------------
// -- Periodic call Area
// ----------------------------------------------------------------------------------------------------------------
protected:
/**
* @brief Request that the current widegt have a periodic call
* @param statusToSet true if the periodic call is needed
* @return ---
*/
void PeriodicCallSet(bool statusToSet);
public:
/**
* @brief Periodic call of this widget
* @param localTime curent system time
* @return ---
*/
virtual void PeriodicCall(int64_t localTime) { };
public:
/**
* @brief Get the widget at the specific windows absolute position
* @param[in] pos gAbsolute position of the requested widget knowledge
* @return NULL No widget found
* @return pointer on the widget found
*/
virtual ewol::Widget * GetWidgetAtPos(Vector2D<float> pos) { if (false==IsHide()) { return this; } return NULL; };
/**
* @brief Event on an input of this Widget
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
* @param[in] pos Absolute position of the event
* @return true the event is used
* @return false the event is not used
*/
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, Vector2D<float> pos) { return false; };
/**
* @brief Event on a short-cut of this Widget (in case of return false, the event on the keyevent will arrive in the function @ref OnEventKb)
* @param[in] shift The key Shift (left or/and right) is pressed (if true)
* @param[in] control The key control (left or/and right) is pressed (if true)
* @param[in] alt The key Alt is pressed (if true)
* @param[in] meta The key Meta (windows key/Apple key) (left or/and right) is pressed (if true)
* @param[in] unicodeValue key pressed by the user
* @return true if the event has been used
* @return false if the event has not been used
*/
virtual bool OnEventShortCut(bool shift, bool control, bool alt, bool meta, uniChar_t unicodeValue) { return false; };
/**
* @brief Event on the keybord (if no shortcut has been detected before).
* @param[in] type of the event (ewol::EVENT_KB_TYPE_DOWN or ewol::EVENT_KB_TYPE_UP)
* @param[in] unicodeValue key pressed by the user
* @return true if the event has been used
* @return false if the event has not been used
*/
virtual bool OnEventKb(eventKbType_te typeEvent, uniChar_t unicodeData) { return false; };
/**
* @brief Event on the keyboard that is not a printable key (if no shortcut has been detected before).
* @return true if the event has been used
* @return false if the event has not been used
*/
virtual bool OnEventKbMove(eventKbType_te typeEvent, eventKbMoveType_te moveTypeEvent) { return false; };
// ----------------------------------------------------------------------------------------------------------------
// -- Drawing : All drawing must be done in 2 separate buffer 1 for the current display and 1 for the working...
// ----------------------------------------------------------------------------------------------------------------
protected:
bool m_needRegenerateDisplay; //!< the display might be done the next regeneration
/**
* @brief The widget mark itself that it need to regenerate the nest time.
* @param ---
* @return ---
*/
void MarkToRedraw(void);
/**
* @brief Get the need of the redrawing of the widget and reset it to false
* @param ---
* @return true if we need to redraw
* @return false if we have no need to redraw
*/
bool NeedRedraw(void) { bool tmpData=m_needRegenerateDisplay; m_needRegenerateDisplay=false; return tmpData; };
public:
/**
* @brief extern interface to request a draw ... (called by the drawing thread [Android, X11, ...])
* This function generate a clipping with the viewport openGL system. Like this a widget draw can not draw over an other widget
* @note This function is virtual for the scrolled widget, and the more complicated OpenGl widget
* @param[in] displayProp properties of the current display
* @return ---
*/
virtual void GenDraw(DrawProperty displayProp);
protected:
/**
* @brief Common widget drawing function (called by the drawing thread [Android, X11, ...])
* @param[in] displayProp properties of the current display
* @return ---
*/
virtual void OnDraw(DrawProperty& displayProp) { };
public:
/**
* @brief Event generated when a redraw is needed
* @param ---
* @return ---
*/
virtual void OnRegenerateDisplay(void) { };
}; // end of the class Widget declaration
};// end of namespace
#endif

View File

@ -1,225 +0,0 @@
/**
*******************************************************************************
* @file ewol/WidgetManager.cpp
* @brief basic ewol Widget Manager (Sources)
* @author Edouard DUPIN
* @date 13/11/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewol/WidgetManager.h>
#include <ewol/widget/Joystick.h>
#include <ewol/widget/Button.h>
#include <ewol/widget/ButtonColor.h>
//#include <ewol/widget/Scene.h>
#include <etk/Vector.h>
#undef __class__
#define __class__ "WidgetManager"
static bool IsInit = false;
// For the focus Management
static ewol::Widget * m_focusWidgetDefault = NULL;
static ewol::Widget * m_focusWidgetCurrent = NULL;
static etk::Vector<ewol::Widget*> l_listOfPeriodicWidget;
static bool l_havePeriodic = false;
static bool l_haveRedraw = true;
void ewol::widgetManager::Init(void)
{
EWOL_DEBUG("==> Init Widget-Manager");
// prevent android error ==> can create memory leak but I prefer
m_focusWidgetDefault = NULL;
m_focusWidgetCurrent = NULL;
l_listOfPeriodicWidget.Clear();
l_havePeriodic = false;
l_haveRedraw = true;
// init all the widget global parameters :
ewol::WIDGET_JoystickInit();
ewol::WIDGET_ButtonInit();
ewol::WIDGET_ButtonColorInit();
//ewol::WIDGET_SceneInit();
IsInit = true;
}
void ewol::widgetManager::UnInit(void)
{
EWOL_DEBUG("==> Un-Init Widget-Manager");
EWOL_INFO("Realease all FOCUS");
ewol::widgetManager::FocusSetDefault(NULL);
ewol::widgetManager::FocusRelease();
IsInit = false;
l_listOfPeriodicWidget.Clear();
}
void ewol::widgetManager::Rm(ewol::Widget * newWidget)
{
PeriodicCallRm(newWidget);
FocusRemoveIfRemove(newWidget);
}
/* *************************************************************************
* Focus Area :
* *************************************************************************/
void ewol::widgetManager::FocusKeep(ewol::Widget * newWidget)
{
if (NULL == newWidget) {
// nothing to do ...
return;
}
if (false == newWidget->CanHaveFocus()) {
EWOL_VERBOSE("Widget can not have Focus, id=" << ewol::widgetManager::Get(newWidget));
return;
}
if (newWidget == m_focusWidgetCurrent) {
// nothing to do ...
return;
}
if (NULL != m_focusWidgetCurrent) {
EWOL_DEBUG("Rm Focus on WidgetID=" << m_focusWidgetCurrent->GetId() );
m_focusWidgetCurrent->RmFocus();
}
m_focusWidgetCurrent = newWidget;
if (NULL != m_focusWidgetCurrent) {
EWOL_DEBUG("Set Focus on WidgetID=" << m_focusWidgetCurrent->GetId() );
m_focusWidgetCurrent->SetFocus();
}
}
void ewol::widgetManager::FocusSetDefault(ewol::Widget * newWidget)
{
if (NULL != newWidget && false == newWidget->CanHaveFocus()) {
EWOL_VERBOSE("Widget can not have Focus, id=" << newWidget->GetId() );
return;
}
if (m_focusWidgetDefault == m_focusWidgetCurrent) {
if (NULL != m_focusWidgetCurrent) {
EWOL_DEBUG("Rm Focus on WidgetID=" << m_focusWidgetCurrent->GetId() );
m_focusWidgetCurrent->RmFocus();
}
m_focusWidgetCurrent = newWidget;
if (NULL != m_focusWidgetCurrent) {
EWOL_DEBUG("Set Focus on WidgetID=" << m_focusWidgetCurrent->GetId() );
m_focusWidgetCurrent->SetFocus();
}
}
m_focusWidgetDefault = newWidget;
}
void ewol::widgetManager::FocusRelease(void)
{
if (m_focusWidgetDefault == m_focusWidgetCurrent) {
// nothink to do ...
return;
}
if (NULL != m_focusWidgetCurrent) {
EWOL_DEBUG("Rm Focus on WidgetID=" << m_focusWidgetCurrent->GetId() );
m_focusWidgetCurrent->RmFocus();
}
m_focusWidgetCurrent = m_focusWidgetDefault;
if (NULL != m_focusWidgetCurrent) {
EWOL_DEBUG("Set Focus on WidgetID=" << m_focusWidgetCurrent->GetId() );
m_focusWidgetCurrent->SetFocus();
}
}
ewol::Widget * ewol::widgetManager::FocusGet(void)
{
return m_focusWidgetCurrent;
}
void ewol::widgetManager::FocusRemoveIfRemove(ewol::Widget * newWidget)
{
if (m_focusWidgetCurrent == newWidget) {
EWOL_WARNING("Release Focus when remove widget");
FocusRelease();
}
if (m_focusWidgetDefault == newWidget) {
EWOL_WARNING("Release default Focus when remove widget");
FocusSetDefault(NULL);
}
}
void ewol::widgetManager::PeriodicCallAdd(ewol::Widget * pWidget)
{
for (int32_t iii=0; iii < l_listOfPeriodicWidget.Size(); iii++) {
if (l_listOfPeriodicWidget[iii] == pWidget) {
return;
}
}
for (int32_t iii=0; iii < l_listOfPeriodicWidget.Size(); iii++) {
if (NULL == l_listOfPeriodicWidget[iii]) {
l_listOfPeriodicWidget[iii] = pWidget;
return;
}
}
l_listOfPeriodicWidget.PushBack(pWidget);
l_havePeriodic = true;
}
void ewol::widgetManager::PeriodicCallRm(ewol::Widget * pWidget)
{
int32_t nbElement = 0;
for (int32_t iii=0; iii < l_listOfPeriodicWidget.Size(); iii++) {
if (l_listOfPeriodicWidget[iii] == pWidget) {
l_listOfPeriodicWidget[iii] = NULL;
} else {
nbElement++;
}
}
if (0 == nbElement) {
l_havePeriodic = false;
}
}
void ewol::widgetManager::PeriodicCall(int64_t localTime)
{
for (int32_t iii=0; iii < l_listOfPeriodicWidget.Size(); iii++) {
if (NULL != l_listOfPeriodicWidget[iii]) {
l_listOfPeriodicWidget[iii]->PeriodicCall(localTime);
}
}
}
bool ewol::widgetManager::PeriodicCallHave(void)
{
return l_havePeriodic;
}
void ewol::widgetManager::MarkDrawingIsNeeded(void)
{
l_haveRedraw = true;
}
bool ewol::widgetManager::IsDrawingNeeded(void)
{
bool tmp = l_haveRedraw;
l_haveRedraw = false;
return tmp;
}

View File

@ -1,58 +0,0 @@
/**
*******************************************************************************
* @file ewol/WidgetManager.h
* @brief basic ewol Widget Manager (Header)
* @author Edouard DUPIN
* @date 13/11/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_WIDGET_MANAGER_H__
#define __EWOL_WIDGET_MANAGER_H__
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <ewol/OObject.h>
#include <etk/Vector.h>
#include <ewol/Widget.h>
namespace ewol {
namespace widgetManager {
void Init( void);
void UnInit(void);
// need to call when remove a widget to clear all dependency of the focus system
void Rm( ewol::Widget * newWidget);
void FocusKeep( ewol::Widget * newWidget); // set the focus at the specific widget
void FocusSetDefault(ewol::Widget * newWidget); // select the default focus getter
void FocusRelease( void); // Release focus from the current widget to the default
ewol::Widget * FocusGet( void);
void FocusRemoveIfRemove(ewol::Widget * newWidget);
void PeriodicCallAdd(ewol::Widget * pWidget);
void PeriodicCallRm( ewol::Widget * pWidget);
void PeriodicCall(int64_t localTime);
bool PeriodicCallHave(void);
void MarkDrawingIsNeeded(void);
bool IsDrawingNeeded(void);
};
};
#endif

View File

@ -1,222 +0,0 @@
/**
*******************************************************************************
* @file ewol/Windows.cpp
* @brief ewol window system (sources)
* @author Edouard DUPIN
* @date 20/10/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <etk/Types.h>
#include <etk/UString.h>
#include <ewol/Widget.h>
#include <ewol/Windows.h>
#include <ewol/OObject.h>
#include <ewol/Texture.h>
#include <ewol/Font.h>
#include <ewol/ewol.h>
#include <ewol/importgl.h>
#include <ewol/WidgetManager.h>
#include <ewol/base/eventInputManagement.h>
#undef __class__
#define __class__ "Windows"
//list of local events :
extern const char * const ewolEventWindowsHideKeyboard = "ewol Windows hideKeyboard";
ewol::Windows::Windows(void)
{
SetCanHaveFocus(true);
m_subWidget = NULL;
SetDecorationDisable();
//KeyboardShow(KEYBOARD_MODE_CODE);
}
ewol::Windows::~Windows(void)
{
if (NULL != m_subWidget) {
delete(m_subWidget);
m_subWidget=NULL;
}
for(int32_t iii=0; iii<m_popUpWidgetList.Size(); iii++) {
if (NULL != m_popUpWidgetList[iii]) {
delete(m_popUpWidgetList[iii]);
m_popUpWidgetList[iii]=NULL;
}
}
m_popUpWidgetList.Clear();
}
bool ewol::Windows::CalculateSize(float availlableX, float availlableY)
{
//EWOL_DEBUG("calculateMinSize on : " << m_currentCreateId);
m_size.x = availlableX;
m_size.y = availlableY;
if (NULL != m_subWidget) {
m_subWidget->CalculateMinSize();
// TODO : Check if min Size is possible ...
// TODO : Herited from MinSize .. and expand ???
m_subWidget->CalculateSize(m_size.x, m_size.y);
}
for(int32_t iii=0; iii<m_popUpWidgetList.Size(); iii++) {
if (NULL != m_popUpWidgetList[iii]) {
m_popUpWidgetList[iii]->CalculateMinSize();
m_popUpWidgetList[iii]->CalculateSize(m_size.x, m_size.y);
}
}
return true;
}
/**
* @brief Get the widget at the specific windows absolute position
* @param[in] pos gAbsolute position of the requested widget knowledge
* @return NULL No widget found
* @return pointer on the widget found
*/
ewol::Widget * ewol::Windows::GetWidgetAtPos(Vector2D<float> pos)
{
// calculate relative position
Vector2D<float> relativePos = RelativePosition(pos);
// event go directly on the pop-up
if (0 < m_popUpWidgetList.Size()) {
if (NULL == m_popUpWidgetList[m_popUpWidgetList.Size()-1]) {
m_popUpWidgetList.PopBack();
} else {
return m_popUpWidgetList[m_popUpWidgetList.Size()-1]->GetWidgetAtPos(pos);
}
// otherwise in the normal windows
} else if (NULL != m_subWidget) {
return m_subWidget->GetWidgetAtPos(pos);
}
// otherwise the event go to this widget ...
return this;
}
void ewol::Windows::SysDraw(void)
{
//EWOL_DEBUG("Drow on (" << m_size.x << "," << m_size.y << ")");
// set the size of the open GL system
glViewport(0,0,m_size.x,m_size.y);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
ewol::DrawProperty displayProp;
displayProp.m_windowsSize = m_size;
displayProp.m_origin.x = 0;
displayProp.m_origin.y = 0;
displayProp.m_size = m_size;
GenDraw(displayProp);
glDisable(GL_BLEND);
return;
}
void ewol::Windows::OnRegenerateDisplay(void)
{
if (NULL != m_subWidget) {
m_subWidget->OnRegenerateDisplay();
}
for(int32_t iii=0; iii<m_popUpWidgetList.Size(); iii++) {
if (NULL != m_popUpWidgetList[iii]) {
m_popUpWidgetList[iii]->OnRegenerateDisplay();
}
}
}
void ewol::Windows::OnDraw(ewol::DrawProperty& displayProp)
{
// Clear the screen with transparency ...
glClearColor(0.750, 0.750, 0.750, 0.5);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//EWOL_WARNING(" WINDOWS draw on " << m_currentDrawId);
// first display the windows on the display
if (NULL != m_subWidget) {
m_subWidget->GenDraw(displayProp);
//EWOL_DEBUG("Draw Windows");
}
// second display the pop-up
for(int32_t iii=0; iii<m_popUpWidgetList.Size(); iii++) {
if (NULL != m_popUpWidgetList[iii]) {
m_popUpWidgetList[iii]->GenDraw(displayProp);
//EWOL_DEBUG("Draw Pop-up");
}
}
}
void ewol::Windows::SetSubWidget(ewol::Widget * widget)
{
if (NULL != m_subWidget) {
EWOL_INFO("Remove current main windows Widget...");
delete(m_subWidget);
m_subWidget = NULL;
}
m_subWidget = widget;
// Regenerate the size calculation :
CalculateSize(m_size.x, m_size.y);
}
void ewol::Windows::PopUpWidgetPush(ewol::Widget * widget)
{
m_popUpWidgetList.PushBack(widget);
// Regenerate the size calculation :
CalculateSize(m_size.x, m_size.y);
ewol::eventInput::NewLayerSet();
}
/**
* @brief Inform object that an other object is removed ...
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
* @note : Sub classes must call this class
* @return ---
*/
void ewol::Windows::OnObjectRemove(ewol::EObject * removeObject)
{
// First step call parrent :
ewol::Widget::OnObjectRemove(removeObject);
// second step find if in all the elements ...
if (m_subWidget == removeObject) {
EWOL_DEBUG("Remove main element of the windows ==> destroyed object");
m_subWidget = NULL;
}
for(int32_t iii=m_popUpWidgetList.Size()-1; iii>=0; iii--) {
if(m_popUpWidgetList[iii] == removeObject) {
EWOL_DEBUG("Remove Pop-up [" << iii << "] element of the windows ==> destroyed object");
m_popUpWidgetList[iii] = NULL;
m_popUpWidgetList.Erase(iii);
}
}
}

View File

@ -1,103 +0,0 @@
/**
*******************************************************************************
* @file ewol/Windows.h
* @brief ewol window system (header)
* @author Edouard DUPIN
* @date 20/10/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_WINDOWS_H__
#define __EWOL_WINDOWS_H__
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <etk/Vector.h>
#include <ewol/Widget.h>
namespace ewol {
class Windows :public ewol::Widget
{
public:
Windows(void);
virtual ~Windows(void);
/**
* @brief Get the current Object type of the EObject
* @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it
* @param[in] objectType type description
* @return true if the object is compatible, otherwise false
*/
virtual const char * const GetObjectType(void) { return "EwolWindows"; };
// internal event at ewol system :
public:
void SysDraw(void);
void SysOnShow(void) {};
void SysOnHide(void) {};
void SysOnKill(void) {};
public:
virtual void OnShow(void) { };
virtual void OnHide(void) { };
virtual bool OnKill(void) { return true; };
virtual void OnReduce(void) { };
virtual void On(void) { };
public:
virtual bool CalculateSize(float availlableX, float availlableY);
/**
* @brief Get the widget at the specific windows absolute position
* @param[in] pos gAbsolute position of the requested widget knowledge
* @return NULL No widget found
* @return pointer on the widget found
*/
virtual ewol::Widget * GetWidgetAtPos(Vector2D<float> pos);
private:
bool m_hasDecoration;
public:
void SetDecorationDisable(void)
{
m_hasDecoration = false;
}
void SetDecorationEnable(void)
{
m_hasDecoration = true;
}
private:
ewol::Widget* m_subWidget;
etk::Vector<ewol::Widget*> m_popUpWidgetList;
public:
void SetSubWidget(ewol::Widget * widget);
void PopUpWidgetPush(ewol::Widget * widget);
protected:
virtual void OnDraw(ewol::DrawProperty& displayProp);
public:
virtual void OnRegenerateDisplay(void);
public:
/**
* @brief Inform object that an other object is removed ...
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
* @note : Sub classes must call this class
* @return ---
*/
virtual void OnObjectRemove(ewol::EObject * removeObject);
};
};
#endif

View File

@ -1,374 +0,0 @@
/**
*******************************************************************************
* @file MainThread.cpp
* @brief Main Ewol thread for the abstraction of the OS problematics (Sources)
* @author Edouard DUPIN
* @date 27/01/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <etk/Types.h>
#include <etk/File.h>
#include <ewol/ewol.h>
#include <ewol/Debug.h>
#include <ewol/threadMsg.h>
#include <ewol/base/MainThread.h>
#include <ewol/base/gui.h>
#include <ewol/Texture.h>
#include <ewol/EObject.h>
#include <ewol/EObjectManager.h>
#include <ewol/WidgetManager.h>
#include <ewol/ShortCutManager.h>
#include <ewol/base/eventInputManagement.h>
static ewol::threadMsg::threadMsg_ts androidJniMsg;
enum {
THREAD_INIT,
THREAD_UN_INIT,
THREAD_RECALCULATE_SIZE,
THREAD_RESIZE,
THREAD_HIDE,
THREAD_SHOW,
THREAD_INPUT_MOTION,
THREAD_INPUT_STATE,
THREAD_KEYBORAD_KEY,
THREAD_KEYBORAD_MOVE,
THREAD_JUST_DISPLAY,
};
#include <unistd.h>
typedef struct {
int w;
int h;
} eventResize_ts;
typedef struct {
ewol::inputType_te type;
int pointerID;
float x;
float y;
} eventInputMotion_ts;
typedef struct {
ewol::inputType_te type;
int pointerID;
bool state;
float x;
float y;
} eventInputState_ts;
void EWOL_NativeResize(int w, int h );
void EWOL_NativeRegenerateDisplay(void);
extern guiSystem::event::specialKey_ts specialCurrentKey;
static bool requestEndProcessing = false;
void ewolProcessEvents(void)
{
int32_t nbEvent = 0;
//EWOL_DEBUG(" ******** Event");
ewol::threadMsg::threadMsgContent_ts data;
data.type = THREAD_JUST_DISPLAY;
while (ewol::threadMsg::WaitingMessage(androidJniMsg)>0)
{
nbEvent++;
ewol::threadMsg::WaitMessage(androidJniMsg, data);
if (data.type != THREAD_JUST_DISPLAY) {
//EWOL_DEBUG("EVENT");
switch (data.type) {
case THREAD_INIT:
EWOL_DEBUG("Receive MSG : THREAD_INIT");
break;
case THREAD_UN_INIT:
EWOL_DEBUG("Receive MSG : THREAD_UN_INIT");
requestEndProcessing = true;
break;
case THREAD_RECALCULATE_SIZE:
UpdateGuiSize();
break;
case THREAD_RESIZE:
//EWOL_DEBUG("Receive MSG : THREAD_RESIZE");
{
eventResize_ts * tmpData = (eventResize_ts*)data.data;
EWOL_NativeResize(tmpData->w, tmpData->h);
}
break;
case THREAD_INPUT_MOTION:
//EWOL_DEBUG("Receive MSG : THREAD_INPUT_MOTION");
{
eventInputMotion_ts * tmpData = (eventInputMotion_ts*)data.data;
Vector2D<float> pos;
pos.x = tmpData->x;
pos.y = tmpData->y;
ewol::eventInput::Motion(tmpData->type, tmpData->pointerID, pos);
}
break;
case THREAD_INPUT_STATE:
//EWOL_DEBUG("Receive MSG : THREAD_INPUT_STATE");
{
eventInputState_ts * tmpData = (eventInputState_ts*)data.data;
Vector2D<float> pos;
pos.x = tmpData->x;
pos.y = tmpData->y;
ewol::eventInput::State(tmpData->type, tmpData->pointerID, tmpData->state, pos);
}
break;
case THREAD_KEYBORAD_KEY:
//EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY");
{
guiSystem::event::keyboardKey_ts * tmpData = (guiSystem::event::keyboardKey_ts*)data.data;
specialCurrentKey = tmpData->special;
if (false==ewol::shortCut::Process(tmpData->special.shift, tmpData->special.ctrl, tmpData->special.alt, tmpData->special.meta, tmpData->myChar, tmpData->isDown)) {
guiAbstraction::SendKeyboardEvent(tmpData->isDown, tmpData->myChar);
}
}
break;
case THREAD_KEYBORAD_MOVE:
//EWOL_DEBUG("Receive MSG : THREAD_KEYBORAD_MOVE");
{
guiSystem::event::keyboardMove_ts * tmpData = (guiSystem::event::keyboardMove_ts*)data.data;
specialCurrentKey = tmpData->special;
guiAbstraction::SendKeyboardEventMove(tmpData->isDown, tmpData->move);
}
break;
case THREAD_HIDE:
EWOL_DEBUG("Receive MSG : THREAD_HIDE");
//guiAbstraction::SendKeyboardEventMove(tmpData->isDown, tmpData->move);
//gui_uniqueWindows->SysOnHide();
break;
case THREAD_SHOW:
EWOL_DEBUG("Receive MSG : THREAD_SHOW");
//guiAbstraction::SendKeyboardEventMove(tmpData->isDown, tmpData->move);
//gui_uniqueWindows->SysOnShow();
break;
default:
EWOL_DEBUG("Receive MSG : UNKNOW");
break;
}
}
}
}
void guiSystem::SetArchiveDir(int mode, const char* str)
{
switch(mode)
{
case 0:
EWOL_DEBUG("Directory APK : path=" << str);
etk::SetBaseFolderData(str);
break;
case 1:
EWOL_DEBUG("Directory mode=FILE path=" << str);
etk::SetBaseFolderDataUser(str);
break;
case 2:
EWOL_DEBUG("Directory mode=CACHE path=" << str);
etk::SetBaseFolderCache(str);
break;
case 3:
EWOL_DEBUG("Directory mode=EXTERNAL_CACHE path=" << str);
break;
default:
EWOL_DEBUG("Directory mode=???? path=" << str);
break;
}
}
bool isGlobalSystemInit = false;
void guiSystem::Init(void)
{
EWOL_INFO("==> Ewol System Init (BEGIN)");
if (false == isGlobalSystemInit) {
// create message system ...
EWOL_DEBUG("Init thread message system");
ewol::threadMsg::Init(androidJniMsg);
requestEndProcessing = false;
EWOL_INFO("v" EWOL_VERSION_TAG_NAME);
EWOL_INFO("Build Date: " BUILD_TIME);
etk::InitDefaultFolder("ewolApplNoName");
ewol::EObjectManager::Init();
ewol::EObjectMessageMultiCast::Init();
ewol::eventInput::Init();
ewol::widgetManager::Init();
ewol::texture::Init();
ewol::InitFont();
ewol::shortCut::Init();
APP_Init();
isGlobalSystemInit = true;
EWOL_DEBUG("Send Init message to the thread");
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_INIT, ewol::threadMsg::MSG_PRIO_REAL_TIME);
EWOL_DEBUG("end basic init");
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_RECALCULATE_SIZE, ewol::threadMsg::MSG_PRIO_MEDIUM);
}
EWOL_INFO("==> Ewol System Init (END)");
}
void guiSystem::UnInit(void)
{
EWOL_INFO("==> Ewol System Un-Init (BEGIN)");
if (true == isGlobalSystemInit) {
isGlobalSystemInit = false;
// unset all windows
ewol::DisplayWindows(NULL);
// call application to uninit
APP_UnInit();
ewol::shortCut::UnInit();
ewol::texture::UnInit();
ewol::UnInitFont();
ewol::widgetManager::UnInit();
ewol::EObjectMessageMultiCast::UnInit();
ewol::EObjectManager::UnInit();
ewol::eventInput::UnInit();
ewol::threadMsg::UnInit(androidJniMsg);
}
EWOL_INFO("==> Ewol System Un-Init (END)");
}
void ewol::RequestUpdateSize(void)
{
if (true == isGlobalSystemInit) {
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_RECALCULATE_SIZE, ewol::threadMsg::MSG_PRIO_MEDIUM);
}
}
void guiSystem::event::Resize(int w, int h )
{
if (true == isGlobalSystemInit) {
eventResize_ts tmpData;
tmpData.w = w;
tmpData.h = h;
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_RESIZE, ewol::threadMsg::MSG_PRIO_MEDIUM, &tmpData, sizeof(eventResize_ts) );
}
}
void guiSystem::event::SetInputMotion(int pointerID, float x, float y )
{
if (true == isGlobalSystemInit) {
eventInputMotion_ts tmpData;
tmpData.type = ewol::INPUT_TYPE_FINGER;
tmpData.pointerID = pointerID;
tmpData.x = x;
tmpData.y = y;
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_INPUT_MOTION, ewol::threadMsg::MSG_PRIO_LOW, &tmpData, sizeof(eventInputMotion_ts) );
}
}
void guiSystem::event::SetInputState(int pointerID, bool isUp, float x, float y )
{
if (true == isGlobalSystemInit) {
eventInputState_ts tmpData;
tmpData.type = ewol::INPUT_TYPE_FINGER;
tmpData.pointerID = pointerID;
tmpData.state = isUp;
tmpData.x = x;
tmpData.y = y;
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_INPUT_STATE, ewol::threadMsg::MSG_PRIO_LOW, &tmpData, sizeof(eventInputState_ts) );
}
}
void guiSystem::event::SetMouseMotion(int pointerID, float x, float y )
{
if (true == isGlobalSystemInit) {
eventInputMotion_ts tmpData;
tmpData.type = ewol::INPUT_TYPE_MOUSE;
tmpData.pointerID = pointerID;
tmpData.x = x;
tmpData.y = y;
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_INPUT_MOTION, ewol::threadMsg::MSG_PRIO_LOW, &tmpData, sizeof(eventInputMotion_ts) );
}
}
void guiSystem::event::SetMouseState(int pointerID, bool isUp, float x, float y )
{
if (true == isGlobalSystemInit) {
eventInputState_ts tmpData;
tmpData.type = ewol::INPUT_TYPE_MOUSE;
tmpData.pointerID = pointerID;
tmpData.state = isUp;
tmpData.x = x;
tmpData.y = y;
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_INPUT_STATE, ewol::threadMsg::MSG_PRIO_LOW, &tmpData, sizeof(eventInputState_ts) );
}
}
void guiSystem::event::SetKeyboard(guiSystem::event::keyboardKey_ts& keyInput)
{
if (true == isGlobalSystemInit) {
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_KEYBORAD_KEY, ewol::threadMsg::MSG_PRIO_LOW, &keyInput, sizeof(guiSystem::event::keyboardKey_ts) );
}
}
void guiSystem::event::SetKeyboardMove(guiSystem::event::keyboardMove_ts& keyInput)
{
if (true == isGlobalSystemInit) {
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_KEYBORAD_MOVE, ewol::threadMsg::MSG_PRIO_LOW, &keyInput, sizeof(guiSystem::event::keyboardMove_ts) );
}
}
void guiSystem::event::Hide(void)
{
if (true == isGlobalSystemInit) {
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_HIDE, ewol::threadMsg::MSG_PRIO_LOW);
}
}
void guiSystem::event::Show(void)
{
if (true == isGlobalSystemInit) {
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_SHOW, ewol::threadMsg::MSG_PRIO_LOW);
}
}
void guiSystem::Draw(void)
{
if (true == isGlobalSystemInit) {
ewolProcessEvents();
int64_t localTime = GetCurrentTime();
ewol::widgetManager::PeriodicCall(localTime);
EWOL_NativeRegenerateDisplay();
ewol::texture::UpdateContext();
EWOL_NativeRender();
}
}

View File

@ -1,83 +0,0 @@
/**
*******************************************************************************
* @file MainThread.h
* @brief Main Ewol thread for the abstraction of the OS problematics (Header)
* @author Edouard DUPIN
* @date 27/01/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*O
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_MAIN_TREAD_H__
#define __EWOL_MAIN_TREAD_H__
#include <ewol/ewol.h>
namespace guiSystem
{
void Init(void);
void UnInit(void);
void SetArchiveDir(int mode, const char* str);
namespace event {
void Resize(int w, int h );
void SetInputMotion(int pointerID, float x, float y);
void SetInputState(int pointerID, bool isUp, float x, float y);
void SetMouseMotion(int pointerID, float x, float y);
void SetMouseState(int pointerID, bool isUp, float x, float y);
typedef struct {
bool capLock;
bool shift;
bool ctrl;
bool meta;
bool alt;
bool altGr;
bool verNum;
bool insert;
} specialKey_ts;
typedef struct {
bool isDown;
uniChar_t myChar;
guiSystem::event::specialKey_ts special;
} keyboardKey_ts;
typedef struct {
bool isDown;
ewol::eventKbMoveType_te move;
guiSystem::event::specialKey_ts special;
} keyboardMove_ts;
void SetKeyboard(guiSystem::event::keyboardKey_ts& keyInput);
void SetKeyboardMove(guiSystem::event::keyboardMove_ts& keyInput);
void Hide(void);
void Show(void);
};
void Draw(void);
};
#endif

View File

@ -1,389 +0,0 @@
/**
*******************************************************************************
* @file eventInputManagement.cpp
* @brief Input (mouse,finger) abstraction layer (Sources)
* @author Edouard DUPIN
* @date 00/04/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <ewol/OObject.h>
#include <ewol/Widget.h>
#include <ewol/Windows.h>
#include <ewol/base/gui.h>
#include <ewol/Debug.h>
#include <etk/UString.h>
#include <ewol/EObject.h>
#include <ewol/EObjectManager.h>
#include <ewol/WidgetManager.h>
#include <ewol/base/gui.h>
#include <ewol/ewol.h>
#include <ewol/Texture.h>
#include <ewol/base/MainThread.h>
#include <ewol/base/eventInputManagement.h>
typedef struct {
bool isUsed;
int32_t destinationInputId;
int64_t lastTimeEvent;
ewol::Widget* curentWidgetEvent;
Vector2D<float> origin;
Vector2D<float> size;
Vector2D<float> downStart;
bool isDown;
bool isInside;
int32_t nbClickEvent; // 0 .. 1 .. 2 .. 3
} InputPoperty_ts;
#define MAX_MANAGE_INPUT (10)
InputPoperty_ts eventInputSaved[MAX_MANAGE_INPUT];
InputPoperty_ts eventMouseSaved[MAX_MANAGE_INPUT];
static void CleanElement(InputPoperty_ts *eventTable, int32_t idInput)
{
eventTable[idInput].isUsed = false;
eventTable[idInput].destinationInputId = 0;
eventTable[idInput].lastTimeEvent = 0;
eventTable[idInput].curentWidgetEvent = NULL;
eventTable[idInput].origin.x = 0;
eventTable[idInput].origin.y = 0;
eventTable[idInput].size.x = 99999999;
eventTable[idInput].size.y = 99999999;
eventTable[idInput].downStart.x = 0;
eventTable[idInput].downStart.y = 0;
eventTable[idInput].isDown = false;
eventTable[idInput].isInside = false;
eventTable[idInput].nbClickEvent = 0;
}
/**
* @brief Inform object that an other object is removed ...
* @param[in] removeObject Pointer on the EObject removed ==> the user must remove all reference on this EObject
* @note : Sub classes must call this class
* @return ---
*/
void ewol::eventInput::OnObjectRemove(ewol::EObject * removeObject)
{
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
if (eventInputSaved[iii].curentWidgetEvent == removeObject) {
// remove the property of this input ...
CleanElement(eventInputSaved, iii);
}
if (eventMouseSaved[iii].curentWidgetEvent == removeObject) {
// remove the property of this input ...
CleanElement(eventMouseSaved, iii);
}
}
}
/**
* @brief a new layer on the windows is set ==> might remove all the property of the current element ...
* @param ---
* @return ---
*/
void ewol::eventInput::NewLayerSet(void)
{
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
// remove the property of this input ...
CleanElement(eventInputSaved, iii);
CleanElement(eventMouseSaved, iii);
}
}
void ewol::eventInput::Init(void)
{
EWOL_INFO("Init");
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
// remove the property of this input ...
CleanElement(eventInputSaved, iii);
CleanElement(eventMouseSaved, iii);
}
}
void ewol::eventInput::UnInit(void)
{
EWOL_INFO("Un-Init");
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
// remove the property of this input ...
CleanElement(eventInputSaved, iii);
CleanElement(eventMouseSaved, iii);
}
}
extern ewol::Windows* gui_uniqueWindows;
/**
* @brief generate the event on the destinated widger
* @param[in] type Type of the event that might be sended
* @param[in] destWidget Pointer on the requested widget that element might be sended
* @param[in] IdInput Id of the event (PC : [0..9] and touch : [1..9])
* @param[in] typeEvent type of the eventg generated
* @param[in] pos position of the event
* @return true if event has been greped
*/
static bool localEventInput(ewol::inputType_te type, ewol::Widget* destWidget, int32_t IdInput, ewol::eventInputType_te typeEvent, Vector2D<float> pos)
{
if (NULL != destWidget) {
if (type == ewol::INPUT_TYPE_MOUSE || type == ewol::INPUT_TYPE_FINGER) {
return destWidget->OnEventInput(type, IdInput, typeEvent, pos);
} else {
return false;
}
}
return false;
}
/**
* @brief Convert the system event id in the correct EWOL id depending of the system management mode
* This function find the next input id unused on the specifiic widget ==> on PC, the ID does not change (IHM is not the same
* @param[in] destWidget Pointer of the widget destination
* @param[in] realInputId System Id
* @return the ewol input id
*/
static int32_t localGetDestinationId(ewol::inputType_te type, ewol::Widget* destWidget, int32_t realInputId)
{
if (type == ewol::INPUT_TYPE_FINGER) {
int32_t lastMinimum = 0;
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
if (true==eventInputSaved[iii].isUsed) {
if (eventInputSaved[iii].curentWidgetEvent == destWidget) {
if (iii != realInputId) {
lastMinimum = etk_max(lastMinimum, eventInputSaved[iii].destinationInputId);
}
}
}
}
return lastMinimum+1;
}
return realInputId;
}
// defined by the platform specific file :
extern int32_t separateClickTime;
extern int32_t offsetMoveClicked;
extern int32_t offsetMoveClickedDouble;
// note if id<0 ==> the it was finger event ...
void ewol::eventInput::Motion(ewol::inputType_te type, int pointerID, Vector2D<float> pos)
{
// convert position in Open-GL coordonates ...
pos.y = ewol::GetCurrentHeight() - pos.y;
InputPoperty_ts *eventTable = NULL;
if (type == ewol::INPUT_TYPE_MOUSE) {
eventTable = eventMouseSaved;
} else if (type == ewol::INPUT_TYPE_FINGER) {
eventTable = eventInputSaved;
} else {
EWOL_ERROR("Unknown type of event");
return;
}
if( pointerID > MAX_MANAGE_INPUT
|| pointerID < 0) {
// not manage input
return;
}
// special case for the mouse event 0 that represent the hover event of the system :
if (type == ewol::INPUT_TYPE_MOUSE && pointerID == 0) {
// this event is all time on the good widget ... and manage the enter and leave ...
// NOTE : the "layer widget" force us to get the widget at the specific position all the time :
ewol::Widget* tmpWidget = gui_uniqueWindows->GetWidgetAtPos(pos);
if( tmpWidget != eventTable[pointerID].curentWidgetEvent
|| ( true == eventTable[pointerID].isInside
&& ( eventTable[pointerID].origin.x > pos.x
|| eventTable[pointerID].origin.y > pos.y
|| (eventTable[pointerID].origin.x + eventTable[pointerID].size.x) < pos.x
|| (eventTable[pointerID].origin.y + eventTable[pointerID].size.y) < pos.y) ) ) {
eventTable[pointerID].isInside = false;
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [LEAVE] " << pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_LEAVE, pos);
}
if (false == eventTable[pointerID].isInside) {
// Set the element inside ...
eventTable[pointerID].isInside = true;
// get destination widget :
if(NULL != gui_uniqueWindows) {
eventTable[pointerID].curentWidgetEvent = gui_uniqueWindows->GetWidgetAtPos(pos);
} else {
eventTable[pointerID].curentWidgetEvent = NULL;
}
if (NULL == eventTable[pointerID].curentWidgetEvent) {
eventTable[pointerID].isInside = false;
}
if (NULL != eventTable[pointerID].curentWidgetEvent) {
eventTable[pointerID].origin = eventTable[pointerID].curentWidgetEvent->GetOrigin();
eventTable[pointerID].size = eventTable[pointerID].curentWidgetEvent->GetSize();
}
eventTable[pointerID].destinationInputId = 0;
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [ENTER] " << pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_ENTER, pos);
}
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [MOVE] " << pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_MOVE, pos);
} else if (true == eventTable[pointerID].isUsed) {
if (true == eventTable[pointerID].isInside) {
if( eventTable[pointerID].origin.x > pos.x
|| eventTable[pointerID].origin.y > pos.y
|| (eventTable[pointerID].origin.x + eventTable[pointerID].size.x) < pos.x
|| (eventTable[pointerID].origin.y + eventTable[pointerID].size.y) < pos.y) {
eventTable[pointerID].isInside = false;
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [LEAVE] " << pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_LEAVE, pos);
}
} else {
if( ( eventTable[pointerID].origin.x <= pos.x
&& (eventTable[pointerID].origin.x + eventTable[pointerID].size.x) >= pos.x )
&& ( eventTable[pointerID].origin.y <= pos.y
&& (eventTable[pointerID].origin.y + eventTable[pointerID].size.y) >= pos.y ) ) {
eventTable[pointerID].isInside = true;
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [ENTER] " << pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_ENTER, pos);
}
}
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [MOVE] " << pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_MOVE, pos);
}
}
void ewol::eventInput::State(ewol::inputType_te type, int pointerID, bool isDown, Vector2D<float> pos)
{
// convert position in Open-GL coordonates ...
pos.y = ewol::GetCurrentHeight() - pos.y;
InputPoperty_ts *eventTable = NULL;
if (type == ewol::INPUT_TYPE_MOUSE) {
eventTable = eventMouseSaved;
} else if (type == ewol::INPUT_TYPE_FINGER) {
eventTable = eventInputSaved;
} else {
EWOL_ERROR("Unknown type of event");
return;
}
if( pointerID > MAX_MANAGE_INPUT
|| pointerID <= 0) {
// not manage input
return;
}
// get the curent time ...
int64_t currentTime = GetCurrentTime();
if (true == isDown) {
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
if(true == eventTable[pointerID].isUsed) {
// we have an event previously ... check delay between click and offset position
if (currentTime - eventTable[pointerID].lastTimeEvent > separateClickTime) {
CleanElement(eventTable, pointerID);
} else if( abs(eventTable[pointerID].downStart.x - pos.x) >= offsetMoveClicked
|| abs(eventTable[pointerID].downStart.y - pos.y) >= offsetMoveClicked ){
CleanElement(eventTable, pointerID);
}
}
if(true == eventTable[pointerID].isUsed) {
// save start time
eventTable[pointerID].lastTimeEvent = currentTime;
// generate DOWN Event
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_DOWN, pos);
} else {
// Mark it used :
eventTable[pointerID].isUsed = true;
// Save current position :
eventTable[pointerID].downStart = pos;
// save start time
eventTable[pointerID].lastTimeEvent = currentTime;
// Set the element inside ...
eventTable[pointerID].isInside = true;
// get destination widget :
if(NULL != gui_uniqueWindows) {
eventTable[pointerID].curentWidgetEvent = gui_uniqueWindows->GetWidgetAtPos(pos);
} else {
eventTable[pointerID].curentWidgetEvent = NULL;
}
if (NULL != eventTable[pointerID].curentWidgetEvent) {
eventTable[pointerID].origin = eventTable[pointerID].curentWidgetEvent->GetOrigin();
eventTable[pointerID].size = eventTable[pointerID].curentWidgetEvent->GetSize();
eventTable[pointerID].destinationInputId = localGetDestinationId(type, eventTable[pointerID].curentWidgetEvent, pointerID);
} else {
eventTable[pointerID].destinationInputId = -1;
}
// generate DOWN Event
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, eventTable[pointerID].destinationInputId, ewol::EVENT_INPUT_TYPE_DOWN, pos);
}
} else {
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [UP] " << pos);
if(false == eventTable[pointerID].isUsed) {
// bad case ... ???
EWOL_DEBUG("Up event without previous down ... ");
// Mark it un-used :
eventTable[pointerID].isUsed = false;
// revove the widget ...
eventTable[pointerID].curentWidgetEvent = NULL;
} else {
// generate UP Event
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [UP] " << pos);
localEventInput(type, eventTable[pointerID].curentWidgetEvent, pointerID, ewol::EVENT_INPUT_TYPE_UP, pos);
// generate event (single)
if( abs(eventTable[pointerID].downStart.x - pos.x) < offsetMoveClicked
&& abs(eventTable[pointerID].downStart.y - pos.y) < offsetMoveClicked ){
// Save current position :
eventTable[pointerID].downStart = pos;
// save start time
eventTable[pointerID].lastTimeEvent = currentTime;
int32_t nbClickMax = 0;
if(eventTable[pointerID].curentWidgetEvent != NULL) {
nbClickMax = eventTable[pointerID].curentWidgetEvent->GetMouseLimit();
if (nbClickMax>5) {
nbClickMax = 5;
}
}
if(eventTable[pointerID].nbClickEvent < nbClickMax) {
// generate event SINGLE :
eventTable[pointerID].nbClickEvent++;
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [SINGLE] " << pos);
localEventInput(type,
eventTable[pointerID].curentWidgetEvent,
eventTable[pointerID].destinationInputId,
(ewol::eventInputType_te)(ewol::EVENT_INPUT_TYPE_SINGLE + eventTable[pointerID].nbClickEvent-1),
pos);
if( eventTable[pointerID].nbClickEvent >= nbClickMax) {
eventTable[pointerID].nbClickEvent = 0;
}
} else {
eventTable[pointerID].nbClickEvent = 0;
}
}
// specific for tuch event
if (type == ewol::INPUT_TYPE_FINGER) {
CleanElement(eventTable, pointerID);
}
}
}
}

View File

@ -1,62 +0,0 @@
/**
*******************************************************************************
* @file eventInputManagement.h
* @brief Input (mouse,finger) abstraction layer (header)
* @author Edouard DUPIN
* @date 00/04/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __EWOL_EVENT_INPUT_MANAGEMENT_H__
#define __EWOL_EVENT_INPUT_MANAGEMENT_H__
namespace ewol
{
typedef enum {
INPUT_TYPE_UNKNOW,
INPUT_TYPE_MOUSE,
INPUT_TYPE_FINGER,
} inputType_te;
namespace eventInput
{
void Init(void);
void UnInit(void);
// note if id<0 ==> the it was finger event ...
void Motion(ewol::inputType_te type, int pointerID, Vector2D<float> pos );
void State(ewol::inputType_te type, int pointerID, bool isDown, Vector2D<float> pos);
/**
* @brief Inform object that an other object is removed ...
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
* @note : Sub classes must call this class
* @return ---
*/
void OnObjectRemove(ewol::EObject * removeObject);
/**
* @brief a new layer on the windows is set ==> might remove all the property of the current element ...
* @param ---
* @return ---
*/
void NewLayerSet(void);
}
}
#endif

View File

@ -1,336 +0,0 @@
/**
*******************************************************************************
* @file gui.cpp
* @brief Gui abstraction layer common part (Sources)
* @author Edouard DUPIN
* @date 01/02/2012
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewol/Debug.h>
#include <etk/UString.h>
#include <ewol/EObject.h>
#include <ewol/EObjectManager.h>
#include <ewol/WidgetManager.h>
#include <ewol/base/gui.h>
#include <ewol/ewol.h>
#include <ewol/Texture.h>
#include <ewol/base/MainThread.h>
#include <ewol/importgl.h>
ewol::Windows* gui_uniqueWindows = NULL;
float gui_width = 320;
float gui_height = 480;
int32_t ewol::GetCurrentWidth(void)
{
return gui_width;
}
int32_t ewol::GetCurrentHeight(void)
{
return gui_height;
}
void ewol::PopUpWidgetPush(ewol::Widget * tmpWidget)
{
if (NULL != gui_uniqueWindows && NULL != tmpWidget) {
gui_uniqueWindows->PopUpWidgetPush(tmpWidget);
}
}
void UpdateGuiSize(void)
{
if (NULL != gui_uniqueWindows) {
gui_uniqueWindows->CalculateSize((float)gui_width, (float)gui_height);
gui_uniqueWindows->SetOrigin(0.0, 0.0);
}
}
void EWOL_NativeResize(int w, int h )
{
gui_width = w;
gui_height = h;
//EWOL_INFO("Resize w=" << w << " h=" << h);
UpdateGuiSize();
}
void EWOL_NativeRegenerateDisplay(void)
{
// Remove all widget that they are no more usefull (these who decided to destroy themself)
ewol::EObjectManager::RemoveAllAutoRemove();
//EWOL_INFO("Resize w=" << w << " h=" << h);
if (NULL != gui_uniqueWindows) {
// Redraw all needed elements
gui_uniqueWindows->OnRegenerateDisplay();
}
}
void guiAbstraction::ForceRedrawAll(void)
{
if (NULL != gui_uniqueWindows) {
gui_uniqueWindows->CalculateSize((float)gui_width, (float)gui_height);
}
}
void guiAbstraction::SetDisplayOnWindows(ewol::Windows * newWindows)
{
gui_uniqueWindows = newWindows;
ForceRedrawAll();
}
void guiAbstraction::SendKeyboardEvent(bool isDown, uniChar_t keyInput)
{
// Get the current Focused Widget :
ewol::Widget * tmpWidget = ewol::widgetManager::FocusGet();
if (NULL != tmpWidget) {
if(true == isDown) {
EWOL_VERBOSE("GUI PRESSED : \"" << keyInput << "\"");
tmpWidget->OnEventKb(ewol::EVENT_KB_TYPE_DOWN, keyInput);
} else {
EWOL_VERBOSE("GUI Release : \"" << keyInput << "\"");
tmpWidget->OnEventKb(ewol::EVENT_KB_TYPE_UP, keyInput);
}
}
}
void guiAbstraction::SendKeyboardEventMove(bool isDown, ewol::eventKbMoveType_te &keyInput)
{
// Get the current Focused Widget :
ewol::Widget * tmpWidget = ewol::widgetManager::FocusGet();
if (NULL != tmpWidget) {
if(true == isDown) {
tmpWidget->OnEventKbMove(ewol::EVENT_KB_TYPE_DOWN, keyInput);
} else {
tmpWidget->OnEventKbMove(ewol::EVENT_KB_TYPE_UP, keyInput);
}
}
}
static int64_t startTime = -1;
static int64_t nbCallTime = 0;
static int64_t nbDisplayTime = 0;
static int64_t min = 99999999999999;
static int64_t avg = 0;
static int64_t max = 0;
static int64_t min2 = 99999999999999;
static int64_t avg2 = 0;
static int64_t max2 = 0;
// display every second ...
#define DISPLAY_PERIODE_US (1000000)
static float gTriangleVertices[] = { 0.0f, 0.0f, 200.0f, 0.0f, 0.0f, 200.0f };
static float gTriangleVertices5[] = { 200.0f, 200.0f, 100.0f, 200.0f, 200.0f, 100.0f,
200.0f, 200.0f, 300.0f, 200.0f, 200.0f, 300.0f };
void EWOL_GenericDraw(bool everyTime)
{
//EWOL_DEBUG("redraw (" << gui_width << "," << gui_height << ")");
if(NULL == gui_uniqueWindows) {
// set the size of the open GL system
glViewport(0,0,gui_width,gui_height);
// Clear the screen with transparency ...
glClearColor(0.0,0.0,0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//glOrtho(0., width, 0., -height, 1., 20.);
glOrthoEwol(-gui_width/2, gui_width/2, gui_height/2, -gui_height/2, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//glTranslatef(0, -height/2, -5);
glTranslatef(-gui_width/2, -gui_height/2, -1.0);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnableClientState( GL_VERTEX_ARRAY );
//LOGI("engine_draw_frame (%d,%d)",width,height);
glColor4f(0.0, 1.0, 1.0, 1.0);
glVertexPointer(2, GL_FLOAT, 0, gTriangleVertices5 );
glDrawArrays( GL_TRIANGLES, 0, 6);
static int vallllll = 0;
static float transparency = 0.0;
if (vallllll <= 1) {
transparency +=0.025;
if (transparency >= 1.0) {
vallllll++;
transparency = 0.0;
glColor4f(1.0, 0.0, 0.0, 1.0);
} else {
glColor4f(1.0, 0.0, 0.0, transparency);
}
} else if (vallllll <= 2) {
transparency +=0.025;
if (transparency >= 1.0) {
vallllll++;
transparency = 0.0;
glColor4f(1.0, 1.0, 0.0, 1.0);
} else {
glColor4f(1.0, 1.0, 0.0, transparency);
}
} else if (vallllll <= 3) {
transparency +=0.025;
if (transparency >= 1.0) {
vallllll++;
transparency = 0.0;
glColor4f(0.0, 1.0, 0.0, 1.0);
} else {
glColor4f(0.0, 1.0, 0.0, transparency);
}
} else if (vallllll <= 4) {
transparency +=0.025;
if (transparency >= 1.0) {
vallllll++;
transparency = 0.0;
glColor4f(0.0, 1.0, 1.0, 1.0);
} else {
glColor4f(0.0, 1.0, 1.0, transparency);
}
} else if (vallllll <= 5) {
transparency +=0.025;
if (transparency >= 1.0) {
vallllll++;
transparency = 0.0;
glColor4f(0.0, 0.0, 1.0, 1.0);
} else {
glColor4f(0.0, 0.0, 1.0, transparency);
}
} else {
transparency +=0.025;
if (transparency >= 1.0) {
vallllll = 0;
transparency = 0.0;
glColor4f(1.0, 0.0, 1.0, 1.0);
} else {
glColor4f(1.0, 0.0, 1.0, transparency);
}
}
glVertexPointer(2, GL_FLOAT, 0, gTriangleVertices );
glDrawArrays( GL_TRIANGLES, 0, 3);
glDisableClientState( GL_VERTEX_ARRAY );
glDisable(GL_BLEND);
} else {
bool display = false;
nbCallTime++;
if (startTime<0) {
startTime = GetCurrentTime();
}
int64_t currentTime = GetCurrentTime();
//EWOL_DEBUG("current : " << currentTime << "time diff : " << (currentTime - startTime));
if ( (currentTime - startTime) > DISPLAY_PERIODE_US) {
display = true;
}
int64_t currentTime3 = GetCurrentTime();
// check if the regenerate is needed ...
if( true == ewol::widgetManager::IsDrawingNeeded()
|| true == everyTime) {
ewol::texture::UpdateContext();
nbDisplayTime++;
gui_uniqueWindows->SysDraw();
}
// send Message that we just finished a display ...
//EWOL_ThreadEventHasJustDisplay();
int64_t currentTime2 = GetCurrentTime();
int64_t processTimeLocal = (currentTime2 - currentTime);
min = etk_min(min, processTimeLocal);
max = etk_max(max, processTimeLocal);
avg += processTimeLocal;
processTimeLocal = (currentTime2 - currentTime3);
min2 = etk_min(min2, processTimeLocal);
max2 = etk_max(max2, processTimeLocal);
avg2 += processTimeLocal;
if (true == display) {
EWOL_DEBUG("display property : " << nbDisplayTime << "/" << nbCallTime << "fps");
EWOL_DEBUG("timeToProcess1 : " << (float)((float)min / 1000.0) << "ms "
<< (float)((float)avg/(float)nbDisplayTime / 1000.0) << "ms "
<< (float)((float)max / 1000.0) << "ms ");
EWOL_DEBUG("timeToProcess2 : " << (float)((float)min2 / 1000.0) << "ms "
<< (float)((float)avg2/(float)nbDisplayTime / 1000.0) << "ms "
<< (float)((float)max2 / 1000.0) << "ms ");
max2 = 0;
max = 0;
min = 99999999999999;
min2 = 99999999999999;
avg=0;
avg2=0;
nbCallTime = 0;
nbDisplayTime = 0;
startTime = -1;
}
}
}
void EWOL_NativeGLDestroy(void)
{
ewol::texture::UpdateContextIsDestroy();
}
#include <ewol/importgl.h>
void glOrthoEwol(GLfloat left,
GLfloat right,
GLfloat bottom,
GLfloat top,
GLfloat nearVal,
GLfloat farVal)
{
GLfloat myMatrix[4*4];
int iii;
for(iii=0; iii<4*4 ; iii++) {
myMatrix[iii] = 0;
}
myMatrix[0] = 2.0 / (right - left);
myMatrix[5] = 2.0 / (top - bottom);
myMatrix[10] = -2.0 / (farVal - nearVal);
#if 1
myMatrix[3] = -1*(right + left) / (right - left);
myMatrix[7] = -1*(top + bottom) / (top - bottom);
myMatrix[11] = -1*(farVal + nearVal) / (farVal - nearVal);
#else
// test if matrix is not corectly instanciate ...
myMatrix[12] = -1*(right + left) / (right - left);
myMatrix[13] = -1*(top + bottom) / (top - bottom);
myMatrix[14] = -1*(farVal + nearVal) / (farVal - nearVal);
#endif
myMatrix[15] = 1;
glLoadMatrixf(myMatrix);
}

View File

@ -1,71 +0,0 @@
/**
*******************************************************************************
* @file gui.h
* @brief Gui abstraction layer (header)
* @author Edouard DUPIN
* @date 20/10/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#ifndef __GUI_ABSTRACTION_H__
#define __GUI_ABSTRACTION_H__
#include <etk/Types.h>
#include <etk/UString.h>
#include <ewol/Windows.h>
#include <ewol/ewol.h>
void EWOL_NativeRender(void);
void EWOL_NativeResize(int w, int h );
void EWOL_GenericDraw(bool everyTime);
void EWOL_NativeGLDestroy(void);
void UpdateGuiSize(void);
namespace guiAbstraction
{
void Stop(void);
void SetDisplayOnWindows(ewol::Windows * newOne);
void ChangeSize(int32_t w, int32_t h);
void ChangePos(int32_t x, int32_t y);
void GetAbsPos(int32_t & x, int32_t & y);
bool IsPressedInput(int32_t inputID);
void KeyboardShow(ewol::keyboardMode_te mode);
void KeyboardHide(void);
void ForceRedrawAll(void);
void SendKeyboardEvent(bool isDown, uniChar_t keyInput);
void SendKeyboardEventMove(bool isDown, ewol::eventKbMoveType_te &keyInput);
// copy and cut generic properties :
typedef enum {
CLIPBOARD_MODE_PRIMARY,
CLIPBOARD_MODE_STD,
} clipBoardMode_te;
void ClipBoardGet(etk::UString& newData, clipBoardMode_te mode);
void ClipBoardSet(etk::UString& newData, clipBoardMode_te mode);
};
//!< must be define in CPP by the application ...
void APP_Init(void);
void APP_UnInit(void);
#define NB_MAX_INPUT (20)
#endif

View File

@ -1,199 +0,0 @@
/**
*******************************************************************************
* @file guiAndroid.cpp
* @brief Gui abstraction layer (Sources)
* @author Edouard DUPIN
* @date 20/10/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <jni.h>
#include <sys/time.h>
#include <time.h>
#include <android/log.h>
#include <stdint.h>
#include <ewol/Debug.h>
#include <etk/UString.h>
#include <ewol/WidgetManager.h>
#include <ewol/base/gui.h>
#include <ewol/ewol.h>
#include <ewol/importgl.h>
#include <ewol/Texture.h>
#undef __class__
#define __class__ "AndroidJNI"
int32_t separateClickTime = 800000;
int32_t offsetMoveClicked = 40000;
int32_t offsetMoveClickedDouble = 300000;
extern float gui_width;
extern float gui_height;
extern ewol::Windows* gui_uniqueWindows;
int64_t GetCurrentTime(void)
{
struct timeval now;
gettimeofday(&now, NULL);
//EWOL_VERBOSE("current time : " << now.tv_sec << "s " << now.tv_usec << "us");
return (int64_t)((int64_t)now.tv_sec*(int64_t)1000000 + (int64_t)now.tv_usec);
}
void Draw(void);
#define OFFSET_MOVE_CLICKED (20)
#define OFFSET_MOVE_CLICKED_DOUBLE (40)
#undef SEPARATED_CLICK_TIME
#define SEPARATED_CLICK_TIME (300)
//bool inputIsPressed[NB_MAX_INPUT];// = {false, false, false};
int32_t m_previousBouttonId = -1;
int32_t m_previousDown_x = -1;
int32_t m_previousDown_y = -1;
int32_t m_previous_x = -1;
int32_t m_previous_y = -1;
int64_t m_previousTime = 0;
bool m_previousDouble = false;
static etk::UString l_clipBoardPrimary(""); // local copy of the selection
static etk::UString l_clipBoardStd(""); // local copy of the clipboard
void EWOL_NativeRender(void)
{
EWOL_GenericDraw(true);
glFlush();
}
void ewol::SetTitle(etk::UString title)
{
// can not set the title in Android ...
}
// ClipBoard AREA :
void guiAbstraction::ClipBoardGet(etk::UString &newData, clipBoardMode_te mode)
{
EWOL_INFO("Request Get of a clipboard : " << mode << " size=" << newData.Size() );
newData = "";
switch (mode)
{
case CLIPBOARD_MODE_PRIMARY:
// get our own buffer ... (no current selectin on Android ...
newData = l_clipBoardPrimary;
break;
case CLIPBOARD_MODE_STD:
EWOL_TODO("implement on Android");
// get our own buffer ...
newData = l_clipBoardStd;
break;
default:
EWOL_ERROR("Request an unknow ClipBoard ...");
break;
}
}
void guiAbstraction::ClipBoardSet(etk::UString &newData, clipBoardMode_te mode)
{
EWOL_VERBOSE("Request set of a clipboard : " << mode << " size=" << newData.Size() );
switch (mode)
{
case CLIPBOARD_MODE_PRIMARY:
if (newData.Size() > 0) {
// copy it ...
l_clipBoardPrimary = newData;
}
break;
case CLIPBOARD_MODE_STD:
if (newData.Size() > 0) {
// copy it ...
l_clipBoardStd = newData;
// Request the clipBoard :
EWOL_TODO("implement on Android copy the copy data");
}
break;
default:
EWOL_ERROR("Request an unknow ClipBoard ...");
break;
}
}
#undef __class__
#define __class__ "guiAbstraction"
void guiAbstraction::Stop(void)
{
// TODo : send a message to the android system to stop ...
}
// java system to send message :
void SendSystemMessage(const char * dataString);
void SendJava_KeyboardShow(bool showIt);
void guiAbstraction::KeyboardShow(ewol::keyboardMode_te mode)
{
// send a message at the java :
SendJava_KeyboardShow(true);
}
void guiAbstraction::KeyboardHide(void)
{
// send a message at the java :
SendJava_KeyboardShow(false);
}
void guiAbstraction::ChangeSize(int32_t w, int32_t h)
{
// nothing to do with Android
}
void guiAbstraction::ChangePos(int32_t x, int32_t y)
{
// nothing to do with Android
}
void guiAbstraction::GetAbsPos(int32_t & x, int32_t & y)
{
}
bool guiAbstraction::IsPressedInput(int32_t inputID)
{
//if (true == guiAbstractionIsInit) {
// return myX11Access->IsPressedInput(inputID);
//} else {
// EWOL_CRITICAL("X11 ==> not init ... ");
return false;
//}
}
#include <ewol/ewol.h>
int32_t ewol::CmdLineNb(void)
{
return 0;
}
etk::UString ewol::CmdLineGet(int32_t id)
{
return "";
}

View File

@ -1,46 +0,0 @@
/**
*******************************************************************************
* @file guiDoubleBuffer.cpp
* @brief Gui abstraction layer (Sources)
* @author Edouard DUPIN
* @date 20/10/2011
* @par Project
* ewol
*
* @par Copyright
* Copyright 2011 Edouard DUPIN, all right reserved
*
* This software is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY.
*
* Licence summary :
* You can modify and redistribute the sources code and binaries.
* You can send me the bug-fix
*
* Term of the licence in in the file licence.txt.
*
*******************************************************************************
*/
#include <ewol/Debug.h>
#include <base/guiDoubleBuffer.h>
#undef __class__
#define __class__ "guiAbstraction"
void guiAbstraction::Init(int32_t argc, char *argv[])
{
EWOL_INFO("INIT for DoubleBuffer environement");
}
void guiAbstraction::Run(void)
{
EWOL_INFO("Start Running");
EWOL_INFO("Stop Running");
}
void guiAbstraction::UnInit(void)
{
EWOL_INFO("UN-INIT for DoubleBuffer environement");
}

Some files were not shown because too many files have changed in this diff Show More