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

Username:   Password: 
 RegisterRegister   
 Pictures
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
TokenHerbz




PostPosted: Wed Sep 07, 2005 10:54 pm   Post subject: Pictures

Hi, is there a way to edit the size of a picuter WITHOUT changing the image file...

code:

import GUI

setscreen("Graphics:200;200")

var mypic :int := Pic.FileNew ("dagger.bmp")

proc dag
Pic.Draw(mypic, 50, 50, 2)
end dag

var daggerBut : int := GUI.CreateButton (100, 10, 0, "Dagger", dag)

loop
    exit when GUI.ProcessEvent
end loop
Pic.Free(mypic)

If i wanted to say, draw that knife bigger, how would i do it
viseversa smaller... thanks!

**Note** Copy paste wont work
Sponsor
Sponsor
Sponsor
sponsor
TokenHerbz




PostPosted: Wed Sep 07, 2005 10:56 pm   Post subject: (No subject)

also, i forgot to ask, How do i MOVE the picture?

There isn't a tut on those 2 things...
jamonathin




PostPosted: Thu Sep 08, 2005 5:58 am   Post subject: (No subject)

Firstly, if you're going to post right after you just made the topic, you can use that pretty little 'Edit' button located at the top, right hand side of your post.

Now, to change the size of your image. . .

You can use Pic.Scale. All you need to do is make another variable equal to Pic.Scale ( picID, xSize, ySize ).
Basically, if you wanted your image to be 200 pixels by 150, then . . .

code:

var mypic:int :=Pic.FileNew("dagger.bmp")
var new_dagger :int := Pic.Scale (mypic, 200, 150)

This way you can still use your dagger image and your scaled dagger image.

Once you ge tthe hang of it, you can incorporate it into procedure and whatnot. Here's a basic example.
Turing:

setscreen ("graphics:max;max,offscreenonly")

var mypic : int := Pic.FileNew ("dagger.bmp")

proc dag (Xsize, Ysize, Image, X, Y : int)
    var SCALED_IMAGE : int %Making a temporary variable inside the procedure
    SCALED_IMAGE := Pic.Scale (Image, Xsize, Ysize) %Scaling 'mypic' to the desired 'x' and 'y' size
    Pic.Draw (SCALED_IMAGE, X, Y, picMerge) %Now drawing that image
end dag
/* What the above means
 Xsize - new pixel x-length for the image
 Ysize - new pixel y-length for the image
 Image - Which ever image variable we use
 X - X value of where the image will be drawn
 Y - Y value of where the image will be drawn
 */


for decreasing i : 500 .. 5 by 5
    cls
    dag (i, i, mypic, 0, 0)
    View.Update
end for


**EDIT**


If you want to move the image, all you have to do change the x and y values, like such:
code:
setscreen ("graphics:max;max,offscreenonly")
colorback (black)
var mypic : int := Pic.FileNew ("dagger.bmp")
var mx, my, mz : int
loop
    mousewhere (mx, my, mz)
    cls
    %drawfillbox (mx, my, mx + 10, my + 10, white)
    Pic.Draw (mypic, mx, my, picMerge)
    View.Update
    exit when mz = 1
end loop
TokenHerbz




PostPosted: Fri Sep 09, 2005 1:36 pm   Post subject: (No subject)

thank you
TokenHerbz




PostPosted: Sun Sep 11, 2005 1:37 pm   Post subject: (No subject)

Say im using lots LOTS of pictures... Will this lag the game i creat???
[Gandalf]




PostPosted: Sun Sep 11, 2005 1:43 pm   Post subject: (No subject)

If you are using LOTS of pictures, then you should not be using Turing - it can't handle too many, and the requirements for your program will be huge. If you want to reduce lag, then you can always Pic.Free any pictures that you are not using so it doens't keep them in memory.
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  [ 6 Posts ]
Jump to:   


Style:  
Search: