expedite++: First C++ test.

This commit is contained in:
Savio Sena 2014-08-24 07:48:21 -03:00 committed by Savio Sena
parent 1a3b5e8d7d
commit f0dbeca426
8 changed files with 192 additions and 5 deletions

View File

@ -10,7 +10,7 @@ AC_CONFIG_HEADERS([config.h])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([1.6 dist-bzip2])
AM_INIT_AUTOMAKE([1.6 dist-bzip2 subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
PKG_PROG_PKG_CONFIG
@ -59,7 +59,7 @@ EFL_ENABLE_BETA_API_SUPPORT
# EFL++ dependencies
PKG_CHECK_MODULES([EFL_CXX], eina-cxx >= 1.11.0 eo-cxx >= 1.11.0 evas-cxx >= 1.11.0 eet-cxx >= 1.11.0)
PKG_CHECK_MODULES([EFL_CXX], efl-cxx >= 1.11.99 eina-cxx >= 1.11.99 eo-cxx >= 1.11.99 evas-cxx >= 1.11.99 eet-cxx >= 1.11.99)
### Checks for header files
@ -97,9 +97,9 @@ AC_MSG_CHECKING([whether the compiler supports -fno-rtti -fno-exceptions])
AC_MSG_RESULT([${have_cxx_flags}])
CXXFLAGS="${CXXFLAGS_save}"
if test "x${have_cxx_flags}" = "xyes" ; then
EXPEDITE_CXXFLAGS="-fno-rtti -fno-exceptions -std=c++11"
EXPEDITE_CXXFLAGS="-fno-rtti -fno-exceptions"
fi
CXXFLAGS="{CXXFLAGS} -std=c++11"
CXXFLAGS="${CXXFLAGS} -std=c++11"
AC_LANG_POP([C++])
AC_SUBST(EXPEDITE_CXXFLAGS)

View File

@ -7,6 +7,7 @@ AM_CPPFLAGS = \
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
@EFL_CFLAGS@ \
@EFL_CXX_CFLAGS@ \
@EVIL_CFLAGS@
bin_PROGRAMS = expedite
@ -48,6 +49,8 @@ image_blend_nearest_solid_same_scaled.c \
image_blend_smooth_same_scaled.c \
image_blend_smooth_solid_same_scaled.c \
image_blend_border.c \
cxx/image_blend_border.cc \
cxx/image_blend_border_cxx.c \
image_blend_solid_middle_border.c \
image_blend_solid_border.c \
image_blend_border_recolor.c \
@ -131,7 +134,7 @@ font_effect_blur_color.c
expedite_CFLAGS = @WIN32_CFLAGS@
expedite_CXXFLAGS = @EXPEDITE_CXXFLAGS@
expedite_LDADD = @EFL_LIBS@ @EVIL_LIBS@ -lm
expedite_LDADD = @EFL_LIBS@ @EFL_CXX_LIBS@ @EVIL_LIBS@ -lm
expedite_LDFLAGS = @lt_enable_auto_import@
.rc.lo:

View File

@ -1,6 +1,14 @@
#ifndef ABOUT_H
#define ABOUT_H
#ifdef __cplusplus
extern "C" {
#endif
void about_start(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,92 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#undef FNAME
#undef NAME
#undef ICON
/* metadata */
#define FNAME image_blend_border_start_cxx
#define NAME "Image Blend Border (C++)"
#define ICON "blend.png"
#include "Eo.h"
#include "Evas.h"
#include "main.hh"
#include "Eo.hh"
#include "Eina.hh"
#include "Evas.hh"
namespace _ctx {
evas::canvas evas;
efl::eina::list<evas::image> images;
}
/* standard var */
static int done = 0;
/* setup */
static void _setup()
{
int i;
Evas_Object *o;
for (i = 0; i < OBNUM; i++)
{
evas::image o(efl::eo::parent = _ctx::evas);
_ctx::images.push_back(o);
o.file_set(::build_path("bar.png"), ""); // XXX
o.border_set(6, 6, 6, 6);
o.visibility_set(true);
}
done = 0;
}
/* cleanup */
static void _cleanup()
{
_ctx::images.clear();
}
/* loop - do things */
static void _loop(double t, int f)
{
int i = 0;
Evas_Coord x, y, w, h, w0, h0;
for (auto it = _ctx::images.begin(), end = _ctx::images.end(); it != end; it++, i++)
{
w0 = 80;
h0 = 80;
w = 5 + ((1.0 + cos((double)(f + (i * 10)) / (7.4 * SLOW) )) * w0 * 2);
h = 5 + ((1.0 + sin((double)(f + (i * 19)) / (12.6 * SLOW) )) * h0 * 2);
x = (win_w / 2) - (w / 2);
x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w0 / 2);
y = (win_h / 2) - (h / 2);
y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h0 / 2);
(*it).position_set(x, y);
(*it).size_set(w, h);
(*it).fill_set(0, 0, w, h);
}
FPS_STD(NAME);
}
/* prepend special key handlers if interactive (before STD) */
static void _key(char *key)
{
KEY_STD;
}
extern "C" void FNAME(void)
{
ui_func_set(_key, _loop);
_setup();
}
#undef FNAME
#undef NAME
#undef ICON

View File

@ -0,0 +1,25 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#undef FNAME
#undef NAME
#undef ICON
/* metadata */
#define FNAME image_blend_border_start
#define NAME "Image Blend Border"
#define ICON "blend.png"
#ifdef UI
_ui_menu_item_add(ICON, NAME, FNAME);
#endif
#ifdef PROTO
void FNAME(void);
#endif
#undef FNAME
#undef NAME
#undef ICON

38
src/bin/main.hh Normal file
View File

@ -0,0 +1,38 @@
#ifndef MAIN_HH
#define MAIN_HH
#define OBNUM 128
#define LOOPS 128
extern "C"
{
#include "ui.h"
const char *build_path(const char *filename);
}
#define SLOW 5.0
extern int win_w, win_h;
extern int loops;
extern const char *choosen_engine;
extern Eina_Bool fullscreen;
extern Eina_Bool cmp_report;
#define KEY_STD \
if ((!strcmp(key, "Escape")) || (!strcmp(key, "q")) || (!strcmp(key, "Q")) || (!strcmp(key, "Return"))) \
{ \
_cleanup(); \
ui_menu(); \
}
#define FPS_STD(x) \
if ((f >= loops) && (!done)) \
{ \
double fps; \
fps = (double)f / t; \
ui_fps(fps); \
printf("%4.2f , %s\n", fps, x); \
done = 1; \
}
#endif // MAIN_HH

View File

@ -1,3 +1,12 @@
#ifdef __cplusplus
extern "C" {
#endif
// C++ tests
#include "cxx/image_blend_border_cxx.c"
// C tests
#include "widgets_file_icons.c"
#include "widgets_file_icons_2.c"
#include "widgets_file_icons_2_grouped.c"
@ -122,3 +131,7 @@
#include "filter_object_blur.c"
#include "filter_object_blur_solid.c"
#endif
#ifdef __cplusplus
}
#endif

View File

@ -1,6 +1,10 @@
#ifndef UI_H
#define UI_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _Menu_Item Menu_Item;
struct _Menu_Item
{
@ -24,4 +28,8 @@ void ui_fps(double fps);
void ui_num(int n);
void ui_all(void);
#ifdef __cplusplus
}
#endif
#endif