I'm Drawing A Blank Here
BlitzMax Forums/BlitzMax Programming/I'm Drawing A Blank Here
| ||
I'm pretty sure a lot of you are more familiar with drawing on canvas() than I am. Could you please show me how to correct this so both windows appear at the same time ? One is smaller than the other so it should be possible. |
| ||
Well, for one, the canvas with the oval on is under the main canvas [z-order is wrong], and two, the oval isnt being drawn because your drawing it after SetBlend, then clearing the screen, and flipping a blank backbuffer [forever]!'zvidborder=CreateCanvas(0,0,mx,my,zvideo,0) ' initialize border window 'SetGraphics CanvasGraphics(zvidborder) ' activate it 'SetBlend alphablend ' set so black is transparent 'For i=deskrect[1] To deskrect[1]+deskrect[3]-1 ' For j=deskrect[0] To deskrect[0]+deskrect[2]-1 ' If i<4 Or j<4 Or i>deskrect[3]-5 Or j>deskrect[2]-5 ' SetColor 0,0,Rand(128,255) ' simple draw blue border ' Plot j,i 'EndIf 'Next 'Next 'Flip zvidmain=CreateCanvas(mx/2-960/2,my/2-704/2,960,704,zvideo,0) ' now create smaller screen inside the full-size one SetGraphics CanvasGraphics(zvidmain) ActivateGadget zvidmain ' activate it SetBlend alphablend Repeat Cls DrawOval 50,50,100,100 Flip ' pollevent necessary since we are using canvas screens Until PollEvent()>0 And CurrentEvent.id=event_keydown Dabz |
| ||
I'm Drawing A Blank Here I thought "Oh god, it's going to be a question about Cls()." I never understood maxgui, it seems really counterintuitive to me. I probably just have to work with it more... |
| ||
Hi Endive. One of the main reasons I'm using it is it has the ability of creating windows without frames. If there's an easier way to accomplish it without using MaxGUI, I certainly would like to see that. Ultimately what I wanted to do here was create a screen of 960x704 inside a solid black screen that was the full dimensions of whatever monitor the user has. Why ? Then you wouldn't have the frame or tasks appear around the edges, so if you had a 1024x768 screen, that area would appear solid black and inside centered is a smaller 960x704 screen that is active. Plotting to pixel position 0,0 would actually plot only to the 960x704 screen and disregard the outer 1024x768 entirely. . . . As for Cls(), outside of SetClsColor(), that's not too hard to figure out. :) |
| ||
Alright gang, here is some interesting code: Is there a way to easily make this work without using external libraries ? And BONUS if you can remove the border additionally. |
| ||
if you can remove the border hiya, Do you mean to remove the standard OS frame that surrounds a regular window? if so is this any help? |
| ||
Clicked THIS and got an error from inside BlitzBasic.com. ERROR: Internal error |
| ||
no worries, it links to... http://www.blitzbasic.com/Community/posts.php?topic=102797 |
| ||
Still getting error. Was it deleted ? Trying a different browser. ... Nope. Even Google Chrome gives an error. |
| ||
Are you logged into BlitzMax.com? see if it works if you log into BlitzBasic.com? If that doesn't work then I'll copy paste it here |
| ||
Strange, I'm definitely logged in, Dave. (Checked and rechecked). [X] BlitzBasic Forums [X] Blitzbasic.com [X] Blitzmax.com |
| ||
For me it works - just replace blitzbasic.com with blitzmax.com When linking with [.a]text[./a] you just use this code: [.a /Community/posts.php?topic=102797]Relative Link[./a] -> Relative Link bye Ron |
| ||
Thanks Derron, I didn't know that you could do relative linking, thats good to know. |
| ||
Hi Ron and Dave, nope. These both still gives me an error. http://www.blitzbasic.com/Community/posts.php?topic=102797 http://www.blitzmax.com/Community/posts.php?topic=102797 |
| ||
very strange, oh well not to worry, a copy/paste... In brl.mod/graphics.mod/graphics.bmx, insert the following at line 48: Const GRAPHICS_BORDERLESS = $40 In brl.mod/dxgraphics.mod/d3d9graphics.bmx, change this section at line 148: If depth wstyle=WS_VISIBLE|WS_POPUP Else wstyle=WS_VISIBLE|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX EndIf To: If depth wstyle=WS_VISIBLE|WS_POPUP Else If flags & GRAPHICS_BORDERLESS Then wstyle = WS_VISIBLE | WS_POPUP Else wstyle = WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX End If EndIf In brl.mod/dxgraphics.mod/d3d7graphics.bmx, change this section at line 290: Local style=WS_VISIBLE|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX To: Local style=WS_VISIBLE|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX If flags & GRAPHICS_BORDERLESS Then style = WS_VISIBLE | WS_POPUP And in brl.mod/glgraphics.mod/glgraphics.win32.c make the following two changes, first at line 8: enum{ _BACKBUFFER= 0x2, _ALPHABUFFER= 0x4, _DEPTHBUFFER= 0x8, _STENCILBUFFER= 0x10, _ACCUMBUFFER= 0x20, }; Becomes: enum{ _BACKBUFFER= 0x2, _ALPHABUFFER= 0x4, _DEPTHBUFFER= 0x8, _STENCILBUFFER= 0x10, _ACCUMBUFFER= 0x20, _BORDERLESS= 0x40, }; And at line 322: hwnd_style=WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX; Becomes: hwnd_style=WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX; if (flags && _BORDERLESS) { hwnd_style = WS_POPUP; } Are you familiar with the 'building modules' process? After making the changes above hit CTRL+D, or Program menu->Build modules. To build a module that imports a .c/.cpp/.asm file you'll need to install a gcc compiler. The .c file is an internal part of the opengl implementation used for the GLGraphicsDriver which GLMax2DDriver uses. If you just want to check out the borderless example code then you can make changes to just the .bmx files and the D3D7Max2DDriver/D3D9Max2DDriver will show you the effect without the need for a gcc compiler. |
| ||
You then use GRAPHICS_BORDERLESS as the 'flags' parameter for the Graphics command... Graphics 800,600,,,GRAPHICS_BORDERLESS |
| ||
BACKING UP MOD ... (First !) Making changes ... BlitzMax\mod\brl.mod\graphics.mod\graphics.bmx Line #48 is within the REM / ENDREM, placing the new code at line 51, outside the REM Other changes to MOD libs seem fine. Okay, as for compilation, BUILD MODULES is ghosted out, cannot be selected. Did you post the borderless example code yet, Dave ? |
| ||
Ahh, Well, it can be done. You see, we have the complete source code for BlitzMax ( the mod folder ). The only thing we don't have installed is the compiler itself ( which has been released as open source now ). So you can rewrite the whole of BlitzMax if you so desired but to do that you'll need extra tools and it's not supported by BRL. As 'Max isn't exactly new most people have learned how to change the modules to suit, but to do that you'll need more than the standard installation. So as to stay with your main objective it may be better to leave the module tweaks for anoother time? However if you do find time to learn how to build modules then it becomes very easy to add in features to BlitzMax that didn't exist and you'll see just how powerful a language it actually is. Until then.... sorry to have butted in, and... as you were ;-) |
| ||
Well, I tried Graphics 640,480,,,GRAPHICS_BORDERLESS and I get the error message: Compile Error - Identifier 'graphics_borderless' not found Let's take this a step at a time. I need to compile, "glgraphics.bmx" yes ? Here is the code for it: You can see I've made the change to add the constant value. Now, if I try to compile this, however, I get the following: Compile Error - Modules does not match commandline module |
| ||
Compiling a file from modules will not work. You won't be able to build modules until you install a C++ toolchain for BlitzMax to use. When BlitzMax is configured correctly the Build Modules menu option will be enabled. |
| ||
Oops, I mistakenly did say that you can build them if you do not need to rebuild a .c/.cpp/.asm file - thats my bad and I apologise for the wrong information! |
| ||
Recompiling BlitzMAX's primary and main libraries. Sounds so -wrong- ... It's just me. I'll stick with MaxGui for borderless. And, I found a way to get around what I needed, which was to change where coordinates 0,0 appear.SetOrigin (deskrect[0]+deskrect[2])/2-mx/2,(deskrect[1]+deskrect[3])/2-my/2Where "mx" and "my" are temporary variables for determining the actual size across and down of the play area I want. Now, I =DO= know about SetVirtualResolution, I really don't want to go that route as I'm using Truetype Fonts and they ALWAYS blur when you use SetVirtualResolution for something smaller than your normal screen. For those of you not familiar, SetOrigin will let you choose where coordinates 0,0 appear. So if you opened a screen that was 1024x768 and said: SetOrigin 32,32 Then drawing from 0,0 would actually start at 32,32. Pretty useful that. As for the misinformation regarding compilation, No problem, Dave. A lot of these things really are over my head. I'm going to get back to coding - and essentially out of everyone's hair until I run into another snag. Might be a-while. Thanks for all the info thus far ! |