|
Post by kennn on Dec 4, 2019 9:04:50 GMT -6
Hi, today I dowloaded nearly all your projects in the "Projects" sub-forum: Breakout, Rockwars, 1945, Santa, The Game and Pong. They can show that you are able to write excellent games in RCBasic. Yes!!
|
|
|
Post by tbird on Dec 4, 2019 11:37:33 GMT -6
My favorite is his game Attack...complete with awesome box art Not because I contributed, but because I actually played it alot lol.
|
|
|
Post by johnno56 on Dec 4, 2019 13:58:40 GMT -6
You are both too kind... The 'only' original work was 'attack'. I originally made it for my grandkids using 'Scratch 2.0'. Converting it to SDLBasic was tricky, but once done, converting it to RCBasic was a 'piece if cake'. But, if it wasn't for TBird's contributions, the game would not run as well as it does now.... 'Santa', was also a 'Scratch' project, but not mine. 'Rockwars' was an almost direct conversion from QBasic. I have no idea who made '1945' originally, but my version, was a conversion from Naalaa as was Pong. 'Breakout' was a 'team' effort on SDLBasic. The only work I did was the graphics... Conversion to RCBasic, took some time, but was relatively easy...
All of the games could use a lot of improvement... Feel free to 'tinker'... Post your results... Then sit back and enjoy the accolades of your admiring public... Ah, nuts! Train of thought being confused with day dreaming... *sigh*
There is one SDLBasic program that I would like to convert... Remember the old 1978 version of Super Star Trek by David Ahl? It was just plain text. My version uses 3 'screens' to display the game. I would need to work out how to create a 'main' screen that can contain 3 smaller 'screens'.
Does anyone have any tutorials on "Window Management" and "Canvases"?
|
|
|
Post by tbird on Dec 4, 2019 18:58:04 GMT -6
I do not, but I will write one for you right now!!
|
|
|
Post by johnno56 on Dec 4, 2019 19:12:26 GMT -6
This is the "Intro" screen to the game.... The background (Primary window) is 1024x768 "Main Screen" is 570x420 at 20,20 (primary co-ords) "Auxillury Screen" is 370x420 at 600,20 (primary co-ords) "Command Screen" is 950x280 at 20,450 (primary co-ords) Hope this helps.... J
|
|
|
Post by tbird on Dec 4, 2019 20:20:11 GMT -6
Sorry I got really sidetracked...back on it now lol. n00b would have to explain canvases, they don't act like I thought they would... I would just use one canvas and use positioning variables for your own windows.
|
|
|
Post by tbird on Dec 4, 2019 20:35:33 GMT -6
Sorry had to go somewhere but mobile still works lol.
What I meant was you just need graphics to represent your windows and the positions to draw your text in the correct fake window.
So for example your main window you would enclose with a graphic, or a primitive box. Then your text would start at like 50 on the x and 50 on the y.
Your aux screen same thing except your value for text on the x would be 400 or something...
If you have some global variables you can easily set where you need positions.
I hope this makes sense as I wont br avle to write something up till tomorrow.
|
|
|
Post by johnno56 on Dec 4, 2019 22:30:41 GMT -6
I have been experimenting with defining one window with three canvases with limited success. I'm going to go back to the sdlbasic listing and try to decipher its "screenopen" command and see if RC has an equivalent.... I am sure that whatever you can write will be far better than what I have come up with... lol
|
|
|
Post by johnno56 on Dec 5, 2019 6:38:50 GMT -6
tbird,
I threw together a simple layout. One window with three canvases using a combination of CanvasOpen and SetCanvasViewport. Pressing 1, 2 or 3 will instruct Canvases 2,3 and 4 to fill with colour. Releasing will return each 'screen' to normal.
This works ok for graphic primitives. I have not tested with either sprite, text or rendered text.
xmax = 1024 ymax = 768 title$ = "Multiple Canvas test # 01" WindowOpen(1,title$,0,0,xmax,ymax,0) CanvasOpen(1,xmax,ymax,0,0,xmax,ymax,1) ClearCanvas CanvasOpen(2,570,420,20,20,570,420,0) CanvasOpen(3,370,420,600,20,370,420,0) CanvasOpen(4,950,280,20,450,950,280,0) SetCanvasViewport(2,20,20,570,420) SetCanvasViewport(3,600,20,370,420) SetCanvasViewport(4,20,450,950,280) ' ' Display "Main Screen" - Blue ' Canvas(2) setColor(rgb(0,0,255)) Rect(0,0,569,419) ' ' Display "Auxillury Screen" - Cyan ' Canvas(3) setColor(rgb(0,255,255)) Rect(0,0,369,419) ' ' Display "Auxillury Screen" - Green ' Canvas(4) setColor(rgb(0,255,0)) Rect(0,0,949,279) update()
do if key(k_1) = 1 then Canvas(2) setColor(rgb(0,0,255)) RectFill(0,0,569,419) else Canvas(2) setColor(rgb(0,0,0)) RectFill(0,0,569,419) setColor(rgb(0,0,255)) Rect(0,0,569,419) end if if key(k_2) = 1 then Canvas(3) setColor(rgb(0,255,255)) RectFill(0,0,369,419) else Canvas(3) setColor(rgb(0,0,0)) RectFill(0,0,369,419) setColor(rgb(0,255,255)) Rect(0,0,369,419) end if if key(k_3) = 1 then Canvas(4) setColor(rgb(0,255,0)) RectFill(0,0,949,279) else Canvas(4) setColor(rgb(0,0,0)) RectFill(0,0,949,279) setColor(rgb(0,255,0)) Rect(0,0,949,279) end if update() loop until key(k_escape) = 1
I know its rough but it's just a proof of concept at the moment
|
|
|
Post by tbird on Dec 5, 2019 9:54:39 GMT -6
Apparently I should have looked on here first, I couldn't get canvases to do what I wanted, you got it though, awesome. I didn't think about using the viewports....all well here is what my first idea was anyway.
Just have fake screens or fake multiple canvases...either way start a project and I would like to contribute!!
DIM SCREEN_WIDTH DIM SCREEN_HEIGHT SCREEN_WIDTH = 800 SCREEN_HEIGHT = 600
DIM zrnicFont$
If OS = "WINDOWS" Then zrnicFont$ = Dir + "\\zrnic rg.ttf" Else zrnicFont$ = Dir + "/zrnic rg.ttf" End If
WindowOpen(0, "Windows...not that windows :)", WINDOWPOS_CENTERED, WINDOWPOS_CENTERED, SCREEN_WIDTH, SCREEN_HEIGHT, 1) CanvasOpen(0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 1) Canvas(0)
LoadFont(0, zrnicFont$, 24) Font(0)
DIM screen1X DIM screen1Y DIM screen1W DIM screen1H DIM screen1Active screen1X = 8 screen1Y = 8 screen1W = 484 screen1H = 384
DIM screen2X DIM screen2Y DIM screen2W DIM screen2H DIM screen2Active screen2X = 500 screen2Y = 8 screen2W = 292 screen2H = 384
DIM screen3X DIM screen3Y DIM screenW DIM screenH DIM screen3Active screen3X = 8 screen3Y = 400 screen3W = 784 screen3H = 192
DIM keyTimer DIM keyTimerDiff keyTimer = Timer() keyTimerDiff = 350
blue = RGB(20,20,250) red = RGB(250,20,20) green = RGB(20,250,20)
Function UpdateScreens() SetColor(RGB(0,0,0)) If screen1Active Then DrawText("Screen 1!", screen1X + 4, screen1Y + 4) End If If screen2Active Then DrawText("Screen 2!", screen2X + 4, screen2Y + 4) End If If screen3Active Then DrawText("Screen 3!", screen3X + 4, screen3Y + 4) End If End Function
While NOT Key(K_ESCAPE) ClearCanvas() SetColor(blue) BoxFill(screen1X, screen1Y, screen1X + screen1W, screen1Y + screen1H) SetColor(red) BoxFill(screen2X, screen2Y, screen2X + screen2W, screen2Y + screen2H) SetColor(green) BoxFill(screen3X, screen3Y, screen3X + screen3W, screen3Y + screen3H)
UpdateScreens()
If Key(K_1) And NOT screen1Active And Timer() - keyTimer > keyTimerDiff Then screen1Active = True keyTimer = Timer() End If If Key(K_1) And screen1Active And Timer() - keyTimer > keyTimerDiff Then screen1Active = False keyTimer = Timer() End If
If Key(K_2) And NOT screen2Active And Timer() - keyTimer > keyTimerDiff Then screen2Active = True keyTimer = Timer() End If If Key(K_2) And screen2Active And Timer() - keyTimer > keyTimerDiff Then screen2Active = False keyTimer = Timer() End If
If Key(K_3) And NOT screen3Active And Timer() - keyTimer > keyTimerDiff Then screen3Active = True keyTimer = Timer() End If If Key(K_3) And screen3Active And Timer() - keyTimer > keyTimerDiff Then screen3Active = False keyTimer = Timer() End If Update() Wend
|
|
|
Post by n00b on Dec 5, 2019 10:43:08 GMT -6
Sorry for being late to the party. tbird johnno56 You should look at the "graphics and sound" section in the manual. I added a more in depth explanation on this in the last release. Understanding viewport and offset for canvases allows you to do some really cool stuff. Canvases are basically the same as SDLBasic's screens but they actually have more features than SDLBasic like the ability to set color modulation and change blend modes. Also, look at the new mode 7 demo I added to the examples in the latest release. It shows how to use multiple canvases to simulate 3D effects with transforms.
|
|
|
Post by johnno56 on Dec 5, 2019 13:51:40 GMT -6
tbird: That was the idea I had originally thought of... except... maths and I do not get on well together... lol But very nicely done...
n00b: I couldn't get the mode7 example to run. "Error on Line 251 in mariokart.bas: ImageColorMod was not found in this scope-: main" (Geany error message) BUT... It ran perfectly fine using the RC IDE... Very cool example!
I'm probably going to be "off the air" for most of today. ALL the grandkids are popping in for a visit... So much house to protect... So few bear traps...
Thanks for the assist guys... I will "dive back in" tomorrow... assuming I survive today of course... lol
|
|
|
Post by n00b on Dec 5, 2019 14:16:24 GMT -6
If you are getting that error message in geany, it means geany is linked to an older version. You may want to open a terminal and type "rcbasic_build -v" to make sure you are linking to 3.11.
|
|
|
Post by tbird on Dec 5, 2019 22:30:08 GMT -6
I do remember the mode 7 demo, I will have a look at these neat features a little more closely.
|
|
|
Post by kennn on Dec 6, 2019 6:56:30 GMT -6
You are both too kind... The 'only' original work was 'attack'. I originally made it for my grandkids using 'Scratch 2.0'. Converting it to SDLBasic was tricky, but once done, converting it to RCBasic was a 'piece if cake'. But, if it wasn't for TBird's contributions, the game would not run as well as it does now.... 'Santa', was also a 'Scratch' project, but not mine. 'Rockwars' was an almost direct conversion from QBasic. I have no idea who made '1945' originally, but my version, was a conversion from Naalaa as was Pong. 'Breakout' was a 'team' effort on SDLBasic. The only work I did was the graphics... Conversion to RCBasic, took some time, but was relatively easy... Very interesting experiences. Should we make an account on itch.io and put all these projects there? Let more gamers and game developers download the projects. itch.io provides free services for indie game developers. I think that creating an account should be quite easy. I suggest this name: RCBasicFans. Therefore, the URL should become RCBasicFans.itch.io. This method will easily make RCBasic's community bigger because itch.io has a lot of visitors every day. Not only you, other RCBasic users' projects can also be put on RCBasicFans.itch.io if they want.
|
|