Author Topic: Background Images  (Read 12029 times)

anemity

  • Newbie
  • *
  • Posts: 4
Background Images
« on: December 21, 2010, 10:35:55 AM »
Hello,
    I am new to the software creation scene. I have been messing around with the tutorials and have learned quite a bit so far with no knowledge of your program and coding. Those deffinately help but my question is how do you assign a background image to an individual card? I have been searching pages but no luck and what I have tried did not work. Thanks for your help :)
-Rich
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 464
  • Here to help you
Re: Background Images
« Reply #1 on: December 21, 2010, 12:21:43 PM »
Quote from: "anemity"
Hello,
    I am new to the software creation scene. I have been messing around with the tutorials and have learned quite a bit so far with no knowledge of your program and coding. Those deffinately help but my question is how do you assign a background image to an individual card? I have been searching pages but no luck and what I have tried did not work. Thanks for your help :)
-Rich

Hello anemity

You can assign a background image to an individual card with one of the CardLoadImages commands or load an image from an ImageBank:-

CardLoadImage - loads the named local image file and attaches the image to the card. The image can be left at its normal size or scaled to fill the card using values of 0 or 1 respectively.
 
Code: [Select]
    CardLoadImage(cid,fname,scale)
 
     CardLoadImage(5,fname,1)

There are also CardLoadImageAbs, CardLoadImageXP and CardLoadImageXPAbs - these are for absolute pathanmes and Cross-Platform(XP) independent images - they are described in the Language Reference PDF and built-in help.

For Image bank there is the CardBankImage command.

I'm not sure but on older machines there might have been some image flashing as the card loads - also you can call these commands in the open script of a card.
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.

anemity

  • Newbie
  • *
  • Posts: 4
Re: Background Images
« Reply #2 on: December 21, 2010, 09:24:55 PM »
Thanks for your speedy reply. I tried using that coding I know I am doing something wrong so i'll show you what I did here.
cid is I am guessing card id? I put 1 since I want to put the background image on my first card. I put the file name then i put the number for the image to fill the screen. do i have to put codes before and after the image codes?

 CardLoadImage(cid,fname,scale)

     CardLoadImage(1,logomain.jpg,1)

thats how mine looks. Do I put that in the main code? Or do I make a new defined method?  Also where do i put the image at so it can use it? Sorry if you had this question a million times so far and this is something simple that I am overlooking. Thanks again for your help.
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 464
  • Here to help you
Re: Background Images
« Reply #3 on: December 22, 2010, 11:50:38 AM »
Quote from: "anemity"
Thanks for your speedy reply. I tried using that coding I know I am doing something wrong so i'll show you what I did here.
cid is I am guessing card id? I put 1 since I want to put the background image on my first card. I put the file name then i put the number for the image to fill the screen. do i have to put codes before and after the image codes?

 CardLoadImage(cid,fname,scale)

     CardLoadImage(1,logomain.jpg,1)

thats how mine looks. Do I put that in the main code? Or do I make a new defined method?  Also where do i put the image at so it can use it? Sorry if you had this question a million times so far and this is something simple that I am overlooking. Thanks again for your help.

Its fine, I can't recall when this was last asked.

Just wondering if you enclosed the image filename in quotes :-

Code: [Select]
CardLoadImage(1,'wood1.jpg',1)

Also is your image in the same folder as your project? If you want to place the image in a sub folder then you need to change the filename (pathname)

Code: [Select]
@ in subfolder called MyPictures on Macintosh
CardLoadImage(1,'MyPictures:wood1.jpg',1)

@ in subfolder called MyPictures on Windows
CardLoadImage(1,'MyPictures/wood1.jpg',1)



The HyperNext examples BooksHC and BooksHN both show how to load a wooden image into the card's background using an ImageBank - its in the Startup section of MainCode. Although the various CardLoadImage commands are easier to understand than ImageBanks.

