about summary refs log tree commit diff stats
path: root/apworld
Commit message (Collapse)AuthorAgeFilesLines
* Converted to proto2Star Rauchenberger2025-08-122-9/+8
| | | | | | | | | | | | | | | | | This will let us use an older version of protobuf in Python, and allows us to use the Godot protobuf implementation at all. Scalar fields with custom defaults in data.proto were changed to not have a default, because Godot doesn't handle it properly. The equivalent fields in human.proto still have the defaults, and datapacker copies the default value in if necessary. The Panel message in data.proto was also renamed to PanelData because otherwise it conflicts with the native Godot class named Panel. The double field in Letter was renamed to level2, because Godot couldn't handle it well. Finally, common.proto was removed and its contents were moved into data.proto, which allows us to generate code for Python without needing to edit it. NOTE: I had to slightly modify the Godot protobuf code generator. I'll need to upload that somewhere.
* Items and connections in the apworldStar Rauchenberger2025-08-128-9/+254
|
* Added support for masteriesStar Rauchenberger2025-08-092-0/+18
| | | | | Also assigned IDs for the_butterfly, as well as already configured letters.
* Added the_betweenStar Rauchenberger2025-08-092-3/+3
|
* Assigned IDs for four_roomsStar Rauchenberger2025-08-071-2/+2
|
* Assign AP IDs to doors and panelsStar Rauchenberger2025-08-074-12/+30
|
* Started apworldStar Rauchenberger2025-08-077-0/+113
vcpkg's libprotobuf is older than what PIP has, but neither are completely up to date either. Ugh. Doors have a room now because that's where the location will go.
' href='#n11'>11 12 13 14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110













                                                     
                                                                                                                                                        












                                                           
                                    





































































                                                                                            


                                                               




                                                                                             

 
   
//
//  CocosOverlayScrollView.m
//  shapes
//
//  Created by Nate Murray on 8/23/10.
//  Copyright 2010 LittleHiccup. All rights reserved.
//

#import "CocosOverlayScrollView.h"

@implementation CocosOverlayScrollView
@synthesize targetLayer;

// Configure your favorite UIScrollView options here
-(id) initWithFrame: (CGRect) frameRect numPages: (int) numPages width: (float) width layer: (CCNode*) layer pageControl:(UIPageControl *)m_pageControl{
    if ((self = [super initWithFrame: frameRect])){ 
        self.contentSize = CGSizeMake(width*numPages, 320);
        self.bounces = YES;
        self.delaysContentTouches = NO;
        self.delegate = self;
        self.pagingEnabled = YES;
        self.scrollsToTop = NO;
        self.showsVerticalScrollIndicator = NO;
        self.showsHorizontalScrollIndicator = NO;
        [self setUserInteractionEnabled:TRUE];
        [self setScrollEnabled:TRUE];
        self.targetLayer = layer;
        // self.canCancelContentTouches  = YES;
        pageControl = m_pageControl;
    }
    return self;
}

-(void) touchesBegan: (NSSet *) touches withEvent: (UIEvent *) event
{
    if (!self.dragging)
    {
        // UITouch* touch = [[touches allObjects] objectAtIndex:0];
        // CGPoint location = [touch locationInView: [[touch view] superview]];
        // CCLOG(@"touch at l.x:%f l.y:%f", location.x, location.y);

        [self.nextResponder touchesBegan: touches withEvent:event];
        [[[CCDirector sharedDirector] openGLView] touchesBegan:touches withEvent:event];
    }

    [super touchesBegan: touches withEvent: event];
}

-(void) touchesEnded: (NSSet *) touches withEvent: (UIEvent *) event
{
    if (!self.dragging)
    {
        [self.nextResponder touchesEnded: touches withEvent:event];
        [[[CCDirector sharedDirector] openGLView] touchesEnded:touches withEvent:event];
    }

    [super touchesEnded: touches withEvent: event];
}

-(void) touchesCancelled: (NSSet *) touches withEvent: (UIEvent *) event
{
    // if (!self.dragging)
    // {
        // CCLOG(@"CocosOverlayScrollView touchesEnded not dragging");
        [self.nextResponder touchesCancelled: touches withEvent:event];
        [[[CCDirector sharedDirector] openGLView] touchesCancelled:touches withEvent:event];
    // }
    [super touchesCancelled: touches withEvent: event];
}


- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView
{
  // TODO - Custom code for handling deceleration of the scroll view
}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    CGPoint dragPt = [scrollView contentOffset];
    dragPt = [[CCDirector sharedDirector] convertToGL:dragPt];

    dragPt.y = dragPt.y * -1;
    dragPt.x = dragPt.x * -1;

    CGPoint newLayerPosition = CGPointMake(dragPt.x, dragPt.y);

    [targetLayer setPosition:newLayerPosition];
}

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
    // CGPoint dragPt = [scrollView contentOffset];
    // etc.
}

-(void) dealloc {
    self.targetLayer = nil;
    [super dealloc];
}

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    int currentPage = (NSUInteger)(scrollView.contentOffset.x / scrollView.frame.size.width);
    NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
    [defaults setInteger:currentPage forKey:@"lastSelectedMode"];
    
    [pageControl setCurrentPage:currentPage];
}

@end