Hi.
My game use 1024x768 resolution.
I've coded an game-editor to place some ennemies ships on a canvas. Next i save their positions. In the editor, With a 1024x768 window, i can't fix the canvas size more than 1024x768 pixels. This is a problem to position some ennemies outside this zone (in my game, a space shooter, a lot of ennemies come from outside the screen)
The following code, is an example, in my game editor i can't use a pixmap : i use a lot of max2d commands as Drawline, drawimage, to position things on the canvas.
Is there another solution than use a 1152x864 window !?!
Thanks !
My game use 1024x768 resolution.
I've coded an game-editor to place some ennemies ships on a canvas. Next i save their positions. In the editor, With a 1024x768 window, i can't fix the canvas size more than 1024x768 pixels. This is a problem to position some ennemies outside this zone (in my game, a space shooter, a lot of ennemies come from outside the screen)
The following code, is an example, in my game editor i can't use a pixmap : i use a lot of max2d commands as Drawline, drawimage, to position things on the canvas.
Is there another solution than use a 1152x864 window !?!
Thanks !
Strict Const WWX = 1024 Const WWY = 768 Global Win:TGadget=CreateWindow("",0,0,WWX,WWY, Null,WINDOW_TITLEBAR) Global Panel:TGadget=CreatePanel (0,0,WWX-40,WWY-80,Win) Global Canvas:TGadget=CreateCanvas (0,0,WWX,WWY,Panel) Global sh:TGadget = CreateSlider(0,WWY-80, WWX-40,20,Win, SLIDER_HORIZONTAL) Global sv:TGadget = CreateSlider(WWX-40,0,20,WWY-80,Win, SLIDER_VERTICAL) SetSliderRange sh , ClientWidth(panel) , GadgetWidth(Canvas) SetSliderRange sv, ClientHeight(panel) , GadgetHeight(Canvas) SetSliderValue sv, 0 SetSliderValue sh , 0 Global Ennemies_list : TList = CreateList() Type TEnnemi Field x Field y Function Create:TEnnemi(x:Int , y:Int) Local e:TEnnemi = New TEnnemi e.x = x e.y = y ListAddLast Ennemies_list , e Return e End Function Function Draw_all () For Local e:TEnnemi = EachIn Ennemies_list SetColor 255 , 255 , 0 DrawOval e.x-3,e.y-3,6,6 Next End Function End Type Function Draw_canvas() SetGraphics CanvasGraphics(canvas) Cls SetGadgetShape Canvas, -SliderValue(sh), -SliderValue(sv), GadgetWidth(Canvas), GadgetHeight(Canvas) SetColor 0,40,0 For Local i=0 To GadgetWidth (Canvas) Step 32 DrawLine i,0,i,GadgetHeight(Canvas) Next SetColor 0 , 40 , 0 For Local i=0 To GadgetHeight (Canvas) Step 32 DrawLine 0,i,GadgetWidth(Canvas),i Next TEnnemi.Draw_all() Flip End Function Global paintTimer:TTimer=CreateTimer(75) Repeat WaitEvent() Select EventID() Case EVENT_TIMERTICK Draw_canvas() Case EVENT_MOUSEDOWN TEnnemi.Create (EventX(), EventY()) Case EVENT_WINDOWCLOSE FreeGadget canvas End End Select Forever