When testing I often just put the commands in the Card's script - so when the card loads the command is executed before the card is drawn.
However, in longer programs its often better to place such initialization code in the Startup section of the MainCode then you can see everything grouped together.
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.

anemity

  • Newbie
  • *
  • Posts: 4
Re: Background Images
« Reply #4 on: December 23, 2010, 11:48:25 AM »
still not working for me. here is my code

@ Any code here is executed before the Home card loads.

@ --- Home Card ---
CardLoadImage(1,'backgroundmain.jpg',1)

Local okay,numcards,n

ImageBankReset
ImageBankReserve(1)

Put ImageBankSetSizeFN(1,640,480) into okay
If okay=1 Then
    ImageBankLoad(1,'backgroundmain.jpg',1)
    @ --- Home Card ---
    CardBankImage(1,1)
    @ --- Template Card 2 ---
    CardBankImage(2,1)
    @ --- For Player with more data cards ---
    Put TotalCardsFN into numcards
    If numcards>2 Then
        For n=1 To numcards
            CardBankImage(n,1)
        EndFor
    EndIf
EndIf


does that look right? i been reading through tutorials but stll don't get what i am doing wrong
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 464
  • Here to help you
Re: Background Images
« Reply #5 on: December 23, 2010, 06:09:05 PM »
Quote from: "anemity"
still not working for me. here is my code

@ Any code here is executed before the Home card loads.

@ --- Home Card ---
CardLoadImage(1,'backgroundmain.jpg',1)

Local okay,numcards,n

ImageBankReset
ImageBankReserve(1)

Put ImageBankSetSizeFN(1,640,480) into okay
If okay=1 Then
    ImageBankLoad(1,'backgroundmain.jpg',1)
    @ --- Home Card ---
    CardBankImage(1,1)
    @ --- Template Card 2 ---
    CardBankImage(2,1)
    @ --- For Player with more data cards ---
    Put TotalCardsFN into numcards
    If numcards>2 Then
        For n=1 To numcards
            CardBankImage(n,1)
        EndFor
    EndIf
EndIf


does that look right? i been reading through tutorials but stll don't get what i am doing wrong

I think I'm missing something here because I copied your code into a test project, renamed to use "wooden1.jpg" and it works both under Mac OS X and Windows XP.

Here is a test project, just ignore the fields and general mess etc, your code is there, and you can see images in the project folder.
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 464
  • Here to help you
Re: Background Images
« Reply #6 on: December 23, 2010, 06:14:02 PM »
Just a thought - if you are on Windows platform - Apple Quicktime needs to be installed otherwise images might not display.
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.

anemity

  • Newbie
  • *
  • Posts: 4
Re: Background Images
« Reply #7 on: December 23, 2010, 08:34:28 PM »
Thanks a lot for your help man it is greatly appreciated. I'll try that when I get home. I'm running windows, have quick time installed and have the file in the folder. So I know i'm doin something wrong if you make it work allright haha the fun process of learning. If you ever need help coding a webpage or making custom graphics I been doing them for 10+ years let me know I don't mind helping out I believe in Karma :) But anyway thanks again and i'll post with my results
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »

Malkom

  • Administrator
  • Newbie
  • *****
  • Posts: 464
  • Here to help you
Re: Background Images
« Reply #8 on: December 24, 2010, 05:45:14 AM »
Quote from: "anemity"
Thanks a lot for your help man it is greatly appreciated. I'll try that when I get home. I'm running windows, have quick time installed and have the file in the folder. So I know i'm doin something wrong if you make it work allright haha the fun process of learning. If you ever need help coding a webpage or making custom graphics I been doing them for 10+ years let me know I don't mind helping out I believe in Karma :) But anyway thanks again and i'll post with my results

Thats fine, its nice to get things working, or either we find a bug in HyperNext, either way we make some kind of progress. :)
« Last Edit: January 01, 1970, 01:00:00 AM by Guest »
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.