Posted: Mon 24 Dec 2012, 05:38
It's an svg image. Scripts begin with #!/bin/something and need to have the executable bit set.
READ-ONLY Archive
https://oldforum.puppylinux.com/
Code: Select all
echo ' < blah blah> '
Code: Select all
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="354" viewBox="0 176 256 176">
<image xlink:href="zelda-map.png" height="1408" width="4096" />
<svg x="32" y="240" width="16" height="16" viewBox="0 0 16 16">
<image xlink:href="link.png" width="432" height="303" />
</svg>
</svg>
technosaurus,technosaurus wrote:to further confuse everyone new to this topic, here is my latest research results for svg and "sprites"... I found it easier to include a second svg rather than the more complicated method of filling a rectangle with a pattern from an image (it may be slower to render but I couldn't figure out a good way to slice the png sprites for fill patterns)
Not that I would be comfortable publishing due to copyrights (as the last example shows, I have been just using existing tilesets, maps and sprites for experimenting, but more than that would fall outside of "fair use"). I would like to make a block pushing puzzle game along the lines of Adventures of Lolo, an RPG reminiscent of Final Fantasy (the original NES version), an adventure game similar to Zelda or possibly a strategy game like Civilizations, Warcraft or Sim City. These top view 2D (or 2.5D) games were always the most fun (for me at least), perhaps because less resources were spent developing the game engine and graphics and more effort was put into developing the game play?seaside wrote:Do you have by any chance, a small game you could show using this technique?
Code: Select all
#include <gtk/gtk.h>
#define IMAGE "GPSr2-bgr3.svg"
int main(int argc, char *argv[]){
int watch,fd; GtkWidget *window, *image;
gtk_init (&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
/* leave out window decoration */
gtk_window_set_decorated(GTK_WINDOW(window), FALSE);
image = gtk_image_new_from_file(IMAGE);
gtk_container_add(GTK_CONTAINER(window), image);
gtk_widget_show_all(window);
gtk_main ();}
linuph,linuph wrote:@technosaurus
The script is attached. It works but there's needless code in it, I suppose. Since I'm a total noob in C/GTK, I don't know how to optimize it. Not that it is a problem, but I don't like stupid code.
Code: Select all
int watch,fd;
starhawk,starhawk wrote:
Would you be able to either provide me or locate for me, simple instructions for a text parser in this language? I've looked high and low and can't find anything on my own. I guess my Google-Fu is weak (old man).
This is something I should have said as well -- the effort is appreciated for sure, even if the code produced is incomprehensible to me -- after all, it's not your fault, Seaside, that I can't read newfangled code!linuph wrote:Seaside, thanks!
Code: Select all
#!/bin/icon
# fonts
link graphics
procedure main()
WOpen("size=600,200") | stop("Can't open window")
WAttrib("pos=50,150")
WAttrib("label=Icon Programming - Fonts Demonstration")
GotoXY(10,50)
ransom("The quick brown fox jumps over the lazy dog.")
WDone()
end
procedure ransom(s)
local c
static famlist, attlist, sizelist
initial
{
famlist:=["URW Chancery L","DejaVu Sans"]
attlist:=["","","bold","italic"]
sizelist:=[18,22,24,32,34]
}
every c:=!s do
{
Font(?famlist || "," || ?sizelist || "," || ?attlist)
WWrites(c)
}
return
end
Code: Select all
#!/bin/icon
#clipping
link graphics
procedure main()
local x,y
WOpen("size=600,400", "bg=yellow")
WAttrib("pos=300,100")
WAttrib("label=Icon Programming - Clipping")
Fg("red")
FillRectangle(50,50,400,300)
Fg("green")
FillRectangle(70,70,360,260)
Clip(71,71,359,259)
every 1 to 50 do
{
x:=?400+50
y:=?300+50
WAttrib("fg=black","linewidth=5")
DrawCircle(x,y,30)
WAttrib("fg=white","linewidth=3")
DrawCircle(x,y,30)
}
WDone()
end
Code: Select all
#!/bin/icon
# Sierpinsky
$define Width 400
$define Height 400
$define X1 0
$define Y1 Height
$define X2 (Width/2)
$define Y2 0
$define X3 Width
$define Y3 Height
link graphics
procedure main()
local x,y
WOpen("size=400,400", "bg=light green")
WAttrib("label=Icon Programming - Sierpinski Diagram")
Fg("red")
WWrite("Press 'q' to quit")
Fg("black")
x:=Width/2
y:=Height/2
until WQuit() do
{
case ?3 of
{
1: {
x:=(x+X1)/2
y:=(y+Y1)/2
}
2: {
x:=(x+X2)/2
y:=(y+Y2)/2
}
3: {
x:=(x+X3)/2
y:=(y+Y3)/2
}
}
DrawPoint(x,y)
}
end
Code: Select all
#!/bin/sh
if [ -f startku.jpg ]; then
rm startku.jpg
fi
USER=$HOSTNAME
RES=$(xrandr | grep "current" | cut -d 'c' -f1,3 | tr -cd 'x [:digit:]' | cut -d 'x' -f1,2)
WIDTH=$(echo $RES | cut -d 'x' -f1,1)
HEIGHT=$(echo $RES | cut -d 'x' -f2,3)
echo '
<svg version="1.1">
<rect width="1366" height="768"
style="fill:rgb(0,0,255)"/>
<text >
<tspan x="550" y="500" font-family="Open Sans" font-weight="bolder" font-size="100"
fill="white" letter-spacing="-5">
limuks
</tspan>
<tspan x="550" y="530" font-family="Open Sans" font-weight="lighter" font-size="30"
fill="white">
'"$USER"''"'"'s puppy linux
</tspan>
</text>
<path stroke-dasharray="20,10,5,5,5,10" d="M5 60 215 0" />
<circle cx="370" cy="100" r="12" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="350" cy="140" r="10" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="400" cy="110" r="5" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="410" cy="130" r="5" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="430" cy="120" r="2" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="300" cy="110" r="40" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="300" cy="110" r="33" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="300" cy="110" r="21" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="700" cy="100" r="80" fill="#6BADF6" style="fill-opacity:0.2"/>
<circle cx="700" cy="100" r="60" fill="#6BADF6" style="fill-opacity:0.2"/>
<circle cx="700" cy="100" r="40" fill="#6BADF6" style="fill-opacity:0.2"/>
<circle cx="700" cy="100" r="20" fill="#6BADF6" style="fill-opacity:0.2"/>
<circle cx="1000" cy="150" r="100" fill="#6BADF6" style="fill-opacity:0.2"/>
<circle cx="1000" cy="150" r="80" fill="#6BADF6" style="fill-opacity:0.2"/>
<circle cx="1000" cy="150" r="60" fill="#6BADF6" style="fill-opacity:0.2"/>
<circle cx="1000" cy="150" r="45" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="1000" cy="150" r="30" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="1000" cy="150" r="15" fill="#6BADF6" style="fill-opacity:0.5"/>
<circle cx="300" cy="700" r="20" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="300" cy="700" r="10" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="300" cy="700" r="5" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="400" cy="710" r="20" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="400" cy="710" r="10" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="400" cy="710" r="5" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="500" cy="730" r="30" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="500" cy="730" r="23" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="500" cy="730" r="16" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="640" cy="700" r="30" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="640" cy="700" r="20" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="640" cy="700" r="7" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="700" cy="680" r="30" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="700" cy="680" r="20" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="700" cy="680" r="5" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="900" cy="720" r="20" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="900" cy="720" r="10" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="900" cy="720" r="5" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="935" cy="700" r="20" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="935" cy="700" r="10" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="935" cy="700" r="5" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="1000" cy="680" r="30" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="1000" cy="680" r="20" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="1000" cy="680" r="15" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="1000" cy="680" r="10" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="1050" cy="710" r="20" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="1050" cy="710" r="10" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="1050" cy="710" r="5" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="1100" cy="735" r="20" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="1100" cy="735" r="10" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="1100" cy="735" r="5" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="1200" cy="730" r="20" fill="#6BADF6" style="fill-opacity:0.5"/>
<circle cx="1200" cy="730" r="10" fill="#6BADF6" style="fill-opacity:0.3"/>
<circle cx="1200" cy="730" r="5" fill="#6BADF6" style="fill-opacity:0.3"/>
</svg>' > startku.jpg
if [ -f /usr/share/backgrounds/startku.jpg ]; then
rm /usr/share/backgrounds/startku.jpg
fi
cp startku.jpg /usr/share/backgrounds/startku.jpg&
wallpaper /usr/share/backgrounds/startku.jpg&
defaultimageviewer startku.jpg
Code: Select all
<rect width="1366" height="768"
style="fill:rgb(0,0,255)"/>
Code: Select all
<rect width="'$WIDTH'" height="'$HEIGHT'"
style="fill:rgb(0,0,255)"/>