|
Post by johnno56 on Mar 2, 2022 2:03:33 GMT -6
As there are very few schemes for RC Studio, I figured that maybe an editor similar to QB64's IDE colour selector, might be handy. At the moment there are 12 scheme attributes. Each attribute has its own RGB setting. The initial version well, was promptly scrapped, after n00b provided a much needed routine to convert a decimal value of colour to RGB. The current version is barely useful and is still "up on blocks". I am still trying to get my head around how to do all this and coding used is sloppy at best... Mouse and keyboard are used at the moment... I am hoping to only use the keyboard for inputting the saving filename... RC-schemer02.zip (393.5 KB) Instructions: Select a colour with the mouse; Select an item with the keyboard; (the item will change to the selected colour); Reset will restore all items to their original state; Save, at the moment; outputs the scheme item string to the console (this is still under development) Check out the current schemes in the "Program/rcbasic/config/schemes" for the format of the scheme strings. Any and all 'constructive' advice is always appreciated... J
|
|
|
Post by johnno56 on Mar 2, 2022 2:21:56 GMT -6
n00b, update. Changing the keyboard input from key() to inkey seems to have solved the multiple entries issue. I will attempt to create a 'live' scheme file or two. Ideally, it would be better if a sample screen could be displayed, before saving... maybe down the track? If creation is successful, I will post an new version... fingers crossed... J
|
|
|
Post by johnno56 on Mar 2, 2022 2:36:11 GMT -6
Ok. The first test was using 12 of the brightest colours (from bright red, on the patch, right across). The editor produced the file. Studio detected the file. File loaded without error. My eyes are still adjusting to the horrible colour scheme... I won't post the results... At least I can spare you of that! I will give the next test a lot more thought about the colours...
|
|
|
Post by johnno56 on Mar 2, 2022 3:18:05 GMT -6
here is a better example. These are images of the Studio "Dark Theme" and the Editor theme.... The differences are due to the fact that the editor has a limited colour palette. RC-schemer03.zip (393.58 KB) No error checking. Output file is hard-coded to 'test03.scheme'... Colours are close, but not the same...
|
|
|
Post by n00b on Mar 2, 2022 8:06:03 GMT -6
This looks great. I will try it when I get home.
|
|
|
Post by johnno56 on Mar 2, 2022 13:15:59 GMT -6
Although the colour selection source is ok, it is still not, 'web safe'. (needs to be about 216 colours) Oh man, one could spend ages just working on a colour selector... lol The QB64 editor uses both numeric manual input and slider control for R, G and B colour adjustment. Humph... No colour patch... lol I am creating a "To Do" list... If you can think of any of the many changes required, just let me know and if it is within my capabilities, I will effect the said changes...
|
|
|
Post by johnno56 on Mar 3, 2022 14:47:08 GMT -6
I am trying my hand at creating "sliders" for colour control. This is just the slider routine. No sprites or gui used. Everything, except for the font, is drawn. Please excuse the colour scheme (no pun intended). Use is simple: LMB and hold on the slider and drag left or right. You can also just click on the track and the "slider" will move to that position. One small problem: It is too easy to "lose track" of the slider... Mouse movement seems a bit fast and can leave the slider behind. I have not, as yet, devised a method to "lock" the slider to the mouse pointer. Any assistance would be appreciated. Once this single slider is working I can simply create the other two. My intention is to offer a choice of colour control. Colour patch or sliders. ' ' SLIDER ' ' To be used to regulate a variable: Eg: Colour etc. ' xmax = 350 ymax = 190 title$ = "Slider Test #1" center_x = windowpos_centered center_y = windowpos_centered WindowOpen(1,title$,center_x,center_y,xmax,ymax,WindowMode(1,0,0,0,0),1) SetWindowAutoClose(1, 0) CanvasOpen(1,xmax,ymax,0,0,xmax,ymax,0)
fnt = 1: loadFont(1, "FreeSansBold.ttf", 18) Font(fnt)
track1X = 0: track1Y = 92: track1W = 270: track1h = 6 slider1X = 0: slider1Y = track1Y - 8: slider1W = 15: slider1H = 22 value1 = 0 touching1 = 0
do ' Scan for mouse usage mx = mouseX my = mouseY mb = mouseButton(0) ' Clear Screen setColor(rgb(170,170,170)) RectFill(0, 0, xmax - 1, ymax - 1)
' Draw "Track" setColor(rgb(255, 255, 255)): RectFill(track1X, track1Y, track1W, 6) setColor(rgb(0, 0, 0)): RectFill(track1X, track1Y, track1W - 2, 4) setColor(rgb(170, 170, 170)): RectFill(track1X + 2, track1Y + 2, track1W - 4, 2) ' Draw "Slider" setColor(rgb(0, 0, 0)): RectFill(slider1X, slider1Y, slider1W, slider1H) setColor(rgb(255, 255, 255)): RectFill(slider1X, slider1Y, slider1W - 2, slider1H - 2) setColor(rgb(170, 170, 170)): RectFill(slider1X + 2, slider1Y + 2, slider1W - 4, slider1H - 4)
' Move slider to mouse if clicking on only the track. if mb = 1 and mx > track1X and mx < track1X + track1W and my > track1Y - 10 and my < track1Y + track1H + 10 then if touching1 = 0 then slider1X = mx - 7 end if end if ' Move slider if mouse button is pressed and "touching" slider. if mb = 1 and mx > slider1X and mx < slider1X + slider1W and my > slider1Y and my < slider1Y + slider1H then touching1 = 1 slider1X = mx - 7 if slider1X < track1X then slider1X = track1X end if if slider1X > track1W - slider1W then slider1X = track1W - slider1W end if else touching1 = 0 end if value1 = slider1X ' Display slider value setColor(rgb(160, 0, 0)) DrawText(str(value1), track1W + 10, track1Y - 10)
if Not WindowExists(1) Or WindowEvent_Close(1) Then end end if update() loop until key(27) = 1
FreeSansBold.ttf (89.28 KB)
|
|
|
Post by johnno56 on Mar 3, 2022 16:18:41 GMT -6
Ok. A simple work around. Mouse selection can be either 'clack and drag', 'click on track' or mousewheel up and down (fine tuning).
All three sliders are working (arrays! gotta love 'em!)
Same font is used. Opinions / suggestions? (be nice...)
' ' SLIDER ' ' To be used to regulate a variable: Eg: Colour etc. ' xmax = 350 ymax = 190 title$ = "Slider Test #3" center_x = windowpos_centered center_y = windowpos_centered WindowOpen(1,title$,center_x,center_y,xmax,ymax,WindowMode(1,0,0,0,0),1) SetWindowAutoClose(1, 0) CanvasOpen(1,xmax,ymax,0,0,xmax,ymax,0)
fnt = 1: loadFont(1, "FreeSansBold.ttf", 18) Font(fnt)
Dim trackX[4], trackY[4], trackW[4], trackH[4] Dim sliderX[4], sliderY[4], sliderW[4], sliderH[4] Dim value[4], touching[4], i, mx, my, mb
trackY[1] = 30: trackY[2] = 80: trackY[3] = 130
for i = 1 to 3 trackX[i] = 0: trackW[i] = 270: trackH[i] = 6 sliderX[i] = 0: sliderY[i] = trackY[i] - 8: sliderW[i] = 15: sliderH[i] = 22 value[i] = 0: touching[i] = 0 next
'====================================================================== Sub updateStuff() ' Move slider using wheel if touching the track. if mx > trackX[i] and mx < trackX[i] + trackW[i] and my > trackY[i] - 10 and my < trackY[i] + trackH[i] + 10 then if MouseWheelY() < 0 then sliderX[i] = sliderX[i] - 1 if sliderX[i] < 0 then sliderX[i] = 0 end if elseif MouseWheelY > 0 then sliderX[i] = sliderX[i] + 1 if sliderX[i] > 255 then sliderX[i] = 255 end if end if end if
' Move slider to mouse if clicking on only the track. if mb = 1 and mx > trackX[i] and mx < trackX[i] + trackW[i] and my > trackY[i] - 10 and my < trackY[i] + trackH[i] + 10 then if touching[i] = 0 then sliderX[i] = mx - 7 end if end if ' Move slider if mouse button is pressed and "touching" slider. if mb = 1 and mx > sliderX[i] and mx < sliderX[i] + sliderW[i] and my > sliderY[i] and my < sliderY[i] + sliderH[i] then touching[i] = 1 sliderX[i] = mx - 7 if sliderX[i] < trackX[i] then sliderX[i] = trackX[i] end if if sliderX[i] > trackW[i] - sliderW[i] then sliderX[i] = trackW[i] - sliderW[i] end if else touching[i] = 0 end if value[i] = sliderX[i]
End Sub
Sub drawStuff() ' Draw "Track" setColor(rgb(255, 255, 255)): RectFill(trackX[i], trackY[i], trackW[i], trackH[i]) setColor(rgb(0, 0, 0)): RectFill(trackX[i], trackY[i], trackW[i] - 2, trackH[i] - 2) setColor(rgb(170, 170, 170)): RectFill(trackX[i] + 2, trackY[i] + 2, trackW[i] - 4, trackH[i] - 4) ' Draw "Slider" setColor(rgb(0, 0, 0)): RectFill(sliderX[i], sliderY[i], sliderW[i], sliderH[i]) setColor(rgb(255, 255, 255)): RectFill(sliderX[i], sliderY[i], sliderW[i] - 2, sliderH[i] - 2) setColor(rgb(170, 170, 170)): RectFill(sliderX[i] + 2, sliderY[i] + 2, sliderW[i] - 4, sliderH[i] - 4)
' Display slider value select case i case 1: setColor(rgb(value[i], 0, 0)) case 2: setColor(rgb(0, value[i], 0)) case 3: setColor(rgb(0, 0, value[i])) end select DrawText(str(value[i]), trackW[i] + 10, trackY[i] - 10)
' Draw Colour Sample setColor(rgb(value[1], value[2], value[3])): RectFill(xmax - 40, ymax - 40, 30, 30) setColor(rgb(0, 0, 0)): Rect(xmax - 40, ymax - 40, 30, 30)
End Sub '======================================================================
do ' Scan for mouse usage mx = mouseX my = mouseY mb = mouseButton(0) ' Clear Screen setColor(rgb(170,170,170)) RectFill(0, 0, xmax, ymax) for i = 1 to 3 updateStuff() drawStuff() ' Debug 'setColor(rgb(255, 255, 255)) 'DrawText(str(MouseWheelY()), 10, 10) if Not WindowExists(1) Or WindowEvent_Close(1) Then end end if next update()
loop until key(27) = 1
|
|
|
Post by johnno56 on Mar 4, 2022 20:45:00 GMT -6
Here is the latest update. The slider controls have been integrated. The program is now menu driven. There is still a LOT to do... Ignore the hideous fonts and colouring. Prototyping prerogative... lol (suggestions on style is always welcome) Some things to note: I still need to develop a method of inputting a file name using the current fonts. At the moment, the output file is "sample.scheme", which should be created within the working directory. As I use Linux Mint, you may have to modify the file path... I am still yet to figure out how to load and parse an already existing scheme file. String handling has never been my strong suit... lol Any advice or assistance would be appreciated. RC-schemer06.zip (430.16 KB) What happened to versions 3 to 5? Nothing. Still got them. Too many bugs to publish... lol
|
|
|
Post by n00b on Mar 4, 2022 21:05:32 GMT -6
Hey johnno56 I think this is a pretty good start. I really like how smooth the slider works. If you don't mind, I might steal this to integrate into my gui library. The UI was also pretty clean and responsive in general. I might try to upload an example of how to parse the scheme files tommorow if you still need it.
|
|
|
Post by johnno56 on Mar 4, 2022 22:20:18 GMT -6
A parser would be cool... Thank you!
|
|
|
Post by n00b on Mar 6, 2022 0:39:20 GMT -6
|
|
|
Post by johnno56 on Mar 6, 2022 1:36:58 GMT -6
Cool... Thank you for such a quick response... Much appreciated.
|
|
|
Post by johnno56 on Mar 9, 2022 13:15:02 GMT -6
Ok. First. I am still trying to integrate n00b's file parser into the program and still working on a method to input a new filename... But, in the meantime, I have been testing the program by converting 17 QB64 IDE themes to RC. Installation is simple. Extract the files into the rcbasic/schemes/ directory. Word of warning. I question the colour sense of the QB64 members! Most of the schemes are ok. Some look like a rainbow threw up on the screen... Do not shoot the messenger! I would 'like' to say, "Enjoy"... lol J schemesQb.zip (5.1 KB) ps: Throwing together a scheme or two is fun... Not so much after 17 of the beasties! lol My next set, hopefully, will be the Geany themes... Oh... So much more than 17... *sigh*
|
|
|
Post by johnno56 on Mar 10, 2022 12:44:37 GMT -6
Ok. A brief update. I now have a very crude method of entering the new filename using 'inkey'. (needs work but removes the need for hard coding the new filename - cannot backspace yet...). I will need help in how to modify 'path$' to suit operating systems... I have added a 'load scheme' to the menu, but until I figure out how to implement n00b's file parser, that option is inactive... There are still some additions that I am toying with at the moment... eg: Mini-sample screen. The scheme items on the screen are colour coded as desired, but I think an 'overall' image maybe better to view, before saving... Thoughts? Although the sliders work well, it may also be useful, if the user can enter the decimal colour via keyboard as well... (?) I would appreciate comments about my choice of font and colours... I know... It's very mid to late 70's... Arial is too plain... Although the program kind of function ok, I think it would be better, if it was 'easier on the eye'... lol Whilst on subject of aesthetics... If you are coding on a laptop would you be so kind as to post your screen dimensions? One can only squeeze so much into 800x600... lol RC-schemer08.zip (431.56 KB) ps: The 'inkey' routine is quite cumbersome. A method of optimising would be appreciated...
|
|