|
Post by eyfenna on Oct 7, 2016 5:46:52 GMT -6
Here I'm going to poste suggestions for the documentation which although complete still deserves some polish.
DrawImage_Rotate ( slot, x, y, angle )
Draws an image to the current canvas rotated by a given angle given in degree.
Example:
DrawImage_Blit ( slot, x, y, src_x, src_y, src_w, src_h)
Draws a portion of an image to the current canvas.
Example: DrawImage_Blit ( 0, 20, 20, 0, 0, 50, 50 )
Draws image of slot 0 with a width of 50 and height of 50 pixel at position 20 pixel canvas width and 20 pixel canvas height.
Can also be applied to display parts of an image – for effects like walking movement :
i = 0
while true
i = i +1
if i = 4 then i = 0 end if
DrawImageBlit(0,20,20,i*50,0,200,50)
if key(k_escape) end end if
wend
FPrint ( txt$ )
Outputs a string without an automatic new-line
Example:
a$ = „Hello World“
fprint(a$)
if numbers, number variables or string variables are put within the same fprint a plus sign is put inbetween
a = 4 a$ = "four" fprint( 4 + " times\n") fprint(a$ + " times\n") fprint(a + " times\n") fprint(4 + " " + a +" " + a$ + " times\n")
Frac ( n )
Returns the decimal portion of a number.
Example: Frac(3.5)
This will return 0.5
Hex$ ( n )
Returns a hexadecimal representation of a number.
Example:
Hex$(15)
Returns f
Pop_N ( )
Returns the number on top of the number stack.
Example:
while true push_N(4) push_N(3) push_N(2) push_N(1) push_N(0) for n = 1 to N_stack_size() m = pop_N() fprint(m + “ ") next wait(20000) wend
Prints 0 1 2 3 4 on console
|
|
|
Post by n00b on Oct 7, 2016 12:45:17 GMT -6
Thanks for these improvements. I wrote all the documentation over 2 days so I know that there is alot of room for improvement. I will add your additions to the documentation for future releases. Any help I can get on improving this software is greatly appreciated as this is something I do in my spare time which I don't get a whole lot of these days.
|
|
|
Post by eyfenna on Oct 9, 2016 9:33:23 GMT -6
I was pointing a buddy, a programmer, to the rcbasic page and he said it lacks a description ... I was telling him:
RC BASIC is a basic dialect/derivate that integrates the simple direct media layer and allows for handling of images on 2d surfaces, music, sound and response to mouse, joystick and touchscreen events.
on either windowopen, canvasopen, loadImage or drawImage or the topic Displaying images
To dispay and watch an png image on the screen:
windowopen(0,"drawImage test",windowpos_centered,windowPos_centered,800,600,0) canvasopen(0,800,600,0,0,800,600,0)
loadimage (0, "nameoftheimage.png") setImageAlpha(0,100)
while true ImageExists(0) clearcanvas() drawImage(0,100,0) update()
if key(k_escape) then end end if wend
|
|
|
Post by n00b on Oct 9, 2016 23:55:54 GMT -6
The website is a wordpress site and I think the theme isn't showing the description I have put on there. I will possibly look into other themes eventually. As far as your example, you are using extra ImageExists(), but not doing anything with the value it returns. I would rewrite it like this:
windowopen(0,"drawImage test",windowpos_centered,windowPos_centered,800,600,0) canvasopen(0,800,600,0,0,800,600,0)
loadimage (0, "nameoftheimage.png") setImageAlpha(0,100)
while true clearcanvas()
If ImageExists(0) Then drawImage(0,100,0) End If
update()
if key(k_escape) then end end if wend
|
|
|
Post by eyfenna on Oct 15, 2016 4:25:25 GMT -6
Although this is tips and tricks I thinik this one is very basic and helpfull to not include it in the documentation in the category mod or andbit:both forms behave equal for n = 0 to 10 if n mod 2 = 0 then fprint(n + "\n") end if next and for n = 0 to 10 if andbit(n,1) = 0 then fprint(n + "\n") end if next although this can be found on wikipedia and easily memorized, truth tables ar going to be helpfull for beginners andbit:
Bit 1
| Bit 2
| result | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
orbit:Bit 1
| Bit 2
| result | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 |
xorbit
Bit 1 | Bit 2 | result | 1 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 |
following works for blitting something one time:
drawImage_blit or do loop:
n = 0 do clearcanvas() drawImage_blit(0, 20,20,n*50,0,50,50) n = n +1 update() loop until 12 GetMouse
Example :
Tells the position of the mouscursor within the window: windowopen(0,"mousetest",windowpos_centered, windowpos_centered, 320,240,0) canvasopen(0,320,240,0,0,320,240,0) while true mx=0 my=0 mb1=false mb2=false mb3=false GetMouse (mx,my,mb1,mb2,mb3) fprint("x: " + mx + " y: " + my + "\n") if mb1 then fprint("mousebutton 1 pressed") elseif mb2 then fprint("mousebutton 2 pressed") elseif mb3 then fprint("mousebutton 3 pressed") end if if key(k_escape) then end end if wend
|
|