My question
How does a person update the screen in gtk for a game or video updating?
notes
Glade was used to make the following code and I was wondering how I would update the screen (the ppm that is currently being used is just a placeholder)
this is the relevant image class that i wanted to update (about 60 times a second at 1920 by 1080 pixels)
<object class="GtkImage">
<property name="width-request">100</property>
<property name="height-request">80</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixbuf">image.PPM</property>
how would I update the image?
This is the code I am using for the placeholder image
function GHW()
nx = 1920 - 200
ny = 1080 - 200
open("image.PPM", "w") do image
write(image,"P3\n" , string(nx) , " " , string(ny) , "\n" , string(255) , "\n")
for i in 1 : ny
for j in 1 : nx
r = (nx - j) / nx
g = i / ny
b = (i*j) / (nx*ny)
ir = string(Integer(255 - trunc(255.99*r)))
write(image, ir , " ")
ig = string(Integer(255 - trunc(255.99*g)))
write(image,ig , " ")
ib = string(Integer(trunc(255.9*b)))
write(image,ib , " ")
write(image, "\n")
end
end
end
nx = round(Int,nx / 3)
ny = round(Int,ny / 3)
open("mini_image.PPM", "w") do image
write(image,"P3\n" , string(nx) , " " , string(ny) , "\n" , string(255) , "\n")
for i in 1 : ny
for j in 1 : nx
r = (nx - j) / nx
g = i / ny
b = (i*j) / (nx*ny)
ir = string(Integer(255 - trunc(255.99*r)))
write(image, ir , " ")
ig = string(Integer(255 - trunc(255.99*g)))
write(image,ig , " ")
ib = string(Integer(trunc(255.9*b)))
write(image,ib , " ")
write(image, "\n")
end
end
end
end
If possible please help change the size of the image dependent on window size too that would be great