It's competition time!

For other topics related to the FreeBASIC project or its community.
KristopherWindsor
Posts: 2428
Joined: Jul 19, 2006 19:17
Location: Sunnyvale, CA
Contact:

Postby KristopherWindsor » Nov 05, 2007 4:06

duke4e wrote:
KristopherWindsor wrote:It looks like the competition will be harder than the previous one, with people such as duke4e and vdecampo entering, so I'll have to get a good idea soon! :-)

This sounds like i'm some "cool dude". Actually I'm better at googling tutorials than at programming.


But your Breakout is just as good as mine. :-)
aleofjax
Posts: 117
Joined: Oct 18, 2007 8:10

Postby aleofjax » Nov 05, 2007 4:47

Here's my first release. It has a couple of bugs still, but it is for the most part fully playable, with 13 levels of play, and a help screen to get you started! The code is UGLY, let me tell you, but it works! Enjoy!
http://www.mediafire.com/?4xxd24fg0dj

edit: I updated the link, so it should work fine now. This will be my entry for the compo unless I have time to make any changes/enhancements before the deadline. Here's a quick run-down of the game:

Aliens have showed up looking for jellyfish! Their UFO flies around above the water, where a purple crab has been enlisted to throw the jellyfish up to them. Another alien flies around with the UFO, cathing the jellyfish out of the air and delivering them to the ship. The jellyfish, colored red, blue and green, swim in from the right hand side of the screen, and a flashing light on the UFO lets you know what color you need to deliver. You use the keys 'W', 'A', 'S', and 'D' to make the crab swim around, and use the spacebar to toss them when you're close enough. The higher your crab is relative to the jellyfish, the higher the throw will be. You can also aim left/right by being slightly left/right of the jellyfish, respectively. Once the Jellyfish has been thrown, he becomes stunned, and will no longer swim, even if he falls back into the water. If you can hit the UFO directly, great! You'll get a good hang time bonus added to your score! If not, then you can use the orange alien, controled by the mouse, to fly over and catch your prey by clicking and holding a mouse button. When you release the mouse button, the jellyfish will be released, and inherit the alien's velocity as it flies through the air. You can drop the jellyfish directly onto the UFO for an easy 500 points, or try to toss him from the other side of the screen for a hang time bonus. (My highes bonus so far is 722 points!) If you trow him off the top of the screen, he'll eventually come back down; don't worry. If you put the wrong color jellyfish into the UFO, you loose 500 points, so be careful!

Now if you let a jellyfish swim all the way over to the left side of the screen, he'll turn to stone! Any jellyfish that runs into one of these stones also turns to stone. This also happens if a falling jellyfish reaches the bottom of the screen. Your crab cannot swim through these stones, he just bounces off. The first level has one jellyfish at a time, and each concecutive level adds one more. Fill up the progress meter to advance to the next level, and finish all 13 levels to win!

Known bugs/issues:
============
*A couple of stones tend to remain on the screen after a level change, then dissapear once a new stone is created.

*Too many stones on the board creates a fairly serious preformance drag. I may swich to a POINT() based collision system instead of a linked list/distance formula

*Game crashed when I reached level 6. I haven't had time to try to duplicate the failure; might be random.

*Grabbing a jellyfish with the orange alien while the jellyfish is still under water causes the splash animation to delay until you release the jellyfish again. Easily fixed once I get off work.
ssjx
Posts: 33
Joined: Oct 23, 2007 8:51
Contact:

Postby ssjx » Nov 05, 2007 9:29

Hi aleofjax, i just had a quick go on your game. It seems very cool but it does seem to run very very fast, the purple jellyfish seems to bounce around wildly!
aleofjax
Posts: 117
Joined: Oct 18, 2007 8:10

Postby aleofjax » Nov 05, 2007 10:38

Thanks for the comment! I guess I didn't think to put a max velocity on the purple guy. What about the speed for everything else? I did include a frame limiter, with a max fps of 60. I'll throw in an fps readout when I get home to see if my machine is even hitting 60. (Win 2K, P4 1.4Ghtz, 768 MB RAM) If it's not, then I can tone down the responsiveness of the controls.

