realbasic-games
[Top] [All Lists]

Re: Making declares

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: Making declares
From: Seth Willits <seth at freaksw dot com>
Date: Wed, 26 May 2004 19:42:23 -0700
Delivered-to: realbasic-games at lists dot realsoftware dot com
List-help: <mailto:realbasic-games-request@lists.realsoftware.com?subject=help>
List-id: REALbasic Games <realbasic-games.lists.realsoftware.com>
List-post: <mailto:realbasic-games@lists.realsoftware.com>
References: <p06100500bcdafea4b038 at [192 dot 168 dot 0 dot 100]>
On May 26, 2004, at 7:14 PM, Chris Dillman wrote:

1. Anyone have some complicated declears I can learn from?
I have all the GL declears and im going off of those for now.

2. Is it possible to call out to CoreGrpahics?
I THINK... this is part of carbon.. But possibly not CarbonLib but only in Carbon Framework... can I call into that? Or would I need a mach-o build and some kind of mach-o calling system?

I think I need to talk to where ever #include <CGDirectDisplay.h> is...


Mach is needed for that. You need to use the ApplicationServices framework though, not Carbon. Hopefully this helps some:



Const kFWApplicationServices As String= "ApplicationServices"
Const kCGMaxDisplayReservationInterval As Double=15
Const kCGErrorSuccess As Integer=0
Const kCGDisplayBlendSolidColor As Double=1.0
Const kCGDisplayBlendNormal As Double=0.0


  dim err, token, start as integer
  dim redBlend, greenBlend, blueBlend as double


Declare Function CGDisplayFadeOperationInProgress Lib kFWApplicationServices () as Boolean Declare Function CGAcquireDisplayFadeReservation Lib kFWApplicationServices (interval as single, ByRef token as integer) as Integer Declare Function CGReleaseDisplayFadeReservation Lib kFWApplicationServices (token as integer) as Integer Declare Function CGDisplayFade Lib kFWApplicationServices (token as integer, seconds as single, startBlend as single, endBlend as single, redBlend as single, greenBlend as double, blueBlend as single, synchronous as boolean) as Integer



  // Black
  redBlend = 0.0
  greenBlend = 0.0
  blueBlend = 0.0


  // Reserve Token
  err = CGAcquireDisplayFadeReservation(6.0, token)
  if err <> kCGErrorSuccess then
MsgBox "Quartz Services Error" + EndOfLine + EndOfLine + "Couldn't reserve display fade token: " + str(err)
    return
  end if


  // Something MUST be here otherwise the next
  // declare will NOT operate synchronously! But why?!
  start = ticks

// if anyone knows why this is, please tell me!!!!


  // Fade Out
err = CGDisplayFade(token, 2.0, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, redBlend, greenBlend, blueBlend, true)
  if err <> kCGErrorSuccess then
MsgBox "Quartz Services Error" + EndOfLine + EndOfLine + "Couldn't fade in display: " + str(err)
    return
  end if


  // Fade In
err = CGDisplayFade(token, 2.0, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, redBlend, greenBlend, blueBlend, true)
  if err <> kCGErrorSuccess then
MsgBox "Quartz Services Error" + EndOfLine + EndOfLine + "Couldn't fade out display: " + str(err)
    return
  end if

  // Release Token
  err = CGReleaseDisplayFadeReservation(token)
  if err <> kCGErrorSuccess then
MsgBox "Quartz Services Error" + EndOfLine + EndOfLine + "Couldn't release token: " + str(err)
    return
  end if






Seth Willits
------------------------------------------------------------------------ ---
President and Head Developer of Freak Software - http://www.freaksw.com
REALbasic Guru at ResExcellence - http://www.resexcellence.com/realbasic

"Great spirits have always encountered violent opposition from mediocre
minds."
    -- Albert Einstein
------------------------------------------------------------------------ ---

_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>