From e4f9c9ccea3da81c722f20dff7452503aec226a9 Mon Sep 17 00:00:00 2001 From: Jerome St-Louis Date: Sun, 6 Jul 2014 08:04:00 -0400 Subject: [PATCH] ear/extract; extras; samples: Fixes --- ear/extract/extract.ec | 3 +- ear/extract/extract.epj | 3 +- ecere/src/gfx/drivers/XDisplayDriver.ec | 2 ++ extras/audio/alsa.ec | 15 +++++----- ide/src/project/ProjectNode.ec | 2 +- .../guiAndGfx/pictureRotateAlpha/pictureRotate.epj | 18 ++++++++++++ samples/guiAndGfx/pictureRotateAlpha/rotate1.ec | 32 ++++++++++------------ samples/guiAndGfx/skinning/form1.ec | 17 +++++++----- samples/guiAndGfx/snow/snow.ec | 2 +- 9 files changed, 58 insertions(+), 36 deletions(-) diff --git a/ear/extract/extract.ec b/ear/extract/extract.ec index 51af54d..b28575c 100644 --- a/ear/extract/extract.ec +++ b/ear/extract/extract.ec @@ -213,7 +213,8 @@ class SelfExtract : Window void ViewArchive(const char * path) { FileListing listing { path }; - char string[MAX_LOCATION], * directory; + char string[MAX_LOCATION]; + const char * directory; DataRow row; SplitArchivePath(path, string, &directory); diff --git a/ear/extract/extract.epj b/ear/extract/extract.epj index 36670ae..1f0f902 100644 --- a/ear/extract/extract.epj +++ b/ear/extract/extract.epj @@ -54,7 +54,8 @@ "m", "dl", "pthread", - "X11" + "X11", + "freetype" ] } }, diff --git a/ecere/src/gfx/drivers/XDisplayDriver.ec b/ecere/src/gfx/drivers/XDisplayDriver.ec index 9980301..f540e20 100644 --- a/ecere/src/gfx/drivers/XDisplayDriver.ec +++ b/ecere/src/gfx/drivers/XDisplayDriver.ec @@ -517,6 +517,8 @@ class XDisplayDriver : DisplayDriver xDisplay.image = XShmCreateImage(xGlobalDisplay, xSystemVisual /*DefaultVisual(xGlobalDisplay, DefaultScreen(xGlobalDisplay))*/, format->depth, ZPixmap, null, &xDisplay.shminfo, width, height); } + else if(display.useSharedMemory && !xSharedMemory) + printf("%s", $"Error: Requested shared memory but shared memory pixmaps are not supported by X server.\n"); #endif if(xDisplay.image) { diff --git a/extras/audio/alsa.ec b/extras/audio/alsa.ec index 48535cb..563190b 100644 --- a/extras/audio/alsa.ec +++ b/extras/audio/alsa.ec @@ -12,7 +12,7 @@ static AudioSpec audioSpec { }; static bool paused; static Semaphore pauseSemaphore { }; -static char *device = "default"; +static const char *device = "default"; static snd_mixer_t *mixer_handle; @@ -35,8 +35,8 @@ public bool AudioSetVolume(VolumeControl type, double percent) { snd_mixer_elem_t *elem; snd_mixer_selem_id_t *sid; - int pmin, pmax; - int get_vol, set_vol; + long pmin, pmax; + int set_vol; float f_multi; snd_mixer_load(mixer_handle); @@ -75,7 +75,7 @@ public bool AudioGetVolume(VolumeControl type, double * percent) snd_mixer_elem_t *elem; snd_mixer_selem_id_t *sid; long pmin, pmax; - long get_vol, set_vol; + long set_vol; float f_multi; snd_mixer_load(mixer_handle); @@ -116,7 +116,6 @@ public void CloseMixer() public int OpenAudio(AudioSpec wanted, AudioSpec result) { int err; - unsigned int i; buffer = new byte[wanted.samples * wanted.channels * wanted.bits / 8]; memset(buffer, 0, wanted.samples * wanted.channels * wanted.bits / 8); @@ -204,14 +203,14 @@ static class SoundThread : Thread frames = snd_pcm_writei(handle, buffer, numSamples); if(frames < 0) - frames = snd_pcm_recover(handle, frames, 0); + frames = snd_pcm_recover(handle, (int)frames, 0); if (frames < 0) { - printf("snd_pcm_writei failed: %s\n", snd_strerror(frames)); + printf("snd_pcm_writei failed: %s\n", snd_strerror((int)frames)); break; } if (frames > 0 && frames < numSamples) - printf("Short write (expected %li, wrote %li)\n", numSamples, frames); + printf("Short write (expected %ui, wrote %li)\n", numSamples, frames); } } return 0; diff --git a/ide/src/project/ProjectNode.ec b/ide/src/project/ProjectNode.ec index bf7d960..9bd4e49 100644 --- a/ide/src/project/ProjectNode.ec +++ b/ide/src/project/ProjectNode.ec @@ -17,7 +17,7 @@ static define app = ((GuiApplication)__thisModule); static void OutputLog(const char * string) { #ifdef MAKEFILE_GENERATOR - printf(string); + printf("%s", string); #else ide.outputView.buildBox.Log(string); #endif diff --git a/samples/guiAndGfx/pictureRotateAlpha/pictureRotate.epj b/samples/guiAndGfx/pictureRotateAlpha/pictureRotate.epj index f01eb71..df9c066 100644 --- a/samples/guiAndGfx/pictureRotateAlpha/pictureRotate.epj +++ b/samples/guiAndGfx/pictureRotateAlpha/pictureRotate.epj @@ -9,6 +9,24 @@ "ecere" ] }, + "Platforms" : [ + { + "Name" : "linux", + "Options" : { + "Libraries" : [ + "m" + ] + } + }, + { + "Name" : "apple", + "Options" : { + "Libraries" : [ + "m" + ] + } + } + ], "Configurations" : [ { "Name" : "Debug", diff --git a/samples/guiAndGfx/pictureRotateAlpha/rotate1.ec b/samples/guiAndGfx/pictureRotateAlpha/rotate1.ec index 2381445..3657e6a 100644 --- a/samples/guiAndGfx/pictureRotateAlpha/rotate1.ec +++ b/samples/guiAndGfx/pictureRotateAlpha/rotate1.ec @@ -78,7 +78,7 @@ public class PictureRotate : Window Camera camera { type = fixed; - position = { 0, -1000, 0 }; + position = { 0, -275, 0 }; zMin = 0.1f, orientation = Euler { 0, 90, 0 }; }; @@ -89,8 +89,7 @@ public class PictureRotate : Window Mesh mesh; material.baseMap = image.bitmap; plane.Create(displaySystem); - //plane.transform.scaling = { 20 / 2 / 0.707, 20 /2 / 0.707f, 20 /2/ 0.707f }; - plane.transform.scaling = { 1.0f, 1.5f, 1.0f }; + plane.transform.scaling = { 1, 1, 1 }; // plane.transform.scaling = { image.bitmap.width, 1.5f, image.bitmap.height }; //plane.transform.scaling = { Max(image.bitmap.width, image.bitmap.height), 1.5f, Max(image.bitmap.width, image.bitmap.height) }; @@ -98,7 +97,7 @@ public class PictureRotate : Window if(!image.bitmap) return false; w = image.bitmap.width; h = image.bitmap.height; - camera.position.y = -Max(image.bitmap.height, image.bitmap.height); + camera.position.y = -Max(image.bitmap.height, image.bitmap.height) / sqrt(2); plane.UpdateTransform(); @@ -120,21 +119,20 @@ public class PictureRotate : Window { Size size = initSize; Anchor anchor = this.anchor; - Bitmap bitmap = image ? image.bitmap : null; - - if(!size.w && (!anchor.left.type || !anchor.right.type)) + if(image && image.bitmap) { - if(bitmap) - *w = (int)(bitmap.width * zoom / 0.707); - else - *w = 80; + Bitmap bitmap = image.bitmap; + double m = Max(bitmap.width, bitmap.height) * zoom * sqrt(2); + if(!size.w && (!anchor.left.type || !anchor.right.type)) + *w = (int)m; + if(!size.h && (!anchor.top.type || !anchor.bottom.type)) + *h = (int)m; } - - if(!size.h && (!anchor.top.type || !anchor.bottom.type)) + else { - if(bitmap) - *h = (int)(bitmap.height * zoom / 0.707); - else + if(!size.w && (!anchor.left.type || !anchor.right.type)) + *w = 80; + if(!size.h && (!anchor.top.type || !anchor.bottom.type)) *h = 80; } return true; @@ -167,7 +165,7 @@ static Degrees startAngle; static int startY, startX; static bool rotating; -PictureRotate megan +PictureRotate pic { displayDriver = "OpenGL", background = 0, diff --git a/samples/guiAndGfx/skinning/form1.ec b/samples/guiAndGfx/skinning/form1.ec index 9f4a583..ee972f2 100644 --- a/samples/guiAndGfx/skinning/form1.ec +++ b/samples/guiAndGfx/skinning/form1.ec @@ -2,8 +2,11 @@ import "ecere" class Form1 : Window { +#if defined(__linux__) + displayDriver = "OpenGL"; +#endif alphaBlend = true; - text = "Form1"; + caption = "Form1"; background = activeBorder; borderStyle = sizable; hasMaximize = true; @@ -12,12 +15,12 @@ class Form1 : Window size = { 640, 480 }; nativeDecorations = false; - Button button1 { this, text = "button1", position = { 440, 152 } }; - DropBox dropBox1 { this, text = "dropBox1", position = { 208, 88 } }; - ListBox listBox1 { this, text = "listBox1", position = { 304, 280 } }; - EditBox editBox1 { this, text = "editBox1", position = { 96, 184 } }; - Label label1 { this, text = "label1", position = { 432, 248 } }; - ScrollBar scrollBar1 { this, text = "scrollBar1", position = { 488, 360 } }; + Button button1 { this, caption = "button1", position = { 440, 152 } }; + DropBox dropBox1 { this, caption = "dropBox1", position = { 208, 88 } }; + ListBox listBox1 { this, caption = "listBox1", position = { 304, 280 } }; + EditBox editBox1 { this, caption = "editBox1", position = { 96, 184 } }; + Label label1 { this, caption = "label1", position = { 432, 248 } }; + ScrollBar scrollBar1 { this, caption = "scrollBar1", position = { 488, 360 } }; } Form1 form1 {}; diff --git a/samples/guiAndGfx/snow/snow.ec b/samples/guiAndGfx/snow/snow.ec index 76672a4..8b217e0 100644 --- a/samples/guiAndGfx/snow/snow.ec +++ b/samples/guiAndGfx/snow/snow.ec @@ -11,7 +11,7 @@ define backgroundColor = Color { 10, 0, 60 }; class Snowing : Window { - text = "Snowing"; + caption = "Snowing"; background = backgroundColor; opacity = 0; drawBehind = false; -- 1.8.3.1