Posted
about 9 years
ago
by
Agar-SVN
Author: vedge
Date: 2016-03-24 22:42:57 -0400 (Thu, 24 Mar 2016)
New Revision: 9854
Modified:
trunk/Makefile
Log:
fix "pre-package" target
Modified: trunk/Makefile
===================================================================
---
... [More]
trunk/Makefile2016-03-25 02:42:36 UTC (rev 9853)
+++ trunk/Makefile2016-03-25 02:42:57 UTC (rev 9854)
< at >< at > -102,11 +102,11 < at >< at >
echo "install-sdk.exe" >> ${PROJFILELIST}; \
echo "VisualC.html" >> ${PROJFILELIST}; \
V=`perl mk/get-version.pl`; \
-cat README |sed "s/$/`echo -e \\\r`/" >README.txt; \
-cat INSTALL.txt |sed "s/$/`echo -e \\\r`/" >INSTALL-Windows.txt; \
-cat ChangeLogs/Release-$$V.txt |sed "s/$/`echo -e \\\r`/" >RELEASE-$$V.txt; \
-cat mk/LICENSE.txt |sed "s/$/`echo -e \\\r`/" >LICENSE.txt; \
-cat gui/fonts/Vera-Copyright.txt |sed "s/$/`echo -e \\\r`/" >LICENSE-Vera.txt; \
+cat README |sed "s/$$/`echo -e \\\r`/" >README.txt; \
+cat INSTALL.txt |sed "s/$$/`echo -e \\\r`/" >INSTALL-Windows.txt; \
+cat ChangeLogs/Release-$$V.txt |sed "s/$$/`echo -e \\\r`/" >RELEASE-$$V.txt; \
+cat mk/LICENSE.txt |sed "s/$$/`echo -e \\\r`/" >LICENSE.txt; \
+cat gui/fonts/Vera-Copyright.txt |sed "s/$$/`echo -e \\\r`/" >LICENSE-Vera.txt; \
cp -f mk/agar-logo.png Logo.png; \
echo "README.txt" >> ${PROJFILELIST}; \
echo "INSTALL-Windows.txt" >> ${PROJFILELIST}; \
[Less]
|
Posted
about 9 years
ago
by
Agar-SVN
Author: vedge
Date: 2016-03-24 22:42:36 -0400 (Thu, 24 Mar 2016)
New Revision: 9853
Modified:
trunk/gui/drv_sdl_common.c
Log:
use strtod() for better portability
Modified: trunk/gui/drv_sdl_common.c
... [More]
===================================================================
--- trunk/gui/drv_sdl_common.c2016-03-24 11:04:29 UTC (rev 9852)
+++ trunk/gui/drv_sdl_common.c2016-03-25 02:42:36 UTC (rev 9853)
< at >< at > -621,7 +621,7 < at >< at >
char *ep;
AG_GetString(drv, "fpsMax", buf, sizeof(buf));
-v = strtof(buf, &ep);
+v = (float)strtod(buf, &ep);
if (*ep == '\0')
dsw->rNom = (Uint)(1000.0/v);
}
[Less]
|
Posted
over 9 years
ago
by
Agar-SVN
Author: vedge
Date: 2015-12-31 23:12:16 -0500 (Thu, 31 Dec 2015)
New Revision: 9849
Modified:
trunk/tests/axe.bmp
trunk/tests/helmet-socket.bmp
trunk/tests/helmet.bmp
trunk/tests/menubg.bmp
trunk/tests/sockets.c
... [More]
trunk/tests/sword-socket.bmp
trunk/tests/sword.bmp
Log:
fix "sockets" test
Modified: trunk/tests/axe.bmp
===================================================================
(Binary files differ)
Modified: trunk/tests/helmet-socket.bmp
===================================================================
(Binary files differ)
Modified: trunk/tests/helmet.bmp
===================================================================
(Binary files differ)
Modified: trunk/tests/menubg.bmp
===================================================================
(Binary files differ)
Modified: trunk/tests/sockets.c
===================================================================
--- trunk/tests/sockets.c2015-12-15 05:14:42 UTC (rev 9848)
+++ trunk/tests/sockets.c2016-01-01 04:12:16 UTC (rev 9849)
< at >< at > -38,7 +38,7 < at >< at >
}
AG_SocketInsertIcon(sock, icon);
} else {
-printf("Not a helmet!\n");
+AG_TextTmsg(AG_MSG_ERROR, 1000, "Not a helmet!");
}
return (1);
}
< at >< at > -56,7 +56,7 < at >< at >
}
AG_SocketInsertIcon(sock, icon);
} else {
-printf("Not a weapon!\n");
+AG_TextTmsg(AG_MSG_ERROR, 1000, "Not a weapon!");
}
return (1);
}
< at >< at > -72,6 +72,11 < at >< at >
AG_Icon *helmet, *sword, *axe;
int i;
+if (agDriverOps->wm != AG_WM_SINGLE) {
+AG_SetError("Test is only applicable to single-window drivers");
+return (-1);
+}
+
/* Create a fixed widget container */
fx = AG_FixedNew(win, AG_FIXED_EXPAND);
< at >< at > -93,8 +98,6 < at >< at >
continue;
}
pixmaps[i] = AG_SurfaceFromFile(path);
-AG_SurfaceSetColorKey(pixmaps[i], AG_SRCCOLORKEY,
- AG_MapPixelRGB(pixmaps[i]->format, 0,255,0));
}
/*
< at >< at > -145,8 +148,7 < at >< at >
AG_SocketInsertIcon(sock, axe);
AG_WindowSetPadding(win, 0, 0, 0, 0);
-AG_WindowSetGeometryAligned(win, AG_WINDOW_BC, 640, 128);
-/*agColors[WINDOW_BG_COLOR] = AG_ColorRGB(0,0,0); */
+AG_WindowSetGeometryAligned(win, AG_WINDOW_BC, 640, 128+64);
return (0);
}
Modified: trunk/tests/sword-socket.bmp
===================================================================
(Binary files differ)
Modified: trunk/tests/sword.bmp
===================================================================
(Binary files differ)
[Less]
|
Posted
over 9 years
ago
by
Agar-SVN
Author: vedge
Date: 2015-11-24 03:13:23 -0500 (Tue, 24 Nov 2015)
New Revision: 9847
Modified:
trunk/gui/drv_cocoa.m
Log:
- honor AG_WINDOW_DENYFOCUS.
- implement lowerWindow() operation.
Modified: trunk/gui/drv_cocoa.m
... [More]
===================================================================
--- trunk/gui/drv_cocoa.m2015-11-24 05:16:50 UTC (rev 9846)
+++ trunk/gui/drv_cocoa.m2015-11-24 08:13:23 UTC (rev 9847)
< at >< at > -84,12 +84,12 < at >< at >
< at >implementation AG_CocoaWindow
- (BOOL)canBecomeKeyWindow
{
-return (YES);
+return (_agarWindow->flags & AG_WINDOW_DENYFOCUS) ? NO : YES;
}
- (BOOL)canBecomeMainWindow
{
-return (YES);
+return (_agarWindow->flags & AG_WINDOW_MAIN) ? YES : NO;
}
< at >end
< at >< at > -1221,9 +1221,17 < at >< at >
static int
COCOA_LowerWindow(AG_Window *win)
{
-/* TODO */
-AG_SetError("Lower window not implemented");
-return (-1);
+NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+AG_DriverCocoa *co = (AG_DriverCocoa *)WIDGET(win)->drv;
+
+AG_MutexLock(&co->lock);
+if (![co->win isMiniaturized]) {
+[co->win orderBack:nil];
+}
+AG_MutexUnlock(&co->lock);
+
+[pool release];
+return (0);
}
static int
[Less]
|
Posted
over 9 years
ago
by
Agar-SVN
Author: vedge
Date: 2015-11-24 00:16:50 -0500 (Tue, 24 Nov 2015)
New Revision: 9846
Modified:
trunk/core/event.c
Log:
- kqueue: report kevent errors to console; ignore timer events with NULL udata.
- kqueue: preallocate some initial changelist
... [More]
entries.
- kqueue: safe to unlock timers prior to processing I/O and other events.
Modified: trunk/core/event.c
===================================================================
--- trunk/core/event.c2015-11-22 11:44:34 UTC (rev 9845)
trunk/core/event.c2015-11-24 05:16:50 UTC (rev 9846)
< at >< at > -688,6 688,7 < at >< at >
src->caps[AG_SINK_WRITE] = 1;
src->caps[AG_SINK_FSEVENT] = 1;
src->caps[AG_SINK_PROCEVENT] = 1;
GrowKqChangelist(kq, 64);/* Preallocate */
#elif defined(HAVE_TIMERFD)
src->sinkFn = AG_EventSinkTIMERFD;
src->addTimerFn = AG_AddTimerTIMERFD;
< at >< at > -1102,29 1103,33 < at >< at >
return (-1);
}
kq->nChanges = 0;
/* 1. Process timer expirations. */
AG_LockTiming();
-/* 1. Process timer expirations. */
for (i = 0; i < rv; i ) {
struct kevent *kev = &kq->events[i];
enum ag_event_sink_type esType = GetSinkType(kev->filter);
Uint32 rvt;
AG_Timer *to;
AG_Object *ob;
if (kev->flags & EV_ERROR) {
-AG_SetError("kevent[%d]: %s", i, AG_Strerror(kev->data));
-return (-1);
Verbose("kevent (%ld,%d): %s\n", kev->ident, kev->filter,
AG_Strerror((int)kev->data));
continue;
}
-if (esType != AG_SINK_TIMER) {
if (esType != AG_SINK_TIMER ||
(to = (AG_Timer *)kev->udata) == NULL) {
continue;
}
-to = (AG_Timer *)kev->udata;
rvt = to->fn(to, &to->fnEvent);
-if (rvt > 0) {
if (rvt > 0) {/* Restart timer */
struct kevent *kev;
#ifdef DEBUG_TIMERS
Verbose("TIMER[%d] resetting t= %u\n", to->id, (Uint)rvt);
#endif
if (GrowKqChangelist(kq, kq->nChanges 1) == -1) {
AG_UnlockTiming();
return (-1);
}
kev = &kq->changes[kq->nChanges ];
< at >< at > -1131,11 1136,13 < at >< at >
AG_EV_SET(kev, to->id, EVFILT_TIMER,
EV_ADD|EV_ENABLE|EV_ONESHOT, 0, (int)rvt, to);
to->ival = rvt;
-} else {
-AG_Object *ob = to->obj;
} else {/* Expire */
#ifdef DEBUG_TIMERS
Verbose("TIMER[%d] expired\n", to->id);
#endif
if ((ob = to->obj) == NULL) {
continue;
}
TAILQ_REMOVE(&ob->timers, to, timers);
if (TAILQ_EMPTY(&ob->timers)) {
TAILQ_REMOVE(&agTimerObjQ, ob, tobjs);
< at >< at > -1150,6 1157,8 < at >< at >
agTimerCount--;
}
}
AG_UnlockTiming();
/* 2. Process I/O and other events. */
for (i = 0; i < rv; i ) {
struct kevent *kev = &kq->events[i];
< at >< at > -1172,7 1181,6 < at >< at >
break;
}
}
-AG_UnlockTiming();
return (0);
}
[Less]
|
Posted
over 9 years
ago
by
Agar-SVN
Author: vedge
Date: 2015-11-22 06:44:23 -0500 (Sun, 22 Nov 2015)
New Revision: 9844
Modified:
trunk/gui/AG_GLView.3
trunk/gui/AG_Widget.3
trunk/gui/drv_gl_common.c
trunk/gui/widget.c
trunk/gui/widget.h
Log:
- implement
... [More]
AG_WIDGET_USE_OPENGL in base AG_Widget(3) as a replacement for
the AG_GLView(3) class.
- AG_LEGACY (1.3): remove `bound' event alias.
Modified: trunk/gui/AG_GLView.3
===================================================================
--- trunk/gui/AG_GLView.32015-11-22 11:36:22 UTC (rev 9843)
trunk/gui/AG_GLView.32015-11-22 11:44:23 UTC (rev 9844)
< at >< at > -37,6 37,14 < at >< at >
.Ed
.Sh DESCRIPTION
.\" IMAGE(http://libagar.org/widgets/AG_GLView.png, "The AG_GLView widget (with an OverlayFn)")
NOTE: As of version 1.5.0,
.Nm
has been superceded by the
.Dv AG_WIDGET_USE_OPENGL
feature of the base
.Xr AG_Widget 3
class.
.Pp
The
.Nm
widget provides a low-level OpenGL context.
< at >< at > -44,23 52,17 < at >< at >
.Fn scale
and
.Fn draw .
-.Pp
The
.Fn scale
function is expected to set the projection matrix.
-The typical scale function may be a simple call to
For example, the scale function may be a simple call to
.Xr glOrtho 3 .
-When the
-.Fn scaled
-routine is invoked, the OpenGL current matrix is set to the projection matrix,
-and the matrix is initialized to identity.
.Pp
The
-.Em draw
.Fn draw
function renders the scene to the display.
-Before calling the
-.Em draw
-function,
Before calling
.Fn draw ,
.Nm
calls
.Xr glViewport 3 .
< at >< at > -84,24 86,6 < at >< at >
.Xr AG_RedrawOnTick 3 ,
or a conditional update using
.Xr AG_RedrawOnChange 3 .
-.Pp
-In OpenGL mode, the Agar GUI elements are rendered using GL primitives, so
-it is the responsibility of the caller to save and restore all GL state
-(except for the matrices and clipping plane states), in the
-.Em draw
-function.
-.Pp
-Typically,
-.Nm
-is used as a base class to implement more specific scene-rendering widgets.
-For example, the
-.Xr SG_View 3
-and
-.Xr SK_View 3
-widgets of FreeSG
-.Pq Lk http://freesg.org/
-are all subclasses of
-.Nm .
.Sh INHERITANCE HIERARCHY
.Xr AG_Object 3 ->
.Xr AG_Widget 3 ->
< at >< at > -229,22 213,13 < at >< at >
For the
.Ft AG_GLView
object:
-.Bl -tag -width "float mProjection[16] "
.Bl -tag -compact -width "float mProjection[16] "
.It Ft float mProjection[16]
-Projection matrix (4x4, column-major) to automatically load every time the
-.Nm
-is drawn.
-Defaults to identity.
Saved Projection matrix (4x4, column-major).
.It Ft float mModelview[16]
-Modelview matrix (4x4, column-major) to automatically load every time the
-.Nm
-is drawn.
-Defaults to identity.
Saved Modelview matrix.
.It Ft float mTexture[16]
-Texture matrix (4x4, column-major) to automatically load every time the
-.Nm
-is drawn.
-Defaults to identity.
Saved Texture matrix.
.El
.Sh EXAMPLES
See
< at >< at > -261,3 236,7 < at >< at >
The
.Nm
widget first appeared in Agar 1.2.
As of Agar 1.5.0, it has been superceded by the
.Dv AG_WIDGET_USE_OPENGL
feature of
.Xr AG_Widget 3 .
Modified: trunk/gui/AG_Widget.3
===================================================================
--- trunk/gui/AG_Widget.32015-11-22 11:36:22 UTC (rev 9843)
trunk/gui/AG_Widget.32015-11-22 11:44:23 UTC (rev 9844)
< at >< at > -1021,13 1021,13 < at >< at >
.Bl -tag -compact -width 2n
.It Fn widget-shown "void"
The widget is now visible.
-Exceptionally, user-defined handlers for this event should be set using
NOTE: Handlers for this event should be set using
.Xr AG_AddEvent 3
as opposed to
.Xr AG_SetEvent 3 .
.It Fn widget-hidden "void"
The widget is no longer visible.
-Exceptionally, user-defined handlers for this event should be set using
NOTE: Handlers for this event should be set using
.Xr AG_AddEvent 3
as opposed to
.Xr AG_SetEvent 3 .
< at >< at > -1043,6 1043,24 < at >< at >
The widget now holds focus inside its parent container.
.It Fn widget-lostfocus "void"
The widget no longer holds focus.
.It Fn widget-reshape "void"
Widget size has changed and
.Dv USE_OPENGL
is set (and the
.Dv GL_PROJECTION
or
.Dv GL_MODELVIEW
matrices may need to be updated).
.It Fn widget-overlay "void"
Invoked following the
.Fn draw
operation; requires
.Dv USE_OPENGL .
.It Fn widget-underlay "void"
Invoked prior to the
.Fn draw
operation; requires
.Dv USE_OPENGL .
.It Fn font-changed "void"
The default font associated with the widget has changed.
The new font may be accessed via the
< at >< at > -1207,29 1225,37 < at >< at >
.Dv TAB
is used to change the focus to the next widget.
.It AG_WIDGET_NOSPACING
-Advise parent container widgets to avoid applying spacing and padding rules
-to this widget.
-This flag is used by such widgets as
-.Xr AG_Titlebar 3
-and
-.Xr AG_Menu 3 .
Advise parent container to disable spacing and padding (per standard box model),
for this widget.
.It AG_WIDGET_USE_TEXT
-Advise that the widget's
Allow
.Fn draw ,
.Fn size_request
-or
and
.Fn size_allocate
-routines will make calls such as
to use
.Xr AG_TextRender 3
-or
and
.Xr AG_TextSize 3 .
-Prior to invoking those routines, Agar will set the font engine's state
-(using
-.Xr AG_PushTextState 3
Agar will automatically save/restore the font engine state according to the
widget's computed style settings.
Enables reception of the "font-changed" event.
.It AG_WIDGET_USE_OPENGL
Establish a separate OpenGL context for the widget.
Before the
.Fn draw
routine is invoked, Agar will automatically save/restore the
.Dv GL_PROJECTION ,
.Dv GL_MODELVIEW
and
-.Xr AG_PopTextState 3 )
-according to the widget's effective style settings.
-Enables reception of the "font-changed" event.
.Dv GL_TEXTURE
matrices along with GL attributes
.Dv GL_TRANSFORM_BIT ,
.Dv GL_VIEWPORT_BIT
and
.Dv GL_TEXTURE_BIT .
Enables reception of "widget-reshape", "widget-overlay" and "widget-underlay"
events.
.It AG_WIDGET_USE_MOUSEOVER
Detect cursor motion over the widget's area; update the
.Dv AG_WIDGET_MOUSEOVER
< at >< at > -1252,4 1278,7 < at >< at >
Widget-level variable bindings have been replaced by generic
.Xr AG_Variable 3
pointers in Agar 1.3.4.
-The widget "actions" interface first appeared in Agar 1.4.
The Actions interface first appeared in Agar 1.4.
The
.Dv AG_WIDGET_USE_OPENGL
feature first appeared in Agar 1.5.
Modified: trunk/gui/drv_gl_common.c
===================================================================
--- trunk/gui/drv_gl_common.c2015-11-22 11:36:22 UTC (rev 9843)
trunk/gui/drv_gl_common.c2015-11-22 11:44:23 UTC (rev 9844)
< at >< at > -293,8 293,8 < at >< at >
if (tc != NULL) {
tc->x = 0.0f;
tc->y = 0.0f;
-tc->w = (float)su->w / gsu->w;
-tc->h = (float)su->h / gsu->h;
tc->w = (float)su->w / (float)gsu->w;
tc->h = (float)su->h / (float)gsu->h;
}
/* Upload as an OpenGL texture. */
< at >< at > -336,8 336,8 < at >< at >
if (tc != NULL) {
tc->x = 0.0f;
tc->y = 0.0f;
-tc->w = (float)gsu->w / su->w;
-tc->h = (float)gsu->h / su->h;
tc->w = (float)gsu->w / (float)su->w;
tc->h = (float)gsu->h / (float)su->h;
}
glBindTexture(GL_TEXTURE_2D, (GLuint)texture);
< at >< at > -359,19 359,19 < at >< at >
AG_GL_PrepareTexture(void *obj, int s)
{
AG_Widget *wid = obj;
AG_Driver *drv = wid->drv;
if (wid->textures[s] == 0) {
-wid->textures[s] = AG_SurfaceTexture(wid->surfaces[s],
AG_GL_UploadTexture(drv, &wid->textures[s], wid->surfaces[s],
&wid->texcoords[s]);
} else if (wid->surfaceFlags[s] & AG_WIDGET_SURFACE_REGEN) {
wid->surfaceFlags[s] &= ~(AG_WIDGET_SURFACE_REGEN);
-AG_GL_StdUpdateTexture(wid->drv, wid->textures[s],
AG_GL_UpdateTexture(drv, wid->textures[s],
wid->surfaces[s], &wid->texcoords[s]);
}
}
/* Generic emulated BlitSurface() for GL drivers. */
-/* XXX inefficient */
void
AG_GL_BlitSurface(void *obj, AG_Widget *wid, AG_Surface *s, int x, int y)
{
< at >< at > -382,7 382,7 < at >< at >
AG_ASSERT_CLASS(obj, "AG_Driver:*");
AG_ASSERT_CLASS(wid, "AG_Widget:*");
-texture = AG_SurfaceTexture(s, &tc);
AG_GL_UploadTexture(drv, &texture, s, &tc);
AGDRIVER_CLASS(drv)->pushBlendingMode(drv,
AG_ALPHA_SRC,
< at >< at > -458,7 458,7 < at >< at >
float w2 = w/2.0f;
float h2 = h/2.0f;
-texture = AG_SurfaceTexture(s, &tc);
AG_GL_UploadTexture(drv, &texture, s, &tc);
AGDRIVER_CLASS(drv)->pushBlendingMode(drv,
AG_ALPHA_SRC,
< at >< at > -588,8 588,8 < at >< at >
AG_ObjectLock(wid);
for (i = 0; i < wid->nsurfaces; i ) {
if (wid->surfaces[i] != NULL) {
-wid->textures[i] = AG_SurfaceTexture(wid->surfaces[i],
- &wid->texcoords[i]);
AG_GL_UploadTexture(wid->drv, &wid->textures[i],
wid->surfaces[i], &wid->texcoords[i]);
} else {
wid->textures[i] = 0;
}
Modified: trunk/gui/widget.c
===================================================================
--- trunk/gui/widget.c2015-11-22 11:36:22 UTC (rev 9843)
trunk/gui/widget.c2015-11-22 11:44:23 UTC (rev 9844)
< at >< at > -156,6 156,8 < at >< at >
AG_Widget *widParent = (AG_Widget *)parent;
Uint i;
Debug(w, "Attach to window (%s)\n", OBJECT(parent)->name);
SetParentWindow(w, AGWINDOW(widParent));
if (AGWINDOW(widParent)->visible) {
w->flags |= AG_WIDGET_UPDATE_WINDOW;
< at >< at > -172,6 174,9 < at >< at >
} else if (AG_OfClass(parent, "AG_Widget:*") &&
AG_OfClass(w, "AG_Widget:*")) {
AG_Widget *widParent = (AG_Widget *)parent;
Debug(w, "Attach to widget (%s in %s)\n", OBJECT(parent)->name,
widParent->window != NULL ? OBJECT(widParent->window)->name : "NULL");
SetParentWindow(w, widParent->window);
if (widParent->window != NULL &&
< at >< at > -182,6 187,7 < at >< at >
AG_OfClass(w, "AG_Widget:AG_Window:*")) {
AG_Driver *drvParent = (AG_Driver *)parent;
Debug(w, "Attach to driver (%s)\n", OBJECT(parent)->name);
SetParentDriver(w, drvParent);
} else {
AG_FatalError("Inconsistent widget attach");
< at >< at > -287,18 293,7 < at >< at >
}
}
-#ifdef AG_LEGACY
-/* "widget-bound" event; replaced by AG_Variable(3) in 1.3.4. */
static void
-Bound(AG_Event *event)
-{
-AG_Widget *wid = AG_SELF();
-AG_Variable *V = AG_PTR(1);
-AG_PostEvent(NULL, wid, "widget-bound", "%p", V);
-}
-#endif /* AG_LEGACY */
-
-static void
Init(void *obj)
{
AG_Widget *wid = obj;
< at >< at > -338,10 333,6 < at >< at >
ev->flags |= AG_EVENT_PROPAGATE;
ev = AG_SetEvent(wid, "widget-hidden", OnHide, NULL);
ev->flags |= AG_EVENT_PROPAGATE;
-#ifdef AG_LEGACY
-/* "widget-bound" event; replaced by AG_Variable(3) in 1.3.4. */
-AG_SetEvent(wid, "bound", Bound, NULL);
-#endif
TAILQ_INIT(&wid->redrawTies);
TAILQ_INIT(&wid->cursorAreas);
< at >< at > -398,7 389,7 < at >< at >
if (rt != NULL) {
TAILQ_REMOVE(&wid->redrawTies, rt, redrawTies);
AG_DelTimer(wid, &rt->to);
-Free(rt);
free(rt);
}
return;
}
< at >< at > -941,19 932,19 < at >< at >
rt != TAILQ_END(&wid->redrawTies);
rt = rtNext) {
rtNext = TAILQ_NEXT(rt, redrawTies);
-Free(rt);
free(rt);
}
for (at = TAILQ_FIRST(&wid->mouseActions);
at != TAILQ_END(&wid->mouseActions);
at = atNext) {
atNext = TAILQ_NEXT(at, ties);
-Free(at);
free(at);
}
for (at = TAILQ_FIRST(&wid->keyActions);
at != TAILQ_END(&wid->keyActions);
at = atNext) {
atNext = TAILQ_NEXT(at, ties);
-Free(at);
free(at);
}
/* Free the action tables. */
< at >< at > -1139,6 1130,72 < at >< at >
return (0);
}
#ifdef HAVE_OPENGL
static void
DrawPrologueGL_Reshape(AG_Widget *wid)
{
glMatrixMode(GL_PROJECTION); glPushMatrix();
glMatrixMode(GL_MODELVIEW); glPushMatrix();
AG_PostEvent(NULL, wid, "widget-reshape", NULL);
wid->flags &= ~(AG_WIDGET_GL_RESHAPE);
glGetFloatv(GL_PROJECTION, wid->gl.mProjection);
glGetFloatv(GL_MODELVIEW, wid->gl.mModelview);
glMatrixMode(GL_PROJECTION); glPopMatrix();
glMatrixMode(GL_MODELVIEW); glPopMatrix();
}
static void
DrawPrologueGL(AG_Widget *wid)
{
Uint hView;
AG_PostEvent(NULL, wid, "widget-underlay", NULL);
glPushAttrib(GL_TRANSFORM_BIT | GL_VIEWPORT_BIT | GL_TEXTURE_BIT);
if (wid->flags & AG_WIDGET_GL_RESHAPE)
DrawPrologueGL_Reshape(wid);
hView = AGDRIVER_SINGLE(wid->drv) ? AGDRIVER_SW(wid->drv)->h :
HEIGHT(wid->window);
glViewport(wid->rView.x1, (hView - wid->rView.y2),
WIDTH(wid), HEIGHT(wid));
glMatrixMode(GL_TEXTURE);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadMatrixf(wid->gl.mProjection);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadMatrixf(wid->gl.mModelview);
glDisable(GL_CLIP_PLANE0);
glDisable(GL_CLIP_PLANE1);
glDisable(GL_CLIP_PLANE2);
glDisable(GL_CLIP_PLANE3);
}
static void
DrawEpilogueGL(AG_Widget *wid)
{
glMatrixMode(GL_MODELVIEW);glPopMatrix();
glMatrixMode(GL_PROJECTION);glPopMatrix();
glMatrixMode(GL_TEXTURE);glPopMatrix();
glPopAttrib(); /* GL_TRANSFORM_BIT | GL_VIEWPORT_BIT */
AG_PostEvent(NULL, wid, "widget-overlay", NULL);
}
#endif /* HAVE_OPENGL */
/*
* Render a widget to the display.
* Must be invoked from GUI rendering context.
< at >< at > -1155,23 1212,27 < at >< at >
WIDGET_OPS(wid)->draw == NULL)
goto out;
-if (wid->flags & AG_WIDGET_DISABLED) {
-wid->cState = AG_DISABLED_STATE;
-} else if (wid->flags & AG_WIDGET_MOUSEOVER) {
-wid->cState = AG_HOVER_STATE;
-} else if (wid->flags & AG_WIDGET_FOCUSED) {
-wid->cState = AG_FOCUSED_STATE;
-} else {
-wid->cState = AG_DEFAULT_STATE;
-}
if (wid->flags & AG_WIDGET_DISABLED) { wid->cState = AG_DISABLED_STATE; }
else if (wid->flags & AG_WIDGET_MOUSEOVER) { wid->cState = AG_HOVER_STATE; }
else if (wid->flags & AG_WIDGET_FOCUSED) { wid->cState = AG_FOCUSED_STATE; }
else { wid->cState = AG_DEFAULT_STATE; }
if (wid->flags & AG_WIDGET_USE_TEXT) {
AG_PushTextState();
AG_TextFont(wid->font);
AG_TextColor(wid->pal.c[wid->cState][AG_TEXT_COLOR]);
}
#ifdef HAVE_OPENGL
if (wid->flags & AG_WIDGET_USE_OPENGL)
DrawPrologueGL(wid);
#endif
WIDGET_OPS(wid)->draw(wid);
-
#ifdef HAVE_OPENGL
if (wid->flags & AG_WIDGET_USE_OPENGL)
DrawEpilogueGL(wid);
#endif
if (wid->flags & AG_WIDGET_USE_TEXT)
AG_PopTextState();
out:
< at >< at > -1245,6 1306,9 < at >< at >
if (w->flags & AG_WIDGET_USE_TEXT) {
AG_PopTextState();
}
#ifdef HAVE_OPENGL
w->flags |= AG_WIDGET_GL_RESHAPE;
#endif
AG_ObjectUnlock(w);
}
< at >< at > -1341,6 1405,9 < at >< at >
if (AG_RectCompare2(&wid->rView, &rPrev) != 0) {
AG_PostEvent(NULL, wid, "widget-moved", NULL);
#ifdef HAVE_OPENGL
wid->flags |= AG_WIDGET_GL_RESHAPE;
#endif
}
OBJECT_FOREACH_CHILD(chld, wid, ag_widget) {
AG_WidgetUpdateCoords(chld,
Modified: trunk/gui/widget.h
===================================================================
--- trunk/gui/widget.h2015-11-22 11:36:22 UTC (rev 9843)
trunk/gui/widget.h2015-11-22 11:44:23 UTC (rev 9844)
< at >< at > -12,7 12,6 < at >< at >
#include <agar/gui/surface.h>
#include <agar/gui/anim.h>
#include <agar/gui/stylesheet.h>
-
#include <agar/gui/mouse.h>
#include <agar/gui/keyboard.h>
#include <agar/gui/drv.h>
< at >< at > -19,7 18,11 < at >< at >
#include <agar/gui/begin.h>
-/* Widget size requisition and allocation structures. */
struct ag_widget;
struct ag_cursor;
struct ag_font;
/* Widget size requisition and allocation. */
typedef struct ag_size_req {
int w, h;/* Requested geometry in pixels */
} AG_SizeReq;
< at >< at > -28,7 31,7 < at >< at >
int x, y;/* Allocated position in pixels */
} AG_SizeAlloc;
-/* Widget class description structure. */
/* Widget class description. */
typedef struct ag_widget_class {
struct ag_object_class _inherit;
void (*draw)(void *);
< at >< at > -38,20 41,20 < at >< at >
/* Relative size specification of visual element. */
typedef enum ag_widget_sizespec {
-AG_WIDGET_BAD_SPEC,/* Parser error */
-AG_WIDGET_PIXELS,/* Pixel count */
-AG_WIDGET_PERCENT,/* % of available space */
-AG_WIDGET_STRINGLEN,/* Width of given string */
-AG_WIDGET_FILL/* Fill remaining space */
AG_WIDGET_BAD_SPEC,/* Parser error */
AG_WIDGET_PIXELS,/* Pixel count */
AG_WIDGET_PERCENT,/* % of available space */
AG_WIDGET_STRINGLEN,/* Width of given string */
AG_WIDGET_FILL/* Fill remaining space */
} AG_SizeSpec;
-/* Container widget "packing mode" specification. */
/* Packing mode (i.e., for container widgets). */
enum ag_widget_packing {
AG_PACK_HORIZ,
AG_PACK_VERT
};
-/* Flag description (e.g., for AG_Checkbox(3)) */
/* Flag description (i.e., for AG_Checkbox(3)) */
typedef struct ag_flag_descr {
Uint bitmask;/* Bitmask */
const char *descr;/* Bit(s) description */
< at >< at > -59,7 62,7 < at >< at >
} AG_FlagDescr;
/*
- * Registered widget action.
* Widget Actions
*/
typedef enum ag_action_type {
AG_ACTION_FN,/* Execute function */
< at >< at > -102,7 105,7 < at >< at >
AG_TAILQ_ENTRY(ag_action_tie) ties;
} AG_ActionTie;
-/* Widget redraw tie. */
/* Redraw tie (for AG_RedrawOn*() feature). */
enum ag_redraw_tie_type {
AG_REDRAW_ON_CHANGE,
AG_REDRAW_ON_TICK
< at >< at > -117,9 120,6 < at >< at >
AG_TAILQ_ENTRY(ag_redraw_tie) redrawTies; /* In widget */
} AG_RedrawTie;
-struct ag_widget;
-struct ag_cursor;
-
/* Cursor-change area */
typedef struct ag_cursor_area {
AG_Rect r;/* Area in window */
< at >< at > -130,9 130,9 < at >< at >
} AG_CursorArea;
/*
- * Palette of globally inheritable widget colors. Color schemes may be
- * configured on a per-class, per-instance or per-"id"-tag basis.
- * Sync: agWidgetStateNames[], agWidgetColorNames[], agDefaultPalette[].
* Standard widget colors (CSS-defined, state-dependent, globally-inheritable).
*
* SYNC: agWidgetStateNames[], agWidgetColorNames[], agDefaultPalette[].
*/
#define AG_WIDGET_NSTATES 5
#define AG_WIDGET_NCOLORS 5
< at >< at > -159,33 159,33 < at >< at >
#define AG_WCOLOR_HOV(wid,which) AGWIDGET(wid)->pal.c[AG_HOVER_STATE][which]
#define AG_WCOLOR_SEL(wid,which) AGWIDGET(wid)->pal.c[AG_SELECTED_STATE][which]
-struct ag_font;
-
-/* Widget instance structure */
/* Base Agar widget */
typedef struct ag_widget {
struct ag_object obj;
Uint flags;
#define AG_WIDGET_FOCUSABLE0x000001 /* Can grab focus */
-#define AG_WIDGET_FOCUSED0x000002 /* Holds focus (optimization) */
#define AG_WIDGET_FOCUSED0x000002 /* Holds focus (computed) */
#define AG_WIDGET_UNFOCUSED_MOTION0x000004 /* All mousemotion events */
#define AG_WIDGET_UNFOCUSED_BUTTONUP0x000008 /* All mousebuttonup events */
#define AG_WIDGET_UNFOCUSED_BUTTONDOWN0x000010 /* All mousebuttondown events */
-#define AG_WIDGET_VISIBLE0x000020 /* Widget is visible */
#define AG_WIDGET_VISIBLE0x000020 /* Widget is visible (computed) */
#define AG_WIDGET_HFILL0x000040 /* Expand to fill width */
#define AG_WIDGET_VFILL0x000080 /* Expand to fill height */
#define AG_WIDGET_USE_OPENGL0x000100 /* Set up separate GL context */
#define AG_WIDGET_HIDE0x000200 /* Don't draw this widget */
#define AG_WIDGET_DISABLED0x000400 /* Don't respond to input */
-#define AG_WIDGET_MOUSEOVER0x000800 /* Cursor intersects widget */
#define AG_WIDGET_MOUSEOVER0x000800 /* Mouseover state (computed) */
#define AG_WIDGET_CATCH_TAB0x001000 /* Catch tab key events */
-#define AG_WIDGET_UNDERSIZE0x004000 /* Size allocation failed */
-#define AG_WIDGET_NOSPACING0x008000 /* Disable spacings around widget; container-specific */
#define AG_WIDGET_GL_RESHAPE0x002000 /* Pending GL view reshape */
#define AG_WIDGET_UNDERSIZE0x004000 /* Size alloc failed (computed) */
#define AG_WIDGET_NOSPACING0x008000 /* No box model (container-specific) */
#define AG_WIDGET_UNFOCUSED_KEYDOWN0x010000 /* All mousebuttondown events */
#define AG_WIDGET_UNFOCUSED_KEYUP0x020000 /* All mousebuttondown events */
#define AG_WIDGET_TABLE_EMBEDDABLE0x080000 /* Usable in polled tables */
#define AG_WIDGET_UPDATE_WINDOW0x100000 /* Request an AG_WindowUpdate() as soon as possible */
-#define AG_WIDGET_QUEUE_SURFACE_BACKUP0x200000 /* Backup surfaces as soon as possible */
-#define AG_WIDGET_USE_TEXT0x400000 /* Widget uses font engine */
#define AG_WIDGET_QUEUE_SURFACE_BACKUP0x200000 /* Must backup surfaces ASAP */
#define AG_WIDGET_USE_TEXT0x400000 /* Use Agar's font engine */
#define AG_WIDGET_USE_MOUSEOVER0x800000 /* Update MOUSEOVER flag and generate mouseover events */
#define AG_WIDGET_EXPAND(AG_WIDGET_HFILL|AG_WIDGET_VFILL)
< at >< at > -213,11 213,15 < at >< at >
AG_TAILQ_HEAD_(ag_cursor_area) cursorAreas;/* Cursor-change areas
(not yet attached) */
-/* Global inheritable style attributes */
-AG_StyleSheet *css;/* Alternate style sheet */
-enum ag_widget_color_state cState;/* Current color state */
-struct ag_font *font;/* Effective font */
-AG_WidgetPalette pal;/* Effective colors */
AG_StyleSheet *css;/* Alternate style sheet */
enum ag_widget_color_state cState;/* Current CSS color state */
struct ag_font *font;/* Computed font reference */
AG_WidgetPalette pal;/* Computed color palette */
struct {
float mProjection[16];/* Projection matrix */
float mModelview[16];/* Modelview matrix */
} gl;
} AG_Widget;
#define AGWIDGET(wi)((AG_Widget *)(wi))
[Less]
|
Posted
over 9 years
ago
by
Agar-SVN
Author: vedge
Date: 2015-11-22 06:30:57 -0500 (Sun, 22 Nov 2015)
New Revision: 9839
Modified:
trunk/gui/AG_Anim.3
trunk/gui/anim.c
trunk/gui/anim.h
Log:
AG_AnimDup() const-correct
Modified: trunk/gui/AG_Anim.3
... [More]
===================================================================
--- trunk/gui/AG_Anim.32015-11-22 11:28:27 UTC (rev 9838)
+++ trunk/gui/AG_Anim.32015-11-22 11:30:57 UTC (rev 9839)
< at >< at > -70,7 +70,7 < at >< at >
.Fn AG_AnimFromJPEGs "const char *path"
.Pp
.Ft "AG_Anim *"
-.Fn AG_AnimDup "AG_Anim *src"
+.Fn AG_AnimDup "const AG_Anim *src"
.Pp
.Ft "void"
.Fn AG_AnimSetOrigFPS "AG_Anim *anim" "double fps"
< at >< at > -189,6 +189,7 < at >< at >
.Fn AG_AnimDup
function returns a duplicate of the specified animation, or NULL if
insufficient memory is available.
+The source animation must be locked (src->lock).
.Pp
The
.Fn AG_AnimSetOrigFPS
Modified: trunk/gui/anim.c
===================================================================
--- trunk/gui/anim.c2015-11-22 11:28:27 UTC (rev 9838)
+++ trunk/gui/anim.c2015-11-22 11:30:57 UTC (rev 9839)
< at >< at > -181,19 +181,19 < at >< at >
return (-1);
}
-/* Return a newly-allocated duplicate of an animation. */
+/*
+ * Return a newly-allocated duplicate of an animation.
+ * The source animation must be locked.
+ */
AG_Anim *
-AG_AnimDup(AG_Anim *sa)
+AG_AnimDup(const AG_Anim *sa)
{
AG_Anim *a;
int i;
-AG_MutexLock(&sa->lock);
-
a = AG_AnimNew(sa->type, sa->w, sa->h, sa->format,
(sa->flags & AG_SAVED_ANIM_FLAGS));
if (a == NULL) {
-AG_MutexUnlock(&sa->lock);
return (NULL);
}
if ((a->f = TryMalloc(sa->n*sizeof(AG_AnimFrame))) == NULL) {
< at >< at > -208,10 +208,8 < at >< at >
memcpy(af->pixels, sa->f[i].pixels, sa->h*sa->pitch);
a->n++;
}
-AG_MutexUnlock(&sa->lock);
return (a);
fail:
-AG_MutexUnlock(&sa->lock);
AG_AnimFree(a);
return (NULL);
}
Modified: trunk/gui/anim.h
===================================================================
--- trunk/gui/anim.h2015-11-22 11:28:27 UTC (rev 9838)
+++ trunk/gui/anim.h2015-11-22 11:30:57 UTC (rev 9839)
< at >< at > -59,7 +59,7 < at >< at >
AG_Anim *AG_AnimFromPNGs(const char *);
AG_Anim *AG_AnimFromJPEGs(const char *);
int AG_AnimSetPalette(AG_Anim *, AG_Color *, Uint, Uint);
-AG_Anim *AG_AnimDup(AG_Anim *);
+AG_Anim *AG_AnimDup(const AG_Anim *);
int AG_AnimResize(AG_Anim *, Uint, Uint);
void AG_AnimFree(AG_Anim *);
[Less]
|
Posted
over 9 years
ago
by
Agar-SVN
Author: vedge
Date: 2015-11-22 06:28:27 -0500 (Sun, 22 Nov 2015)
New Revision: 9838
Modified:
trunk/core/core_close.h
Log:
don't undef AG_DEBUG/LEGACY/THREADS
Modified: trunk/core/core_close.h
... [More]
===================================================================
--- trunk/core/core_close.h2015-11-09 05:41:14 UTC (rev 9837)
+++ trunk/core/core_close.h2015-11-22 11:28:27 UTC (rev 9838)
< at >< at > -1,8 +1,8 < at >< at >
/*Public domain*/
-#undef AG_DEBUG
-#undef AG_LEGACY
-#undef AG_THREADS
+/* #undef AG_DEBUG */
+/* #undef AG_LEGACY */
+/* #undef AG_THREADS */
#ifdef _AGAR_HAVE_64BIT_H_
# undef _AGAR_HAVE_64BIT_H_
[Less]
|
Posted
over 9 years
ago
by
Agar-SVN
Author: vedge
Date: 2015-11-09 00:41:14 -0500 (Mon, 09 Nov 2015)
New Revision: 9837
Modified:
trunk/gui/menu.c
Log:
make AG_MenuExpand() windows modal again
Modified: trunk/gui/menu.c
... [More]
===================================================================
--- trunk/gui/menu.c2015-11-07 15:58:26 UTC (rev 9836)
+++ trunk/gui/menu.c2015-11-09 05:41:14 UTC (rev 9837)
< at >< at > -179,7 +179,7 < at >< at >
}
win = AG_WindowNew(
- AG_WINDOW_NOTITLE|AG_WINDOW_NOBORDERS|
+ AG_WINDOW_MODAL|AG_WINDOW_NOTITLE|AG_WINDOW_NOBORDERS|
AG_WINDOW_NORESIZE|AG_WINDOW_DENYFOCUS|AG_WINDOW_KEEPABOVE);
if (win == NULL) {
return (NULL);
[Less]
|
Posted
over 9 years
ago
by
Agar-SVN
Author: vedge
Date: 2015-11-07 10:58:26 -0500 (Sat, 07 Nov 2015)
New Revision: 9836
Modified:
trunk/gui/gui.c
Log:
work around mutex error on exit under OSX
Modified: trunk/gui/gui.c
... [More]
===================================================================
--- trunk/gui/gui.c2015-11-07 14:50:04 UTC (rev 9835)
+++ trunk/gui/gui.c2015-11-07 15:58:26 UTC (rev 9836)
< at >< at > -265,7 +265,9 < at >< at >
AG_Unset(cfg, agGUIOptions[i].key);
AG_ObjectDestroy(&agInputDevices);
+#ifndef __APPLE__ /* XXX mutex issue */
AG_ObjectDestroy(&agDrivers);
+#endif
AG_PixelFormatFree(agSurfaceFmt); agSurfaceFmt = NULL;
AG_EditableDestroyClipboards();
[Less]
|