[PAID] Screen Framework for AGK?

Started by Amon, May 26, 2019, 16:27:52

Previous topic - Next topic

Amon

I need a basic screen framework like diddy2 but for AGK. I'm willing to pay to get this done for me. If anyone is capable, has the time and is willing can you email me or post here and we can discuss it, includin costs.

Thank you.

Qube

I'm not familiar with diddy 2 but if you can describe what you'd ideally like then if I already have something similar in my framework I'll send it over to you for free :)
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

Derron

Screen frameworks usually handle:
- update / render current "screen object"
- transition between "current object" and "last/next screen objects"
- have "prepare/firststart/init/afterXYZ/beforeXYZ" function/hooks which are called in the approbriate situations for screen objects to create objects, clean up, prepare stuff ...

So in essence you create screens for start menus, loading screens, publisher logo, ingame, gameover, ... and then just tell in your logic to go to the screen XYZ. If you are on your "start screen" a "previous screen" command would lead to exiting the app - except you re-wire connections manually.


bye
Ron


Amon

Derron summed it up perfectly. Do you have anything like this, Qube?

Qube

Quote from: Derron on May 26, 2019, 22:06:31
Screen frameworks usually handle: ........
Thanks, I guessed as much in regards to what Diddy can do on this side.

Quote from: blinkok on May 26, 2019, 22:48:52
I'm thinking it might be this
Yeah, I've heard of Diddy but I've never used Monkey 2 and thus I'm not familiar with all that Diddy does to help with game creation.

Quote from: Amon. on May 26, 2019, 23:36:46
Derron summed it up perfectly. Do you have anything like this, Qube?
Oddly enough I don't have a framework for this as I code my games in a fashion where I can call any scene at any time anyway and fade in / out with a simple function call. I can see the benefit of having a more framework approach over a coding approach so it's something I'd be interested in doing along with my updated AGK framework stuff.

When I get around to doing this side and if I can make it separate enough from the rest of the framework then I'll happily provide the code for free. In the meantime if someone offers to code a system up for you then of course feel free to take their offer.
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

Amon

What you have now sounds pretty cool, Qube. I'd be interested in trying it. :)

Qube

Quote from: Amon. on May 27, 2019, 11:48:23
What you have now sounds pretty cool, Qube. I'd be interested in trying it. :)
This is probably not what you're after but is roughly what I do in my games to change between scenes and menus. Anyway, hope some part of it is of use.

Attached is a full project you can load straight into AGK and test ( use the latest version of AGK Classic )

Instructions of what this does as a scene change example.

1.. Fades in and out of each section
2.. Press SPACE to go from Main Menu to Main Game
3.. Press SPACE in Main Game to change level
4.. Press M in Main Game to change to a Mini Game
5.. Press SPACE in a Mini Game to return to the Main Game
6.. Press ESC in the Main Game or Mini Game to return to the Main Menu
7.. Press ESC on the Main Menu to QUIT

Source ( included in the attachment ) :


Global screenWidth As Float = 1024
Global screenHeight As Float = 576

SetWindowTitle( "Scene Test" )
SetWindowSize( screenWidth, screenHeight, 0 )
SetWindowPosition( ( GetMaxDeviceWidth() - GetWindowWidth() ) / 2, ( ( GetMaxDeviceHeight() - GetWindowHeight() ) / 2 ) )
SetWindowAllowResize( 0 )
SetVirtualResolution( screenWidth, screenHeight )
SetDisplayAspect( screenWidth / screenHeight )
SetOrientationAllowed( 0, 0, 1, 1 )
EnableClearColor( 1 )
SetRandomSeed( GetUnixTime() )
SetRandomSeed2( GetUnixTime() )
SetRawMouseVisible( 0 )
SetVsync( 1 )
SetClearColor( 0, 0, 0 )
UseNewDefaultFonts( 1 )

Global targetFrameRate As Float = 60.0
Global gameAtlas As Integer, deltaTime As Float, gameScene As String, gameWorld As Integer, gameLevel As Integer, nextScene As String
Global fadeMode As Integer, fadeValue As Float, fadeStage As Integer, fadeAction As String

Global spritePixel, spriteBall, spriteMenu, spriteGame, spriteMini
Global ballAngle As Float

Dim numbers[ 9 ]

Variables()
PrepareMedia()

gameScene = "Main Menu"
fadeMode = 0 // start with fading in

//
// MAIN LOOP
//

Do
// SCENES

If gameScene = "Main Menu" Then MainMenu()
If gameScene = "Game" Then MainGame()
If gameScene = "Mini Game" Then MiniGame()

// CHANGING OF SCENES

If fademode = -1
If GetRawKeyPressed( KEY_SPACE )
If gameScene = "Main Menu"
gameLevel = 1
ChangeScene( "Game", "" )
EndIf

If gameScene = "Game"
ChangeScene( "Game", "Next Level" )
EndIf

If gameScene = "Mini Game" Then ChangeScene( "Game", "" )
EndIf

If GetRawKeyPressed( KEY_M )
If gameScene = "Game" Then ChangeScene( "Mini Game", "" )
EndIf

If GetRawKeyPressed( KEY_ESCAPE ) And gameScene <> "Main Menu" Then ChangeScene( "Main Menu", "" )
If GetRawKeyPressed( KEY_ESCAPE ) And gameScene = "Main Menu" Then END
EndIf

// FADING AND ACTIOND AFTERWARDS

If fadeMode = 0 Then FadeIn( fadeAction )
If fadeMode = 1 Then FadeOut( fadeAction )

// SWAP AND REPEAT

Swap()
GetDeltaTime()
Loop

//
// MAIN MENU
//

Function MainMenu()
Sprite( spriteMenu, screenWidth / 2 ,screenHeight / 2, 255, 255, 255, 255, 1 )
EndFunction

//
// GAME
//

Function MainGame()
For i = 0 To 359 Step 20
Sprite( spriteBall, ( screenWidth / 2 ) + Cos( i + ballAngle ) * screenHeight / 2.2, ( screenHeight / 2 ) + Sin( i - ballAngle * 2 ) * screenHeight / 2.2, 255, 255, 255, 255, 1 )
Next

Inc ballAngle, 1 * deltaTime
If ballAngle >= 360 Then Dec ballAngle, 360

Sprite( spriteGame, screenWidth / 2 ,screenHeight / 2, 255, 255, 255, 255, 1 )

Sprite( numbers[ gameLevel ], screenWidth / 2, ( screenHeight / 2 ) + 50, 255, 255, 255, 255, 1 )
EndFunction

//
// MINI GAME
//

Function MiniGame()
For i = 0 To 359 Step 30
Sprite( spriteBall, ( screenWidth / 2 ) + Cos( i + ballAngle ) * screenHeight / 2.2, ( screenHeight / 2 ) + Sin( i + ballAngle ) * screenHeight / 2.2, 255, 155, 155, 255, 1 )
Next

Inc ballAngle, 1 * deltaTime
If ballAngle >= 360 Then Dec ballAngle, 360

Sprite( spriteMini, screenWidth / 2 ,screenHeight / 2, 255, 255, 255, 255, 1 )
EndFunction

//
// SETUP TO CHANGE SCENE
//

Function ChangeScene( fScene As String, fAction As String )
nextScene = fScene
fadeAction = fAction
fadeMode = 1
EndFunction

//
//  FADE IN
//

Function FadeIn( fAction As String )
// init the fade

If fadeStage = 0
fadeStage = 1
fadeValue = 255
EndIf

// do the fade

Dec fadeValue, 3 * deltaTime
If fadeValue <= 0
fadeValue = 0
fadeStage = 0
fadeMode = -1

// any actions to take after fading?
EndIf

// draw super zoomed sprite

Sprite( spritePixel, 0, 0, 0, 0, 0, fadeValue, 0 )
EndFunction

//
// FADE OUT
//

Function FadeOut( fAction As String )
// init the fade

If fadeStage = 0
fadeStage = 1
fadeValue = 0
EndIf

// do the fade

Inc fadeValue, 5 * deltaTime
If fadeValue >= 255
fadeValue = 255
fadeStage = 0
fadeMode = 0

If nextScene > "" Then gameScene = nextScene
nextScene = ""

// any actions to take after fading?

If fAction = "Next Level"
Inc gameLevel
If gameLevel > 9 Then gameLevel = 1
EndIf
EndIf

// draw super zoomed sprite

Sprite( spritePixel, 0, 0, 0, 0, 0, fadeValue, 0 )
EndFunction

//
// PREPARE MEDIA
//

Function PrepareMedia()
gameAtlas = LoadImage( "media.png" )

temp = LoadSubImage( gameAtlas, "whitepixel.png" )
spritePixel = CreateSprite( temp )
SetSpriteSize( spritePixel, screenWidth, screenHeight )

temp = LoadSubImage( gameAtlas, "ball.png" )
spriteBall = CreateSprite( temp )

temp = LoadSubImage( gameAtlas, "mainmenu.png" )
spriteMenu = CreateSprite( temp )

temp = LoadSubImage( gameAtlas, "gamelevel.png" )
spriteGame = CreateSprite( temp )

temp = LoadSubImage( gameAtlas, "minigame.png" )
spriteMini = CreateSprite( temp )

For i = 0 To 9
temp = LoadSubImage( gameAtlas, Str( i ) + ".png" )
numbers[ i ] = CreateSprite( temp )
Next
EndFunction

//
// SPRITE FUNCTION
//

Function Sprite( fImage, fXPos As Float, fYPos As Float, fRed, fGreen, fBlue, fAlpha, fHandle )
If GetSpriteExists( fImage ) = 0 Then ExitFunction

SetSpriteColor( fImage, fRed, fGreen, fBlue, fAlpha )

If fHandle = 0 Then SetSpritePosition( fImage, fXPos, fYPos ) // top left handle
If fHandle = 1 Then SetSpritePosition( fImage, fXPos - ( GetSpriteWidth( fImage ) / 2.0 ),fYPos - GetSpriteHeight( fImage ) / 2.0 ) // center handle

DrawSprite( fImage )
EndFunction

//
// DELTA TIME - super cheap method
//

Function GetDeltaTime()
deltaTime = GetFrameTime() * targetFrameRate
EndFunction

//
// SETUP VARIABLES
//

Function Variables()
fadeMode = -1
fadeStage = 0

#constant    KEY_BACK         8
#constant    KEY_TAB          9
#constant    KEY_ENTER        13
#constant    KEY_SHIFT        16
#constant    KEY_CONTROL      17
#constant    KEY_ESCAPE       27
#constant    KEY_SPACE        32
#constant    KEY_PAGEUP       33
#constant    KEY_PAGEDOWN     34
#constant    KEY_END          35
#constant    KEY_HOME         36
#constant    KEY_LEFT         37
#constant    KEY_UP           38
#constant    KEY_RIGHT        39
#constant    KEY_DOWN         40
#constant    KEY_INSERT       45
#constant    KEY_DELETE       46
#constant    KEY_0            48
#constant    KEY_1            49
#constant    KEY_2            50
#constant    KEY_3            51
#constant    KEY_4            52
#constant    KEY_5            53
#constant    KEY_6            54
#constant    KEY_7            55
#constant    KEY_8            56
#constant    KEY_9            57
#constant    KEY_A            65
#constant    KEY_B            66
#constant    KEY_C            67
#constant    KEY_D            68
#constant    KEY_E            69
#constant    KEY_F            70
#constant    KEY_G            71
#constant    KEY_H            72
#constant    KEY_I            73
#constant    KEY_J            74
#constant    KEY_K            75
#constant    KEY_L            76
#constant    KEY_M            77
#constant    KEY_N            78
#constant    KEY_O            79
#constant    KEY_P            80
#constant    KEY_Q            81
#constant    KEY_R            82
#constant    KEY_S            83
#constant    KEY_T            84
#constant    KEY_U            85
#constant    KEY_V            86
#constant    KEY_W            87
#constant    KEY_X            88
#constant    KEY_Y            89
#constant    KEY_Z            90
#constant    KEY_F1           112
#constant    KEY_F2           113
#constant    KEY_F3           114
#constant    KEY_F4           115
#constant    KEY_F5           116
#constant    KEY_F6           117
#constant    KEY_F7           118
#constant    KEY_F8           119
#constant    KEY_S1           186   
#constant    KEY_S2           187
#constant    KEY_S3           188
#constant    KEY_S4           189
#constant    KEY_S5           190
#constant    KEY_S6           191
#constant    KEY_S7           192
#constant    KEY_S8           219
#constant    KEY_S9           220
#constant    KEY_S10          221
#constant    KEY_S11          222
#constant    KEY_S12          223
EndFunction
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

Amon

That's pretty much what I needed. Thank you, Qube. :)

Qube

Quote from: Amon. on May 28, 2019, 07:08:38
That's pretty much what I needed. Thank you, Qube. :)
Cool, so long as it's of some use or points you in the direction you want.

When I redo my framework it'll be a much neater system and I'll no longer need to code in things like the above or pausing a game / music & sounds etc. Just straight to coding the game ;D
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

Amon

Quote from: Qube on May 28, 2019, 18:41:53
Quote from: Amon. on May 28, 2019, 07:08:38
That's pretty much what I needed. Thank you, Qube. :)
Cool, so long as it's of some use or points you in the direction you want.

When I redo my framework it'll be a much neater system and I'll no longer need to code in things like the above or pausing a game / music & sounds etc. Just straight to coding the game ;D
Now that would be cool. What you have sorted for us so far is still good so thanks for that and I  look forward to the next framework. :)

Qube

Quote from: Amon. on May 28, 2019, 19:10:12
Now that would be cool. What you have sorted for us so far is still good so thanks for that and I  look forward to the next framework. :)
Ah, that'll be for internal use and not a freebie, sorry :( :P
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

Amon

Quote from: Qube on May 28, 2019, 19:56:00
Quote from: Amon. on May 28, 2019, 19:10:12
Now that would be cool. What you have sorted for us so far is still good so thanks for that and I  look forward to the next framework. :)
Ah, that'll be for internal use and not a freebie, sorry :( :P
HOW DARE YOU DENY ME DA CODEZ! :)
One quick question: What is the best way to display text using the Print function when using Swap() instead of Sync()?

Qube

QuoteHOW DARE YOU DENY ME DA CODEZ! :)
Sure, OK, I'll just slave away and provide everything you need :))

QuoteOne quick question: What is the best way to display text using the Print function when using Swap() instead of Sync()?
Never used the Print command and I can't see how to render it without Sync() :o

However you could use the other built in commands for text ( more flexible ). You could also wrap up a Function to work like Print.

If I'm ever using the built in text commands then I cheat a little by reassigning the text of a Global variable or else you're supplying one variable per line of text and I think that's just silly.

Like so :


Global myText As Integer

CreateText( myText, "" )
SetTextSize( myText, 50 )

Do
SetTextString( myText, "Hello" )
SetTextPosition( myText, 100, 100 )
DrawText( myText )

SetTextString( myText, "World!" )
SetTextPosition( myText, 140, 140 )
DrawText( myText )

Swap()
Loop
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

LineOf7s

Quote from: Qube on May 28, 2019, 19:56:00
Quote from: Amon. on May 28, 2019, 19:10:12
Now that would be cool. What you have sorted for us so far is still good so thanks for that and I  look forward to the next framework. :)
Ah, that'll be for internal use and not a freebie, sorry :( :P

Sell it.
"Life's biggest obstacles are your greatest opportunities to excel"