|
Post by vovchik on Feb 12, 2016 22:10:19 GMT 1
Dear Alex, There is a blank row at the bottom of the large and stretched aqua background and the bacon image often has perturbations in the top row, meaning that I am not aligning something or counting something properly. At the moment, that "what" escapes me. With kind regards, vovchik PS. You might be right about double buffering. Is there an environmental variable for that?
|
|
|
Post by basica on Feb 13, 2016 1:04:56 GMT 1
vovchik, I'm not sure if this is any help, but fooling with a couple of aspects - IMAGE_MEM(bg_png, bg_png_len, 0, 0, 200.6) <--- added .6 to 200 IMAGE_MEM(hanoi_png, hanoi_png_len, 350, 321, 0.6) <--- changed 300 to 321 to see if image on bottom edge produced a complete fill for the background (no blank last row and no apparent change to the top row). Also, the lower right Hanoi image extended properly to the bottom edge. Maybe this will trigger some kind of insight Regards, basica (I assumed that if everything is static, no swapbuffer was required)
|
|
|
Post by vovchik on Feb 13, 2016 10:04:04 GMT 1
Dear basica, I don't really know why yet, but your mod does the trick with the background and the missing line. Thanks!. With kind regards, vovchik
|
|
|
Post by basica on Feb 19, 2016 2:40:19 GMT 1
I thought I'd try to make a little game using GLUT in canvas and the stb image loader. As the "glutKeyboardFunc" in canvas is used as a "quit" and those keys do not return the keyboard up,down,left,right directional keys, I found another function (glutSpecialFunc) that did. So, I imported that one and another (glWindowPos2i) to make tracking positions easier. Here is "Butt the Matador", probably the only bullring game where the Bull always wins. Instructions not included , basica (Tar and Pic attached) Attachments:
butt_the_matador.tgz (427.09 KB)
|
|
|
Post by vovchik on Feb 19, 2016 10:59:05 GMT 1
Dear basica, Well done. Thanks. And coded very economically. I like it. With kind regards, vovchik
|
|
|
Post by basica on Feb 19, 2016 17:11:16 GMT 1
vovchik, Thanks, I have no illusions about my game making talents, as I showed "Butt the Matador" to my next door neighbor's son and by the look on his face, it was clear to me what he thought about it..... (Perhaps "Grand Theft Auto" was more to his liking, although he was quite excited about the possibility of programming a game himself) Regards, basica (I have a feeling that when he sees how much effort and resource has to go into producing a compelling game, his enthusiasm my quickly diminish)
|
|
|
Post by alexfish on Mar 2, 2016 15:16:35 GMT 1
Hi Vovchik & All
been looking at these external ARRAYS , kind of thinking could they be reusable , much like DATA >> RESTORE , READ blagh
Save this as arraydat.h
#define MY_BITS 0,1,2,3,\ 4,5,6, \ 7,8,9
#define MY_BITS2 "Zero", "Ten", "Twenty", \ "Thirty", "Forty", "Fifty"
and a bit of code for testing
PRAGMA INCLUDE arraydat.h
REM define arrays from external data
LOCAL arr[]={MY_BITS} TYPE NUMBER LOCAL arr$[]={MY_BITS2} TYPE STRING
PRINT arr[0] PRINT arr$[0]
' need another
LOCAL arr3[]={MY_BITS} TYPE NUMBER ' and so on
REM from here can use bacon to find the sizes etc
BR Alex
|
|
|
Post by vovchik on Mar 2, 2016 17:44:52 GMT 1
Dear Alex, What a brilliant idea. Have to see how we can start using it nicely. Thanks. With kind regards, vovchik
|
|
|
Post by alexfish on May 2, 2016 23:05:31 GMT 1
Wrong Thread
|
|
|
Post by anurup on Jun 1, 2016 11:50:59 GMT 1
Hi,
Using the FONT directive does not seem to work for the CANVAS widget.
This works fine:
editor = EDIT(400, 400) FONT(editor, "Courier 10")
but this doesn't:
canvas = CANVAS(400, 400)
FONT(canvas, "Courier 10") Calling OUT after this still prints text in the default system font (I think).
Thanks for any help.
Regards Anurup
|
|
|
Post by vovchik on Jun 1, 2016 12:08:51 GMT 1
Dear Anurup, The CANVAS has its own way of dealing with fonts (not TrueType but outlined Hershey font vectors). If you want to use truetype, I implemented it in my skinned CANVAS widgets, e.g.. widgetsand here, using SVG paths. svgsWith kind regards, vovchik PS. The syntax for loading/using Hershey fonts is explained at the beginning of the canvas.bac file.
|
|
|
Post by anurup on Jun 1, 2016 12:42:47 GMT 1
Dear vovchik, Thank you for taking the trouble to answer patiently. After reading your canvas.bac documentation, and before I jump to try out the things that you mentioned, I find myself mildly confused. I just wanted to clarify that I have understood you correctly. Sorry for the trouble - but I usually have a hard time trying to keep up with the (brilliant) work that Peter and the rest of you have done on this project. I am using the HUG library (as opposed to the high performance canvas) and talking about the CANVAS directive there. So you're saying that this directive doesn't work at all with TTF? Or are you saying that it doesn't work at all with Hershey fonts? Or doesn't work with either? If I choose to keep using the HUG (as opposed to your canvas), is there no way to change the font the CANVAS widget uses? (BTW, the reason I am trying to avoid the high performance canvas is that it seems to have slightly sluggish performance on the system that I need to work on and I do not have root access to try and fiddle around.) I think I got more confused just asking those questions. Would be great if you could shed some light. Thanks a ton! Anurup
|
|
|
Post by vovchik on Jun 1, 2016 13:14:00 GMT 1
Dear Anurup, HUG is a wrapper around GTK, and you can, if you figure out how, use truetype fonts installed on your system. Many HUG widgets make use of pango markup, so you can control some things that way. For button fonts, you have to change properties, and the GTK documentation explains that. There are also many examples on the forum, quite a few posted by me, where markup and property changes are used. I would have to go looking for them, but they are around. I will post some examples and provide some links, if I can find them. I have included two little examples. For HUG gui purposes, an easy way to do specify a font is: INCLUDE "hug.bac" HUGOPTIONS("FONT Liberation Mono Bold 15") mywin = WINDOW("test", 400,400) button = BUTTON("test", 90, 50) ATTACH(mywin, button, 50, 50) DISPLAY
With kind regards, vovchik PS. Frr the HUG canvas, use OUT to display text. It knows markup: OUT("text", "fgcolor", "bgcolor", xposition, yposition) Type: directive Draws text on the default canvas, starting top left at <xposition> and <yposition>. The text may contain Pango Text Attribute Markup Language to set different styles and formats. The colors are defined as a string of the format "#rrggbb" which is a hexadecimal triplet. This example defines the color yellow: "#FFFF00".
|
|
|
Post by anurup on Jun 2, 2016 7:32:12 GMT 1
Thank you vovchik! The Pango markup examples helped me achieve what I had been struggling with...
|
|
|
Post by vovchik on Jun 2, 2016 8:14:38 GMT 1
Dear anurup, I am glad you got things going! Pango markup can very useful! With kind regards, vovchik
|
|