Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 uploading bmp. images into turing
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
RottenPunk




PostPosted: Sun Feb 15, 2004 9:50 pm   Post subject: uploading bmp. images into turing

hey, i have basically finished an assignment for my grade 10 computer course but as a 'finishing touch' i want to add a couple bmp. images into the background or somewhere on the page. i tried using a tutorial listed on this site but i was getting a segment error or something. can someone give me the code for uploading an image into turing? thanks.

Mod Edit: Post in the right section next time, Moved
Sponsor
Sponsor
Sponsor
sponsor
AsianSensation




PostPosted: Sun Feb 15, 2004 9:54 pm   Post subject: (No subject)

make sure you either included the directory of the picture and used // instead of /, or just include the picture in the same folder as the source code, lastly, make sure your spelling is correct, 99% of the problems lies there.
Maverick




PostPosted: Sun Feb 15, 2004 9:58 pm   Post subject: (No subject)

like a sprite?
shorthair




PostPosted: Sun Feb 15, 2004 10:01 pm   Post subject: (No subject)

Sprites havent been implemented yet , there no where near ready , tom said he has stopped working on hem
RottenPunk




PostPosted: Tue Apr 06, 2004 12:04 pm   Post subject: uploading again

hey, a couple months ago i created the topic can didnt really get the reply i was looking for. i didnt use images in the program i was working on then but i need them for this rpogram. i used the turing keyword refernce and it gave me a code that uploads the picture i need but it draws it like 50 times. i changed it so that it only draws it once but the position of the picture keeps changing everytime i try it and it is bigger than i want it to be. here is the code...
code:
        var picID: int
        var x, y : int
       
        picID := Pic.FileNew ("coke.bmp")
        for i : 0..1
            x := Rand.Int (0, maxx)     % Random x
            y := Rand.Int (0, maxy)     % Random y
            Pic.Draw (picID, x, y, picCopy)
        end for
        Pic.Free (picID)

can someone tell me how i can decide what the size and position of the picture is on the screen? thanks.
Dan




PostPosted: Tue Apr 06, 2004 3:48 pm   Post subject: (No subject)

shorthair wrote:
Sprites havent been implemented yet , there no where near ready , tom said he has stopped working on hem


ah i made sprites for turing about a month ago Rolling Eyes

if u whont sprites check out the dTeam page or look at turing turials under sprites.


as for RottenPunk question:

1st you need an int to store the refuernce to the pic


var picID: int


then u need to tell turing to make a file stream to the pic and store the refece num in picID


picID := Pic.FileNew ("coke.bmp") %were stuff in ""s is the file path


then to show the pic at lest say (10,20) where 10 is x querdent and 20 is y we whould do this


Pic.Draw (picID, 10, 20, picCopy)


the first input is the pic rencfect num form the int, then the x qudent and then the y and the then mode. the difrrent modes for drawing pics can be found in the turing help thingy.

so your code whold be

code:

var picID :int :=Pic.FileNew ("coke.bmp")
Pic.Draw (picID, 10, 20, picCopy)


to draw the pic at (10,20) in picCopy mode.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
RottenPunk




PostPosted: Wed Apr 07, 2004 5:09 pm   Post subject: (No subject)

thanks. i got the upload working earlier today but i have another problem. i have my picture moving across the sky in turing (it's a plane) and i have it stopping where i want it but if my plane comes near another object, picture, etc. in turing that isn't coloured the background colour blue, it covers that object up. is there any way that I can get rid of the background colour in my picture so that only the plane itself shows up. i used paint to draw the picture. here is the code and the image. if you test this out u will have 2 mess around with the directory that i have for loading the image...
[code]
var pic1:int
var x:int:=1
drawfill (32,32,32,32)
drawfillbox (-1,-10,800,65,green)
drawfillbox (20,20,120,120,114)
drawbox (20,20,120,120,black)
%Draws the outer lines on the house
drawline (160,160,160,60,black)
drawline (120,120,160,160,black)
drawline (120,20,160,60,black)
%
drawline (120,120,90,180,black)
drawline (160,160,90,180,black)
drawline (20,120,91,180,black)
drawfillbox (50,20,80,60,black)

drawfill (149,159,245,black)
drawfill (121,119,114,black)
%Sun
drawfilloval (70,320,60,60,yellow)
%Tree
drawfillbox (480,10,505,90,114)
drawfilloval (491,125,40,40,green)
%Plane
loop
x:=x+1
pic1:=Pic.FileNew ("c:/Documents and Settings/Administrator/My Documents/tik/misc turing/airplane1.bmp")
Pic.Draw (pic1,640-x,300,picCopy)
delay (100)
exit when x=330
end loop
%Birds
RottenPunk




PostPosted: Wed Apr 07, 2004 5:13 pm   Post subject: (No subject)

ok nevermind. i cant send the bmp. file as an attachment so if u could just look at the code and give me an idea id appreciate it. thanks.
Dan




PostPosted: Wed Apr 07, 2004 6:37 pm   Post subject: (No subject)

your problem is that the backgorund image gets coverd by the plan image right?

well there are two ways to go about fixing this:

1. you have to redraw the hole backgorund and then the plan over it

or

2. uses sprites.

with 1 you may get flickering so u whould have to uses view.update with a screen mode of offscreenonly. with 2 you have to have turing 3.x and not 4.x or uses a turing add that brings sprites back.

so basicly ether make a fuction for drawing the back ground and call it each time you move the plan or look at the dTeam page here for our sprites add on and figger out how to use them.


P.S. when posting turing progames that have bmp files zip them together then post them.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 9 Posts ]
Jump to:   


Style:  
Search: