Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Gary

#16
How easy would it be to do a spectrum attribute clash effect on GLB? Im thinking that if you had some sort of array 32 x 24 where you stored the paper and ink colours then draw all the paper blocks on a background, then all graphics in white and then overlay the ink colours onto the graphics, would that work or is there a better way?
#17
I was writing a video fruit machine and wanted it to be as close to the operating system I used for physical reel based machines where I basically "fire and forget" things like telling a lamp to flash or start the reels spinning or checking if a button was pressed. So within my graphic draw routines I have a flag for each graphic, lit and unlit, and I attach a status flag to each image saying which to draw. The interrupt can toggle these flags at a very specific interval to create flashing images. Also the reels have a flag to say stopped, spinning, stop at a position, bounce back and nudge. Again all this movement is controlled by the interrupt and not the main draw routine. Possibly I over engineered the solution but it works for me
#18
No problems what so ever Bigsofty. It sat in the background running set code on a 20 50 100 250 and 500 ms interval with no issues. Admittedly it was not a massive amount of code but it still worked
#19
Been using this lib for a while though and always had a windows alert and an UNHANDLED EXCEPTION alert in the debug window when exiting a program but as the code was never actually being quit I never bothered looking for it until today and it turns out my thread is causing the issue

I am setting the thread up with the following command

Code (glbasic) Select

// Create a Mutex
mx_mutex=ThMutexCreate()

// Start a new thread
IF ThThreadCreate("Interrupt")=FALSE
PRINT "Can't create thread", 0,0
SHOWSCREEN
MOUSEWAIT
END
ENDIF


But how should I be handling it on app close? I thought that by doing
Code (glbasic) Select
ThMutexDelete(mx_mutex)
before the end command would do the trick but I still get the exception.

I am 100% certain its the thread that is causing the alert as when I dont initialise it then the code exits correctly.

Any help would be appreciated

EDIT: Found the issue, my code used the thread as a pseudo interrupt and the subroutine actually never quit, it did the code in a while 1 loop. Once I forced a graceful exit from the SUB before I deleted the Mutex it removed the error on shutdown. So the lesson is, make sure the thread is not running when you delete and exit :)
#20
Solved it, Will post my solution incase anyone else needs to do something similar

I used

Code (glbasic) Select
DECLARE_ALIAS(BPStartDLL, "gamesocket.dll", "BP_StartDLL", (void*), int);

to set up the call and

Code (glbasic) Select
FUNCTION StartDLL:
INLINE

if(BPStartDLL)
return BPStartDLL(GLBASIC_HWND());
else
return 255;
ENDINLINE
ENDFUNCTION


to send the HWND value
#21
GLBasic - en / DLL and HWND
2015-Aug-28
I have a DLL which I need to include in a program. I have got it all loading and opening properly but I am struggling with one of the commands I need to set up.

In the manual that came with the DLL is has visual studio examples and the one im struggling with at the moment is this one

Code (glbasic) Select

BP_StartDLL = (bp_bool_hwnd) GetProcAddress (DllModule, "BP_StartDLL");


and it says to call it you need to do the following

Code (glbasic) Select
RetVal = (*BP_StartDLL)(myhWnd);

Now I thought I had found out how to do it from the help and set things up like this

Code (glbasic) Select
DECLARE_ALIAS(BPStartDLL, "gamesocket.dll", "BP_StartDLL", (bool hwnd), int);

in the part where I load the DLL and declare all the functions

and

Code (glbasic) Select
FUNCTION StartDLL:
INLINE
if(BPStartDLL)
return BPStartDLL(GLBASIC_HWND);
else
return 255;
ENDINLINE
ENDFUNCTION


In the actual StartDLL function but it is refusing to talk to the other program it is supposed to. I think it is getting the wrong HWND value.

Anyone got any ideas where I am going wrong?

Thanks
Gary
#22
scrap that. its me forgetting my code from 4 years ago

incase anyone else has a similar issue then this worked for me

Code (glbasic) Select
USESCREEN 1
DRAWSPRITE 70,0,0
GRABSPRITE 801,0,-768,1024,768
GRABSPRITE 802,0,0,1024,768
USESCREEN 2
DRAWSPRITE 801,1024,0
DRAWSPRITE 802,0,0
USESCREEN -1
DRAWSPRITE 999,0,0


with the following set up for the 2 screens

CREATESCREEN 2,999,2048,768
CREATESCREEN 1,70,1024,1536
#23
this is what is actually displaying now, the right side is being animated properly but the left side for some reason is staying static and also its showing the wrong artwork (reel symbols are different to the right side ones)
#24
I took out the setscreen and that removed the flickering, I now set that at start up depending on a flag at build time.

I am rendering everything to a sprite set as screen 1 (sprite number 70) so that I can resize it depending on the output screen size. I have checked that the sprite is being generated properly by using savesprite and it is as per the attached image

This is only going to run on a windows based computer so I know GRABSPRITE does not work on some mobile platforms

Looks like I might have to rewrite all the draw routines if SDL is broken :(

Thanks for the advice

#25
I thought something like this would do it

Code (glbasic) Select
GRABSPRITE 301,0,0,1024,768 // grab the top half of the screen
GRABSPRITE 302,0,768,1024,768 // grab the bottom half of the screen
SETSCREEN 2048,768,FALSE // create a screen 2 screens wide and 1 screen high
DRAWSPRITE 301,1024,0 // draw the top half on the right
DRAWSPRITE 302,0,0 //draw the bottom half on the left


it kind of works but it gives the bottom half of the screen on both sides (with a bit of graphics clipping at the top of the left side half) and it is constantly flickering
#26
its a png background with loads of of other pngs laid on top of it
#27
I am wondering if there is an easy way for GLB to do the following

I have a display that is currently drawn as a single screen of 1024 wide and 1526 high to display over 2 screens within windows. I now need to draw it as a screen 2048 wide and 768 high with the screen that starts at 1024,0 being what was drawn as the top screen.

Can I use my existing draw routine and then create a sprite for each of the halves of the screens and then redraw in the new positions?

its something like this I'm after


current screen layout
----------
-        -
-    x   -
-        -
----------
-        -
-    y   -
-        -
----------

new screen layout
-------------------
-        --       -
-   y    --   x   -
-        --       -
-------------------

#28
 :happy: :happy: :happy:

all I needed was to add that unborder code and then before every SHOWSCREEN call Unborder(0,0) and it works

Cheers everyone for the input, it helped me think it through and get it solved
#29
Actually Erico, no I didn't. Ive never set them before so didn't know about it, time to try that now. Cheers

I did find this topic on going borderless http://www.glbasic.com/forum/index.php?topic=1899.0 but to be honest I don't have a clue on how the code works lol, I know the 64,64 is where it draws the screen but do I just use this instead of SHOWSCREEN?
#30
I tried running a screen size of 2048 x 768 as full screen and it decided to open it up as a windowed app with the midpoint set as the middle of the first screen so half a screen was lost to the left and half was missing on the right.

if there was a way of making sure it opened at 0,0 every time and without the borders or title bar (without installing any extra software, its running on a closed system that can't be changed) I would be sorted but I don't know if GLB can do that or is there any other software I can install that will alter the exe file?