-- GENERATED by C->Haskell Compiler, version 0.16.3 Crystal Seed, 24 Jan 2009 (Haskell) -- Edit the ORIGNAL .chs file instead! {-# LINE 1 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-}{-# LANGUAGE ForeignFunctionInterface #-} {-# LANGUAGE TypeSynonymInstances #-} -- This source file is part of HGamer3D -- (A project to enable 3D game development in Haskell) -- For the latest info, see http://www.althainz.de/HGamer3D.html -- -- (c) 2011, 2012 Peter Althainz -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- ClassResource.chs -- module HGamer3D.Bindings.Ogre.ClassResource where import C2HS import Foreign import Foreign.Ptr import Foreign.C import Monad (liftM, liftM2) import HGamer3D.Data.HG3DClass import HGamer3D.Data.Vector import HGamer3D.Data.Colour import HGamer3D.Data.Angle import HGamer3D.Bindings.Ogre.Utils {-# LINE 42 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} import HGamer3D.Bindings.Ogre.ClassPtr {-# LINE 43 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} import HGamer3D.Bindings.Ogre.StructHG3DClass {-# LINE 44 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} -- | Virtual destructor. Shouldn't need to be overloaded, as the resource deallocation code should reside in unload()Resource::unload() delete :: HG3DClass -- ^ classpointer - pointer of Class instance which is going to be deleted. -> IO () -- ^ delete a1 = withHG3DClass a1 $ \a1' -> delete'_ a1' >>= \res -> return () {-# LINE 49 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} -- | Prepares the resource for load, if it is not already. One can call prepare()load()load()prepare()load()prepare()prepare()prepare()load()prepare()load()prepare()prepare() prepare :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> Bool -- ^ backgroundThread - Whether this is occurring in a background thread -> IO () -- ^ prepare a1 a2 = withHG3DClass a1 $ \a1' -> let {a2' = fromBool a2} in prepare'_ a1' a2' >>= \res -> return () {-# LINE 54 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} -- | Loads the resource, if it is not already. If the resource is loaded from a file, loading is automatic. If not, if for example this resource gained it's data from procedural calls rather than loading from a file, then this resource will not reload on it's own. load :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> Bool -- ^ backgroundThread - Indicates whether the caller of this method is the background resource loading thread. -> IO () -- ^ load a1 a2 = withHG3DClass a1 $ \a1' -> let {a2' = fromBool a2} in load'_ a1' a2' >>= \res -> return () {-# LINE 59 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} -- | Reloads the resource, if it is already loaded. Calls unload()load() reload :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO () -- ^ reload a1 = withHG3DClass a1 $ \a1' -> reload'_ a1' >>= \res -> return () {-# LINE 63 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} -- | Returns true if the Resource isReloadable :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO (Bool) -- ^ isReloadable a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' -> isReloadable'_ a1' a2' >>= \res -> peekBoolUtil a2'>>= \a2'' -> return (a2'') {-# LINE 68 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} -- | Is this resource manually loaded? isManuallyLoaded :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO (Bool) -- ^ isManuallyLoaded a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' -> isManuallyLoaded'_ a1' a2' >>= \res -> peekBoolUtil a2'>>= \a2'' -> return (a2'') {-# LINE 73 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} -- | Unloads the resource; this is not permanent, the resource can be reloaded later if required. unload :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO () -- ^ unload a1 = withHG3DClass a1 $ \a1' -> unload'_ a1' >>= \res -> return () {-# LINE 77 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} -- | Retrieves info about the size of the resource. getSize :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO (Int) -- ^ getSize a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' -> getSize'_ a1' a2' >>= \res -> peekIntConv a2'>>= \a2'' -> return (a2'') {-# LINE 82 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} -- | 'Touches' the resource to indicate it has been used. touch :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO () -- ^ touch a1 = withHG3DClass a1 $ \a1' -> touch'_ a1' >>= \res -> return () {-# LINE 86 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} -- | Gets resource name. getName :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO (String) -- ^ getName a1 = withHG3DClass a1 $ \a1' -> alloc64k $ \a2' -> getName'_ a1' a2' >>= \res -> peekCString a2'>>= \a2'' -> return (a2'') {-# LINE 91 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} -- | Returns true if the Resource isPrepared :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO (Bool) -- ^ isPrepared a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' -> isPrepared'_ a1' a2' >>= \res -> peekBoolUtil a2'>>= \a2'' -> return (a2'') {-# LINE 96 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} -- | Returns true if the Resource isLoaded :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO (Bool) -- ^ isLoaded a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' -> isLoaded'_ a1' a2' >>= \res -> peekBoolUtil a2'>>= \a2'' -> return (a2'') {-# LINE 101 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} -- | Returns whether the resource is currently in the process of background loading. isLoading :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO (Bool) -- ^ isLoading a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' -> isLoading'_ a1' a2' >>= \res -> peekBoolUtil a2'>>= \a2'' -> return (a2'') {-# LINE 106 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} -- | Returns whether this ResourceThis option only makes sense when you have built Ogreload()load()isLoaded() isBackgroundLoaded :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO (Bool) -- ^ isBackgroundLoaded a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' -> isBackgroundLoaded'_ a1' a2' >>= \res -> peekBoolUtil a2'>>= \a2'' -> return (a2'') {-# LINE 111 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} -- | Tells the resource whether it is background loaded or not. Resource::isBackgroundLoaded setBackgroundLoaded :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> Bool -- ^ bl -> IO () -- ^ setBackgroundLoaded a1 a2 = withHG3DClass a1 $ \a1' -> let {a2' = fromBool a2} in setBackgroundLoaded'_ a1' a2' >>= \res -> return () {-# LINE 116 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} -- | Escalates the loading of a background loaded resource. If a resource is set to load in the background, but something needs it before it's been loaded, there could be a problem. If the user of this resource really can't wait, they can escalate the loading which basically pulls the loading into the current thread immediately. If the resource is already being loaded but just hasn't quite finished then this method will simply wait until the background load is complete. escalateLoading :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO () -- ^ escalateLoading a1 = withHG3DClass a1 $ \a1' -> escalateLoading'_ a1' >>= \res -> return () {-# LINE 120 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} -- | Gets the group which this resource is a member of. getGroup :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO (String) -- ^ getGroup a1 = withHG3DClass a1 $ \a1' -> alloc64k $ \a2' -> getGroup'_ a1' a2' >>= \res -> peekCString a2'>>= \a2'' -> return (a2'') {-# LINE 125 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} -- | Change the resource group ownership of a ResourceThis method is generally reserved for internal use, although if you really know what you're doing you can use it to move this resource from one group to another. changeGroupOwnership :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> String -- ^ newGroup - Name of the new group -> IO () -- ^ changeGroupOwnership a1 a2 = withHG3DClass a1 $ \a1' -> withCString a2 $ \a2' -> changeGroupOwnership'_ a1' a2' >>= \res -> return () {-# LINE 130 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} -- | Gets the manager which created this resource. getCreator :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO (HG3DClass) -- ^ getCreator a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' -> getCreator'_ a1' a2' >>= \res -> peek a2'>>= \a2'' -> return (a2'') {-# LINE 135 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} -- | Get the origin of this resource, e.g. a script file name. This property will only contain something if the creator of this resource chose to populate it. Script loaders are advised to populate it. getOrigin :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO (String) -- ^ getOrigin a1 = withHG3DClass a1 $ \a1' -> alloc64k $ \a2' -> getOrigin'_ a1' a2' >>= \res -> peekCString a2'>>= \a2'' -> return (a2'') {-# LINE 140 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} -- | Returns the number of times this resource has changed state, which generally means the number of times it has been loaded. Objects that build derived data based on the resource can check this value against a copy they kept last time they built this derived data, in order to know whether it needs rebuilding. This is a nice way of monitoring changes without having a tightly-bound callback. getStateCount :: HG3DClass -- ^ classpointer - pointer of Class instance from which this methods is called. -> IO (Int) -- ^ getStateCount a1 = withHG3DClass a1 $ \a1' -> alloca $ \a2' -> getStateCount'_ a1' a2' >>= \res -> peekIntConv a2'>>= \a2'' -> return (a2'') {-# LINE 145 ".\\HGamer3D\\Bindings\\Ogre\\ClassResource.chs" #-} foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResource.chs.h ogre_rsrc_destruct" delete'_ :: ((HG3DClassPtr) -> (IO ())) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResource.chs.h ogre_rsrc_prepare" prepare'_ :: ((HG3DClassPtr) -> (CInt -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResource.chs.h ogre_rsrc_load" load'_ :: ((HG3DClassPtr) -> (CInt -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResource.chs.h ogre_rsrc_reload" reload'_ :: ((HG3DClassPtr) -> (IO ())) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResource.chs.h ogre_rsrc_isReloadable" isReloadable'_ :: ((HG3DClassPtr) -> ((Ptr CInt) -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResource.chs.h ogre_rsrc_isManuallyLoaded" isManuallyLoaded'_ :: ((HG3DClassPtr) -> ((Ptr CInt) -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResource.chs.h ogre_rsrc_unload" unload'_ :: ((HG3DClassPtr) -> (IO ())) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResource.chs.h ogre_rsrc_getSize" getSize'_ :: ((HG3DClassPtr) -> ((Ptr CInt) -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResource.chs.h ogre_rsrc_touch" touch'_ :: ((HG3DClassPtr) -> (IO ())) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResource.chs.h ogre_rsrc_getName" getName'_ :: ((HG3DClassPtr) -> ((Ptr CChar) -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResource.chs.h ogre_rsrc_isPrepared" isPrepared'_ :: ((HG3DClassPtr) -> ((Ptr CInt) -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResource.chs.h ogre_rsrc_isLoaded" isLoaded'_ :: ((HG3DClassPtr) -> ((Ptr CInt) -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResource.chs.h ogre_rsrc_isLoading" isLoading'_ :: ((HG3DClassPtr) -> ((Ptr CInt) -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResource.chs.h ogre_rsrc_isBackgroundLoaded" isBackgroundLoaded'_ :: ((HG3DClassPtr) -> ((Ptr CInt) -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResource.chs.h ogre_rsrc_setBackgroundLoaded" setBackgroundLoaded'_ :: ((HG3DClassPtr) -> (CInt -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResource.chs.h ogre_rsrc_escalateLoading" escalateLoading'_ :: ((HG3DClassPtr) -> (IO ())) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResource.chs.h ogre_rsrc_getGroup" getGroup'_ :: ((HG3DClassPtr) -> ((Ptr CChar) -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResource.chs.h ogre_rsrc_changeGroupOwnership" changeGroupOwnership'_ :: ((HG3DClassPtr) -> ((Ptr CChar) -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResource.chs.h ogre_rsrc_getCreator" getCreator'_ :: ((HG3DClassPtr) -> ((HG3DClassPtr) -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResource.chs.h ogre_rsrc_getOrigin" getOrigin'_ :: ((HG3DClassPtr) -> ((Ptr CChar) -> (IO ()))) foreign import ccall safe "HGamer3D\\Bindings\\Ogre\\ClassResource.chs.h ogre_rsrc_getStateCount" getStateCount'_ :: ((HG3DClassPtr) -> ((Ptr CInt) -> (IO ())))