Search found 9441 matches

by fxm
Mar 25, 2011 10:38
Forum: General
Topic: Function exists to remove all spaces from a string?
Replies: 44
Views: 4520

I suggest just a slight variation of the nice procedure of TJF , trying to optimize a little the start value of the loop FOR ... NEXT SUB TrimSpaces(BYREF Text AS STRING) VAR p = INSTR(Text, " ") - 1 IF p >= 0 THEN FOR i AS INTEGER = p TO LEN(Text) - 1 IF Text[i] <>...
by fxm
Mar 24, 2011 17:36
Forum: General
Topic: Maximum resolution Getting font size
Replies: 10
Views: 1467

@counting_pine SCREENRES PixelAbscisseSize, PixelOrdonneeSize, ... WIDTH PixelAbscisseSize \ PixelWidth, PixelOrdonneeSize \ PixelHeight (with PixelWidth = 8 and PixelHeight = 8 or 14 or 16) Yes, it is more concise and it runs also in any configuration of screen size and font, because the fractional...
by fxm
Mar 24, 2011 12:26
Forum: Beginners
Topic: screen & char size
Replies: 2
Views: 1233

See this previous topic about the 3 basic resolutions available under fbgfx :
http://www.freebasic.net/forum/viewtopic.php?t=17419
by fxm
Mar 23, 2011 20:16
Forum: General
Topic: Origin for letter placement with Draw String
Replies: 11
Views: 1350

It runs correctly, because in font 8x16 , the first 2 lines are not used to write a " H ", while in font 8x8 , the first line is used . The statement 'Draw String' draws the top left corner of the font (8x16 or 8x8) at the position x,y . To better understand : - In the 2 cases, Print in addition " H...
by fxm
Mar 22, 2011 17:49
Forum: General
Topic: best way to launch external exe's & other programs ?
Replies: 7
Views: 1503

I believe SHELL halts the first program, though. I'm not certain if this can be worked around with THREADS. Under Windows, you can use the cmd "Start" to launch a programm without wait the command interpreter exit. Code from within FB : result = Shell("Start program_name") Example with WordPad prog...
by fxm
Mar 22, 2011 12:43
Forum: Windows
Topic: New inline FBC code block (GoRC) for resource script ?
Replies: 6
Views: 2772

Re: New inline FBC code block (GoRC) for resource script ?

Why create this new inline FBC code block for resource script ? - In order to avoid to waste one individual resource-definition script file What is exactly "wasted" ?!? I'm not really sure what problem this solves. In the worst case, spend a file.rc for just one line of script. See my second post.
by fxm
Mar 22, 2011 12:01
Forum: General
Topic: 'On [Local] Error Goto' and 'Resume [Next]' statements
Replies: 4
Views: 1854

ON ERROR is not the best way to catch errors. Many FB functions will return error codes if they were successful, like OPEN, GET, PUT, etc... -Vince I agree : - When function form is available, I test the returned error code (remark : using the returned error code from function inhibits the QuickBAS...
by fxm
Mar 22, 2011 9:16
Forum: General
Topic: Math, coordinates find x on a line
Replies: 11
Views: 1379

Re: Math, coordinates find x on a line

type point2d as single x,y end type function pointonline(x1 as single,y1 as single,x2 as single,y2 as single,part as single) as point2d Dim As Single dx=x2-x1,dy=y2-y1,length=Sqr(dx*dx+dy*dy) dx=dx/length:dy=dy/length return type<point2d>(x1+part*length*dx,y1+part*length*dy)...
by fxm
Mar 22, 2011 9:04
Forum: General
Topic: Math, coordinates find x on a line
Replies: 11
Views: 1379

Re: Math, coordinates find x on a line

I am making a bow game. This should be used to calculate the shooting of the arrow. On a straight line that started on x1,y1 and ends at x2,y2 what is the formula to calculate any point x3,y3 on this line? If you want an equation for actually finding a point on a line between two points, it could l...
by fxm
Mar 21, 2011 23:23
Forum: General
Topic: Math, coordinates find x on a line
Replies: 11
Views: 1379

Example : (x1, y1) = (320, 240) (u, v) = (1 / sqr(5), 2 / sqr(5)) dim as integer x1 = 320, y1 = 240 dim as single u = 1 / sqr(5), v = 2 / sqr(5) dim as integer x, y screen 12 for i as integer = -200 to 200 step 1 x = x1 + i * u y = y1 + i * v pset(x, y), 15 next sleep a step ...
by fxm
Mar 21, 2011 22:14
Forum: General
Topic: Math, coordinates find x on a line
Replies: 11
Views: 1379

fxm has the basic equation. - I proposed the point-slope or two-point form : y - y1 = m * (x - x1) where the slope m = (y2 - y1) / (x2 - x1) - rolliebollocks proposed a parametric form : (x, y) = (x1, y1) + i * (u, v) where (u, v) is an unitary vector parallel with the line. Consequently, the integ...
by fxm
Mar 21, 2011 21:42
Forum: General
Topic: inline C
Replies: 6
Views: 915

In the same kind of idea, I suggested some time ago a FBC inline code block (GORC ... EndGoRC) for Windows resource script (with not much interest or success) !
http://www.freebasic.net/forum/viewtopic.php?t=17089
by fxm
Mar 21, 2011 21:00
Forum: Beginners
Topic: case & dim
Replies: 33
Views: 4332

The most secure is to use one control character as string separator, eg chr(0). Extrapolated from that of rdc : 'Use chr(0) to encapsulate each string. Dim Shared As String items Dim lookfor As String items = chr(0) & "i" & chr(0) & "e" & c...
by fxm
Mar 21, 2011 20:00
Forum: Beginners
Topic: case & dim
Replies: 33
Views: 4332

agamemnus, it is a forum for beginners :
- Test your program before sending your post, because a lot of mistakes.
- Furthermore, why embedding inside a structure DO ... END DO, whereas EXIT FOR exists ?
by fxm
Mar 21, 2011 12:33
Forum: General
Topic: Math, coordinates find x on a line
Replies: 11
Views: 1379

Equation of the line (x1, y1)-(x2, y2), when x2 <> x1 :
    y - y1 = (y2 - y1) / (x2 - x1) * (x - x1)
Any point (x, y) of this line must verify this formula.

Case where x2 = x1 :
x = x1

Go to advanced search