I could just be that you're holding the move key down too long. It's an acceleration function, not translation. (He is supposed to bounce off of everything)

I'll fiddle with it and update ASAP. Thanks again!
ciw1973
Posts: 157
Joined: Jun 12, 2007 15:03
Location: Isle of Man (United Kingdom)

Postby ciw1973 » Nov 05, 2007 11:19

vdecampo wrote:So to submit our entries, we need only post a link here to the download before the end time of the compo?

-Vince


Yeah, at the end of the competition I'll be downloading the latest versions from all of your download links and these will be used for judging.


ChangeV wrote:Can I change color of sprites?
like red for enemy, blue for player...etc.

Code: Select all

Put [ target, ] [ STEP ] ( x,y ), source [ ,( x1,y1 )-( x2,y2 ) ] [ ,method [ ,( alphaval|value|blender [ ,param]) ] ]


Yeah, you can do what you'd like with the colours, and you're OK to scale and rotate the graphics too if you'd like.
Ryan
Posts: 693
Joined: Jun 10, 2005 2:13
Location: Louisville, KY
Contact:

Postby Ryan » Nov 05, 2007 13:38

Just in case anyone hasn't figured it out yet, the tiles from the graphics file make up a character set... if you start counting from the top left corner going right, the letters and punctuation marks and all will match up to their asc() values. To print text to the screen, you can simply load all the characters into an array w/ the indexes being their number and then loop through a string and put the tile to the screen that corresponds w/ each character's upper cased ascii value.

Most folks probably figured this out, but I thought it'd be nice if everyone was aware. ; )

And my game is coming along just fine... HGE is super fun to learn and use. I think I'm actually building a solid engine out of this, too, that I'll be able to use for future projects.
ssjx
Posts: 33
Joined: Oct 23, 2007 8:51
Contact:

Postby ssjx » Nov 05, 2007 14:15

Ah.. I converted the bitmap to a font but am still using draw string to display it! Do i need to change this? I think as I was not using the system font it did not occur to me that this may be a problem.

Fairly straight forward to remedy anyway.
vdecampo
Posts: 2974
Joined: Aug 07, 2007 23:20
Location: Florida, USA
Contact:

Postby vdecampo » Nov 05, 2007 15:35

duke4e wrote:This sounds like i'm some "cool dude". Actually I'm better at googling tutorials than at programming.


Yeah. And I just Google duke4e! :-)

Cheers!
-Vince
ssjx
Posts: 33
Joined: Oct 23, 2007 8:51
Contact:

Postby ssjx » Nov 05, 2007 19:20

Just a quick message, i've updated my download here:

http://ssjx.co.uk/windows/invaders.php

