uint16 speed __attribute__((packed));
uint next __attribute__((packed));
uint frit __attribute__((packed));
- byte expand[102] __attribute__((packed));
+ byte expand[102];
};
struct FLIFrame
uint size __attribute__((packed));
uint16 magic __attribute__((packed));
uint16 chunknum __attribute__((packed));
- byte nothing[8] __attribute__((packed));
+ byte nothing[8];
};
struct FLIchunk
{
byte ch;
- f.Getc(&ch);
+ f.Getc((char *)&ch);
skip+=ch;
- f.Getc(&ch);
+ f.Getc((char *)&ch);
put=ch;
if(!put)
{
byte ch;
offset=skipline*bitmap.width;
- f.Getc(&ch);
+ f.Getc((char *)&ch);
num = ch;
for(; num>0; num--)
{
- f.Getc(&ch);
+ f.Getc((char *)&ch);
offset += ch;
- f.Getc(&ch);
+ f.Getc((char *)&ch);
put = ch;
if(put>0)
{
}
else if(put<0)
{
- f.Getc(&value);
+ f.Getc((char *)&value);
FillBytes(bitmap.picture+offset,value,-put);
offset-=put;
}
offset=y*bitmap.width;
for(; num>0; num--)
{
- f.Getc(&ch);
+ f.Getc((char *)&ch);
offset += ch;
- f.Getc(&ch);
+ f.Getc((char *)&ch);
put = ch;
if(put>0)
{
uint offset;
int y;
- short num;
+ //short num;
signed char put;
byte value;
for(y=0; y<bitmap.height; y++)
{
byte ch;
int x = 0;
- f.Getc(&ch);
- num = ch;
+ f.Getc((char *)&ch);
+ //num = ch;
/*if(!num)
{
- f.Getc(&ch);
- f.Getc(&ch);
+ f.Getc((char *)&ch);
+ f.Getc((char *)&ch);
FillBytes(bitmap.picture,ch,bitmap.size);
return;
}*/
// for(; num>0 && x < bitmap.width; num--)
for(; x < bitmap.width; )
{
- f.Getc(&ch);
+ f.Getc((char *)&ch);
put = ch;
if(put<0)
{
}
else if(put>0)
{
- f.Getc(&value);
+ f.Getc((char *)&value);
if(offset > bitmap.width * bitmap.height)
printf("bug");
FillBytes(bitmap.picture+offset,value,put);
property int frame { get { return frame; } set { frame = value; } }
property bool palUpdate { get { return palUpdate; } set { palUpdate = value; }}
- bool Load(char *fileName)
+ bool Load(const char *fileName)
{
bool result = false;
//f=FileOpen(fileName, read);
}
};
- property char * animation
+ property const char * animation
{
set
{
class LinkLabel : Label
{
char * url;
- public property char * url
+ public property const char * url
{
set { delete url; url = CopyString(value); }
get { return url; }
class About : Window
{
- text = "Link Demo";
+ caption = "Link Demo";
hasClose = true;
size = { 200, 80 };
LinkLabel
{
this, position = { 10, 10 };
- text = "www.ecere.com";
+ caption = "www.ecere.com";
url = "http://www.ecere.com/";
};
}
for (;d--;i++) {
i->x += i->dx;
i->y += i->dy;
- if (i->x<0 && i->dx<0 || (i->x+i->w >= holder.clientSize.w && i->dx>0))
+ if ((i->x<0 && i->dx<0) || (i->x+i->w >= holder.clientSize.w && i->dx>0))
i->dx = -i->dx;
- if (i->y<0 && i->dy<0 || (i->y+i->h >= holder.clientSize.h && i->dy>0))
+ if ((i->y<0 && i->dy<0) || (i->y+i->h >= holder.clientSize.h && i->dy>0))
i->dy = -i->dy;
}
}
delete(f);
}
}
+ return true;
}
};
MenuDivider { fileMenu };
};
saveDialog = fileSaveDialog;
- bool OnSaveFile(char * fileName)
+ bool OnSaveFile(const char * fileName)
{
File f = FileOpen(fileName, write);
if(f)
{
this, font = { "Lucida Console", 10 }, anchor = { left = 0.0, top = 0.0, right = 0.0, bottom = 0.0 }, hasHorzScroll = true, hasVertScroll = true, multiLine = true;
- bool OnFileModified(FileChange fileChange, char * param)
+ bool OnFileModified(FileChange fileChange, const char * param)
{
return true;
return false;
}
- bool OnFileModified(FileChange fileChange, char * param)
+ bool OnFileModified(FileChange fileChange, const char * param)
{
return true;
exportDialog.SetText("Export %s image", text);
if(exportDialog.Modal())
{
- char * ext = exportDialog.types[exportDialog.fileType].typeExtension;
+ const char * ext = exportDialog.types[exportDialog.fileType].typeExtension;
if(!ext)
{
char extension[MAX_EXTENSION];
if(!extension[0])
{
ext = "jpg";
- ChangeExtension(exportDialog.filePath, ext, exportDialog.filePath);
+ ChangeExtension(exportDialog.filePath, ext, (char *)exportDialog.filePath);
}
}
image.Save(exportDialog.filePath, ext, (void *) bool::true);
exportDialog.SetText("Export %s image", text);
if(exportDialog.Modal())
{
- char * ext = exportDialog.types[exportDialog.fileType].typeExtension;
+ const char * ext = exportDialog.types[exportDialog.fileType].typeExtension;
Bitmap filtered { };
if(!ext)
{
if(!extension[0])
{
ext = "jpg";
- ChangeExtension(exportDialog.filePath, ext, exportDialog.filePath);
+ ChangeExtension(exportDialog.filePath, ext, (char *)exportDialog.filePath);
}
}
if(filtered.Allocate(null, image.width/2, image.height/2, 0, pixelFormat888, false))
UpdateDisplay();
}
};
- bool LoadFractals(char * fileName)
+ bool LoadFractals(const char * fileName)
{
File f = FileOpen(fileName, read);
if(f)
saveDialog = mySaveDialog;
- bool OnSaveFile(char * fileName)
+ bool OnSaveFile(const char * fileName)
{
File f = FileOpen(fileName, write);
if(f)
"Console" : false,
"Compress" : false
},
+ "Platforms" : [
+ {
+ "Name" : "linux",
+ "Options" : {
+ "Libraries" : [
+ "m"
+ ]
+ }
+ },
+ {
+ "Name" : "apple",
+ "Options" : {
+ "Libraries" : [
+ "m"
+ ]
+ }
+ }
+ ],
"Configurations" : [
{
"Name" : "Debug",
"Resources" : [
]
-}
\ No newline at end of file
+}
return true;
}
- bool OnSaveFile(char * fileName)
+ bool OnSaveFile(const char * fileName)
{
File f = FileOpen(fileName, write);
unsigned short mv = (unsigned short)game.version_code;
return true;
}
- void OnLoadFile(char * fileName) {
+ void OnLoadFile(const char * fileName) {
File f = FileOpen(fileName, read);
unsigned short mv;
char prefix[PREFIX_SIZE];
void OnUnserialize(IOChannel channel)
{
- if(!this)
+ GameVehicleType vtype;
+ channel.Get(vtype);
+ if(vtype == ball)
{
- GameVehicleType vtype;
- channel.Get(vtype);
- if(vtype == ball)
- {
- GameBall::OnUnserialize(class(GameBall), this, channel);
- return;
- }
- else
- this = GameVehicle { };
+ GameBall::OnUnserialize(class(GameBall), this, channel);
+ return;
}
+ else
+ this = GameVehicle { };
if(!type)
channel.Get(type);
void OnUnserialize(IOChannel channel)
{
- this = GameBall { };
+ GameBall gb { };
+ this = gb;
GameVehicle::OnUnserialize(channel);
channel.Get(radius);
channel.Get(elasticity);
//support backtracing if ball is within box for line
void Update(Game game) {
//TODO: check for collision with other balls
- uint count;
double time_left=1.0;
BallLineReturn soonest = {INF,{0,0}};
GameLine *soonest_line;
x = sx;
y = sy;
}
- void Add(Vector2D a, Vector2D b) {
+ void Add(const Vector2D a, const Vector2D b) {
x = a.x+b.x;
y = a.y+b.y;
}
- void Sub(Vector2D end, Vector2D start) {
+ void Sub(const Vector2D end, const Vector2D start) {
x = end.x-start.x;
y = end.y-start.y;
}
struct Coord2D : Vector2D {};
-double DotProduct(Vector2D a, Vector2D b) {
+double DotProduct(const Vector2D a, const Vector2D b) {
return a.x*b.x+a.y*b.y;
}
"ecere"
]
},
+ "Platforms" : [
+ {
+ "Name" : "linux",
+ "Options" : {
+ "Libraries" : [
+ "m"
+ ]
+ }
+ },
+ {
+ "Name" : "apple",
+ "Options" : {
+ "Libraries" : [
+ "m"
+ ]
+ }
+ }
+ ],
"Configurations" : [
{
"Name" : "Debug",
define app = ((ReminderApp)__thisModule);
-static void struscpy(char * d, char * s)
+static void struscpy(char * d, const char * s)
{
int j, k;
j = k = 0;
this, noCaret = true, multiLine = true, autoEmpty = true, textHorzScroll = true, hasVertScroll = true, anchor = Anchor { left = 420, top = 30, right = 10, bottom = 10 }
};
- int ReplaceInDirectory(char * directory, char * findWhat, char * replaceWith,
- bool matchCase, bool wholeWord, bool recurse, EditBox edit, EditBox log)
+ int ReplaceInDirectory(const char * directory, const char * findWhat, const char * replaceWith,
+ bool matchCase, bool wholeWord, bool recurse, EditBox edit, EditBox log)
{
FileListing listing { directory, "htm, html, css, ec" };
int total = 0;
#define GRADIENT_DIRECTION horizontal
#define TEXT_COLOR white
#define TEXT_INACTIVE darkGray // Color { 212,208,200 }
-
+/*
static ColorKey gradient[] =
{
{ ColorAlpha { 255, Color { 10, 36, 106 } }, 0.00f },
{ ColorAlpha { 255, Color { 128, 128, 128 } }, 0.00f },
{ ColorAlpha { 255, Color { 192, 192, 192 } }, 1.00f }
};
-
-
+*/
BitmapResource bmpUpMiddle { ":upMiddle.png", alphaBlend = true };
BitmapResource bmpUpLeft { ":upLeft.png", alphaBlend = true };
extern int __ecereVMethodID___ecereNameSpace__ecere__gui__Window_OnPostCreate;
private:
-static void Dummy()
+static __attribute__((unused)) void Dummy()
{
- Window w;
+ Window w = 0;
w.OnPostCreate();
w.OnRedraw(null);
w.OnResizing(null, null);
}
-static void Button::ThumbOnRedraw(Surface surface)
+/*static void Button::ThumbOnRedraw(Surface surface)
{
- int offset = (buttonState == down) ? this.offset : 0;
+ //int offset = (buttonState == down) ? this.offset : 0;
BitmapResource left = bmpThumbUp;
BitmapResource right = bmpThumbDown;
BitmapResource middle = bmpThumbVert;
- int sizeW = size.w;
+ //int sizeW = size.w;
int x = 1; //-40 * sizeH / 96;
int y = -6; //-7 * sizeH / 96;
int w = 14;// * sizeW / 14;
surface.HTile(middle.bitmap, x, y + sideH, w, middleH);
surface.Stretch(right.bitmap, x, y + sideH + middleH, 0,0, w, sideH, right.bitmap.width, right.bitmap.height);
- /*
- surface.Filter(left.bitmap, x, y, 0,0, w, sideH, left.bitmap.width, left.bitmap.height);
- surface.FilterVTile(middle.bitmap, x, y + sideH, w, middleH);
- surface.Filter(right.bitmap, x, y + sideH + middleH, 0,0, w, sideH, right.bitmap.width, right.bitmap.height);
- */
+ //surface.Filter(left.bitmap, x, y, 0,0, w, sideH, left.bitmap.width, left.bitmap.height);
+ //surface.FilterVTile(middle.bitmap, x, y + sideH, w, middleH);
+ //surface.Filter(right.bitmap, x, y + sideH + middleH, 0,0, w, sideH, right.bitmap.width, right.bitmap.height);
}
static bool Button::ThumbIsInside(int x, int y)
box.right -= 1;
box.bottom += 6;
}
-
+*/
public class MySkin_ScrollBar : ScrollBar
{
void OnApplyGraphics()
{
}
- return true;
+ return result;
}
void OnRedraw(Surface surface)
}
-char * cursorsBitmaps[] =
+const char * cursorsBitmaps[] =
{
"<:ecere>cursors/arrow.png",
"<:ecere>cursors/iBeam.png",
{ 5, 0 }
};
-static char * skinBitmaps[SkinBitmap] =
+static const char * skinBitmaps[SkinBitmap] =
{
"<:ecere>elements/areaMinimize.png",
"<:ecere>elements/areaMaximize.png",
return FontResource { faceName = "Tahoma", size = 10.0f, bold = true };
}
- char * ::CursorsBitmaps(uint id, int * hotSpotX, int *hotSpotY, byte ** paletteShades)
+ const char * ::CursorsBitmaps(uint id, int * hotSpotX, int *hotSpotY, byte ** paletteShades)
{
*hotSpotX = cursorsHotSpots[id].x;
*hotSpotY = cursorsHotSpots[id].y;
*ch = Max(*ch, 0);
}
- void PreShowDecorations(Font captionFont, Surface surface, char * name, bool active, bool moving)
+ void PreShowDecorations(Font captionFont, Surface surface, const char * name, bool active, bool moving)
{
if(((BorderBits)borderStyle).fixed && (state != maximized || !parent.menuBar))
{
}
}
- void ShowDecorations(Font captionFont, Surface surface, char * name, bool active, bool moving)
+ void ShowDecorations(Font captionFont, Surface surface, const char * name, bool active, bool moving)
{
bool isNormal = (state == normal);
int top = 0, border = 0, bottom = 0;
return strcmp(a.name, b.name);
}
- void AddDirectory(OldList files, char * directory)
+ void AddDirectory(OldList files, const char * directory)
{
FileListing listing { directory, "pcx, jpg, bmp, png" };
OldList list { };
{
if(bitmap && bitmap.width)
{
+#ifndef __linux__
float scale = Min((float)clientSize.w / (float)bitmap.width, (float)clientSize.h / (float)bitmap.height);
int w = (int)(bitmap.width * scale);
int h = (int)(bitmap.height * scale);
-#ifndef __linux__
surface.Filter(bitmap, (clientSize.w - w) / 2,(clientSize.h - h) / 2, 0,0, w, h, bitmap.width, bitmap.height);
#else
// Until Filter / Stretch works with X
+#ifndef __WIN32__
+void XSync();
+void * IS_XGetDisplay();
+#endif
+
import "ecere"
define NUMFLAKES = 60;
-char * textString = "Let it snow!";
+const char * textString = "Let it snow!";
define backgroundColor = Color { 10, 0, 60 };
class Snowing : Window
if(GetRandom(0, 4) == 0)
{
if(GetRandom(0, 1))
- (!atLeft && SnowTo(offset, stride-1)) || (!atRight && SnowTo(offset, stride+1));
+ (void)((!atLeft && SnowTo(offset, stride-1)) || (!atRight && SnowTo(offset, stride+1)));
else
- (!atRight && SnowTo(offset, stride+1)) || (!atLeft && SnowTo(offset, stride-1));
+ (void)((!atRight && SnowTo(offset, stride+1)) || (!atLeft && SnowTo(offset, stride-1)));
}
}
break;
- case 1: (!atLeft && SnowTo(offset, stride-1)) || (GetRandom(0, 4) == 0 && SnowTo(offset, stride)) || (!atRight && SnowTo(offset, stride+1)); break;
- case 2: (!atRight && SnowTo(offset, stride+1)) || (GetRandom(0, 4) == 0 && SnowTo(offset, stride)) || (!atLeft && SnowTo(offset, stride-1)); break;
+ case 1: (void)((!atLeft && SnowTo(offset, stride-1)) || (GetRandom(0, 4) == 0 && SnowTo(offset, stride)) || (!atRight && SnowTo(offset, stride+1))); break;
+ case 2: (void)((!atRight && SnowTo(offset, stride+1)) || (GetRandom(0, 4) == 0 && SnowTo(offset, stride)) || (!atLeft && SnowTo(offset, stride-1))); break;
}
}
}
delete contents;
}
- property String contents
+ property const String contents
{
set
{
display.FontExtent(fontObject, lines[c], strlen(lines[c]), &w, null);
if(w > maxW) maxW = w;
}
- snapVertScroll = lh; // Snap to line height vertically
- snapHorzScroll = 1;
+ SetScrollLineStep(1, Max(1, lh));
+ snapVertScroll = true ;//lh; // Snap to line height vertically
+ //snapHorzScroll = 1;
scrollArea = { maxW, lh * (linesCount-1) };
return true;
}
int ch = clientSize.h;
for(c = 0; c < linesCount; c++, y += lh)
{
- int w;
if(y > -lh && y < ch)
surface.WriteText(x, y, lines[c], strlen(lines[c]));
}
ListBox listBox1 { fullRowSelect = false, collapseControl = true, treeBranches = true, rootCollapseButton = true, parent = this, text = "listBox1", size = Size { 306, 432 }, anchor = Anchor { left = 10, top = 10, right = 0.5, bottom = 10 } };
- void ListDirectory(DataRow addTo, char *path)
+ void ListDirectory(DataRow addTo, const char *path)
{
static int maxDepth = 0;
FileListing listing { path };
bool OnCreate()
{
- String rootDir = (GetRuntimePlatform() == win32) ? "c:" : getenv("HOME");
+ const String rootDir = (GetRuntimePlatform() == win32) ? "c:" : getenv("HOME");
DataRow row = listBox1.AddString(rootDir);
ListDirectory(row, rootDir);
return true;