
-----------------------------------
LegendsEnd
Fri Feb 24, 2006 9:11 pm

Picture Cropping and Hasch Questions, Please help
-----------------------------------
I had abandoned my RPG project awhile back but I think it's time to start where I left off again. In the design process of all this, I've run into a few problems as I thought about what I would need to do to get all of this working. I know I will have many more questions in the coming weeks so hopefully you guys won't mind helping.

My first problem is images in turing. For example, using:
setscreen("graphics:max;max")
Will give you a screen with the maximum dimensions based on your settings, 1024x800,800x640,etc
Images however, are a set size. So if I were to make a game with images based on 1024x800, is there any way to make it compatible with someone's monitor that's on 800x640 by cropping the images with code in turing? I know the other aspects are easy to figure out by having dynamic x and y values for everything else based on the screen size.

My second problem is in understanding the flushing procedure in turing. In turing ref. under the hasch command, we get this code:
        procedure flush
            var ch : string ( 1 )
            loop
                exit when not hasch
                getch ( ch )    % Discard this character
            end loop
        end flush

What this should do, is that if your program is setup to accept keys via a getch loop, this will allow a process to complete running before more keys are accepted. It works, but how? Now, this is how I see it. We have a loop. We exit when a character has not been inputted before it is read. Therefore, as long as no one is presssing a key at that moment, the loop exits. As far as I can tell, you may as well not have this code in your program and it'll run the exact same way. Help! lol

-----------------------------------
Cervantes
Fri Feb 24, 2006 10:11 pm


-----------------------------------
You can use Pic.Scale to resize images.  It won't be the best quality, though.

The code you've posted is strange.  I would think that, if no keys are pressed, that loop would exit automatically.  You might try Input.Pause, or something like this:

loop
    exit when hasch
end loop


-----------------------------------
LegendsEnd
Sat Feb 25, 2006 2:10 pm


-----------------------------------
Well here's an example of it in use, try it once without the code in the /**/ section and hit spacebar a few times. The command will queue up. Then delete the /* */ and run it with the example flushing code under turing ref. and then mash spacebar. The problem is solved but I don't really get how it works lol. The loop should be doing absolutely nothing. How exactly does getch(a) discard the character?

var a : string (1)
loop
    /*loop
        exit when not hasch
        getch (a) % Discard this character
    end loop
    */
    getch (a)
    if a = chr (32) then %Chr(32) = Spacebar
        for i : 1 .. 3
            put "Hi"
            delay (1000)
        end for
    end if
end loop

-----------------------------------
Cervantes
Sat Feb 25, 2006 2:28 pm


-----------------------------------
Please use How exactly does getch(a) discard the character?

If you're not going to do anything with a, then it's essentially been removed from the keyboard buffer and will never be used: hence, discarded.

-----------------------------------
chrispminis
Sun Feb 26, 2006 11:37 pm


-----------------------------------
Genius!

There always Input.Flush :)

-----------------------------------
codemage
Mon Feb 27, 2006 10:14 am


-----------------------------------
I'd recommend against picture scaling.  Scaling is a lot simpler in a 3d environment where you're just changing the viewable area imposed on the screen.

With a 2d environment, you'd be creating a lot of extra work for yourself, and guaranteeing a heapload of bugs with resizing viewability.

Unless you have some advil handy, consider sticking with a standard resolution instead of max:max.

-----------------------------------
LegendsEnd
Mon Feb 27, 2006 12:01 pm


-----------------------------------
It shouldn't be a problem if I keep all the x,y values with only multiplication/division would it?