Source is now included. The source is not very tidy yet and has some odd bits (i didn't realise you could use #define in FB so have been using const for example..) but it may be useful to someone.

Also there is quite a bit of code that is:

* In the source but not used yet (e.g. high score table)
* In the source but should be removed (e.g. making a font)

Plus i've just noticed a 'print' in a new function, that is for testing and will be gone soon :)
KristopherWindsor
Posts: 2428
Joined: Jul 19, 2006 19:17
Location: Sunnyvale, CA
Contact:

Postby KristopherWindsor » Nov 05, 2007 19:55

SSJX, Const is still recommended when it can be used. #Define is mainly for variables that are not standard variables / numbers.
I.e.

Code: Select all

#define debug
#ifdef debug
'do code
#endif

and

Code: Select all

'can change all comments to act as uncommented
'#define comment '
#define comment

...are good examples of #define, but you should still use Const for single numbers, such as screen height. Const isn't one of those QB-only features. :-)[/code]
vdecampo
Posts: 2974
Joined: Aug 07, 2007 23:20
Location: Florida, USA
Contact:

Postby vdecampo » Nov 05, 2007 20:04

KristopherWindsor wrote:SSJX, Const is still recommended when it can be used. #Define is mainly for variables that are not standard variables / numbers.


What's a non-standard number?

Why do most of the .bi files use #Define then...

From WinGDI.bi

Code: Select all

#define BI_RGB 0
#define BI_RLE8 1
#define BI_RLE4 2
#define BI_BITFIELDS 3
#define BI_JPEG 4
#define BI_PNG 5
#define LF_FACESIZE 32
#define LF_FULLFACESIZE 64
#define CA_NEGATIVE 1
#define CA_LOG_FILTER 2
#define ILLUMINANT_DEVICE_DEFAULT 0
#define ILLUMINANT_A 1
#define ILLUMINANT_B 2
#define ILLUMINANT_C 3
#define ILLUMINANT_D50 4
#define ILLUMINANT_D55 5
#define ILLUMINANT_D65 6
#define ILLUMINANT_D75 7
#define ILLUMINANT_F2 8
#define ILLUMINANT_MAX_INDEX 8
#define ILLUMINANT_TUNGSTEN 1
#define ILLUMINANT_DAYLIGHT 3
#define ILLUMINANT_FLUORESCENT 8
#define ILLUMINANT_NTSC 3
#define RGB_GAMMA_MIN 2500
#define RGB_GAMMA_MAX 65000
#define REFERENCE_WHITE_MIN 6000
#define REFERENCE_WHITE_MAX 10000
#define REFERENCE_BLACK_MIN 0
#define REFERENCE_BLACK_MAX 4000
#define COLOR_ADJ_MIN (-100)
#define COLOR_ADJ_MAX 100
#define CCHDEVICENAME 32
#define CCHFORMNAME 32
#define DI_COMPAT 4
#define DI_DEFAULTSIZE 8
#define DI_IMAGE 2
#define DI_MASK 1
#define DI_NORMAL 3
#define DI_APPBANDING 1
#define EMR_HEADER 1
#define EMR_POLYBEZIER 2
#define EMR_POLYGON 3
#define EMR_POLYLINE 4
#define EMR_POLYBEZIERTO 5
#define EMR_POLYLINETO 6
#define EMR_POLYPOLYLINE 7
#define EMR_POLYPOLYGON 8
#define EMR_SETWINDOWEXTEX 9
#define EMR_SETWINDOWORGEX 10
#define EMR_SETVIEWPORTEXTEX 11
#define EMR_SETVIEWPORTORGEX 12
#define EMR_SETBRUSHORGEX 13
#define EMR_EOF 14
#define EMR_SETPIXELV 15
#define EMR_SETMAPPERFLAGS 16
#define EMR_SETMAPMODE 17
#define EMR_SETBKMODE 18
#define EMR_SETPOLYFILLMODE 19
#define EMR_SETROP2 20
#define EMR_SETSTRETCHBLTMODE 21
#define EMR_SETTEXTALIGN 22
#define EMR_SETCOLORADJUSTMENT 23
#define EMR_SETTEXTCOLOR 24
#define EMR_SETBKCOLOR 25
#define EMR_OFFSETCLIPRGN 26
#define EMR_MOVETOEX 27
#define EMR_SETMETARGN 28
#define EMR_EXCLUDECLIPRECT 29
#define EMR_INTERSECTCLIPRECT 30
#define EMR_SCALEVIEWPORTEXTEX 31
#define EMR_SCALEWINDOWEXTEX 32
#define EMR_SAVEDC 33
#define EMR_RESTOREDC 34
#define EMR_SETWORLDTRANSFORM 35
#define EMR_MODIFYWORLDTRANSFORM 36
#define EMR_SELECTOBJECT 37
#define EMR_CREATEPEN 38
#define EMR_CREATEBRUSHINDIRECT 39
#define EMR_DELETEOBJECT 40
#define EMR_ANGLEARC 41
#define EMR_ELLIPSE 42
#define EMR_RECTANGLE 43
#define EMR_ROUNDRECT 44
#define EMR_ARC 45
#define EMR_CHORD 46
#define EMR_PIE 47
#define EMR_SELECTPALETTE 48
#define EMR_CREATEPALETTE 49
#define EMR_SETPALETTEENTRIES 50
#define EMR_RESIZEPALETTE 51
#define EMR_REALIZEPALETTE 52
#define EMR_EXTFLOODFILL 53
#define EMR_LINETO 54
#define EMR_ARCTO 55
#define EMR_POLYDRAW 56
#define EMR_SETARCDIRECTION 57
#define EMR_SETMITERLIMIT 58
#define EMR_BEGINPATH 59
#define EMR_ENDPATH 60
#define EMR_CLOSEFIGURE 61
#define EMR_FILLPATH 62
#define EMR_STROKEANDFILLPATH 63
#define EMR_STROKEPATH 64
#define EMR_FLATTENPATH 65
#define EMR_WIDENPATH 66
#define EMR_SELECTCLIPPATH 67
#define EMR_ABORTPATH 68
#define EMR_GDICOMMENT 70
#define EMR_FILLRGN 71
#define EMR_FRAMERGN 72
#define EMR_INVERTRGN 73
#define EMR_PAINTRGN 74
#define EMR_EXTSELECTCLIPRGN 75
#define EMR_BITBLT 76
#define EMR_STRETCHBLT 77
#define EMR_MASKBLT 78
#define EMR_PLGBLT 79
#define EMR_SETDIBITSTODEVICE 80
#define EMR_STRETCHDIBITS 81
#define EMR_EXTCREATEFONTINDIRECTW 82
#define EMR_EXTTEXTOUTA 83
#define EMR_EXTTEXTOUTW 84
#define EMR_POLYBEZIER16 85
#define EMR_POLYGON16 86
#define EMR_POLYLINE16 87
#define EMR_POLYBEZIERTO16 88
#define EMR_POLYLINETO16 89
#define EMR_POLYPOLYLINE16 90
#define EMR_POLYPOLYGON16 91
#define EMR_POLYDRAW16 92
#define EMR_CREATEMONOBRUSH 93
#define EMR_CREATEDIBPATTERNBRUSHPT 94
#define EMR_EXTCREATEPEN 95
#define EMR_POLYTEXTOUTA 96
#define EMR_POLYTEXTOUTW 97
#define EMR_SETICMMODE 98
#define EMR_CREATECOLORSPACE 99
#define EMR_SETCOLORSPACE 100
#define EMR_DELETECOLORSPACE 101
#define EMR_GLSRECORD 102
#define EMR_GLSBOUNDEDRECORD 103
#define EMR_PIXELFORMAT 104
#define ENHMETA_SIGNATURE 1179469088
#define EPS_SIGNATURE &h46535045
#define FR_PRIVATE &h10
#define FR_NOT_ENUM &h20
#define META_SETBKCOLOR &h201
#define META_SETBKMODE &h102
#define META_SETMAPMODE &h103
#define META_SETROP2 &h104
#define META_SETRELABS &h105
#define META_SETPOLYFILLMODE &h106
#define META_SETSTRETCHBLTMODE &h107
#define META_SETTEXTCHAREXTRA &h108
#define META_SETTEXTCOLOR &h209
#define META_SETTEXTJUSTIFICATION &h20A
#define META_SETWINDOWORG &h20B
#define META_SETWINDOWEXT &h20C
#define META_SETVIEWPORTORG &h20D
#define META_SETVIEWPORTEXT &h20E
#define META_OFFSETWINDOWORG &h20F
#define META_SCALEWINDOWEXT &h410
#define META_OFFSETVIEWPORTORG &h211
#define META_SCALEVIEWPORTEXT &h412
#define META_LINETO &h213
#define META_MOVETO &h214
#define META_EXCLUDECLIPRECT &h415
#define META_INTERSECTCLIPRECT &h416
#define META_ARC &h817
#define META_ELLIPSE &h418
#define META_FLOODFILL &h419
#define META_PIE &h81A
#define META_RECTANGLE &h41B
#define META_ROUNDRECT &h61C
#define META_PATBLT &h61D
#define META_SAVEDC &h1E
#define META_SETPIXEL &h41F
#define META_OFFSETCLIPRGN &h220
#define META_TEXTOUT &h521
#define META_BITBLT &h922
#define META_STRETCHBLT &hB23
#define META_POLYGON &h324
#define META_POLYLINE &h325
#define META_ESCAPE &h626
#define META_RESTOREDC &h127
#define META_FILLREGION &h228
#define META_FRAMEREGION &h429
#define META_INVERTREGION &h12A
#define META_PAINTREGION &h12B
#define META_SELECTCLIPREGION &h12C
#define META_SELECTOBJECT &h12D
#define META_SETTEXTALIGN &h12E
#define META_CHORD &h830
#define META_SETMAPPERFLAGS &h231
#define META_EXTTEXTOUT &ha32
#define META_SETDIBTODEV &hd33
#define META_SELECTPALETTE &h234
#define META_REALIZEPALETTE &h35
#define META_ANIMATEPALETTE &h436
#define META_SETPALENTRIES &h37
#define META_POLYPOLYGON &h538
#define META_RESIZEPALETTE &h139
#define META_DIBBITBLT &h940
#define META_DIBSTRETCHBLT &hb41
#define META_DIBCREATEPATTERNBRUSH &h142
#define META_STRETCHDIB &hf43
#define META_EXTFLOODFILL &h548
#define META_DELETEOBJECT &h1f0
#define META_CREATEPALETTE &hf7
#define META_CREATEPATTERNBRUSH &h1F9
#define META_CREATEPENINDIRECT &h2FA
#define META_CREATEFONTINDIRECT &h2FB
#define META_CREATEBRUSHINDIRECT &h2FC
#define META_CREATEREGION &h6FF
#define PT_MOVETO 6
#define PT_LINETO 2
#define PT_BEZIERTO 4
#define PT_CLOSEFIGURE 1
#define ELF_VENDOR_SIZE 4
#define ELF_VERSION 0
#define ELF_CULTURE_LATIN 0
#define PFD_TYPE_RGBA 0
#define PFD_TYPE_COLORINDEX 1
#define PFD_MAIN_PLANE 0
#define PFD_OVERLAY_PLANE 1
#define PFD_UNDERLAY_PLANE (-1)
#define PFD_DOUBLEBUFFER 1
#define PFD_STEREO 2
#define PFD_DRAW_TO_WINDOW 4
#define PFD_DRAW_TO_BITMAP 8
#define PFD_SUPPORT_GDI 16
#define PFD_SUPPORT_OPENGL 32
#define PFD_GENERIC_FORMAT 64
#define PFD_NEED_PALETTE 128
#define PFD_NEED_SYSTEM_PALETTE &h00000100
#define PFD_SWAP_EXCHANGE &h00000200
#define PFD_SWAP_COPY &h00000400
#define PFD_SWAP_LAYER_BUFFERS &h00000800
#define PFD_GENERIC_ACCELERATED &h00001000
#define PFD_DEPTH_DONTCARE &h20000000
#define PFD_DOUBLEBUFFER_DONTCARE &h40000000
#define PFD_STEREO_DONTCARE &h80000000
#define SP_ERROR (-1)
#define SP_OUTOFDISK (-4)
#define SP_OUTOFMEMORY (-5)
#define SP_USERABORT (-3)
#define SP_APPABORT (-2)
#define BLACKNESS &h42
#define NOTSRCERASE &h1100A6
#define NOTSRCCOPY &h330008
#define SRCERASE &h440328
#define DSTINVERT &h550009
#define PATINVERT &h5A0049
#define SRCINVERT &h660046
#define SRCAND &h8800C6
#define MERGEPAINT &hBB0226
#define MERGECOPY &hC000CA
#define SRCCOPY &hCC0020
#define SRCPAINT &hEE0086
#define PATCOPY &hF00021
#define PATPAINT &hFB0A09
#define WHITENESS &hFF0062
#define R2_BLACK 1
#define R2_COPYPEN 13
#define R2_MASKNOTPEN 3
#define R2_MASKPEN 9
#define R2_MASKPENNOT 5
#define R2_MERGENOTPEN 12
#define R2_MERGEPEN 15
#define R2_MERGEPENNOT 14
#define R2_NOP 11
#define R2_NOT 6
#define R2_NOTCOPYPEN 4
#define R2_NOTMASKPEN 8
#define R2_NOTMERGEPEN 2
#define R2_NOTXORPEN 10
#define R2_WHITE 16
#define R2_XORPEN 7
#define CM_OUT_OF_GAMUT 255
#define CM_IN_GAMUT 0
#define RGN_AND 1
#define RGN_COPY 5
#define RGN_DIFF 4
#define RGN_OR 2
#define RGN_XOR 3
#define NULLREGION 1
#define SIMPLEREGION 2
#define COMPLEXREGION 3
#define ERROR_ 0
#define CBM_INIT 4
#define DIB_PAL_COLORS 1
#define DIB_RGB_COLORS 0
#define FW_DONTCARE 0
#define FW_THIN 100
#define FW_EXTRALIGHT 200
#define FW_ULTRALIGHT 200
#define FW_LIGHT 300
#define FW_NORMAL 400
#define FW_REGULAR 400
#define FW_MEDIUM 500
#define FW_SEMIBOLD 600
#define FW_DEMIBOLD 600
#define FW_BOLD 700
#define FW_EXTRABOLD 800
#define FW_ULTRABOLD 800
#define FW_HEAVY 900
#define FW_BLACK 900
#define ANSI_CHARSET 0
#define DEFAULT_CHARSET 1
#define SYMBOL_CHARSET 2
#define SHIFTJIS_CHARSET 128
#define HANGEUL_CHARSET 129
#define HANGUL_CHARSET 129
#define GB2312_CHARSET 134
#define CHINESEBIG5_CHARSET 136
#define GREEK_CHARSET 161
#define TURKISH_CHARSET 162
#define HEBREW_CHARSET 177
#define ARABIC_CHARSET 178
#define BALTIC_CHARSET 186
#define RUSSIAN_CHARSET 204
#define THAI_CHARSET 222
#define EASTEUROPE_CHARSET 238
#define OEM_CHARSET 255
#define JOHAB_CHARSET 130
#define VIETNAMESE_CHARSET 163
#define MAC_CHARSET 77
#define OUT_DEFAULT_PRECIS 0
#define OUT_STRING_PRECIS 1
#define OUT_CHARACTER_PRECIS 2
#define OUT_STROKE_PRECIS 3
#define OUT_TT_PRECIS 4
#define OUT_DEVICE_PRECIS 5
#define OUT_RASTER_PRECIS 6
#define OUT_TT_ONLY_PRECIS 7
#define OUT_OUTLINE_PRECIS 8
#define CLIP_DEFAULT_PRECIS 0
#define CLIP_CHARACTER_PRECIS 1
#define CLIP_STROKE_PRECIS 2
#define CLIP_MASK 15
#define CLIP_LH_ANGLES 16
#define CLIP_TT_ALWAYS 32
#define CLIP_EMBEDDED 128
#define DEFAULT_QUALITY 0
#define DRAFT_QUALITY 1
#define PROOF_QUALITY 2
#define NONANTIALIASED_QUALITY 3
#define ANTIALIASED_QUALITY 4
#define DEFAULT_PITCH 0
#define FIXED_PITCH 1
#define VARIABLE_PITCH 2
#define MONO_FONT 8
#define FF_DECORATIVE 80
#define FF_DONTCARE 0
#define FF_MODERN 48
#define FF_ROMAN 16
#define FF_SCRIPT 64
#define FF_SWISS 32
#define PANOSE_COUNT 10
#define PAN_FAMILYTYPE_INDEX 0
#define PAN_SERIFSTYLE_INDEX 1
#define PAN_WEIGHT_INDEX 2
#define PAN_PROPORTION_INDEX 3
#define PAN_CONTRAST_INDEX 4
#define PAN_STROKEVARIATION_INDEX 5
#define PAN_ARMSTYLE_INDEX 6
#define PAN_LETTERFORM_INDEX 7
#define PAN_MIDLINE_INDEX 8
#define PAN_XHEIGHT_INDEX 9
#define PAN_CULTURE_LATIN 0
#define PAN_ANY 0
#define PAN_NO_FIT 1
#define PAN_FAMILY_TEXT_DISPLAY 2
#define PAN_FAMILY_SCRIPT 3
#define PAN_FAMILY_DECORATIVE 4
#define PAN_FAMILY_PICTORIAL 5
#define PAN_SERIF_COVE 2
#define PAN_SERIF_OBTUSE_COVE 3
#define PAN_SERIF_SQUARE_COVE 4
#define PAN_SERIF_OBTUSE_SQUARE_COVE 5
#define PAN_SERIF_SQUARE 6
#define PAN_SERIF_THIN 7
#define PAN_SERIF_BONE 8
#define PAN_SERIF_EXAGGERATED 9
#define PAN_SERIF_TRIANGLE


These all look like normal numbers to me...

-Vince
notthecheatr
Posts: 1759
Joined: May 23, 2007 21:52
Location: Cut Bank, MT
Contact:

Postby notthecheatr » Nov 05, 2007 20:25

I can't explain the .BI files but I agree with KW - when possible, Const is preferred.

But there's not really anything about either that makes one better than the other for anything. It's just a matter of preference.
stylin
Posts: 1253
Joined: Nov 06, 2005 5:19

Postby stylin » Nov 05, 2007 20:51

vdecampo, that's because those are translated from C headers. In FreeBASIC, here's what you gain by using #define over CONST (or ENUM):

- Lack of type-safety. The preprocessor is a simple text-replacement mechanism, and does not care about implicit conversions or anything; bugs caused by this can be difficult to track down.
- Global namespace pollution. C doesn't support namespaces, nor any other kind of named-scope like that; all variables and procedures and defines are placed in the global namespace. In FreeBASIC, namespaces are supported (and their use encouraged), but macros still can't be bound to a namespace. The result is (as many who use the WinAPI know) lots of chances for name-clashing unless the macros' names are prefixed with some semi-unique text.
- Lack of debugging information. I haven't been keeping up on the latest sources, so I may be wrong, but once variables can be declared CONST, I assume symbols will be seen by the linker, which means you can do things like 'print myconst' in gdb and it will know what you mean by 'myconst'.

As far as I know, right now 'CONST x = value' is like '#define x value', except that CONST (and ENUM) symbols can be declared in namespace scope and do uphold type-safety. Whenever you can avoid the preprocessor's naive find/replace, the better, imho.
Lachie Dazdarian
Posts: 2230
Joined: May 31, 2005 9:59
Location: Croatia
Contact:

Postby Lachie Dazdarian » Nov 05, 2007 20:54

aleofjax, I really like the concept of your entry, but the game seems to run too slow on my PC, which is ridicolous. Also, I implemented my own FPS counter (works fine in my programs) and got 365!

Weird.

Anyway, I want more jellyfishes to spawn faster.

BTW, what FB version are you using? I had to change:

Code: Select all

Dim Shared sfx(0 To 8) As Integer


to:

Code: Select all

Dim Shared sfx(0 To 8) As Integer PTR


...to compile you code (please provide binaries people).

ciw, I'm not sure if the idea that the participants vote is good too. It seems like an odd thing to me. I mean, some people might vote for the obvious favorites with low scores to cut down their competition. The again, if the scoring will be public and will have to be elaborated I doubt anyone will be tempted to be malicious. Well, let it be an experiment which hopefully you won't regret making.
Last edited by Lachie Dazdarian on Nov 05, 2007 21:07, edited 1 time in total.
vdecampo
Posts: 2974
Joined: Aug 07, 2007 23:20
Location: Florida, USA
Contact:

Postby vdecampo » Nov 05, 2007 20:55

@stylin

Thanks. That explanation makes much more sense.

Cheers!
-Vince

Return to “Community Discussion”

Who is online

Users browsing this forum: No registered users and 4 guests